ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMailSearchCoursesTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 include_once('Services/Table/classes/class.ilTable2GUI.php');
13 
14 
16 {
20  protected $lng;
21 
25  protected $ctrl;
26 
30  protected $user;
31 
35  protected $rbacsystem;
36 
37  protected $parentObject;
38  protected $mode;
39  protected $mailing_allowed;
40 
50  public function __construct($a_parent_obj, $type='crs', $context='mail')
51  {
52  global $DIC;
53 
54  $this->lng = $DIC['lng'];
55  $this->ctrl = $DIC['ilCtrl'];
56  $this->user = $DIC['ilUser'];
57  $this->rbacsystem = $DIC['rbacsystem'];
58 
59  $this->lng->loadLanguageModule('crs');
60  $this->lng->loadLanguageModule('buddysystem');
61 
62  if ($context == "mail") {
63  // check if current user may send mails
64  include_once "Services/Mail/classes/class.ilMail.php";
65  $mail = new ilMail($this->user->getId());
66  $this->mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
67  }
68 
69  $mode = array();
70 
71  if ($type == "crs") {
72  $mode["short"] = "crs";
73  $mode["long"] = "course";
74  $mode["checkbox"] = "search_crs";
75  $mode["tableprefix"] = "crstable";
76  $mode["lng_mail"] = $this->lng->txt("mail_my_courses");
77  $mode["view"] = "mycourses";
78  $this->setTitle($mode["lng_mail"]);
79  } elseif ($type == "grp") {
80  $mode["short"] = "grp";
81  $mode["long"] = "group";
82  $mode["checkbox"] = "search_grp";
83  $mode["tableprefix"] = "grptable";
84  $mode["lng_mail"] = $this->lng->txt("mail_my_groups");
85  $mode["view"] = "mygroups";
86  $this->setTitle($mode["lng_mail"]);
87  }
88 
89  $this->setId('search_' . $mode["short"]);
90  parent::__construct($a_parent_obj);
91 
92  //$this->courseIds = $crs_ids;
93  $this->parentObject = $a_parent_obj;
94  $this->mode = $mode;
95  $this->context = $context;
96 
97  $this->ctrl->setParameter($a_parent_obj, 'view', $mode['view']);
98  if ($_GET['ref'] != '') {
99  $this->ctrl->setParameter($a_parent_obj, 'ref', $_GET['ref']);
100  }
101  if (is_array($_POST[$mode["checkbox"]])) {
102  $this->ctrl->setParameter($a_parent_obj, $mode["checkbox"], implode(',', $_POST[$mode["checkbox"]]));
103  }
104 
105  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
106  $this->ctrl->clearParameters($a_parent_obj);
107 
108  $this->setSelectAllCheckbox($mode["checkbox"] . '[]');
109  $this->setRowTemplate('tpl.mail_search_courses_row.html', 'Services/Contact');
110 
111  $this->setShowRowsSelector(true);
112 
113  // setup columns
114  $this->addColumn('', '', '1px', true);
115  $this->addColumn($mode["lng_mail"], 'CRS_NAME', '30%');
116  $this->addColumn($this->lng->txt('path'), 'CRS_PATH', '30%');
117  $this->addColumn($this->lng->txt('crs_count_members'), 'CRS_NO_MEMBERS', '20%');
118  $this->addColumn($this->lng->txt('actions'), '', '19%');
119 
120  if ($context == "mail") {
121  if ($this->mailing_allowed) {
122  $this->addMultiCommand('mail', $this->lng->txt('mail_members'));
123  }
124  } elseif ($context == "wsp") {
125  $this->lng->loadLanguageModule("wsp");
126  $this->addMultiCommand('share', $this->lng->txt('wsp_share_with_members'));
127  }
128  $this->addMultiCommand('showMembers', $this->lng->txt('mail_list_members'));
129 
130  if ($_GET['ref'] == 'mail') {
131  $this->addCommandButton('cancel', $this->lng->txt('cancel'));
132  }
133  }
134 
142  public function fillRow($a_set)
143  {
144  if ($a_set['hidden_members']) {
145  $this->tpl->setCurrentBlock('caption_asterisk');
146  $this->tpl->touchBlock('caption_asterisk');
147  $this->tpl->parseCurrentBlock();
148  }
149  foreach ($a_set as $key => $value) {
150  $this->tpl->setVariable(strtoupper($key), $value);
151  }
152  $this->tpl->setVariable('SHORT', $this->mode["short"]);
153  }
154 
155  public function numericOrdering($column)
156  {
157  if ($column == 'CRS_NO_MEMBERS') {
158  return true;
159  }
160  }
161 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
$type
global $DIC
Definition: saml.php:7
$_GET["client_id"]
setId($a_val)
Set id.
user()
Definition: user.php:4
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
$column
Definition: 39dropdown.php:62
This class handles base functions for mail handling.
__construct($a_parent_obj, $type='crs', $context='mail')
Constructor.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
$key
Definition: croninfo.php:18
$_POST["username"]