ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\Course\Grouping\Table\AssignmentHandler Class Reference
+ Collaboration diagram for ILIAS\Course\Grouping\Table\AssignmentHandler:

Public Member Functions

 __construct (protected string $action, protected int $content_obj_id, protected ilObjCourseGrouping $grouping, protected ilLanguage $lng, protected UIFactory $ui_factory, protected DataFactory $data_factory, protected HTTP $http, protected Refinery $refinery, ilObjUser $user, ilTree $tree)
 
 getTable ()
 
 getSelectedTableAction ()
 
 getSelectedRefIDs ()
 

Data Fields

const string ID = 'ref_id'
 
const string COL_TITLE = 'title'
 
const string COL_PATH = 'path'
 
const string COL_ASSIGNED = 'assigned'
 
const string ACTION_TOGGLE_ASSIGNMENT = 'toggle_assignment'
 

Protected Member Functions

 buildColumns ()
 
 buildActions ()
 
 URLBuilder ()
 
 actionToken ()
 
 IDToken ()
 
 initURLBuilderAndTokens ()
 

Protected Attributes

const string ACTION = 'table_action'
 
const string NAMESPACE = 'grouping_assign'
 
URLBuilder $url_builder
 
URLBuilderToken $action_token
 
URLBuilderToken $id_token
 
DataRetrieval $data_retrieval
 

Detailed Description

Definition at line 39 of file AssignmentHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Course\Grouping\Table\AssignmentHandler::__construct ( protected string  $action,
protected int  $content_obj_id,
protected ilObjCourseGrouping  $grouping,
protected ilLanguage  $lng,
protected UIFactory  $ui_factory,
protected DataFactory  $data_factory,
protected HTTP  $http,
protected Refinery  $refinery,
ilObjUser  $user,
ilTree  $tree 
)

Definition at line 56 of file AssignmentHandler.php.

References ILIAS\Repository\lng().

67  {
68  $this->data_retrieval = new AssignmentRetrieval(
69  $this->content_obj_id,
70  $this->grouping,
71  $user,
72  $tree,
73  $this->ui_factory,
74  $this->lng,
75  $this->data_factory
76  );
77  }
+ Here is the call graph for this function:

Member Function Documentation

◆ actionToken()

ILIAS\Course\Grouping\Table\AssignmentHandler::actionToken ( )
protected

Definition at line 126 of file AssignmentHandler.php.

References ILIAS\Course\Grouping\Table\AssignmentHandler\$action_token, and ILIAS\Course\Grouping\Table\AssignmentHandler\initURLBuilderAndTokens().

Referenced by ILIAS\Course\Grouping\Table\AssignmentHandler\buildActions(), and ILIAS\Course\Grouping\Table\AssignmentHandler\getSelectedTableAction().

