ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
19 protected $lng = null;
20 protected $ctrl;
21 protected $parentObject;
22 protected $mode;
33 public function __construct($a_parent_obj, $type = 'crs', $context = 'mail')
34 {
35 global $lng,$ilCtrl, $ilUser, $lng, $rbacsystem;
36
37 $this->setId($type. 'table_members');
38 parent::__construct($a_parent_obj, 'showMembers');
39
40 $this->context = $context;
41 if($this->context == 'mail')
42 {
43 // check if current user may send mails
44 include_once "Services/Mail/classes/class.ilMail.php";
45 $mail = new ilMail($_SESSION["AccountId"]);
46 $this->mailing_allowed = $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
47 }
48
49 $lng->loadLanguageModule('crs');
50 $this->parentObject = $a_parent_obj;
51 $mode = array();
52 if ($type == 'crs')
53 {
54 $mode["checkbox"] = 'search_crs';
55 $mode["short"] = 'crs';
56 $mode["long"] = 'course';
57 $mode["lng_type"] = $lng->txt('course');
58 $mode["view"] = "crs_members";
59 }
60 else if ($type == 'grp')
61 {
62 $mode["checkbox"] = 'search_grp';
63 $mode["short"] = 'grp';
64 $mode["long"] = 'group';
65 $mode["lng_type"] = $lng->txt('group');
66 $mode["view"] = "grp_members";
67 }
68 $this->setTitle($lng->txt('members'));
69 $this->mode = $mode;
70 $ilCtrl->setParameter($a_parent_obj, 'view', $mode['view']);
71 if ($_GET['ref'] != '')
72 $ilCtrl->setParameter($a_parent_obj, 'ref', $_GET['ref']);
73 if (is_array($_POST[$mode["checkbox"]]))
74 $ilCtrl->setParameter($a_parent_obj, $mode["checkbox"], implode(',', $_POST[$mode["checkbox"]]));
75
76 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
77 $ilCtrl->clearParameters($a_parent_obj);
78
79 $this->setRowTemplate('tpl.mail_search_courses_members_row.html', 'Services/Contact');
80
81 // setup columns
82 $this->addColumn('', '', '1%', true);
83 $this->addColumn($lng->txt('login'), 'members_login', '22%');
84 $this->addColumn($lng->txt('name'), 'members_name', '22%');
85 $this->addColumn($lng->txt($mode['long']), 'members_crs_grp', '22%');
86 if(ilBuddySystem::getInstance()->isEnabled())
87 {
88 $this->addColumn($lng->txt('buddy_tbl_filter_state'), 'status', '23%');
89 }
90 $this->addColumn($lng->txt('actions'), '', '10%');
91
92 if($this->context == "mail")
93 {
94 if($this->mailing_allowed)
95 {
96 $this->setSelectAllCheckbox('search_members[]');
97 $this->addMultiCommand('mail', $lng->txt('mail_members'));
98 }
99 }
100 else
101 {
102 $this->setSelectAllCheckbox('search_members[]');
103 $lng->loadLanguageModule("wsp");
104 $this->addMultiCommand('share', $lng->txt("wsp_share_with_members"));
105 }
106 $lng->loadLanguageModule('buddysystem');
107
108 $this->addCommandButton('cancel', $lng->txt('cancel'));
109 }
110
118 public function fillRow($a_set)
119 {
124 global $ilCtrl, $ilUser;
125
126 require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
127 $current_selection_list = new ilAdvancedSelectionListGUI();
128 $current_selection_list->setListTitle($this->lng->txt("actions"));
129 $current_selection_list->setId("act_".md5($a_set['members_id'].'::'.$a_set['search_' . $this->mode['short']]));
130
131 $ilCtrl->setParameter($this->parentObject, 'search_members', $a_set['members_id']);
132 $ilCtrl->setParameter($this->parentObject, 'search_' . $this->mode['short'],
133 is_array($_REQUEST['search_' . $this->mode['short']]) ?
134 implode(',', array_filter(array_map('intval', $_REQUEST['search_' . $this->mode['short']]))) :
135 (int)$_REQUEST['search_' . $this->mode['short']]
136 );
137 $ilCtrl->setParameter($this->parentObject, 'view', $this->mode['view']);
138
139 $action_html = '';
140 if($this->context == "mail")
141 {
142 if($this->mailing_allowed)
143 {
144 $current_selection_list->addItem($this->lng->txt("mail_member"), '', $ilCtrl->getLinkTarget($this->parentObject, "mail"));
145 }
146 }
147 else
148 {
149 $current_selection_list->addItem($this->lng->txt("wsp_share_with_members"), '', $ilCtrl->getLinkTarget($this->parentObject, "share"));
150 }
151
152 if($this->context == 'mail' && ilBuddySystem::getInstance()->isEnabled())
153 {
154 $relation = ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId($a_set['members_id']);
155 if(
156 $a_set['members_id'] != $ilUser->getId() &&
157 $relation->isUnlinked() &&
158 ilUtil::yn2tf(ilObjUser::_lookupPref($a_set['members_id'], 'bs_allow_to_contact_me'))
159 )
160 {
161 $ilCtrl->setParameterByClass('ilBuddySystemGUI', 'user_id', $a_set['members_id']);
162 $current_selection_list->addItem($this->lng->txt('buddy_bs_btn_txt_unlinked_a'), '', $ilCtrl->getLinkTargetByClass('ilBuddySystemGUI', 'request'));
163 }
164 }
165
166 if($current_selection_list->getItems())
167 {
168 $action_html = $current_selection_list->getHTML();
169 }
170 $this->tpl->setVariable(strtoupper('CURRENT_ACTION_LIST'), $action_html);
171
172 foreach($a_set as $key => $value)
173 {
174 $this->tpl->setVariable(strtoupper($key), $value);
175 }
176 }
177}
$_GET["client_id"]
$_SESSION["AccountId"]
User interface class for advanced drop-down selection lists.
__construct($a_parent_obj, $type='crs', $context='mail')
Constructor.
Class Mail this class handles base functions for mail handling.
_lookupPref($a_usr_id, $a_keyword)
Class ilTable2GUI.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
fillRow($a_set)
Standard Version of Fill Row.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static yn2tf($a_yn)
convert "y"/"n" to true/false
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15