ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilStudyProgrammeRepositorySearchGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2015 Richard Klees, Extended GPL, see docs/LICENSE */
4
5require_once("./Services/Search/classes/class.ilRepositorySearchGUI.php");
6
15{
16 public function addUser()
17 {
18 $class = $this->callback['class'];
19 $method = $this->callback['method'];
20
21 // call callback if that function does give a return value => show error message
22 // listener redirects if everything is ok.
23 $class->$method($_POST['user']);
24
25 // Removed this from overwritten class, as we do not want to show the
26 // results again...
27 //$this->showSearchResults();
28 }
29
33 public static function fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar = null, $a_options = array(), $a_sticky = false)
34 {
35 global $DIC;
36 $ilToolbar = $DIC['ilToolbar'];
37 $lng = $DIC['lng'];
38 $ilCtrl = $DIC['ilCtrl'];
39 $tree = $DIC['tree'];
40
41 if (!$toolbar instanceof ilToolbarGUI) {
42 $toolbar = $ilToolbar;
43 }
44
45 // Fill default options
46 if (!isset($a_options['auto_complete_name'])) {
47 $a_options['auto_complete_name'] = $lng->txt('obj_user');
48 }
49 if (!isset($a_options['auto_complete_size'])) {
50 $a_options['auto_complete_size'] = 15;
51 }
52 if (!isset($a_options['submit_name'])) {
53 $a_options['submit_name'] = $lng->txt('btn_add');
54 }
55
56 $ajax_url = $ilCtrl->getLinkTargetByClass(
57 array(get_class($parent_object),'ilStudyProgrammeRepositorySearchGUI'),
58 'doUserAutoComplete',
59 '',
60 true,
61 false
62 );
63
64 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
65 $ul = new ilTextInputGUI($a_options['auto_complete_name'], 'user_login');
66 $ul->setDataSource($ajax_url);
67 $ul->setSize($a_options['auto_complete_size']);
68 if (!$a_sticky) {
69 $toolbar->addInputItem($ul, true);
70 } else {
71 $toolbar->addStickyItem($ul, true);
72 }
73
74 if (count((array) $a_options['user_type'])) {
75 include_once './Services/Form/classes/class.ilSelectInputGUI.php';
76 $si = new ilSelectInputGUI("", "user_type");
77 $si->setOptions($a_options['user_type']);
78 if (!$a_sticky) {
79 $toolbar->addInputItem($si);
80 } else {
81 $toolbar->addStickyItem($si);
82 }
83 }
84
85 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
87 $button->setCaption($a_options['submit_name'], false);
88 $button->setCommand('addUserFromAutoComplete');
89 if (!$a_sticky) {
90 $toolbar->addButtonInstance($button);
91 } else {
92 $toolbar->addStickyItem($button);
93 }
94
95 if ((bool) $a_options['add_search'] ||
96 is_numeric($a_options['add_from_container'])) {
97 $lng->loadLanguageModule("search");
98
99 $toolbar->addSeparator();
100
101 if ((bool) $a_options['add_search']) {
102 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
103 $button = ilLinkButton::getInstance();
104 $button->setCaption("search_users");
105 $button->setUrl($ilCtrl->getLinkTargetByClass('ilStudyProgrammeRepositorySearchGUI', ''));
106 $toolbar->addButtonInstance($button);
107 }
108
109 if (is_numeric($a_options['add_from_container'])) {
110 $parent_ref_id = (int) $a_options['add_from_container'];
111 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "grp");
112 $parent_container_type = "grp";
113 if (!$parent_container_ref_id) {
114 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "crs");
115 $parent_container_type = "crs";
116 }
117 if ($parent_container_ref_id) {
118 if ((bool) $a_options['add_search']) {
119 $toolbar->addSpacer();
120 }
121
122 $ilCtrl->setParameterByClass('ilStudyProgrammeRepositorySearchGUI', "list_obj", ilObject::_lookupObjId($parent_container_ref_id));
123
124 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
125 $button = ilLinkButton::getInstance();
126 $button->setCaption("search_add_members_from_container_" . $parent_container_type);
127 $button->setUrl($ilCtrl->getLinkTargetByClass(array(get_class($parent_object),'ilStudyProgrammeRepositorySearchGUI'), 'listUsers'));
128 $toolbar->addButtonInstance($button);
129 }
130 }
131 }
132
133 $toolbar->setFormAction(
134 $ilCtrl->getFormActionByClass(
135 array(
136 get_class($parent_object),
137 'ilStudyProgrammeRepositorySearchGUI')
138 )
139 );
140 return $toolbar;
141 }
142}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
static getInstance()
Factory.
static _lookupObjId($a_id)
This class represents a selection list property in a property form.
Custom repository search gui class for study programme to make it possible to get a handle on users s...
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.
static getInstance()
Factory.
This class represents a text property in a property form.
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
$lng