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

Public Member Functions

 __construct (protected string $action, protected int $content_obj_id, protected ilLanguage $lng, protected UIFactory $ui_factory, protected DataFactory $data_factory, protected HTTP $http, protected Refinery $refinery, StaticURL $static_url)
 
 getTable ()
 
 getSelectedTableAction ()
 
 getSelectedGroupingIDs ()
 

Data Fields

const string ACTION_DELETE = 'delete'
 
const string ACTION_EDIT = 'edit'
 
const string COL_TITLE = 'title'
 
const string COL_DESCRIPTION = 'description'
 
const string COL_SOURCE = 'source'
 
const string COL_UNIQUE_FIELD = 'unique_field'
 
const string COL_ASSIGNED_OBJS = 'assigned_objs'
 

Protected Member Functions

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

Protected Attributes

const string ID = 'grouping_id'
 
const string ACTION = 'table_action'
 
const string NAMESPACE = 'grouping'
 
URLBuilder $url_builder
 
URLBuilderToken $action_token
 
URLBuilderToken $id_token
 
DataRetrieval $data_retrieval
 

Detailed Description

Definition at line 37 of file GroupingHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Course\Grouping\Table\GroupingHandler::__construct ( protected string  $action,
protected int  $content_obj_id,
protected ilLanguage  $lng,
protected UIFactory  $ui_factory,
protected DataFactory  $data_factory,
protected HTTP  $http,
protected Refinery  $refinery,
StaticURL  $static_url 
)

Definition at line 57 of file GroupingHandler.php.

References ILIAS\Repository\lng().

66  {
67  $this->data_retrieval = new GroupingRetrieval(
68  $this->content_obj_id,
69  $this->lng,
70  $this->ui_factory,
71  $this->data_factory,
73  );
74  }
$static_url
Definition: goto.php:29
+ Here is the call graph for this function:

Member Function Documentation

◆ actionToken()

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

Definition at line 130 of file GroupingHandler.php.

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

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

130  : URLBuilderToken
131  {
132  if (!isset($this->action_token)) {
133  $this->initURLBuilderAndTokens();
134  }
135  return $this->action_token;
136  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildActions()

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

Definition at line 105 of file GroupingHandler.php.

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

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

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

◆ buildColumns()

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

Definition at line 89 of file GroupingHandler.php.

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

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

89  : array
90  {
91  $f = $this->ui_factory->table()->column();
92  $type = ilObject::_lookupType($this->content_obj_id);
93  return [
94  self::COL_TITLE => $f->text($this->lng->txt('title'))->withIsSortable(true),
95  self::COL_DESCRIPTION => $f->text($this->lng->txt('description'))->withIsSortable(true),
96  self::COL_SOURCE => $f->link($this->lng->txt('groupings_source'))->withIsSortable(true),
97  self::COL_UNIQUE_FIELD => $f->text($this->lng->txt('unambiguousness'))->withIsSortable(true),
98  self::COL_ASSIGNED_OBJS => $f->linkListing($this->lng->txt('groupings_assigned_obj_' . $type))->withIsSortable(true)
99  ];
100  }
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectedGroupingIDs()

ILIAS\Course\Grouping\Table\GroupingHandler::getSelectedGroupingIDs ( )
Returns
int[]

Definition at line 176 of file GroupingHandler.php.

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

176  : array
177  {
178  $grouping_ids = [];
180 
181  $retrieval_trafo = $this->refinery->byTrying([
182  $this->refinery->custom()->transformation(function ($v) use ($data_retrieval) {
183  if ((string) $v[0] === 'ALL_OBJECTS') {
184  return $data_retrieval->getAllGroupingIDs();
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  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getSelectedTableAction()

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

Definition at line 161 of file GroupingHandler.php.

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

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

◆ getTable()

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

Definition at line 76 of file GroupingHandler.php.

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

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

◆ IDToken()

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

Definition at line 138 of file GroupingHandler.php.

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

Referenced by ILIAS\Course\Grouping\Table\GroupingHandler\buildActions(), and ILIAS\Course\Grouping\Table\GroupingHandler\getSelectedGroupingIDs().

138  : URLBuilderToken
139  {
140  if (!isset($this->id_token)) {
141  $this->initURLBuilderAndTokens();
142  }
143  return $this->id_token;
144  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initURLBuilderAndTokens()

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

Definition at line 146 of file GroupingHandler.php.

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

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

146  : void
147  {
148  $url_builder = new URLBuilder($this->data_factory->uri(
149  ltrim(ILIAS_HTTP_PATH, '/') . '/' . $this->action
150  ));
152  [self::NAMESPACE],
153  self::ACTION,
154  self::ID
155  );
156  $this->url_builder = $url_builder;
157  $this->action_token = $action_token;
158  $this->id_token = $id_token;
159  }
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\GroupingHandler::URLBuilder ( )
protected

Field Documentation

◆ $action_token

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

◆ $data_retrieval

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

◆ $id_token

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

◆ $url_builder

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

◆ ACTION

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

Definition at line 40 of file GroupingHandler.php.

◆ ACTION_DELETE

const string ILIAS\Course\Grouping\Table\GroupingHandler::ACTION_DELETE = 'delete'

Definition at line 43 of file GroupingHandler.php.

◆ ACTION_EDIT

const string ILIAS\Course\Grouping\Table\GroupingHandler::ACTION_EDIT = 'edit'

Definition at line 44 of file GroupingHandler.php.

◆ COL_ASSIGNED_OBJS

const string ILIAS\Course\Grouping\Table\GroupingHandler::COL_ASSIGNED_OBJS = 'assigned_objs'

◆ COL_DESCRIPTION

const string ILIAS\Course\Grouping\Table\GroupingHandler::COL_DESCRIPTION = 'description'

◆ COL_SOURCE

const string ILIAS\Course\Grouping\Table\GroupingHandler::COL_SOURCE = 'source'

◆ COL_TITLE

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

◆ COL_UNIQUE_FIELD

const string ILIAS\Course\Grouping\Table\GroupingHandler::COL_UNIQUE_FIELD = 'unique_field'

◆ ID

const string ILIAS\Course\Grouping\Table\GroupingHandler::ID = 'grouping_id'
protected

Definition at line 39 of file GroupingHandler.php.

◆ NAMESPACE

const string ILIAS\Course\Grouping\Table\GroupingHandler::NAMESPACE = 'grouping'
protected

Definition at line 41 of file GroupingHandler.php.


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