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