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
00037 class ilPDNotesGUI
00038 {
00039
00045 var $ilias;
00046 var $tpl;
00047 var $lng;
00048
00054 function ilPDNotesGUI()
00055 {
00056 global $ilias, $tpl, $lng, $ilCtrl;
00057
00058
00059 $this->ilias =& $ilias;
00060 $this->tpl =& $tpl;
00061 $this->lng =& $lng;
00062 $this->ctrl =& $ilCtrl;
00063
00064 $this->ctrl->saveParameter($this, "rel_obj");
00065 }
00066
00070 function &executeCommand()
00071 {
00072 $next_class = $this->ctrl->getNextClass();
00073
00074 switch($next_class)
00075 {
00076 case "ilnotegui":
00077 $this->displayHeader();
00078 $this->view();
00079 break;
00080
00081 default:
00082 $cmd = $this->ctrl->getCmd("view");
00083 $this->displayHeader();
00084 $this->$cmd();
00085 break;
00086 }
00087 $this->tpl->show(true);
00088 return true;
00089 }
00090
00094 function displayHeader()
00095 {
00096 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
00097 $this->lng->txt("personal_desktop"));
00098 $this->tpl->setTitle($this->lng->txt("personal_desktop"));
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 sendInfo();
00120
00121 infoPanel();
00122
00123 }
00124
00125
00126
00127
00128 function view()
00129 {
00130 global $ilUser, $lng;
00131
00132
00133 include_once("Services/Notes/classes/class.ilNoteGUI.php");
00134
00135
00136 include_once("Services/Notes/classes/class.ilNote.php");
00137 $rel_objs = ilNote::_getRelatedObjectsOfUser();
00138
00139 if ($_GET["rel_obj"] > 0)
00140 {
00141 $notes_gui = new ilNoteGUI($_GET["rel_obj"], 0,
00142 ilObject::_lookupType($_GET["rel_obj"]),true);
00143 }
00144 else
00145 {
00146 $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
00147 }
00148
00149 $notes_gui->enablePrivateNotes();
00150 $notes_gui->enableHiding(false);
00151 $notes_gui->enableTargets(true);
00152 $notes_gui->enableMultiSelection(true);
00153
00154 $next_class = $this->ctrl->getNextClass($this);
00155
00156 if ($next_class == "ilnotegui")
00157 {
00158 $html = $this->ctrl->forwardCommand($notes_gui);
00159 }
00160 else
00161 {
00162 $html = $notes_gui->getNotesHTML();
00163 }
00164
00165 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.pd_notes.html", "Services/Notes");
00166
00167 if (count($rel_objs) > 1 ||
00168 ($rel_objs[0]["rep_obj_id"] > 0))
00169 {
00170
00171 if ($rel_objs[0]["rep_obj_id"] > 0)
00172 {
00173 $rel_objs = array_merge(array(0), $rel_objs);
00174 }
00175
00176 foreach($rel_objs as $obj)
00177 {
00178 $this->tpl->setCurrentBlock("related_option");
00179 $this->tpl->setVariable("VAL_RELATED",
00180 $obj["rep_obj_id"]);
00181
00182 if ($obj["rep_obj_id"] > 0)
00183 {
00184 $type = ilObject::_lookupType($obj["rep_obj_id"]);
00185 $type_str = (in_array($type, array("lm", "htlm", "sahs", "dbk")))
00186 ? $lng->txt("learning_resource")
00187 : $lng->txt("obj_".$type);
00188 $this->tpl->setVariable("TXT_RELATED", $type_str.": ".
00189 ilObject::_lookupTitle($obj["rep_obj_id"]));
00190 }
00191 else
00192 {
00193 $this->tpl->setVariable("TXT_RELATED",
00194 $lng->txt("personal_desktop"));
00195 }
00196 if ($obj["rep_obj_id"] == $_GET["rel_obj"])
00197 {
00198 $this->tpl->setVariable("SEL", 'selected="selected"');
00199 }
00200 $this->tpl->parseCurrentBlock();
00201 }
00202
00203 $this->tpl->setCurrentBlock("related_selection");
00204 $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
00205 $this->tpl->setVariable("TXT_RELATED_TO", $lng->txt("related_to"));
00206 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00207 $this->tpl->parseCurrentBlock();
00208 }
00209
00210 $this->tpl->setCurrentBlock("adm_content");
00211
00212 $this->tpl->setVariable("NOTES", $html);
00213 $this->tpl->parseCurrentBlock();
00214
00215 }
00216
00220 function changeRelatedObject()
00221 {
00222 $this->ctrl->setParameter($this, "rel_obj", $_POST["rel_obj"]);
00223 $this->ctrl->redirect($this);
00224 }
00225
00226 }
00227 ?>