47 $this->ctrl = $DIC->ctrl();
48 $this->tpl = $DIC[
"tpl"];
49 $this->ui = $DIC->ui();
50 $this->lng = $DIC->language();
51 $this->tree = $DIC->repositoryTree();
52 $this->
user = $DIC->user();
54 $this->lng->loadLanguageModule(
"grp");
55 $this->ctrl->saveParameter($this, array(
"user_id",
"modal_exists"));
66 $next_class =
$ctrl->getNextClass($this);
67 $cmd =
$ctrl->getCmd(
"show");
70 include_once(
"./Modules/Group/UserActions/classes/class.ilGroupUserActionProvider.php");
72 if (count($ca) == 0) {
75 if (count($ca) == 1) {
76 switch (current($ca)) {
78 $cmd =
"selectParent";
81 case "manage_members":
91 switch ($next_class) {
93 if (in_array($cmd, array(
"show",
"selectGroup",
"confirmAddUser",
"addUser",
94 "selectParent",
"createGroup",
"confirmCreateGroupAndAddUser",
"createGroupAndAddUser"))) {
95 $ctrl->setParameter($this,
"modal_exists", 1);
113 $url1 =
$ctrl->getLinkTarget($this,
"selectGroup",
"",
true,
false);
114 $button1 = $this->ui->factory()->button()->standard(
$lng->txt(
"grp_use_existing"),
"#")
116 return "$('#$id').on('click', function() {il.Util.ajaxReplaceInner('$url1', 'il_grp_action_modal_content'); return false;})";
118 $toolbar->addComponent($button1);
121 $url2 =
$ctrl->getLinkTarget($this,
"selectParent",
"",
true,
false);
122 $button2 = $this->ui->factory()->button()->standard(
$lng->txt(
"grp_create_new"),
"#")
124 return "$('#$id').on('click', function() {il.Util.ajaxReplaceInner('$url2', 'il_grp_action_modal_content'); return false;})";
126 $toolbar->addComponent($button2);
129 $tpl->getMessageHTML(
$lng->txt(
"grp_create_or_use_existing"),
"question") .
143 if (
$_GET[
"modal_exists"] == 1) {
144 echo $this->ui->renderer()->renderAsync($this->ui->factory()->legacy(
$a_content));
146 $mtpl =
new ilTemplate(
"tpl.grp_add_to_grp_modal_content.html",
true,
true,
"./Modules/Group/UserActions");
148 $content = $this->ui->factory()->legacy($mtpl->get());
149 $modal = $this->ui->factory()->modal()->roundtrip(
150 $lng->txt(
"grp_add_user_to_group"),
153 return "il.UI.modal.showModal('$id', {'ajaxRenderUrl':'','keyboard':true});";
155 echo $this->ui->renderer()->renderAsync($modal);
171 include_once(
"./Modules/Group/UserActions/classes/class.ilGroupActionTargetExplorerGUI.php");
174 $exp->setClickableType(
"grp");
175 $exp->setTypeWhiteList(array(
"root",
"cat",
"crs",
"fold",
"grp"));
176 $exp->setPathOpen((
int)
$tree->readRootId());
178 if (!$exp->handleCommand()) {
197 include_once(
"./Services/Membership/classes/class.ilParticipants.php");
198 include_once
'./Services/Membership/classes/class.ilParticipants.php';
200 if ($participants->isMember((
int) $_GET[
"user_id"])) {
201 $url =
$ctrl->getLinkTarget($this,
"selectGroup",
"",
true,
false);
202 $button = $this->ui->factory()->button()->standard(
$lng->txt(
"back"),
"#")
204 return "$('#$id').on('click', function() {il.Util.ajaxReplaceInner('$url', 'il_grp_action_modal_content'); return false;})";
208 $tpl->getMessageHTML(
$lng->txt(
"grp_user_already_in_group") .
"<br>" .
211 $this->ui->renderer()->renderAsync($button);
217 $ctrl->setParameter($this,
"grp_act_ref_id", $_GET[
"grp_act_ref_id"]);
218 $url =
$ctrl->getLinkTarget($this,
"addUser",
"",
true,
false);
219 $button = $this->ui->factory()->button()->standard(
$lng->txt(
"grp_add_user"),
"#")
221 return "$('#$id').on('click', function() {il.Util.ajaxReplaceInner('$url', 'il_grp_action_modal_content'); return false;})";
225 $tpl->getMessageHTML(
$lng->txt(
"grp_sure_add_user_to_group") .
"<br>" .
228 $this->ui->renderer()->renderAsync($button);
242 $user_id = (int)
$_GET[
"user_id"];
246 include_once(
"./Modules/Group/classes/class.ilObjGroup.php");
249 include_once
'./Services/Membership/classes/class.ilParticipants.php';
254 include_once
'./Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
255 $participants->sendNotification(
260 echo $tpl->getMessageHTML(
$lng->txt(
"grp_user_been_added"),
"success");
261 echo "<script>setTimeout(function (){ il.Group.UserActions.closeModal();}, 1000);</script>";
277 include_once(
"./Modules/Group/UserActions/classes/class.ilGroupActionTargetExplorerGUI.php");
280 $exp->setTypeWhiteList(array(
"root",
"cat",
"crs"));
281 $exp->setPathOpen((
int)
$tree->readRootId());
283 if (!$exp->handleCommand()) {
284 $this->
sendResponse(
$tpl->getMessageHTML(
$lng->txt(
"grp_no_perm_to_add_create_first"),
"info") .
305 $this->ctrl->saveParameter($this,
"grp_act_par_ref_id");
306 $form->setFormAction($this->ctrl->getLinkTarget($this,
"confirmCreateGroupAndAddUser",
"",
true,
false));
318 $group_gui->setCreationMode(
true);
320 $ref_id =
$_GET[
"ref_id"];
321 $_GET[
"ref_id"] =
$_GET[
"grp_act_par_ref_id"];
322 $form = $group_gui->initForm(
"create",
true);
323 $_GET[
"ref_id"] = $ref_id;
324 $form->clearCommandButtons();
325 $form->addCommandButton(
"save",
$lng->txt(
"grp_next"));
326 $form->setShowTopButtons(
false);
343 if (!
$form->checkInput()) {
348 $this->ctrl->saveParameter($this,
"grp_act_par_ref_id");
349 $form->setFormAction($this->ctrl->getLinkTarget($this,
"createGroupAndAddUser",
"",
true,
false));
350 $form->setValuesByPost();
352 $button = $this->ui->factory()->button()->standard(
$lng->txt(
"grp_create_and_add_user"),
"#")
354 return "$('#$id').on('click', function(e) {il.Group.UserActions.createGroup(e);})";
358 $tpl->getMessageHTML(
$lng->txt(
"grp_sure_create_group_add_user") .
"<br>" .
360 $lng->txt(
"obj_grp") .
": " .
$_POST[
"title"],
"question") .
361 "<div class='ilNoDisplay'>" .
$form->getHTML() .
"</div>" .
362 "<div class='ilRight'>" . $this->ui->renderer()->renderAsync($button) .
"</div>";
378 $user_id = (int)
$_GET[
"user_id"];
386 include_once(
"./Modules/Group/classes/class.ilObjGroup.php");
388 $newObj->setType(
"grp");
389 $newObj->setTitle(
$form->getInput(
"title"));
390 $newObj->setDescription(
$form->getInput(
"desc"));
393 $group_gui->putObjectInTree($newObj, (
int)
$_GET[
"grp_act_par_ref_id"]);
396 $dtpl = $group_gui->getDidacticTemplateVar(
"dtpl");
398 $newObj->applyDidacticTemplate($dtpl);
401 $group_gui->afterSave($newObj,
false);
404 include_once
'./Services/Membership/classes/class.ilParticipants.php';
409 include_once
'./Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
410 $participants->sendNotification(
416 include_once(
"./Services/Link/classes/class.ilLink.php");
418 echo $tpl->getMessageHTML(
$lng->txt(
"grp_created_and_user_been_added"),
"success");
419 echo "<script>setTimeout(function (){ window.location.replace('$url');}, 1500);</script>";
confirmAddUser()
Confirm add user to group.
createGroup($form=null)
Create group.
Add user to group from awareness tool.
if(!array_key_exists('StateId', $_REQUEST)) $id
static _lookupTitle($a_id)
lookup object title
confirmCreateGroupAndAddUser()
Save group.
executeCommand()
Execute command.
if(isset($_POST['submit'])) $form
__construct()
Constructor.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
selectParent()
Select group.
createGroupAndAddUser()
Create group and add user.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getCommandAccess($a_user_id)
Get command access for user.
sendResponse($a_content)
Send response.
const TYPE_ADMISSION_MEMBER
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
selectGroup()
Select group.
withOnLoadCode(\Closure $binder)