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)
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) {
49 $this->
setRowTemplate(
"tpl.rep_search_usr_result_row.html",
"Services/Search");
51 $this->
enable(
'select_all');
56 $this->
setRowTemplate(
"tpl.global_search_usr_result_row.html",
"Services/Search");
62 $this->
addColumn($all_cols[$col][
'txt'], $col);
65 if ($this->
getType() == self::TYPE_STANDARD) {
67 $this->
addColumn($this->lng->txt(
'lucene_relevance_short'),
'relevance');
83 if ($a_field ==
'relevance') {
86 return parent::numericOrdering($a_field);
105 $this->lucene_result =
$res;
124 $this->user_limitations = (bool) $a_limitations;
147 if (!self::$all_selectable_cols) {
148 include_once
'./Services/Search/classes/class.ilUserSearchOptions.php';
151 if ($this->admin_mode) {
153 $columns[
'access_until'] =
array(
'txt' => $this->lng->txt(
'access_until'));
154 $columns[
'last_login'] =
array(
'txt' => $this->lng->txt(
'last_login'));
157 self::$all_selectable_cols =
$columns;
159 return self::$all_selectable_cols;
168 if (!count($a_commands)) {
179 protected function fillRow($a_set)
186 $this->tpl->setVariable(
"VAL_ID", $a_set[
"usr_id"]);
189 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
190 include_once
'./Services/User/classes/class.ilUserUtil.php';
193 $this->tpl->setVariable(
'IMG_LINKED_TO_PROFILE', $link);
194 $this->tpl->setVariable(
195 'USR_IMG_SRC_LINKED',
196 ilObjUser::_getPersonalPicturePath($a_set[
'usr_id'],
'xsmall')
199 $this->tpl->setVariable(
201 ilObjUser::_getPersonalPicturePath($a_set[
'usr_id'],
'xsmall')
210 $a_set[
'gender'] = $a_set[
'gender'] ? $this->lng->txt(
'gender_' . $a_set[
'gender']) :
'';
211 $this->tpl->setCurrentBlock(
'custom_fields');
212 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
213 $this->tpl->parseCurrentBlock();
218 $this->tpl->setCurrentBlock(
'custom_fields');
219 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
220 $this->tpl->parseCurrentBlock();
224 $this->tpl->setCurrentBlock(
'custom_fields');
225 $this->tpl->setVariable(
'CUST_CLASS',
' ' . $a_set[
'access_class']);
226 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
227 $this->tpl->parseCurrentBlock();
232 $this->tpl->setCurrentBlock(
'custom_fields');
233 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
234 $this->tpl->parseCurrentBlock();
237 case 'interests_general':
238 case 'interests_help_offered':
239 case 'interests_help_looking':
240 $this->tpl->setCurrentBlock(
'custom_fields');
241 $this->tpl->setVariable(
'VAL_CUST', implode(
', ', (
array) $a_set[$field]));
242 $this->tpl->parseCurrentBlock();
246 $this->tpl->setCurrentBlock(
'custom_fields');
247 include_once
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php';
248 $this->tpl->setVariable(
'VAL_CUST', (
string) ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_set[
'usr_id']));
249 $this->tpl->parseCurrentBlock();
254 if ($this->admin_mode) {
255 $ilCtrl->setParameterByClass(
"ilobjusergui",
"ref_id",
"7");
256 $ilCtrl->setParameterByClass(
"ilobjusergui",
"obj_id", $a_set[
"usr_id"]);
257 $ilCtrl->setParameterByClass(
"ilobjusergui",
"search",
"1");
258 $link = $ilCtrl->getLinkTargetByClass(
array(
"iladministrationgui",
"ilobjusergui"),
"view");
259 $a_set[$field] =
"<a href=\"" . $link .
"\">" . $a_set[$field] .
"</a>";
260 } elseif ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
261 $a_set[$field] =
"<a href=\"" . $link .
"\">" . $a_set[$field] .
"</a>";
267 $this->tpl->setCurrentBlock(
'custom_fields');
268 $this->tpl->setVariable(
'VAL_CUST', (
string) ($a_set[$field] ? $a_set[$field] :
''));
269 $this->tpl->parseCurrentBlock();
274 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
275 $this->tpl->setVariable(
'SEARCH_RELEVANCE', $this->
getRelevanceHTML($a_set[
'relevance']));
277 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
280 $this->tpl->setVariable(
'CONTACT_ACTIONS',
'');
299 $parse_access =
false;
300 if (isset($additional_fields[
'access_until'])) {
301 $parse_access =
true;
302 unset($additional_fields[
'access_until']);
305 $udf_ids = $usr_data_fields = $odf_ids =
array();
306 foreach ($additional_fields as $field) {
307 if ($field ==
'org_units') {
310 if (substr($field, 0, 3) ==
'udf') {
311 $udf_ids[] = substr($field, 4);
314 $usr_data_fields[] = $field;
316 include_once
'./Services/User/classes/class.ilUserQuery.php';
319 $u_query->setOrderField(
'login');
320 $u_query->setOrderDirection(
'ASC');
321 $u_query->setLimit(999999);
322 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
325 $u_query->setActionFilter(
"active");
329 $u_query->setAccessFilter(
true);
332 $u_query->setAdditionalFields($usr_data_fields);
333 $u_query->setUserFilter($a_user_ids);
335 $usr_data = $u_query->query();
338 if ($this->admin_mode && $parse_access) {
340 $current_time =
time();
341 foreach ($usr_data[
'set'] as $k => $user) {
342 if ($user[
'active']) {
343 if ($user[
"time_limit_unlimited"]) {
344 $txt_access = $this->lng->txt(
"access_unlimited");
345 $usr_data[
"set"][$k][
"access_class"] =
"smallgreen";
346 } elseif ($user[
"time_limit_until"] < $current_time) {
347 $txt_access = $this->lng->txt(
"access_expired");
348 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
351 $usr_data[
"set"][$k][
"access_class"] =
"small";
354 $txt_access = $this->lng->txt(
"inactive");
355 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
357 $usr_data[
"set"][$k][
"access_until"] = $txt_access;
363 include_once
'./Services/User/classes/class.ilUserDefinedData.php';
368 foreach ($usr_data[
'set'] as $set) {
370 foreach ($udf_ids as $udf_field) {
376 $users = $usr_data[
'set'];
379 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
398 $tpl =
new ilTemplate(
'tpl.lucene_relevance.html',
true,
true,
'Services/Search');
400 include_once
"Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
402 $pbar->setCurrent($a_rel);
404 $tpl->setCurrentBlock(
'relevance');
405 $tpl->setVariable(
'REL_PBAR', $pbar->render());
406 $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 formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
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.
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.
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.
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
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.
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.
static getProfileLink($a_usr_id)
Get link to personal profile Return empty string in case of not public profile.