ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilMailSearchCoursesMembersTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Table/classes/class.ilTable2GUI.php';
5require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
6require_once 'Services/Utilities/classes/class.ilStr.php';
7require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
8
18{
22 protected $lng;
23
27 protected $ctrl;
28
32 protected $user;
33
34 protected $mode;
45 public function __construct($a_parent_obj, $type = 'crs', $context = 'mail', $contextObjects)
46 {
47 global $DIC;
48
49 $this->ctrl = $DIC['ilCtrl'];
50 $this->lng = $DIC['lng'];
51 $this->user = $DIC['ilUser'];
52
53 $tableId = $type . '_cml_' . implode('_', (array) $contextObjects);
54 $this->setId($tableId);
55 parent::__construct($a_parent_obj, 'showMembers');
56
57 $this->context = $context;
58 if ($this->context == 'mail') {
59 // check if current user may send mails
60 include_once "Services/Mail/classes/class.ilMail.php";
61 $mail = new ilMail($GLOBALS['DIC']['ilUser']->getId());
62 $this->mailing_allowed = $DIC->rbac()->system()->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
63 }
64
65 $this->setDefaultOrderDirection('ASC');
66 $this->setDefaultOrderField('members_login');
67
68 $this->lng->loadLanguageModule('crs');
69 $this->lng->loadLanguageModule('buddysystem');
70
71 $mode = array();
72 if ($type == 'crs') {
73 $mode["checkbox"] = 'search_crs';
74 $mode["short"] = 'crs';
75 $mode["long"] = 'course';
76 $mode["lng_type"] = $this->lng->txt('course');
77 $mode["view"] = "crs_members";
78 } elseif ($type == 'grp') {
79 $mode["checkbox"] = 'search_grp';
80 $mode["short"] = 'grp';
81 $mode["long"] = 'group';
82 $mode["lng_type"] = $this->lng->txt('group');
83 $mode["view"] = "grp_members";
84 }
85 $this->setTitle($this->lng->txt('members'));
86 $this->mode = $mode;
87 $this->ctrl->setParameter($a_parent_obj, 'view', $mode['view']);
88 if ($_GET['ref'] != '') {
89 $this->ctrl->setParameter($a_parent_obj, 'ref', $_GET['ref']);
90 }
91 if (is_array($_POST[$mode["checkbox"]])) {
92 $this->ctrl->setParameter($a_parent_obj, $mode["checkbox"], implode(',', $_POST[$mode["checkbox"]]));
93 }
94
95 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
96 //$this->ctrl->clearParameters($a_parent_obj);
97
98 $this->setRowTemplate('tpl.mail_search_courses_members_row.html', 'Services/Contact');
99
100 // setup columns
101 $this->addColumn('', '', '1%', true);
102 $this->addColumn($this->lng->txt('login'), 'members_login', '22%');
103 $this->addColumn($this->lng->txt('name'), 'members_name', '22%');
104 $this->addColumn($this->lng->txt($mode['long']), 'members_crs_grp', '22%');
105 if (ilBuddySystem::getInstance()->isEnabled()) {
106 $this->addColumn($this->lng->txt('buddy_tbl_filter_state'), 'status', '23%');
107 }
108 $this->addColumn($this->lng->txt('actions'), '', '10%');
109
110 if ($this->context == "mail") {
111 if ($this->mailing_allowed) {
112 $this->setSelectAllCheckbox('search_members[]');
113 $this->addMultiCommand('mail', $this->lng->txt('mail_members'));
114 }
115 } else {
116 $this->setSelectAllCheckbox('search_members[]');
117 $this->lng->loadLanguageModule("wsp");
118 $this->addMultiCommand('share', $this->lng->txt("wsp_share_with_members"));
119 }
120 $this->lng->loadLanguageModule('buddysystem');
121 $this->addCommandButton('cancel', $this->lng->txt('cancel'));
122 }
123
131 public function fillRow($a_set)
132 {
133 require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
134 $current_selection_list = new ilAdvancedSelectionListGUI();
135 $current_selection_list->setListTitle($this->lng->txt("actions"));
136 $current_selection_list->setId("act_" . md5($a_set['members_id'] . '::' . $a_set['search_' . $this->mode['short']]));
137
138 $this->ctrl->setParameter($this->parent_obj, 'search_members', $a_set['members_id']);
139 $this->ctrl->setParameter(
140 $this->parent_obj,
141 'search_' . $this->mode['short'],
142 is_array($_REQUEST['search_' . $this->mode['short']]) ?
143 implode(',', array_filter(array_map('intval', $_REQUEST['search_' . $this->mode['short']]))) :
144 ilUtil::stripSlashes($_REQUEST['search_' . $this->mode['short']])
145 );
146 $this->ctrl->setParameter($this->parent_obj, 'view', $this->mode['view']);
147
148 $action_html = '';
149 if ($this->context == "mail") {
150 if ($this->mailing_allowed) {
151 $current_selection_list->addItem($this->lng->txt("mail_member"), '', $this->ctrl->getLinkTarget($this->parent_obj, "mail"));
152 }
153 } else {
154 $current_selection_list->addItem($this->lng->txt("wsp_share_with_members"), '', $this->ctrl->getLinkTarget($this->parent_obj, "share"));
155 }
156
157 if ($this->context == 'mail' && ilBuddySystem::getInstance()->isEnabled()) {
158 $relation = ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId($a_set['members_id']);
159 if (
160 $a_set['members_id'] != $this->user->getId() &&
161 $relation->isUnlinked() &&
162 ilUtil::yn2tf(ilObjUser::_lookupPref($a_set['members_id'], 'bs_allow_to_contact_me'))
163 ) {
164 $this->ctrl->setParameterByClass('ilBuddySystemGUI', 'user_id', $a_set['members_id']);
165 $current_selection_list->addItem($this->lng->txt('buddy_bs_btn_txt_unlinked_a'), '', $this->ctrl->getLinkTargetByClass('ilBuddySystemGUI', 'request'));
166 }
167 }
168
169 if ($current_selection_list->getItems()) {
170 $action_html = $current_selection_list->getHTML();
171 }
172 $this->tpl->setVariable(strtoupper('CURRENT_ACTION_LIST'), $action_html);
173
174 foreach ($a_set as $key => $value) {
175 $this->tpl->setVariable(strtoupper($key), $value);
176 }
177 }
178}
user()
Definition: user.php:4
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static getInstanceByGlobalUser()
__construct($a_parent_obj, $type='crs', $context='mail', $contextObjects)
Constructor.
static _lookupPref($a_usr_id, $a_keyword)
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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.
getId()
Get element id.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static yn2tf($a_yn)
convert "y"/"n" to true/false
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type