ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilUserLoginAutoCompleteInputGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
5 
14 {
21  function __construct($a_title, $a_postvar, $a_class, $a_autocomplete_cmd)
22  {
23  global $tpl, $ilCtrl;
24 
25  if(is_object($a_class))
26  {
27  $a_class = get_class($a_class);
28  }
29  if(!is_array($a_class))
30  {
31  $a_class = strtolower($a_class);
32  }
33 
34  parent::__construct($a_title, $a_postvar);
35  $this->setInputType("logac");
36  $tpl->addJavaScript("./Services/User/js/ilUserAutoComplete.js");
37  $this->setMaxLength(70);
38  $this->setSize(30);
39  $dsSchema = array(
40  "resultsList" => 'response.results',
41  "fields" => array( 'login','firstname', 'lastname', 'email')
42  );
43  $this->setDataSourceResultFormat("ilUserAutoComplete");
44  $this->setDataSource($ilCtrl->getLinkTargetByClass($a_class, $a_autocomplete_cmd,'',true));
45  $this->setDataSourceSchema($dsSchema);
46  }
47 
52  public function setResultDataField($a_field)
53  {
54  $fields = $this->getDataSourceSchema();
55  $fields = $fields['fields'];
56 
57  $schema_fields[] = $a_field;
58  foreach((array) $fields as $field)
59  {
60  if($field != $a_field)
61  {
62  $schema_fields[] = $field;
63  }
64  }
65  $this->setDataSourceSchema(
66  array(
67  'resultsList' => 'response.results',
68  'fields' => $schema_fields
69  )
70  );
71  }
72 }