ILIAS  release_8 Revision v8.24
class.ilStudyProgrammeRepositorySearchGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
28{
29 public function addUser(): void
30 {
31 global $DIC;
32 $post_wrapper = $DIC->http()->wrapper()->post();
33 $refinery = $DIC->refinery();
34 $class = $this->callback['class'];
35 $method = $this->callback['method'];
36
37 // call callback if that function does give a return value => show error message
38 // listener redirects if everything is ok.
39 $class->$method($post_wrapper->retrieve('user', $refinery->kindlyTo()->listOf($refinery->kindlyTo()->string())));
40 // Removed this from overwritten class, as we do not want to show the
41 // results again...
42 //$this->showSearchResults();
43 }
44
48 public static function fillAutoCompleteToolbar(
49 $parent_object,
50 ilToolbarGUI $toolbar = null,
51 $a_options = array(),
52 $a_sticky = false
53 ): ilToolbarGUI {
54 global $DIC;
55 $ilToolbar = $DIC['ilToolbar'];
56 $lng = $DIC['lng'];
57 $ilCtrl = $DIC['ilCtrl'];
58 $tree = $DIC['tree'];
59
60 if (!$toolbar instanceof ilToolbarGUI) {
61 $toolbar = $ilToolbar;
62 }
63
64 // Fill default options
65 if (!isset($a_options['auto_complete_name'])) {
66 $a_options['auto_complete_name'] = $lng->txt('obj_user');
67 }
68 if (!isset($a_options['auto_complete_size'])) {
69 $a_options['auto_complete_size'] = 15;
70 }
71 if (!isset($a_options['submit_name'])) {
72 $a_options['submit_name'] = $lng->txt('btn_add');
73 }
74
75 $ajax_url = $ilCtrl->getLinkTargetByClass(
76 array(get_class($parent_object),'ilStudyProgrammeRepositorySearchGUI'),
77 'doUserAutoComplete',
78 '',
79 true,
80 false
81 );
82
83 $ul = new ilTextInputGUI($a_options['auto_complete_name'], 'user_login');
84 $ul->setDataSource($ajax_url);
85 $ul->setSize($a_options['auto_complete_size']);
86 if (!$a_sticky) {
87 $toolbar->addInputItem($ul, true);
88 } else {
89 $toolbar->addStickyItem($ul, true);
90 }
91
92 if (count($a_options['user_type'] ?? [])) {
93 $si = new ilSelectInputGUI("", "user_type");
94 $si->setOptions($a_options['user_type']);
95 if (!$a_sticky) {
96 $toolbar->addInputItem($si);
97 } else {
98 $toolbar->addStickyItem($si);
99 }
100 }
101
102 $button = ilSubmitButton::getInstance();
103 $button->setCaption($a_options['submit_name'], false);
104 $button->setCommand('addUserFromAutoComplete');
105 if (!$a_sticky) {
106 $toolbar->addButtonInstance($button);
107 } else {
108 $toolbar->addStickyItem($button);
109 }
110
111 if ((bool) $a_options['add_search'] ||
112 is_numeric($a_options['add_from_container'])) {
113 $lng->loadLanguageModule("search");
114
115 $toolbar->addSeparator();
116
117 if ((bool) $a_options['add_search']) {
118 $button = ilLinkButton::getInstance();
119 $button->setCaption("search_users");
120 $button->setUrl($ilCtrl->getLinkTargetByClass('ilStudyProgrammeRepositorySearchGUI', ''));
121 $toolbar->addButtonInstance($button);
122 }
123
124 if (isset($a_options['add_from_container']) && is_numeric($a_options['add_from_container'])) {
125 $parent_ref_id = (int) $a_options['add_from_container'];
126 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "grp");
127 $parent_container_type = "grp";
128 if (!$parent_container_ref_id) {
129 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "crs");
130 $parent_container_type = "crs";
131 }
132 if ($parent_container_ref_id) {
133 if ((bool) $a_options['add_search']) {
134 $toolbar->addSpacer();
135 }
136
137 $ilCtrl->setParameterByClass(
138 'ilStudyProgrammeRepositorySearchGUI',
139 "list_obj",
140 ilObject::_lookupObjId($parent_container_ref_id)
141 );
142
143 $button = ilLinkButton::getInstance();
144 $button->setCaption("search_add_members_from_container_" . $parent_container_type);
145 $button->setUrl(
146 $ilCtrl->getLinkTargetByClass(
147 array(get_class($parent_object),'ilStudyProgrammeRepositorySearchGUI'),
148 'listUsers'
149 )
150 );
151 $toolbar->addButtonInstance($button);
152 }
153 }
154 }
155
156 $toolbar->setFormAction(
157 $ilCtrl->getFormActionByClass(
158 array(
159 get_class($parent_object),
160 'ilStudyProgrammeRepositorySearchGUI')
161 )
162 );
163 return $toolbar;
164 }
165}
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupObjId(int $ref_id)
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static fillAutoCompleteToolbar( $parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
This is just the same as in the parent class, except for the hardcoded class name.
This class represents a text property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
global $DIC
Definition: feed.php:28