19declare(strict_types=1);
37 private UIFactory $ui_factory,
40 $this->
setId(
'usrrolesp');
47 $this->
setTitle($this->
lng->txt(
'user_role_starting_point'));
54 $this->
setRowTemplate(
'tpl.user_role_starting_point_row.html',
'components/ILIAS/User');
67 $valid_points = $this->starting_point_repository->getPossibleStartingPoints();
69 $starting_points = [];
71 $available_starting_points = $this->starting_point_repository->getStartingPoints();
73 foreach ($available_starting_points as $available_starting_point) {
74 $starting_point_type = $available_starting_point->getStartingPointType();
75 $position = $available_starting_point->getPosition();
76 $sp_text = $this->
lng->txt($valid_points[$starting_point_type]) ??
'';
78 if ($starting_point_type === Repository::START_REPOSITORY_OBJ
79 && $available_starting_point->getStartingObject() !==
null) {
80 $starting_object_ref_id = $available_starting_point->getStartingObject();
82 $type = $dc->lookupType($object_id);
83 $title = $dc->lookupTitle($object_id);
84 $sp_text = $this->
lng->txt(
'obj_' . $type) .
' '
85 .
'<i>"' .
$title .
'" (' . $starting_object_ref_id .
')</i>';
88 if ($available_starting_point->isRoleBasedStartingPoint()) {
89 $options = unserialize($available_starting_point->getRuleOptions(), [
'allowed_classes' =>
false]);
96 $starting_points[] = [
97 'id' => $available_starting_point->getId(),
98 'criteria' => $role_obj->getTitle(),
99 'starting_page' => $sp_text,
100 'starting_position' => $position,
101 'role_id' => $role_obj->getId()
106 $default_sp = $this->starting_point_repository->getSystemDefaultStartingPointType();
107 $starting_point = $this->
lng->txt($valid_points[$default_sp]);
108 if ($default_sp === Repository::START_REPOSITORY_OBJ) {
109 $starting_object_ref_id = $this->starting_point_repository->getSystemDefaultStartingObject();
112 $type = $dc->lookupType($object_id);
113 $title = $dc->lookupTitle($object_id);
114 $starting_point = $this->
lng->txt(
'obj_' . $type) .
' '
115 .
'<i>"' .
$title .
'" (' . $starting_object_ref_id .
')</i>';
118 $starting_points[] = [
119 'id' => $this->starting_point_repository->getDefaultStartingPointID(),
120 'criteria' => $this->
lng->txt(
'default'),
121 'starting_page' => $starting_point,
125 $sorted_starting_points = $this->starting_point_repository->reArrangePositions(
129 $this->
setData($sorted_starting_points);
143 $this->tpl->setVariable(
'HIDDEN',
'hidden');
145 $this->tpl->setVariable(
'VAL_ID',
'position[' . (
string)
$id .
']');
146 $this->tpl->setVariable(
'VAL_POS',
$row_data[
'starting_position']);
149 $this->tpl->setVariable(
160 $this->tpl->setVariable(
'TXT_PAGE',
$row_data[
'starting_page']);
162 $list = $this->ui_factory->dropdown()->standard($actions)->withLabel(
163 $this->
lng->txt(
'actions')
166 $this->tpl->setVariable(
'ACTION', $this->ui_renderer->render($list));
178 $actions[] = $this->ui_factory->link()->standard(
179 $this->
lng->txt(
'edit'),
183 if (
$id !== $this->starting_point_repository->getDefaultStartingPointID()
184 &&
$id !== $this->starting_point_repository->getUserStartingPointID()) {
185 $delete_url = $this->
ctrl->getLinkTarget(
187 'deleteStartingPoint'
189 $actions[] = $this->ui_factory->link()->standard(
190 $this->
lng->txt(
'delete'),
200 $cmd =
'initRoleStartingPointForm';
201 if (
$id === $this->starting_point_repository->getUserStartingPointID()) {
202 $cmd =
'initUserStartingPointForm';
206 return $this->
ctrl->getLinkTargetByClass(
214 if (
$id === $this->starting_point_repository->getDefaultStartingPointID()) {
225 if (
$id === $this->starting_point_repository->getDefaultStartingPointID()
226 ||
$id === $this->starting_point_repository->getUserStartingPointID()) {
232 $ref_id = $this->rbac_review->getObjectReferenceOfRole($role_id);
237 return $this->
lng->txt(
'has_role') .
': '
Builds a Color from either hex- or rgb values.
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _getTranslation(string $a_role_title)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
class ilRbacReview Contains Review functions of core Rbac.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
TableGUI class for LTI consumer listing.
__construct(object $parent_obj, private Repository $starting_point_repository, private ilRbacReview $rbac_review, private UIFactory $ui_factory, private Renderer $ui_renderer,)
getActions(int $id, ?int $role_id)
getEditLink(int $id, ?int $role_id)
const TABLE_POSITION_DEFAULT
getTitleForCriterium(int $id, ?int $role_id, string $criterium)
An entity that renders components to a string output.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))