ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 {
17  protected $lng = null;
18  protected $ctrl;
19  protected $parentObject;
20  protected $mode;
21  protected $mailing_allowed;
22 
32  public function __construct($a_parent_obj, $type='crs', $context='mail')
33  {
34  global $lng,$ilCtrl, $ilUser, $lng, $rbacsystem;
35 
36  parent::__construct($a_parent_obj);
37  $lng->loadLanguageModule('crs');
38 
39  if($context == "mail")
40  {
41  // check if current user may send mails
42  include_once "Services/Mail/classes/class.ilMail.php";
43  $mail = new ilMail($_SESSION["AccountId"]);
44  $this->mailing_allowed = $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
45  }
46 
47  $mode = array();
48 
49  if ($type == "crs")
50  {
51  $mode["short"] = "crs";
52  $mode["long"] = "course";
53  $mode["checkbox"] = "search_crs";
54  $mode["tableprefix"] = "crstable";
55  $mode["lng_mail"] = $lng->txt("mail_my_courses");
56  $mode["view"] = "mycourses";
57  $this->setTitle($mode["lng_mail"]);
58  }
59  else if ($type == "grp")
60  {
61  $mode["short"] = "grp";
62  $mode["long"] = "group";
63  $mode["checkbox"] = "search_grp";
64  $mode["tableprefix"] = "grptable";
65  $mode["lng_mail"] = $lng->txt("mail_my_groups");
66  $mode["view"] = "mygroups";
67  $this->setTitle($mode["lng_mail"]);
68  }
69 
70  //$this->courseIds = $crs_ids;
71  $this->parentObject = $a_parent_obj;
72  $this->mode = $mode;
73  $this->context = $context;
74 
75  $ilCtrl->setParameter($a_parent_obj, 'view', $mode['view']);
76  if ($_GET['ref'] != '')
77  $ilCtrl->setParameter($a_parent_obj, 'ref', $_GET['ref']);
78  if (is_array($_POST[$mode["checkbox"]]))
79  $ilCtrl->setParameter($a_parent_obj, $mode["checkbox"], implode(',', $_POST[$mode["checkbox"]]));
80 
81  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
82  $ilCtrl->clearParameters($a_parent_obj);
83 
84  $this->setPrefix($mode['tableprefix']);
85  $this->setSelectAllCheckbox($mode["checkbox"].'[]');
86  $this->setRowTemplate('tpl.mail_search_courses_row.html', 'Services/Contact');
87 
88  // setup columns
89  $this->addColumn('', '', '1px', true);
90  $this->addColumn($mode["lng_mail"], 'CRS_NAME', '30%');
91  $this->addColumn($lng->txt('path'), 'CRS_PATH', '30%');
92  $this->addColumn($lng->txt('crs_count_members'), 'CRS_NO_MEMBERS', '20%');
93  $this->addColumn($lng->txt('actions'), '', '19%');
94 
95  if($context == "mail")
96  {
97  if ($this->mailing_allowed)
98  $this->addMultiCommand('mail',$lng->txt('mail_members'));
99  }
100  else if($context == "wsp")
101  {
102  $lng->loadLanguageModule("wsp");
103  $this->addMultiCommand('share',$lng->txt('wsp_share_with_members'));
104  }
105  $this->addMultiCommand('showMembers',$lng->txt('mail_list_members'));
106 
107  if ($_GET['ref'] == 'mail')
108  $this->addCommandButton('cancel', $lng->txt('cancel'));
109  }
110 
118  public function fillRow($a_set)
119  {
120  if ($a_set['hidden_members'])
121  {
122  $this->tpl->setCurrentBlock('caption_asterisk');
123  $this->tpl->touchBlock('caption_asterisk');
124  $this->tpl->parseCurrentBlock();
125  }
126  foreach ($a_set as $key => $value)
127  {
128  $this->tpl->setVariable(strtoupper($key), $value);
129  }
130  $this->tpl->setVariable('SHORT', $this->mode["short"]);
131  }
132 
133  public function numericOrdering($column)
134  {
135  if($column == 'CRS_NO_MEMBERS') return true;
136  }
137 }
138 ?>