4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
5 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
31 public function __construct($a_parent_obj, $a_parent_cmd, $a_admin_mode =
false,
$a_type = self::TYPE_STANDARD)
37 $ilAccess = $DIC[
'ilAccess'];
41 $this->admin_mode = (bool) $a_admin_mode;
45 parent::__construct($a_parent_obj, $a_parent_cmd);
49 $this->
setTitle($this->lng->txt(
'search_results'));
54 if ($this->
getType() == self::TYPE_STANDARD) {
55 $this->
setRowTemplate(
"tpl.rep_search_usr_result_row.html",
"Services/Search");
57 $this->
enable(
'select_all');
62 $this->
setRowTemplate(
"tpl.global_search_usr_result_row.html",
"Services/Search");
68 $this->
addColumn($all_cols[$col][
'txt'], $col);
71 if ($this->
getType() == self::TYPE_STANDARD) {
73 $this->
addColumn($this->lng->txt(
'lucene_relevance_short'),
'relevance');
89 if ($a_field ==
'relevance') {
92 return parent::numericOrdering($a_field);
111 $this->lucene_result =
$res;
130 $this->user_limitations = (bool) $a_limitations;
153 $rbacreview = $DIC[
'rbacreview'];
156 if (!self::$all_selectable_cols) {
157 include_once
'./Services/Search/classes/class.ilUserSearchOptions.php';
160 if ($this->admin_mode) {
162 $columns[
'access_until'] = array(
'txt' => $this->lng->txt(
'access_until'));
163 $columns[
'last_login'] = array(
'txt' => $this->lng->txt(
'last_login'));
166 self::$all_selectable_cols =
$columns;
168 return self::$all_selectable_cols;
177 if (!count($a_commands)) {
188 protected function fillRow($a_set)
198 $this->tpl->setVariable(
"VAL_ID", $a_set[
"usr_id"]);
201 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
202 include_once
'./Services/User/classes/class.ilUserUtil.php';
205 $this->tpl->setVariable(
'IMG_LINKED_TO_PROFILE', $link);
206 $this->tpl->setVariable(
207 'USR_IMG_SRC_LINKED',
208 ilObjUser::_getPersonalPicturePath($a_set[
'usr_id'],
'xsmall')
211 $this->tpl->setVariable(
213 ilObjUser::_getPersonalPicturePath($a_set[
'usr_id'],
'xsmall')
222 $a_set[
'gender'] = $a_set[
'gender'] ? $this->lng->txt(
'gender_' . $a_set[
'gender']) :
'';
223 $this->tpl->setCurrentBlock(
'custom_fields');
224 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
225 $this->tpl->parseCurrentBlock();
230 $this->tpl->setCurrentBlock(
'custom_fields');
231 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
232 $this->tpl->parseCurrentBlock();
236 $this->tpl->setCurrentBlock(
'custom_fields');
237 $this->tpl->setVariable(
'CUST_CLASS',
' ' . $a_set[
'access_class']);
238 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
239 $this->tpl->parseCurrentBlock();
244 $this->tpl->setCurrentBlock(
'custom_fields');
245 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
246 $this->tpl->parseCurrentBlock();
249 case 'interests_general':
250 case 'interests_help_offered':
251 case 'interests_help_looking':
252 $this->tpl->setCurrentBlock(
'custom_fields');
253 $this->tpl->setVariable(
'VAL_CUST', implode(
', ', (array) $a_set[$field]));
254 $this->tpl->parseCurrentBlock();
258 $this->tpl->setCurrentBlock(
'custom_fields');
259 include_once
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php';
260 $this->tpl->setVariable(
'VAL_CUST', (
string) ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_set[
'usr_id']));
261 $this->tpl->parseCurrentBlock();
266 if ($this->admin_mode) {
267 $ilCtrl->setParameterByClass(
"ilobjusergui",
"ref_id",
"7");
268 $ilCtrl->setParameterByClass(
"ilobjusergui",
"obj_id", $a_set[
"usr_id"]);
269 $ilCtrl->setParameterByClass(
"ilobjusergui",
"search",
"1");
270 $link =
$ilCtrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjusergui"),
"view");
271 $a_set[$field] =
"<a href=\"" . $link .
"\">" . $a_set[$field] .
"</a>";
272 } elseif ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
273 $a_set[$field] =
"<a href=\"" . $link .
"\">" . $a_set[$field] .
"</a>";
279 $this->tpl->setCurrentBlock(
'custom_fields');
280 $this->tpl->setVariable(
'VAL_CUST', (
string) ($a_set[$field] ? $a_set[$field] :
''));
281 $this->tpl->parseCurrentBlock();
286 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
287 $this->tpl->setVariable(
'SEARCH_RELEVANCE', $this->
getRelevanceHTML($a_set[
'relevance']));
289 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
292 $this->tpl->setVariable(
'CONTACT_ACTIONS',
'');
311 $parse_access =
false;
312 if (isset($additional_fields[
'access_until'])) {
313 $parse_access =
true;
314 unset($additional_fields[
'access_until']);
317 $udf_ids = $usr_data_fields = $odf_ids = array();
318 foreach ($additional_fields as $field) {
319 if ($field ==
'org_units') {
322 if (substr($field, 0, 3) ==
'udf') {
323 $udf_ids[] = substr($field, 4);
326 $usr_data_fields[] = $field;
328 include_once
'./Services/User/classes/class.ilUserQuery.php';
331 $u_query->setOrderField(
'login');
332 $u_query->setOrderDirection(
'ASC');
333 $u_query->setLimit(999999);
334 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
337 $u_query->setActionFilter(
"active");
341 $u_query->setAccessFilter(
true);
344 $u_query->setAdditionalFields($usr_data_fields);
345 $u_query->setUserFilter($a_user_ids);
347 $usr_data = $u_query->query();
350 if ($this->admin_mode && $parse_access) {
352 $current_time = time();
353 foreach ($usr_data[
'set'] as $k =>
$user) {
354 if (
$user[
'active']) {
355 if (
$user[
"time_limit_unlimited"]) {
356 $txt_access = $this->lng->txt(
"access_unlimited");
357 $usr_data[
"set"][$k][
"access_class"] =
"smallgreen";
358 } elseif (
$user[
"time_limit_until"] < $current_time) {
359 $txt_access = $this->lng->txt(
"access_expired");
360 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
363 $usr_data[
"set"][$k][
"access_class"] =
"small";
366 $txt_access = $this->lng->txt(
"inactive");
367 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
369 $usr_data[
"set"][$k][
"access_until"] = $txt_access;
375 include_once
'./Services/User/classes/class.ilUserDefinedData.php';
380 foreach ($usr_data[
'set'] as $set) {
382 foreach ($udf_ids as $udf_field) {
383 $users[$counter][
'udf_' . $udf_field] =
$data[$set[
'usr_id']][$udf_field];
388 $users = $usr_data[
'set'];
391 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
393 foreach (
$users as $counter => $ud) {
410 $tpl =
new ilTemplate(
'tpl.lucene_relevance.html',
true,
true,
'Services/Search');
412 include_once
"Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
414 $pbar->setCurrent($a_rel);
416 $tpl->setCurrentBlock(
'relevance');
417 $tpl->setVariable(
'REL_PBAR', $pbar->render());
418 $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
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
__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.
foreach($_POST as $key=> $value) $res
getRelevanceHTML($a_rel)
Get relevance html.
static getSelectableColumnInfo($a_admin=false)
Get info of searchable fields for selectable columns in table gui.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
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
getSelectedColumns()
Get selected columns.
getType()
Get search context type.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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
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.
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.
setEnableTitle($a_enabletitle)
Set Enable Title.
static getProfileLink($a_usr_id)
Get link to personal profile Return empty string in case of not public profile.