ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $DIC;
34  $ilToolbar = $DIC['ilToolbar'];
35  $lng = $DIC['lng'];
36  $ilCtrl = $DIC['ilCtrl'];
37  $tree = $DIC['tree'];
38 
39  if(!$toolbar instanceof ilToolbarGUI)
40  {
41  $toolbar = $ilToolbar;
42  }
43 
44  // Fill default options
45  if(!isset($a_options['auto_complete_name']))
46  {
47  $a_options['auto_complete_name'] = $lng->txt('obj_user');
48  }
49  if(!isset($a_options['auto_complete_size']))
50  {
51  $a_options['auto_complete_size'] = 15;
52  }
53  if(!isset($a_options['submit_name']))
54  {
55  $a_options['submit_name'] = $lng->txt('btn_add');
56  }
57 
58  $ajax_url = $ilCtrl->getLinkTargetByClass(array(get_class($parent_object),'ilStudyProgrammeRepositorySearchGUI'),
59  'doUserAutoComplete', '', true,false);
60 
61  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
62  $ul = new ilTextInputGUI($a_options['auto_complete_name'], 'user_login');
63  $ul->setDataSource($ajax_url);
64  $ul->setSize($a_options['auto_complete_size']);
65  if(!$a_sticky)
66  {
67  $toolbar->addInputItem($ul, true);
68  }
69  else
70  {
71  $toolbar->addStickyItem($ul, true);
72  }
73 
74  if(count((array) $a_options['user_type']))
75  {
76  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
77  $si = new ilSelectInputGUI("", "user_type");
78  $si->setOptions($a_options['user_type']);
79  if(!$a_sticky)
80  {
81  $toolbar->addInputItem($si);
82  }
83  else
84  {
85  $toolbar->addStickyItem($si);
86  }
87  }
88 
89  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
90  $button = ilSubmitButton::getInstance();
91  $button->setCaption($a_options['submit_name'], false);
92  $button->setCommand('addUserFromAutoComplete');
93  if(!$a_sticky)
94  {
95  $toolbar->addButtonInstance($button);
96  }
97  else
98  {
99  $toolbar->addStickyItem($button);
100  }
101 
102  if((bool)$a_options['add_search'] ||
103  is_numeric($a_options['add_from_container']))
104  {
105  $lng->loadLanguageModule("search");
106 
107  $toolbar->addSeparator();
108 
109  if((bool)$a_options['add_search'])
110  {
111  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
112  $button = ilLinkButton::getInstance();
113  $button->setCaption("search_users");
114  $button->setUrl($ilCtrl->getLinkTargetByClass('ilStudyProgrammeRepositorySearchGUI',''));
115  $toolbar->addButtonInstance($button);
116  }
117 
118  if(is_numeric($a_options['add_from_container']))
119  {
120  $parent_ref_id = (int)$a_options['add_from_container'];
121  $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "grp");
122  $parent_container_type = "grp";
123  if(!$parent_container_ref_id)
124  {
125  $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "crs");
126  $parent_container_type = "crs";
127  }
128  if($parent_container_ref_id)
129  {
130  if((bool)$a_options['add_search'])
131  {
132  $toolbar->addSpacer();
133  }
134 
135  $ilCtrl->setParameterByClass('ilStudyProgrammeRepositorySearchGUI', "list_obj", ilObject::_lookupObjId($parent_container_ref_id));
136 
137  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
138  $button = ilLinkButton::getInstance();
139  $button->setCaption("search_add_members_from_container_".$parent_container_type);
140  $button->setUrl($ilCtrl->getLinkTargetByClass(array(get_class($parent_object),'ilStudyProgrammeRepositorySearchGUI'), 'listUsers'));
141  $toolbar->addButtonInstance($button);
142  }
143  }
144  }
145 
146  $toolbar->setFormAction(
147  $ilCtrl->getFormActionByClass(
148  array(
149  get_class($parent_object),
150  'ilStudyProgrammeRepositorySearchGUI')
151  )
152  );
153  return $toolbar;
154  }
155 }
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.
Create styles array
The data for the language used.
Custom repository search gui class for study programme to make it possible to get a handle on users s...
global $lng
Definition: privfeed.php:17
global $DIC
$_POST["username"]