Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 include_once("Services/Block/classes/class.ilBlockGUI.php");
00025
00034 class ilPDFeedbackBlockGUI extends ilBlockGUI
00035 {
00036 static $block_type = "pdfeedb";
00040 function ilPDFeedbackBlockGUI()
00041 {
00042 global $ilCtrl, $lng, $ilUser;
00043
00044 parent::ilBlockGUI();
00045
00046 $this->setLimit(5);
00047 $this->setImage(ilUtil::getImagePath("icon_feedb_s.gif"));
00048 $this->setTitle($lng->txt("pdesk_feedback_request"));
00049 $this->setAvailableDetailLevels(2, 1);
00050 $this->allow_moving = false;
00051 }
00052
00058 static function getBlockType()
00059 {
00060 return self::$block_type;
00061 }
00062
00068 static function isRepositoryObject()
00069 {
00070 return false;
00071 }
00072
00076 static function getScreenMode()
00077 {
00078 switch($_GET["cmd"])
00079 {
00080 default:
00081 return IL_SCREEN_SIDE;
00082 break;
00083 }
00084 }
00085
00089 function &executeCommand()
00090 {
00091 global $ilCtrl;
00092
00093 $next_class = $ilCtrl->getNextClass();
00094 $cmd = $ilCtrl->getCmd("getHTML");
00095
00096 return $this->$cmd();
00097 }
00098
00099 function getHTML()
00100 {
00101 $html = parent::getHTML();
00102 if (count($this->feedbacks) == 0)
00103 {
00104 return "";
00105 }
00106 else
00107 {
00108 return $html;
00109 }
00110 }
00111
00115 function fillDataSection()
00116 {
00117 global $ilAccess, $ilUser,$tree;
00118
00119 include_once('Services/Feedback/classes/class.ilFeedback.php');
00120 $feedback = new ilFeedback();
00121 $feedbacks = $feedback->getAllBarometer(0);
00122 $this->feedbacks = array();
00123 foreach($feedbacks as $feedback)
00124 {
00125 if($tree->isDeleted($feedback->getRefId()))
00126 {
00127 continue;
00128 }
00129
00130
00131 if (!$ilAccess->checkAccess("write", "", $feedback->getRefId())
00132 && $feedback->canVote($ilUser->getId(), $feedback->getId()) == 1
00133 && !$feedback->getAnonymous())
00134 {
00135 $this->feedbacks[] = array (
00136 "id" => $feedback->getId(),
00137 "title" => $feedback->getTitle()
00138 );
00139 }
00140 }
00141
00142 $this->setData($this->feedbacks);
00143
00144 if ($this->getCurrentDetailLevel() > 1 && count($this->feedbacks) > 0)
00145 {
00146 $this->setRowTemplate("tpl.feedback_pdbox.html", "Services/Feedback");
00147 parent::fillDataSection();
00148 }
00149 else
00150 {
00151 $this->setEnableNumInfo(false);
00152 $this->setDataSection($this->getOverview());
00153 }
00154 }
00155
00159 function fillRow($a_set)
00160 {
00161 global $ilUser, $ilCtrl, $lng;
00162
00163 $ilCtrl->setParameterByClass("ilfeedbackgui","barometer_id",$a_set["id"]);
00164 $this->tpl->setVariable('LINK_FEEDBACK',
00165 $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", 'ilfeedbackgui'),'voteform'));
00166 $this->tpl->setVariable('TXT_FEEDBACK', $a_set["title"]);
00167 }
00168
00172 function getOverview()
00173 {
00174 global $ilUser, $lng, $ilCtrl;
00175
00176 return '<div class="small">'.((int) count($this->feedbacks))." ".$lng->txt("pdesk_feedbacks")."</div>";
00177 }
00178
00179 }
00180
00181 ?>