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