19declare(strict_types=1);
39 protected int $node_id,
46 $ctrl = $this->gui->ctrl();
47 $next_class = $ctrl->getNextClass($this);
48 $cmd = $ctrl->getCmd(
"contributors");
50 switch ($next_class) {
51 case strtolower(\ilRepositorySearchGUI::class):
52 $rep_search = new \ilRepositorySearchGUI();
53 $rep_search->setTitle($this->domain->lng()->txt(
"blog_add_contributor"));
54 $rep_search->setCallback($this,
'addContributor', $this->blog->getAllLocalRoles($this->node_id));
55 $ctrl->setReturn($this,
'contributors');
56 $ctrl->forwardCommand($rep_search);
60 if (method_exists($this, $cmd)) {
69 $ilTabs = $this->gui->tabs();
70 $ilToolbar = $this->gui->toolbar();
71 $ilCtrl = $this->gui->ctrl();
72 $lng = $this->domain->lng();
73 $tpl = $this->gui->ui()->mainTemplate();
75 $ilTabs->activateTab(
"contributors");
77 $local_roles = $this->blog->getAllLocalRoles($this->node_id);
84 'auto_complete_name' =>
$lng->txt(
'user'),
85 'submit_name' =>
$lng->txt(
'add'),
87 'add_from_container' => $this->node_id,
88 'user_type' => $local_roles
93 $other_roles = $this->blog->getRolesWithContributeOrRedact($this->node_id);
98 $table = $this->gui->contributor()->contributorTableBuilder(
99 $this->blog->getAllLocalRoles($this->node_id),
104 if ($table->handleCommand()) {
116 $lng = $this->domain->lng();
117 $req = $this->gui->standardRequest();
119 $user_login =
$req->getUserLogin();
120 $user_type =
$req->getUserType();
122 if (trim($user_login) ===
'') {
123 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
'failure',
$lng->txt(
'msg_no_search_string'));
127 $users = explode(
',', $user_login);
130 foreach ($users as $user) {
134 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
'failure',
$lng->txt(
'user_not_known'));
149 array $a_user_ids = array(),
150 ?
string $a_user_type =
null
152 $ilCtrl = $this->gui->
ctrl();
153 $lng = $this->domain->lng();
154 $rbacreview = $this->domain->rbac()->review();
155 $rbacadmin = $this->domain->rbac()->admin();
156 $a_user_type = (
int) $a_user_type;
158 if (empty($a_user_ids)) {
159 $a_user_ids = $this->gui->standardRequest()->getIds();
162 if (!count($a_user_ids) || !$a_user_type) {
163 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
'failure',
$lng->txt(
"no_checkbox"));
169 $local_roles = array_keys($this->blog->getAllLocalRoles($this->node_id));
170 if (!in_array($a_user_type, $local_roles)) {
171 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
'failure',
$lng->txt(
"missing_perm"));
178 $a_user_type = (
int) $a_user_type;
179 if (!$rbacreview->isAssigned(
$user_id, $a_user_type)) {
180 $rbacadmin->assignUser($a_user_type,
$user_id);
184 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
185 $ilCtrl->redirect($this,
"contributors");
194 $ids = $this->gui->standardRequest()->getIds();
196 if (count($ids) === 0) {
197 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
'failure', $this->domain->lng()->txt(
"select_one"),
true);
198 $this->gui->ctrl()->redirect($this,
"contributors");
202 $confirm->setHeaderText($this->domain->lng()->txt(
'blog_confirm_delete_contributors'));
203 $confirm->setFormAction($this->gui->ctrl()->getFormAction($this,
'removeContributor'));
204 $confirm->setConfirm($this->domain->lng()->txt(
'delete'),
'removeContributor');
205 $confirm->setCancel($this->domain->lng()->txt(
'cancel'),
'contributors');
215 $this->gui->ui()->mainTemplate()->setContent($confirm->getHTML());
220 $ilCtrl = $this->gui->ctrl();
221 $lng = $this->domain->lng();
222 $rbacadmin = $this->domain->rbac()->admin();
224 $ids = $this->gui->standardRequest()->getIds();
226 if (count($ids) === 0) {
227 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
'failure',
$lng->txt(
"select_one"),
true);
228 $ilCtrl->redirect($this,
"contributors");
232 $local_roles = array_keys($this->blog->getAllLocalRoles($this->node_id));
234 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
'failure',
$lng->txt(
"missing_perm"));
235 $this->contributors();
240 foreach ($local_roles as $role_id) {
241 $rbacadmin->deassignUser($role_id,
$user_id);
245 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
246 $this->gui->ctrl()->redirect($this,
"contributors");
255 $ids = $this->gui->standardRequest()->getIds();
260 $this->gui->ctrl()->redirect($this,
"contributors");
@ilCtrl_Calls ILIAS\Blog\Contributor\ContributorGUI: ilRepositorySearchGUI
addContributorContainerAction(array $ids=[])
Used in ContributorTableBuilder.
addContributor(array $a_user_ids=array(), ?string $a_user_type=null)
Centralized method to add contributors.
confirmRemoveContributor(array $ids=[])
Used in ContributorTableBuilder.
addUserFromAutoComplete()
Autocomplete submit.
__construct(protected InternalDataService $data, protected InternalDomainService $domain, protected InternalGUIService $gui, protected int $node_id, protected \ilObjBlog $blog)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupId(string|array $a_user_str)
static fillAutoCompleteToolbar(object $parent_object, ?ilToolbarGUI $toolbar=null, array $a_options=[], bool $a_sticky=false)
array( auto_complete_name = $lng->txt('user'), auto_complete_size = 15, user_type = array(ilCoursePar...
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setContent(string $a_html)
Sets content for standard template.
readonly ilGlobalTemplateInterface $tpl
catch(\Exception $e) $req