ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPDFeedbackBlockGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("Services/Block/classes/class.ilBlockGUI.php");
25 
35 {
36  static $block_type = "pdfeedb";
41  {
42  global $ilCtrl, $lng, $ilUser;
43 
45 
46  $this->setLimit(5);
47  $this->setImage(ilUtil::getImagePath("icon_feedb_s.gif"));
48  $this->setTitle($lng->txt("pdesk_feedback_request"));
49  $this->setAvailableDetailLevels(2, 1);
50  $this->allow_moving = false;
51  }
52 
58  static function getBlockType()
59  {
60  return self::$block_type;
61  }
62 
68  static function isRepositoryObject()
69  {
70  return false;
71  }
72 
76  static function getScreenMode()
77  {
78  switch($_GET["cmd"])
79  {
80  default:
81  return IL_SCREEN_SIDE;
82  break;
83  }
84  }
85 
89  function &executeCommand()
90  {
91  global $ilCtrl;
92 
93  $next_class = $ilCtrl->getNextClass();
94  $cmd = $ilCtrl->getCmd("getHTML");
95 
96  return $this->$cmd();
97  }
98 
99  function getHTML()
100  {
101  $html = parent::getHTML();
102  if (count($this->feedbacks) == 0)
103  {
104  return "";
105  }
106  else
107  {
108  return $html;
109  }
110  }
111 
115  function fillDataSection()
116  {
117  global $ilAccess, $ilUser,$tree;
118 
119  include_once('Services/Feedback/classes/class.ilFeedback.php');
120  $feedback = new ilFeedback();
121  $feedbacks = $feedback->getAllBarometer(0);
122  $this->feedbacks = array();
123  foreach($feedbacks as $feedback)
124  {
125  if($tree->isDeleted($feedback->getRefId()))
126  {
127  continue;
128  }
129 
130  // do not show feedback for tutors/admins
131  if (!$ilAccess->checkAccess("write", "", $feedback->getRefId())
132  && $feedback->canVote($ilUser->getId(), $feedback->getId()) == 1
133  && !$feedback->getAnonymous())
134  {
135  $this->feedbacks[] = array (
136  "id" => $feedback->getId(),
137  "title" => $feedback->getTitle()
138  );
139  }
140  }
141 
142  $this->setData($this->feedbacks);
143 
144  if ($this->getCurrentDetailLevel() > 1 && count($this->feedbacks) > 0)
145  {
146  $this->setRowTemplate("tpl.feedback_pdbox.html", "Services/Feedback");
148  }
149  else
150  {
151  $this->setEnableNumInfo(false);
152  $this->setDataSection($this->getOverview());
153  }
154  }
155 
159  function fillRow($a_set)
160  {
161  global $ilUser, $ilCtrl, $lng;
162 
163  $ilCtrl->setParameterByClass("ilfeedbackgui","barometer_id",$a_set["id"]);
164  $this->tpl->setVariable('LINK_FEEDBACK',
165  $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", 'ilfeedbackgui'),'voteform'));
166  $this->tpl->setVariable('TXT_FEEDBACK', $a_set["title"]);
167  }
168 
172  function getOverview()
173  {
174  global $ilUser, $lng, $ilCtrl;
175 
176  return '<div class="small">'.((int) count($this->feedbacks))." ".$lng->txt("pdesk_feedbacks")."</div>";
177  }
178 
179 }
180 
181 ?>