126  : URLBuilderToken
127  {
128  if (!isset($this->action_token)) {
129  $this->initURLBuilderAndTokens();
130  }
131  return $this->action_token;
132  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildActions()

ILIAS\Course\Grouping\Table\AssignmentHandler::buildActions ( )
protected
Returns
Action[]

Definition at line 106 of file AssignmentHandler.php.

References Vendor\Package\$f, ILIAS\Course\Grouping\Table\AssignmentHandler\actionToken(), ILIAS\Course\Grouping\Table\AssignmentHandler\IDToken(), ILIAS\Repository\lng(), and ILIAS\Course\Grouping\Table\AssignmentHandler\URLBuilder().

Referenced by ILIAS\Course\Grouping\Table\AssignmentHandler\getTable().

106  : array
107  {
108  $f = $this->ui_factory->table()->action();
109  return [
110  self::ACTION_TOGGLE_ASSIGNMENT => $f->standard(
111  $this->lng->txt('grouping_change_assignment'),
112  $this->URLBuilder()->withParameter($this->actionToken(), self::ACTION_TOGGLE_ASSIGNMENT),
113  $this->IDToken()
114  )
115  ];
116  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildColumns()

ILIAS\Course\Grouping\Table\AssignmentHandler::buildColumns ( )
protected
Returns
Column[]

Definition at line 92 of file AssignmentHandler.php.

References Vendor\Package\$f, ilObject\_lookupType(), and ILIAS\Repository\lng().

Referenced by ILIAS\Course\Grouping\Table\AssignmentHandler\getTable().

92  : array
93  {
94  $f = $this->ui_factory->table()->column();
95  $type = ilObject::_lookupType($this->content_obj_id);
96  return [
97  self::COL_TITLE => $f->text($this->lng->txt('title'))->withIsSortable(true),
98  self::COL_PATH => $f->text($this->lng->txt('path'))->withIsSortable(true),
99  self::COL_ASSIGNED => $f->statusIcon($this->lng->txt('assigned'))->withIsSortable(true)
100  ];
101  }
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectedRefIDs()

ILIAS\Course\Grouping\Table\AssignmentHandler::getSelectedRefIDs ( )
Returns
int[]

Definition at line 172 of file AssignmentHandler.php.

References ILIAS\Course\Grouping\Table\AssignmentHandler\$data_retrieval, $ref_id, $res, ILIAS\FileDelivery\http(), ILIAS\Course\Grouping\Table\AssignmentHandler\IDToken(), and ILIAS\Repository\refinery().

172  : array
173  {
174  $grouping_ids = [];
176 
177  $retrieval_trafo = $this->refinery->byTrying([
178  $this->refinery->custom()->transformation(function ($v) use ($data_retrieval) {
179  if ((string) $v[0] === 'ALL_OBJECTS') {
180  $res = [];
181  foreach ($data_retrieval->getAllEligibleRefIDs() as $ref_id) {
182  $res[] = $ref_id->toInt();
183  }
184  return $res;
185  }
186  throw new \Exception('not all selected');
187  }),
188  $this->refinery->kindlyTo()->listOf(
189  $this->refinery->kindlyTo()->int()
190  )
191  ]);
192 
193  if ($this->http->wrapper()->query()->has($this->IDToken()->getName())) {
194  $grouping_ids = $this->http->wrapper()->query()->retrieve(
195  $this->IDToken()->getName(),
196  $retrieval_trafo
197  );
198  }
199 
200  return $grouping_ids;
201  }
$res
Definition: ltiservices.php:66
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ getSelectedTableAction()

ILIAS\Course\Grouping\Table\AssignmentHandler::getSelectedTableAction ( )

Definition at line 157 of file AssignmentHandler.php.

References ILIAS\Course\Grouping\Table\AssignmentHandler\actionToken(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

157  : string
158  {
159  $action = '';
160  if ($this->http->wrapper()->query()->has($this->actionToken()->getName())) {
161  $action = $this->http->wrapper()->query()->retrieve(
162  $this->actionToken()->getName(),
163  $this->refinery->identity()
164  );
165  }
166  return $action;
167  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getTable()

ILIAS\Course\Grouping\Table\AssignmentHandler::getTable ( )

Definition at line 79 of file AssignmentHandler.php.

References ILIAS\Course\Grouping\Table\AssignmentHandler\buildActions(), ILIAS\Course\Grouping\Table\AssignmentHandler\buildColumns(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

79  : DataTable
80  {
81  return $this->ui_factory->table()->data(
82  $this->data_retrieval,
83  $this->lng->txt('crs_grp_assign_crs') . ' (' . $this->grouping->getTitle() . ')',
84  $this->buildColumns()
85  )->withRequest($this->http->request())
86  ->withActions($this->buildActions());
87  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ IDToken()

ILIAS\Course\Grouping\Table\AssignmentHandler::IDToken ( )
protected

Definition at line 134 of file AssignmentHandler.php.

References ILIAS\Course\Grouping\Table\AssignmentHandler\$id_token, and ILIAS\Course\Grouping\Table\AssignmentHandler\initURLBuilderAndTokens().

Referenced by ILIAS\Course\Grouping\Table\AssignmentHandler\buildActions(), and ILIAS\Course\Grouping\Table\AssignmentHandler\getSelectedRefIDs().

134  : URLBuilderToken
135  {
136  if (!isset($this->id_token)) {
137  $this->initURLBuilderAndTokens();
138  }
139  return $this->id_token;
140  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initURLBuilderAndTokens()

ILIAS\Course\Grouping\Table\AssignmentHandler::initURLBuilderAndTokens ( )
protected

Definition at line 142 of file AssignmentHandler.php.

References ILIAS\Course\Grouping\Table\AssignmentHandler\$action_token, ILIAS\Course\Grouping\Table\AssignmentHandler\$id_token, ILIAS\Course\Grouping\Table\AssignmentHandler\$url_builder, ILIAS\UI\URLBuilder\acquireParameters(), and ILIAS\Course\Grouping\Table\AssignmentHandler\URLBuilder().

Referenced by ILIAS\Course\Grouping\Table\AssignmentHandler\actionToken(), ILIAS\Course\Grouping\Table\AssignmentHandler\IDToken(), and ILIAS\Course\Grouping\Table\AssignmentHandler\URLBuilder().

142  : void
143  {
144  $url_builder = new URLBuilder($this->data_factory->uri(
145  rtrim(ILIAS_HTTP_PATH, '/') . '/' . $this->action
146  ));
148  [self::NAMESPACE],
149  self::ACTION,
150  self::ID
151  );
152  $this->url_builder = $url_builder;
153  $this->action_token = $action_token;
154  $this->id_token = $id_token;
155  }
acquireParameters(array $namespace, string ... $names)
Definition: URLBuilder.php:138
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ URLBuilder()

ILIAS\Course\Grouping\Table\AssignmentHandler::URLBuilder ( )
protected

Field Documentation

◆ $action_token

URLBuilderToken ILIAS\Course\Grouping\Table\AssignmentHandler::$action_token
protected

◆ $data_retrieval

DataRetrieval ILIAS\Course\Grouping\Table\AssignmentHandler::$data_retrieval
protected

◆ $id_token

URLBuilderToken ILIAS\Course\Grouping\Table\AssignmentHandler::$id_token
protected

◆ $url_builder

URLBuilder ILIAS\Course\Grouping\Table\AssignmentHandler::$url_builder
protected

◆ ACTION

const string ILIAS\Course\Grouping\Table\AssignmentHandler::ACTION = 'table_action'
protected

Definition at line 42 of file AssignmentHandler.php.

◆ ACTION_TOGGLE_ASSIGNMENT

const string ILIAS\Course\Grouping\Table\AssignmentHandler::ACTION_TOGGLE_ASSIGNMENT = 'toggle_assignment'

Definition at line 49 of file AssignmentHandler.php.

◆ COL_ASSIGNED

const string ILIAS\Course\Grouping\Table\AssignmentHandler::COL_ASSIGNED = 'assigned'

◆ COL_PATH

const string ILIAS\Course\Grouping\Table\AssignmentHandler::COL_PATH = 'path'

◆ COL_TITLE

const string ILIAS\Course\Grouping\Table\AssignmentHandler::COL_TITLE = 'title'

◆ ID

const string ILIAS\Course\Grouping\Table\AssignmentHandler::ID = 'ref_id'

Definition at line 41 of file AssignmentHandler.php.

◆ NAMESPACE

const string ILIAS\Course\Grouping\Table\AssignmentHandler::NAMESPACE = 'grouping_assign'
protected

Definition at line 43 of file AssignmentHandler.php.


The documentation for this class was generated from the following file: