ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMailSearchCoursesMembersTableGUI.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;
31  public function __construct($a_parent_obj, $type = 'crs')
32  {
33  global $lng,$ilCtrl, $ilUser, $lng, $rbacsystem;
34 
35  // check if current user may send mails
36  include_once "Services/Mail/classes/class.ilMail.php";
37  $mail = new ilMail($_SESSION["AccountId"]);
38  $this->mailing_allowed = $rbacsystem->checkAccess('mail_visible',$mail->getMailObjectReferenceId());
39 
40  parent::__construct($a_parent_obj, 'showMembers');
41  $lng->loadLanguageModule('crs');
42  $this->parentObject = $a_parent_obj;
43  $mode = array();
44  if ($type == 'crs')
45  {
46  $mode["checkbox"] = 'search_crs';
47  $mode["short"] = 'crs';
48  $mode["long"] = 'course';
49  $mode["lng_type"] = $lng->txt('course');
50  $mode["view"] = "crs_members";
51  $mode["tableprefix"] = "crstable_members";
52  }
53  else if ($type == 'grp')
54  {
55  $mode["checkbox"] = 'search_grp';
56  $mode["short"] = 'grp';
57  $mode["long"] = 'group';
58  $mode["lng_type"] = $lng->txt('group');
59  $mode["view"] = "grp_members";
60  $mode["tableprefix"] = "grptable_members";
61  }
62  $this->setTitle($lng->txt('members'));
63  $this->mode = $mode;
64  $ilCtrl->setParameter($a_parent_obj, 'view', $mode['view']);
65  if ($_GET['ref'] != '')
66  $ilCtrl->setParameter($a_parent_obj, 'ref', $_GET['ref']);
67  if (is_array($_POST[$mode["checkbox"]]))
68  $ilCtrl->setParameter($a_parent_obj, $mode["checkbox"], implode(',', $_POST[$mode["checkbox"]]));
69 
70  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
71  $ilCtrl->clearParameters($a_parent_obj);
72 
73  $this->setPrefix($mode['tableprefix']);
74  $this->setSelectAllCheckbox('search_members[]');
75  $this->setRowTemplate('tpl.mail_search_courses_members_row.html', 'Services/Contact');
76 
77  // setup columns
78  $this->addColumn('', '', '1%', true);
79  $this->addColumn($lng->txt('login'), 'USR_LOGIN', '22%');
80  $this->addColumn($lng->txt('name'), 'USR_NAME', '22%');
81  $this->addColumn($lng->txt($mode['long']), 'CRS_GRP', '22%');
82  $this->addColumn($lng->txt('mail_in_addressbook'), 'USR_IN_ADDRESSBOOK', '23%');
83  $this->addColumn($lng->txt('actions'), '', '10%');
84 
85  if ($this->mailing_allowed)
86  $this->addMultiCommand('mail', $lng->txt('mail_members'));
87  $this->addMultiCommand('adoptMembers', $lng->txt("mail_into_addressbook"));
88 
89  $this->addCommandButton('cancel', $lng->txt('cancel'));
90  }
91 
99  public function fillRow($a_set)
100  {
101  global $ilCtrl;
102  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
103  $current_selection_list = new ilAdvancedSelectionListGUI();
104  $current_selection_list->setListTitle($this->lng->txt("actions"));
105  $current_selection_list->setId("act_".$a_set['MEMBERS_ID']);
106 
107  $ilCtrl->setParameter($this->parentObject, 'search_members', $a_set['MEMBERS_ID']);
108  $ilCtrl->setParameter($this->parentObject, 'search_' . $this->mode['short'],
109  is_array($_REQUEST['search_' . $this->mode['short']]) ?
110  implode(',', $_REQUEST['search_' . $this->mode['short']]) :
111  $_REQUEST['search_' . $this->mode['short']]
112  );
113  $ilCtrl->setParameter($this->parentObject, 'view', $this->mode['view']);
114 
115  if ($this->mailing_allowed)
116  $current_selection_list->addItem($this->lng->txt("mail_members"), '', $ilCtrl->getLinkTarget($this->parentObject, "mail"));
117  $current_selection_list->addItem($this->lng->txt("mail_into_addressbook"), '', $ilCtrl->getLinkTarget($this->parentObject, "adoptMembers"));
118 
119  $this->tpl->setVariable(strtoupper('CURRENT_ACTION_LIST'), $current_selection_list->getHTML());
120 
121  foreach ($a_set as $key => $value)
122  {
123  $this->tpl->setVariable(strtoupper($key), $value);
124  }
125  }
126 }
127 ?>