4 require_once
'Services/Table/classes/class.ilTable2GUI.php';
5 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
6 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
58 public function __construct($a_parent_obj, $a_parent_cmd)
66 $this->ctrl = $DIC[
'ilCtrl'];
67 $this->container_tpl = $DIC[
'tpl'];
68 $this->
user = $DIC[
'ilUser'];
70 $this->
setId(
'buddy_system_tbl');
71 parent::__construct($a_parent_obj, $a_parent_cmd);
73 $this->lng->loadLanguageModule(
'buddysystem');
77 $chatSettings =
new ilSetting(
'chatroom');
78 $this->chat_enabled = $chatSettings->get(
"chat_enabled",
false);
83 $this->
setTitle($this->lng->txt(
'buddy_tbl_title_relations'));
85 if($this->access_to_mail_system || $this->chat_enabled)
89 if($this->access_to_mail_system)
93 if($this->chat_enabled)
95 $this->
addMultiCommand(
'inviteToChat', $this->lng->txt(
'invite_to_chat'));
99 $this->
addColumn($this->lng->txt(
'name'),
'public_name');
100 $this->
addColumn($this->lng->txt(
'login'),
'login');
103 $this->
setRowTemplate(
'tpl.buddy_system_relation_table_row.html',
'Services/Contact/BuddySystem');
104 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
117 $this->filters =
array();
118 $this->filter =
array();
120 require_once
'Services/Contact/BuddySystem/classes/states/class.ilBuddySystemRelationStateFactory.php';
122 require_once
'Services/Form/classes/class.ilSelectInputGUI.php';
123 $relations_state_selection =
new ilSelectInputGUI($this->lng->txt(
'buddy_tbl_filter_state'), self::STATE_FILTER_ELM_ID);
127 foreach($state as $key => $option)
129 $options[$key] = $option;
131 $relations_state_selection->
setOptions(
array(
'' => $this->lng->txt(
'please_choose')) + $options);
133 $relations_state_selection->readFromSession();
134 $this->filter[
'relation_state_type'] = $relations_state_selection->getValue();
136 require_once
'Services/Form/classes/class.ilTextInputGUI.php';
137 $public_name =
new ilTextInputGUI($this->lng->txt(
'name'),
'public_name');
139 $public_name->readFromSession();
140 $this->filter[
'public_name'] = $public_name->getValue();
155 $state_filter = $this->filter[self::STATE_FILTER_ELM_ID];
157 return !strlen($state_filter) || strtolower(get_class($relation->
getState())) == strtolower($state_filter);
160 require_once
'Services/User/classes/class.ilUserUtil.php';
164 $logins = array_map(
function($value) {
166 preg_match_all(
'/\[([^\[]+?)\]/', $value, $matches);
168 is_array($matches) &&
169 isset($matches[1]) &&
170 is_array($matches[1]) &&
171 isset($matches[1][count($matches[1]) - 1])
172 ) ? $matches[1][count($matches[1]) - 1] :
'';
175 $public_name = $this->filter[
'public_name'];
176 $relations = $relations->filter(
function(
ilBuddySystemRelation $relation) use ($public_name, $relations, $public_names, $logins) {
178 !strlen($public_name) ||
179 strpos(strtolower($public_names[$relations->getKey($relation)]), strtolower($public_name)) !==
false ||
180 strpos(strtolower($logins[$relations->getKey($relation)]), strtolower($public_name)) !==
false 184 foreach($relations->toArray() as $usr_id => $relation)
188 'public_name' => $public_names[$usr_id],
189 'login' => $logins[$usr_id]
203 if($this->access_to_mail_system)
209 if(!$this->
user->isAnonymous() && $public_profile ==
'y' || $public_profile ==
'g')
211 $this->ctrl->setParameterByClass(
'ilpublicuserprofilegui',
'user', $a_set[
'usr_id']);
212 $profile_target = $this->ctrl->getLinkTargetByClass(
'ilpublicuserprofilegui',
'getHTML');
213 $a_set[
'profile_link'] = $profile_target;
214 $a_set[
'linked_public_name'] = $a_set[
'public_name'];
216 $a_set[
'profile_link_login'] = $profile_target;
217 $a_set[
'linked_login'] = $a_set[
'login'];
221 $a_set[
'unlinked_public_name'] = $a_set[
'public_name'];
222 $a_set[
'unlinked_login'] = $a_set[
'login'];
226 parent::fillRow($a_set);
234 $listener_tpl =
new ilTemplate(
'tpl.buddy_system_relation_table_listener.html',
true,
true,
'Services/Contact/BuddySystem');
235 $listener_tpl->setVariable(
'TABLE_ID', $this->
getId());
236 $listener_tpl->setVariable(
'FILTER_ELM_ID', self::STATE_FILTER_ELM_ID);
239 return parent::render() . $listener_tpl->get();
setExternalSorting($a_val)
Set external sorting.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
static getInstanceByGlobalUser()
setExternalSegmentation($a_val)
Set external segmentation.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false)
Default behaviour is:
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
if(!is_array($argv)) $options
special template class to simplify handling of ITX/PEAR
addMultiCommand($a_cmd, $a_text)
Add Command button.
fillRow($a_set)
Standard Version of Fill Row.
This class represents a text property in a property form.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
getNoEntriesText()
Get text for an empty table.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
Class ilBuddySystemRelation.
static _lookupPref($a_usr_id, $a_keyword)
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable...
const STATE_FILTER_ELM_ID
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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 formCheckbox($checked, $varname, $value, $disabled=false)
??? public
setFilterCommand($a_val, $a_caption=null)
Set filter command.