ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilRepositorySearchGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
35 include_once 'Services/Search/classes/class.ilSearchResult.php';
36 include_once 'Services/Search/classes/class.ilSearchSettings.php';
37 include_once './Services/User/classes/class.ilUserAccountSettings.php';
38 include_once 'Services/Search/classes/class.ilQueryParser.php';
39 
40 
42 {
43  private $search_results = array();
44 
45  protected $add_options = array();
46  protected $object_selection = false;
47 
48  protected $searchable_check = true;
49  protected $search_title = '';
50 
51  var $search_type = 'usr';
52 
58  {
59  global $ilCtrl,$tpl,$lng;
60 
61  $this->ctrl =& $ilCtrl;
62  $this->tpl =& $tpl;
63  $this->lng =& $lng;
64  $this->lng->loadLanguageModule('search');
65  $this->lng->loadLanguageModule('crs');
66 
67  $this->setTitle($this->lng->txt('add_members_header'));
68 
69  $this->__setSearchType();
70  $this->__loadQueries();
71 
72  $this->result_obj = new ilSearchResult();
73  $this->result_obj->setMaxHits(1000000);
74  $this->settings =& new ilSearchSettings();
75 
76  }
77 
82  public function setTitle($a_title)
83  {
84  $this->search_title = $a_title;
85  }
86 
91  public function getTitle()
92  {
93  return $this->search_title;
94  }
95 
100  public function enableSearchableCheck($a_status)
101  {
102  $this->searchable_check = $a_status;
103  }
104 
109  public function isSearchableCheckEnabled()
110  {
112  }
113 
114 
128  public static function fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar = null, $a_options = array())
129  {
130  global $ilToolbar, $lng, $ilCtrl;
131 
132  if(!$toolbar instanceof ilToolbarGUI)
133  {
134  $toolbar = $ilToolbar;
135  }
136 
137  // Fill default options
138  if(!isset($a_options['auto_complete_name']))
139  {
140  $a_options['auto_complete_name'] = $lng->txt('obj_user');
141  }
142  if(!isset($a_options['auto_complete_size']))
143  {
144  $a_options['auto_complete_size'] = 15;
145  }
146  if(!isset($a_options['submit_name']))
147  {
148  $a_options['submit_name'] = $lng->txt('btn_add');
149  }
150 
151  $ajax_url = $ilCtrl->getLinkTargetByClass(array(get_class($parent_object),'ilRepositorySearchGUI'),
152  'doUserAutoComplete', '', true);
153 
154  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
155  $ul = new ilTextInputGUI($a_options['auto_complete_name'], 'user_login');
156  $ul->setDataSource($ajax_url);
157  $ul->setSize($a_options['auto_complete_size']);
158  $toolbar->addInputItem($ul, true);
159 
160  if(count((array) $a_options['user_type']))
161  {
162  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
163  $si = new ilSelectInputGUI("", "user_type");
164  $si->setOptions($a_options['user_type']);
165  $toolbar->addInputItem($si);
166  }
167 
168  $toolbar->addFormButton(
169  $a_options['submit_name'],
170  'addUserFromAutoComplete'
171  );
172 
173  $toolbar->setFormAction(
174  $ilCtrl->getFormActionByClass(
175  array(
176  get_class($parent_object),
177  'ilRepositorySearchGUI')
178  )
179  );
180  return $toolbar;
181  }
182 
187  protected function doUserAutoComplete()
188  {
189 
190  if(!isset($_GET['autoCompleteField']))
191  {
192  $a_fields = array('login','firstname','lastname','email');
193  $result_field = 'login';
194  }
195  else
196  {
197  $a_fields = array((string) $_GET['autoCompleteField']);
198  $result_field = (string) $_GET['autoCompleteField'];
199  }
200 
201  $GLOBALS['ilLog']->write(print_r($a_fields,true));
202  include_once './Services/User/classes/class.ilUserAutoComplete.php';
203  $auto = new ilUserAutoComplete();
204  $auto->setSearchFields($a_fields);
205  $auto->setResultField($result_field);
206  $auto->enableFieldSearchableCheck(true);
207  echo $auto->getList($_REQUEST['term']);
208  exit();
209  }
210 
211 
216  function setString($a_str)
217  {
218  $_SESSION['search']['string'] = $this->string = $a_str;
219  }
220  function getString()
221  {
222  return $this->string;
223  }
224 
229  function &executeCommand()
230  {
231  global $rbacsystem;
232 
233  $next_class = $this->ctrl->getNextClass($this);
234  $cmd = $this->ctrl->getCmd();
235 
236  $this->ctrl->setReturn($this,'');
237 
238  switch($next_class)
239  {
240  default:
241  if(!$cmd)
242  {
243  $cmd = "showSearch";
244  }
245  $this->$cmd();
246  break;
247  }
248  return true;
249  }
250 
251  function __clearSession()
252  {
253 
254  unset($_SESSION['rep_search']);
255  unset($_SESSION['append_results']);
256  unset($_SESSION['rep_query']);
257  unset($_SESSION['rep_search_type']);
258  }
259 
260  function cancel()
261  {
262  $this->ctrl->returnToParent($this);
263  }
264 
265  function start()
266  {
267  // delete all session info
268  $this->__clearSession();
269  $this->showSearch();
270 
271  return true;
272  }
273 
274 
275  public function addUser()
276  {
277  $class = $this->callback['class'];
278  $method = $this->callback['method'];
279 
280  // call callback if that function does give a return value => show error message
281  // listener redirects if everything is ok.
282  $class->$method($_POST['user']);
283 
284  $this->showSearchResults();
285  }
286 
290  protected function addUserFromAutoComplete()
291  {
292  $class = $this->callback['class'];
293  $method = $this->callback['method'];
294 
295  $users = explode(',', $_POST['user_login']);
296  $user_ids = array();
297  foreach($users as $user)
298  {
299  $user_id = ilObjUser::_lookupId($user);
300  if($user_id)
301  {
302  $user_ids[] = $user_id;
303  }
304  }
305 
306  $user_type = isset($_POST['user_type']) ? $_POST['user_type'] : 0;
307 
308  if(!$class->$method($user_ids,$user_type))
309  {
310  $GLOBALS['ilCtrl']->returnToParent($this);
311  }
312  }
313 
317  protected function handleMultiCommand()
318  {
319  $class = $this->callback['class'];
320  $method = $this->callback['method'];
321 
322  // Redirects if everything is ok
323  if(!$class->$method((array) $_POST['user'],$_POST['selectedCommand']))
324  {
325  $this->showSearchResults();
326  }
327  }
328 
329  public function setCallback(&$class,$method,$a_add_options = array())
330  {
331  $this->callback = array('class' => $class,'method' => $method);
332  $this->add_options = $a_add_options ? $a_add_options : array();
333  }
334 
335  public function showSearch()
336  {
337  $this->initFormSearch();
338  $this->tpl->setContent($this->form->getHTML());
339  }
340 
341  public function initFormSearch()
342  {
343  global $ilCtrl;
344 
345  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
346 
347  $this->form = new ilPropertyFormGUI();
348  $this->form->setFormAction($this->ctrl->getFormAction($this,'search'));
349  $this->form->setTitle($this->getTitle());
350  $this->form->addCommandButton('performSearch', $this->lng->txt('search'));
351  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
352 
353 
354  $kind = new ilRadioGroupInputGUI($this->lng->txt('search_type'),'search_for');
355  $kind->setValue($this->search_type);
356  $this->form->addItem($kind);
357 
358  // Users
359  $users = new ilRadioOption($this->lng->txt('search_for_users'),'usr');
360 
361  // UDF
362  include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
364  {
365  switch($info['type'])
366  {
368  case FIELD_TYPE_SELECT:
369 
370  $sel = new ilSelectInputGUI($info['lang'],"rep_query[usr][".$info['db']."]");
371  $sel->setOptions($info['values']);
372  $users->addSubItem($sel);
373  break;
374 
375  case FIELD_TYPE_UDF_TEXT:
376  case FIELD_TYPE_TEXT:
377 
378  if(isset($info['autoComplete']) and $info['autoComplete'])
379  {
380  $ilCtrl->setParameterByClass(get_class($this),'autoCompleteField',$info['db']);
381  $ul = new ilTextInputGUI($info['lang'], "rep_query[usr][".$info['db']."]");
382  $ul->setDataSource($ilCtrl->getLinkTarget($this,
383  "doUserAutoComplete", "", true));
384  $ul->setSize(30);
385  $ul->setMaxLength(120);
386  $users->addSubItem($ul);
387  }
388  else
389  {
390  $txt = new ilTextInputGUI($info['lang'],"rep_query[usr][".$info['db']."]");
391  $txt->setSize(30);
392  $txt->setMaxLength(120);
393  $users->addSubItem($txt);
394  }
395  break;
396  }
397  }
398  $kind->addOption($users);
399 
400 
401 
402  // Role
403  $roles = new ilRadioOption($this->lng->txt('search_for_role_members'),'role');
404  $role = new ilTextInputGUI($this->lng->txt('search_role_title'),'rep_query[role][title]');
405  $role->setSize(30);
406  $role->setMaxLength(120);
407  $roles->addSubItem($role);
408  $kind->addOption($roles);
409 
410  // Course
411  $groups = new ilRadioOption($this->lng->txt('search_for_crs_members'),'crs');
412  $group = new ilTextInputGUI($this->lng->txt('search_crs_title'),'rep_query[crs][title]');
413  $group->setSize(30);
414  $group->setMaxLength(120);
415  $groups->addSubItem($group);
416  $kind->addOption($groups);
417 
418  // Group
419  $groups = new ilRadioOption($this->lng->txt('search_for_grp_members'),'grp');
420  $group = new ilTextInputGUI($this->lng->txt('search_grp_title'),'rep_query[grp][title]');
421  $group->setSize(30);
422  $group->setMaxLength(120);
423  $groups->addSubItem($group);
424  $kind->addOption($groups);
425  }
426 
427 
428  function show()
429  {
430  $this->showSearchResults();
431  }
432 
433  function appendSearch()
434  {
435  $_SESSION['search_append'] = true;
436  $this->performSearch();
437  }
438 
443  function performSearch()
444  {
445  $found_query = false;
446  foreach((array) $_POST['rep_query'][$_POST['search_for']] as $field => $value)
447  {
448  if(trim(ilUtil::stripSlashes($value)))
449  {
450  $found_query = true;
451  break;
452  }
453  }
454  if(!$found_query)
455  {
456  ilUtil::sendFailure($this->lng->txt('msg_no_search_string'));
457  $this->start();
458  return false;
459  }
460 
461  // unset search_append if called directly
462  if($_POST['cmd']['performSearch'])
463  {
464  unset($_SESSION['search_append']);
465  }
466 
467  switch($this->search_type)
468  {
469  case 'usr':
470  $this->__performUserSearch();
471  break;
472 
473  case 'grp':
474  $this->__performGroupSearch();
475  break;
476 
477  case 'crs':
478  $this->__performCourseSearch();
479  break;
480 
481  case 'role':
482  $this->__performRoleSearch();
483  break;
484 
485  default:
486  echo 'not defined';
487  }
488  $this->result_obj->setRequiredPermission('read');
489  $this->result_obj->addObserver($this, 'searchResultFilterListener');
490  $this->result_obj->filter(ROOT_FOLDER_ID,QP_COMBINATION_OR);
491 
492  // User access filter
493  if($this->search_type == 'usr')
494  {
495  include_once './Services/User/classes/class.ilUserFilter.php';
496  $this->search_results = array_intersect(
497  $this->result_obj->getResultIds(),
498  ilUserFilter::getInstance()->filter($this->result_obj->getResultIds())
499  );
500  }
501  else
502  {
503  $this->search_results = array();
504  foreach((array) $this->result_obj->getResults() as $res)
505  {
506  $this->search_results[] = $res['obj_id'];
507  }
508  }
509 
510  if(!count($this->search_results))
511  {
512  ilUtil::sendFailure($this->lng->txt('search_no_match'));
513  $this->showSearch();
514  return true;
515  }
516  $this->__updateResults();
517  if($this->result_obj->isLimitReached())
518  {
519  $message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
520  ilUtil::sendInfo($message);
521  return true;
522  }
523  // show results
524  $this->show();
525  return true;
526  }
527 
529  {
530  include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
531  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
532 
534  {
535  $name = $info['db'];
536  $query_string = $_SESSION['rep_query']['usr'][$name];
537 
538  // continue if no query string is given
539  if(!$query_string)
540  {
541  continue;
542  }
543 
544  if(!is_object($query_parser = $this->__parseQueryString($query_string)))
545  {
546  ilUtil::sendInfo($query_parser);
547  return false;
548  }
549  switch($info['type'])
550  {
552  // Do a phrase query for select fields
553  $query_parser = $this->__parseQueryString('"'.$query_string.'"');
554 
555  case FIELD_TYPE_UDF_TEXT:
557  $udf_search->setFields(array($name));
558  $result_obj = $udf_search->performSearch();
559 
560  // Store entries
561  $this->__storeEntries($result_obj);
562  break;
563 
564  case FIELD_TYPE_SELECT:
565  // Do a phrase query for select fields
566  $query_parser = $this->__parseQueryString('"'.$query_string.'"');
567 
568  case FIELD_TYPE_TEXT:
569  $user_search =& ilObjectSearchFactory::_getUserSearchInstance($query_parser);
570  $user_search->setFields(array($name));
571  $result_obj = $user_search->performSearch();
572 
573  // store entries
574  $this->__storeEntries($result_obj);
575  break;
576  }
577  }
578  }
579 
585  {
586  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
587 
588  $query_string = $_SESSION['rep_query']['grp']['title'];
589  if(!is_object($query_parser = $this->__parseQueryString($query_string)))
590  {
591  ilUtil::sendInfo($query_parser,true);
592  return false;
593  }
594 
595  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
596  $object_search = new ilLikeObjectSearch($query_parser);
597  $object_search->setFilter(array('grp'));
598  $this->__storeEntries($object_search->performSearch());
599 
600  return true;
601  }
602 
607  protected function __performCourseSearch()
608  {
609  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
610 
611  $query_string = $_SESSION['rep_query']['crs']['title'];
612  if(!is_object($query_parser = $this->__parseQueryString($query_string)))
613  {
614  ilUtil::sendInfo($query_parser,true);
615  return false;
616  }
617 
618  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
619  $object_search = new ilLikeObjectSearch($query_parser);
620  $object_search->setFilter(array('crs'));
621  $this->__storeEntries($object_search->performSearch());
622 
623  return true;
624  }
625 
631  {
632  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
633 
634  $query_string = $_SESSION['rep_query']['role']['title'];
635  if(!is_object($query_parser = $this->__parseQueryString($query_string)))
636  {
637  ilUtil::sendInfo($query_parser,true);
638  return false;
639  }
640 
641  // Perform like search
642  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
643  $object_search = new ilLikeObjectSearch($query_parser);
644  $object_search->setFilter(array('role'));
645  $this->__storeEntries($object_search->performSearch());
646 
647  return true;
648  }
649 
655  function &__parseQueryString($a_string,$a_combination_or = true)
656  {
657  $query_parser = new ilQueryParser(ilUtil::stripSlashes($a_string));
658  $query_parser->setCombination($a_combination_or ? QP_COMBINATION_OR : QP_COMBINATION_AND);
659  $query_parser->setMinWordLength(1);
660  $query_parser->setGlobalMinLength(3); // #14768
661  $query_parser->parse();
662 
663  if(!$query_parser->validate())
664  {
665  return $query_parser->getMessage();
666  }
667  return $query_parser;
668  }
669 
670  // Private
671  function __loadQueries()
672  {
673  if(is_array($_POST['rep_query']))
674  {
675  $_SESSION['rep_query'] = $_POST['rep_query'];
676  }
677  }
678 
679 
680  function __setSearchType()
681  {
682  // Update search type. Default to user search
683  if($_POST['search_for'])
684  {
685  #echo 1;
686  $_SESSION['rep_search_type'] = $_POST['search_for'];
687  }
688  if(!$_POST['search_for'] and !$_SESSION['rep_search_type'])
689  {
690  #echo 2;
691  $_SESSION['rep_search_type'] = 'usr';
692  }
693 
694  $this->search_type = $_SESSION['rep_search_type'];
695  #echo $this->search_type;
696 
697  return true;
698  }
699 
700 
701  function __updateResults()
702  {
703  if(!$_SESSION['search_append'])
704  {
705  $_SESSION['rep_search'] = array();
706  }
707  foreach($this->search_results as $result)
708  {
709  $_SESSION['rep_search'][$this->search_type][] = $result;
710  }
711  if(!$_SESSION['rep_search'][$this->search_type])
712  {
713  $_SESSION['rep_search'][$this->search_type] = array();
714  }
715  else
716  {
717  // remove duplicate entries
718  $_SESSION['rep_search'][$this->search_type] = array_unique($_SESSION['rep_search'][$this->search_type]);
719  }
720  return true;
721  }
722 
723  function __appendToStoredResults($a_usr_ids)
724  {
725  if(!$_SESSION['search_append'])
726  {
727  return $_SESSION['rep_search']['usr'] = $a_usr_ids;
728  }
729  $_SESSION['rep_search']['usr'] = array();
730  foreach($a_usr_ids as $usr_id)
731  {
732  $_SESSION['rep_search']['usr'][] = $usr_id;
733  }
734  return $_SESSION['rep_search']['usr'] ? array_unique($_SESSION['rep_search']['usr']) : array();
735  }
736 
737  function __storeEntries(&$new_res)
738  {
739  if($this->stored == false)
740  {
741  $this->result_obj->mergeEntries($new_res);
742  $this->stored = true;
743  return true;
744  }
745  else
746  {
747  $this->result_obj->intersectEntries($new_res);
748  return true;
749  }
750  }
751 
756  protected function addNewSearchButton()
757  {
758  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
759  $toolbar = new ilToolbarGUI();
760  $toolbar->addButton(
761  $this->lng->txt('search_new'),
762  $this->ctrl->getLinkTarget($this,'showSearch')
763  );
764  $this->tpl->setVariable('ACTION_BUTTONS',$toolbar->getHTML());
765  }
766 
767  public function showSearchResults()
768  {
769  $counter = 0;
770  $f_result = array();
771 
772  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.rep_search_result.html','Services/Search');
773  $this->addNewSearchButton();
774 
775  switch($this->search_type)
776  {
777  case "usr":
778  $this->showSearchUserTable($_SESSION['rep_search']['usr'],'showSearchResults');
779  break;
780 
781  case 'grp':
782  $this->showSearchGroupTable($_SESSION['rep_search']['grp']);
783  break;
784 
785  case 'crs':
786  $this->showSearchCourseTable($_SESSION['rep_search']['crs']);
787  break;
788 
789  case 'role':
790  $this->showSearchRoleTable($_SESSION['rep_search']['role']);
791  break;
792  }
793  }
794 
800  protected function showSearchUserTable($a_usr_ids,$a_parent_cmd)
801  {
802  $is_in_admin = ($_REQUEST['baseClass'] == 'ilAdministrationGUI');
803  if($is_in_admin)
804  {
805  // remember link target to admin search gui (this)
806  $_SESSION["usr_search_link"] = $this->ctrl->getLinkTarget($this,'show');
807  }
808 
809  include_once './Services/Search/classes/class.ilRepositoryUserResultTableGUI.php';
810 
811  $table = new ilRepositoryUserResultTableGUI($this,$a_parent_cmd,$is_in_admin);
812  if(count($this->add_options))
813  {
814  $table->addMultiItemSelectionButton(
815  'selectedCommand',
816  $this->add_options,
817  'handleMultiCommand',
818  $this->lng->txt('execute')
819  );
820  }
821  else
822  {
823  $table->addMultiCommand('addUser', $this->lng->txt('btn_add'));
824  }
825  $table->parseUserIds($a_usr_ids);
826 
827  $this->tpl->setVariable('RES_TABLE',$table->getHTML());
828  }
829 
835  protected function showSearchRoleTable($a_obj_ids)
836  {
837  include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
838 
839  $table = new ilRepositoryObjectResultTableGUI($this,'showSearchResults',$this->object_selection);
840  $table->parseObjectIds($a_obj_ids);
841 
842  $this->tpl->setVariable('RES_TABLE',$table->getHTML());
843  }
844 
850  protected function showSearchGroupTable($a_obj_ids)
851  {
852  include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
853 
854  $table = new ilRepositoryObjectResultTableGUI($this,'showSearchResults',$this->object_selection);
855  $table->parseObjectIds($a_obj_ids);
856 
857  $this->tpl->setVariable('RES_TABLE',$table->getHTML());
858  }
859 
865  protected function showSearchCourseTable($a_obj_ids)
866  {
867  include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
868 
869  $table = new ilRepositoryObjectResultTableGUI($this,'showSearchResults',$this->object_selection);
870  $table->parseObjectIds($a_obj_ids);
871 
872  $this->tpl->setVariable('RES_TABLE',$table->getHTML());
873  }
874 
879  protected function listUsers()
880  {
881  // get parameter is used e.g. in exercises to provide
882  // "add members of course" link
883  if ($_GET["list_obj"] != "" && !is_array($_POST['obj']))
884  {
885  $_POST['obj'][0] = $_GET["list_obj"];
886  }
887  if(!is_array($_POST['obj']) or !$_POST['obj'])
888  {
889  ilUtil::sendFailure($this->lng->txt('select_one'));
890  $this->showSearchResults();
891  return false;
892  }
893 
894  $_SESSION['rep_search']['objs'] = $_POST['obj'];
895 
896  // Get all members
897  $members = array();
898  foreach($_POST['obj'] as $obj_id)
899  {
900  $type = ilObject::_lookupType($obj_id);
901  switch($type)
902  {
903  case 'crs':
904  case 'grp':
905 
906  include_once './Services/Membership/classes/class.ilParticipants.php';
908  {
909  $members = array_merge((array) $members, ilParticipants::getInstanceByObjId($obj_id)->getParticipants());
910  }
911  break;
912 
913  case 'role':
914  global $rbacreview;
915 
916  include_once './Services/User/classes/class.ilUserFilter.php';
917  $members = array_merge($members, ilUserFilter::getInstance()->filter($rbacreview->assignedUsers($obj_id)));
918  break;
919  }
920  }
921  $members = array_unique((array) $members);
922  $this->__appendToStoredResults($members);
923 
924  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.rep_search_result.html','Services/Search');
925 
926  $this->addNewSearchButton();
927  $this->showSearchUserTable($_SESSION['rep_search']['usr'],'storedUserList');
928  return true;
929  }
930 
935  protected function storedUserList()
936  {
937  $_POST['obj'] = $_SESSION['rep_search']['objs'];
938  $this->listUsers();
939  return true;
940  }
941 
950  public function searchResultFilterListener($a_ref_id,$a_data)
951  {
952  if($a_data['type'] == 'usr')
953  {
954  if($a_data['obj_id'] == ANONYMOUS_USER_ID)
955  {
956  return false;
957  }
958  }
959  return true;
960  }
961 
967  public function allowObjectSelection($a_value = false)
968  {
969  $this->object_selection = (bool)$a_value;
970  }
971 
975  protected function selectObject()
976  {
977  // get parameter is used e.g. in exercises to provide
978  // "add members of course" link
979  if ($_GET["list_obj"] != "" && !is_array($_POST['obj']))
980  {
981  $_POST['obj'][0] = $_GET["list_obj"];
982  }
983  if(!is_array($_POST['obj']) or !$_POST['obj'])
984  {
985  ilUtil::sendFailure($this->lng->txt('select_one'));
986  $this->showSearchResults();
987  return false;
988  }
989 
990  $this->ctrl->setParameter($this->callback["class"], "obj", implode(";", $_POST["obj"]));
991  $this->ctrl->redirect($this->callback["class"], $this->callback["method"]);
992  }
993 }
994 ?>