ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
64  // check if current user may send mails
65  include_once "Services/Mail/classes/class.ilMail.php";
66  $mail = new ilMail($this->user->getId());
67  $this->mailing_allowed = $this->rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
68  }
69 
70  $mode = array();
71 
72  if ($type == "crs")
73  {
74  $mode["short"] = "crs";
75  $mode["long"] = "course";
76  $mode["checkbox"] = "search_crs";
77  $mode["tableprefix"] = "crstable";
78  $mode["lng_mail"] = $this->lng->txt("mail_my_courses");
79  $mode["view"] = "mycourses";
80  $this->setTitle($mode["lng_mail"]);
81  }
82  else if ($type == "grp")
83  {
84  $mode["short"] = "grp";
85  $mode["long"] = "group";
86  $mode["checkbox"] = "search_grp";
87  $mode["tableprefix"] = "grptable";
88  $mode["lng_mail"] = $this->lng->txt("mail_my_groups");
89  $mode["view"] = "mygroups";
90  $this->setTitle($mode["lng_mail"]);
91  }
92 
93  $this->setId('search_' . $mode["short"]);
94  parent::__construct($a_parent_obj);
95 
96  //$this->courseIds = $crs_ids;
97  $this->parentObject = $a_parent_obj;
98  $this->mode = $mode;
99  $this->context = $context;
100 
101  $this->ctrl->setParameter($a_parent_obj, 'view', $mode['view']);
102  if ($_GET['ref'] != '')
103  $this->ctrl->setParameter($a_parent_obj, 'ref', $_GET['ref']);
104  if (is_array($_POST[$mode["checkbox"]]))
105  $this->ctrl->setParameter($a_parent_obj, $mode["checkbox"], implode(',', $_POST[$mode["checkbox"]]));
106 
107  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
108  $this->ctrl->clearParameters($a_parent_obj);
109 
110  $this->setSelectAllCheckbox($mode["checkbox"].'[]');
111  $this->setRowTemplate('tpl.mail_search_courses_row.html', 'Services/Contact');
112 
113  $this->setShowRowsSelector(true);
114 
115  // setup columns
116  $this->addColumn('', '', '1px', true);
117  $this->addColumn($mode["lng_mail"], 'CRS_NAME', '30%');
118  $this->addColumn($this->lng->txt('path'), 'CRS_PATH', '30%');
119  $this->addColumn($this->lng->txt('crs_count_members'), 'CRS_NO_MEMBERS', '20%');
120  $this->addColumn($this->lng->txt('actions'), '', '19%');
121 
122  if($context == "mail")
123  {
124  if ($this->mailing_allowed)
125  $this->addMultiCommand('mail',$this->lng->txt('mail_members'));
126  }
127  else if($context == "wsp")
128  {
129  $this->lng->loadLanguageModule("wsp");
130  $this->addMultiCommand('share',$this->lng->txt('wsp_share_with_members'));
131  }
132  $this->addMultiCommand('showMembers',$this->lng->txt('mail_list_members'));
133 
134  if ($_GET['ref'] == 'mail')
135  $this->addCommandButton('cancel', $this->lng->txt('cancel'));
136  }
137 
145  public function fillRow($a_set)
146  {
147  if ($a_set['hidden_members'])
148  {
149  $this->tpl->setCurrentBlock('caption_asterisk');
150  $this->tpl->touchBlock('caption_asterisk');
151  $this->tpl->parseCurrentBlock();
152  }
153  foreach ($a_set as $key => $value)
154  {
155  $this->tpl->setVariable(strtoupper($key), $value);
156  }
157  $this->tpl->setVariable('SHORT', $this->mode["short"]);
158  }
159 
160  public function numericOrdering($column)
161  {
162  if($column == 'CRS_NO_MEMBERS') return true;
163  }
164 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
$_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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
global $DIC
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.
$_POST["username"]