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