4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
5 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
31 function __construct($a_parent_obj, $a_parent_cmd, $a_admin_mode =
false,
$a_type = self::TYPE_STANDARD)
35 $this->admin_mode = (bool)$a_admin_mode;
38 $this->
setId(
"rep_search_".$ilUser->getId());
39 parent::__construct($a_parent_obj, $a_parent_cmd);
42 $this->
setFormAction($ilCtrl->getFormAction($this->parent_obj));
43 $this->
setTitle($this->lng->txt(
'search_results'));
48 if($this->
getType() == self::TYPE_STANDARD)
50 $this->
setRowTemplate(
"tpl.rep_search_usr_result_row.html",
"Services/Search");
52 $this->
enable(
'select_all');
59 $this->
setRowTemplate(
"tpl.global_search_usr_result_row.html",
"Services/Search");
66 $this->
addColumn($all_cols[$col][
'txt'], $col);
69 if($this->
getType() == self::TYPE_STANDARD)
75 $this->
addColumn($this->lng->txt(
'lucene_relevance_short'),
'relevance');
93 if($a_field ==
'relevance')
97 return parent::numericOrdering($a_field);
116 $this->lucene_result =
$res;
135 $this->user_limitations = (bool) $a_limitations;
158 if(!self::$all_selectable_cols)
160 include_once
'./Services/Search/classes/class.ilUserSearchOptions.php';
163 if($this->admin_mode)
166 $columns[
'access_until'] =
array(
'txt' => $this->lng->txt(
'access_until'));
167 $columns[
'last_login'] =
array(
'txt' => $this->lng->txt(
'last_login'));
170 self::$all_selectable_cols =
$columns;
172 return self::$all_selectable_cols;
181 if(!count($a_commands))
193 protected function fillRow($a_set)
200 $this->tpl->setVariable(
"VAL_ID", $a_set[
"usr_id"]);
203 if($this->
getType() == self::TYPE_GLOBAL_SEARCH)
205 include_once
'./Services/User/classes/class.ilUserUtil.php';
209 $this->tpl->setVariable(
'IMG_LINKED_TO_PROFILE',$link);
210 $this->tpl->setVariable(
211 'USR_IMG_SRC_LINKED',
217 $this->tpl->setVariable(
230 $a_set[
'gender'] = $a_set[
'gender'] ? $this->lng->txt(
'gender_' . $a_set[
'gender']) :
'';
231 $this->tpl->setCurrentBlock(
'custom_fields');
232 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
233 $this->tpl->parseCurrentBlock();
238 $this->tpl->setCurrentBlock(
'custom_fields');
239 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
240 $this->tpl->parseCurrentBlock();
244 $this->tpl->setCurrentBlock(
'custom_fields');
245 $this->tpl->setVariable(
'CUST_CLASS',
' '.$a_set[
'access_class']);
246 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
247 $this->tpl->parseCurrentBlock();
252 $this->tpl->setCurrentBlock(
'custom_fields');
253 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
254 $this->tpl->parseCurrentBlock();
257 case 'interests_general':
258 case 'interests_help_offered':
259 case 'interests_help_looking':
260 $this->tpl->setCurrentBlock(
'custom_fields');
261 $this->tpl->setVariable(
'VAL_CUST', implode(
', ', (
array) $a_set[$field]));
262 $this->tpl->parseCurrentBlock();
266 $this->tpl->setCurrentBlock(
'custom_fields');
267 include_once
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php';
268 $this->tpl->setVariable(
'VAL_CUST', (
string) ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_set[
'usr_id']));
269 $this->tpl->parseCurrentBlock();
274 if($this->admin_mode)
276 $ilCtrl->setParameterByClass(
"ilobjusergui",
"ref_id",
"7");
277 $ilCtrl->setParameterByClass(
"ilobjusergui",
"obj_id", $a_set[
"usr_id"]);
278 $ilCtrl->setParameterByClass(
"ilobjusergui",
"search",
"1");
279 $link = $ilCtrl->getLinkTargetByClass(
array(
"iladministrationgui",
"ilobjusergui"),
"view");
280 $a_set[$field] =
"<a href=\"".$link.
"\">".$a_set[$field].
"</a>";
282 elseif($this->
getType() == self::TYPE_GLOBAL_SEARCH)
284 $a_set[$field] =
"<a href=\"".$link.
"\">".$a_set[$field].
"</a>";
289 $this->tpl->setCurrentBlock(
'custom_fields');
290 $this->tpl->setVariable(
'VAL_CUST', (
string) ($a_set[$field] ? $a_set[$field] :
''));
291 $this->tpl->parseCurrentBlock();
296 if($this->
getType() == self::TYPE_GLOBAL_SEARCH)
298 $this->tpl->setVariable(
'SEARCH_RELEVANCE',$this->
getRelevanceHTML($a_set[
'relevance']));
301 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
306 $this->tpl->setVariable(
'CONTACT_ACTIONS',
'');
327 $parse_access =
false;
328 if(isset($additional_fields[
'access_until']))
330 $parse_access =
true;
331 unset($additional_fields[
'access_until']);
334 $udf_ids = $usr_data_fields = $odf_ids =
array();
335 foreach($additional_fields as $field)
337 if($field ==
'org_units')
341 if(substr($field, 0, 3) ==
'udf')
343 $udf_ids[] = substr($field,4);
346 $usr_data_fields[] = $field;
348 include_once
'./Services/User/classes/class.ilUserQuery.php';
351 $u_query->setOrderField(
'login');
352 $u_query->setOrderDirection(
'ASC');
353 $u_query->setLimit(999999);
354 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
358 $u_query->setActionFilter(
"activ");
363 $u_query->setAccessFilter(
true);
366 $u_query->setAdditionalFields($usr_data_fields);
367 $u_query->setUserFilter($a_user_ids);
369 $usr_data = $u_query->query();
372 if($this->admin_mode && $parse_access)
375 $current_time =
time();
376 foreach($usr_data[
'set'] as $k => $user)
380 if ($user[
"time_limit_unlimited"])
382 $txt_access = $this->lng->txt(
"access_unlimited");
383 $usr_data[
"set"][$k][
"access_class"] =
"smallgreen";
385 elseif ($user[
"time_limit_until"] < $current_time)
387 $txt_access = $this->lng->txt(
"access_expired");
388 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
393 $usr_data[
"set"][$k][
"access_class"] =
"small";
398 $txt_access = $this->lng->txt(
"inactive");
399 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
401 $usr_data[
"set"][$k][
"access_until"] = $txt_access;
408 include_once
'./Services/User/classes/class.ilUserDefinedData.php';
413 foreach($usr_data[
'set'] as $set)
416 foreach($udf_ids as $udf_field)
418 $users[
$counter][
'udf_'.$udf_field] =
$data[$set[
'usr_id']][$udf_field];
425 $users = $usr_data[
'set'];
428 if($this->
getType() == self::TYPE_GLOBAL_SEARCH)
450 $tpl =
new ilTemplate(
'tpl.lucene_relevance.html',
true,
true,
'Services/Search');
452 include_once
"Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
454 $pbar->setCurrent($a_rel);
456 $tpl->setCurrentBlock(
'relevance');
457 $tpl->setVariable(
'REL_PBAR', $pbar->render());
458 $tpl->parseCurrentBlock();
numericOrdering($a_field)
enable numeric ordering for relevance
TableGUI class user search results.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
getSelectableColumns()
Get all selectable columns.
static $all_selectable_cols
getUserLimitations()
allow user limitations like inactive and access limitations
__construct($a_parent_obj, $a_parent_cmd, $a_admin_mode=false, $a_type=self::TYPE_STANDARD)
Constructor.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static lookupData($a_user_ids, $a_field_ids)
Lookup data.
Search result implementing iterator interface.
static getInstance()
Factory.
getRelevanceHTML($a_rel)
Get relevance html.
static getSelectableColumnInfo($a_admin=false)
Get info of searchable fields for selectable columns in table gui.
special template class to simplify handling of ITX/PEAR
addMultiCommand($a_cmd, $a_text)
Add Command button.
enable($a_module_name)
enables particular modules of table
static formatDate(ilDateTime $date)
Format a date public.
getSelectedColumns()
Get selected columns.
getType()
Get search context type.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
addMultiItemSelectionButton($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
Add Selection List + Command button for selected items.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setLuceneResult(ilLuceneSearchResult $res)
Set lucene result For parsing relevances.
setUserLimitations($a_limitations)
allow user limitations like inactive and access limitations
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
initMultiCommands($a_commands)
Init multi commands.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
parseUserIds($a_user_ids)
Parse user data.
getLuceneResult()
Get lucene result.
fillRow($a_set)
Standard Version of Fill Row.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setEnableTitle($a_enabletitle)
Set Enable Title.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
static getProfileLink($a_usr_id)
Get link to personal profile Return empty string in case of not public profile.