ILIAS  Release_4_1_x_branch Revision 61804
 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 
31  public function __construct($a_parent_obj, $type='crs')
32  {
33  global $lng,$ilCtrl, $ilUser, $lng, $rbacsystem;
34  parent::__construct($a_parent_obj);
35  $lng->loadLanguageModule('crs');
36 
37  // check if current user may send mails
38  include_once "Services/Mail/classes/class.ilMail.php";
39  $mail = new ilMail($_SESSION["AccountId"]);
40  $this->mailing_allowed = $rbacsystem->checkAccess('mail_visible',$mail->getMailObjectReferenceId());
41 
42  $mode = array();
43 
44  if ($type == "crs")
45  {
46  $mode["short"] = "crs";
47  $mode["long"] = "course";
48  $mode["checkbox"] = "search_crs";
49  $mode["tableprefix"] = "crstable";
50  $mode["lng_mail"] = $lng->txt("mail_my_courses");
51  $mode["view"] = "mycourses";
52  $this->setTitle($mode["lng_mail"]);
53  }
54  else if ($type == "grp")
55  {
56  $mode["short"] = "grp";
57  $mode["long"] = "group";
58  $mode["checkbox"] = "search_grp";
59  $mode["tableprefix"] = "grptable";
60  $mode["lng_mail"] = $lng->txt("mail_my_groups");
61  $mode["view"] = "mygroups";
62  $this->setTitle($mode["lng_mail"]);
63  }
64 
65  //$this->courseIds = $crs_ids;
66  $this->parentObject = $a_parent_obj;
67  $this->mode = $mode;
68 
69  $ilCtrl->setParameter($a_parent_obj, 'view', $mode['view']);
70  if ($_GET['ref'] != '')
71  $ilCtrl->setParameter($a_parent_obj, 'ref', $_GET['ref']);
72  if (is_array($_POST[$mode["checkbox"]]))
73  $ilCtrl->setParameter($a_parent_obj, $mode["checkbox"], implode(',', $_POST[$mode["checkbox"]]));
74 
75  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
76  $ilCtrl->clearParameters($a_parent_obj);
77 
78  $this->setPrefix($mode['tableprefix']);
79  $this->setSelectAllCheckbox($mode["checkbox"].'[]');
80  $this->setRowTemplate('tpl.mail_search_courses_row.html', 'Services/Contact');
81 
82  // setup columns
83  $this->addColumn('', 'select', '1%', true);
84  $this->addColumn($mode["lng_mail"], 'CRS_NAME', '30%');
85  $this->addColumn($lng->txt('path'), 'CRS_PATH', '30%');
86  $this->addColumn($lng->txt('crs_count_members'), 'CRS_NO_MEMBERS', '20%');
87  $this->addColumn($lng->txt('actions'), '', '19%');
88 
89  if ($this->mailing_allowed)
90  $this->addMultiCommand('mail',$lng->txt('mail_members'));
91  $this->addMultiCommand('showMembers',$lng->txt('mail_list_members'));
92 
93  if ($_GET['ref'] == 'mail')
94  $this->addCommandButton('cancel', $lng->txt('cancel'));
95  }
96 
104  public function fillRow($a_set)
105  {
106  if ($a_set['hidden_members'])
107  {
108  $this->tpl->setCurrentBlock('caption_asterisk');
109  $this->tpl->touchBlock('caption_asterisk');
110  $this->tpl->parseCurrentBlock();
111  }
112  foreach ($a_set as $key => $value)
113  {
114  $this->tpl->setVariable(strtoupper($key), $value);
115  }
116  $this->tpl->setVariable('SHORT', $this->mode["short"]);
117  }
118 
119  public function numericOrdering($column)
120  {
121  if($column == 'CRS_NO_MEMBERS') return true;
122  }
123 }
124 ?>