ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPDNotesGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  +-----------------------------------------------------------------------------+
5  | ILIAS open source |
6  +-----------------------------------------------------------------------------+
7  | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
8  | |
9  | This program is free software; you can redistribute it and/or |
10  | modify it under the terms of the GNU General Public License |
11  | as published by the Free Software Foundation; either version 2 |
12  | of the License, or (at your option) any later version. |
13  | |
14  | This program is distributed in the hope that it will be useful, |
15  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17  | GNU General Public License for more details. |
18  | |
19  | You should have received a copy of the GNU General Public License |
20  | along with this program; if not, write to the Free Software |
21  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22  +-----------------------------------------------------------------------------+
23 */
24 
37 {
38 
44  var $ilias;
45  var $tpl;
46  var $lng;
47 
53  function ilPDNotesGUI()
54  {
55  global $ilias, $tpl, $lng, $ilCtrl;
56 
57  // initiate variables
58  $this->ilias =& $ilias;
59  $this->tpl =& $tpl;
60  $this->lng =& $lng;
61  $this->ctrl =& $ilCtrl;
62 
63  $this->ctrl->saveParameter($this, "rel_obj");
64  }
65 
69  function &executeCommand()
70  {
71  $next_class = $this->ctrl->getNextClass();
72 
73  switch($next_class)
74  {
75  case "ilnotegui":
76  $this->displayHeader();
77  $this->view(); // forwardCommand is invoked in view() method
78  break;
79 
80  default:
81  $cmd = $this->ctrl->getCmd("view");
82  $this->displayHeader();
83  $this->$cmd();
84  break;
85  }
86  $this->tpl->show(true);
87  return true;
88  }
89 
93  function displayHeader()
94  {
95  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
96  $this->lng->txt("personal_desktop"));
97  $this->tpl->setTitle($this->lng->txt("personal_desktop"));
98 
99  // set locator
100 /*
101  $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
102  $this->tpl->touchBlock("locator_separator");
103  $this->tpl->touchBlock("locator_item");
104  //$this->tpl->setCurrentBlock("locator_item");
105  //$this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
106  //$this->tpl->setVariable("LINK_ITEM",
107  // $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
108  //$this->tpl->parseCurrentBlock();
109 
110  $this->tpl->setCurrentBlock("locator_item");
111  $this->tpl->setVariable("ITEM", $this->lng->txt("private_notes"));
112  $this->tpl->setVariable("LINK_ITEM",
113  $this->ctrl->getLinkTargetByClass("ilpdnotesgui"));
114  $this->tpl->parseCurrentBlock();
115 */
116 
117  // catch feedback message
119  // display infopanel if something happened
121 
122  }
123 
124  /*
125  * display notes
126  */
127  function view()
128  {
129  global $ilUser, $lng;
130 
131  //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
132  include_once("Services/Notes/classes/class.ilNoteGUI.php");
133 
134  // output related item selection (if more than one)
135  include_once("Services/Notes/classes/class.ilNote.php");
136  $rel_objs = ilNote::_getRelatedObjectsOfUser();
137 
138  if ($_GET["rel_obj"] > 0)
139  {
140  $notes_gui = new ilNoteGUI($_GET["rel_obj"], 0,
141  ilObject::_lookupType($_GET["rel_obj"]),true);
142  }
143  else
144  {
145  $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
146  }
147 
148  $notes_gui->enablePrivateNotes();
149  $notes_gui->enablePublicNotes(false);
150  $notes_gui->enableHiding(false);
151  $notes_gui->enableTargets(true);
152  $notes_gui->enableMultiSelection(true);
153 
154  $next_class = $this->ctrl->getNextClass($this);
155 
156  if ($next_class == "ilnotegui")
157  {
158  $html = $this->ctrl->forwardCommand($notes_gui);
159  }
160  else
161  {
162  $html = $notes_gui->getNotesHTML();
163  }
164 
165  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.pd_notes.html", "Services/Notes");
166 
167  if (count($rel_objs) > 1 ||
168  ($rel_objs[0]["rep_obj_id"] > 0))
169  {
170  // prepend personal dektop, if first object
171  if ($rel_objs[0]["rep_obj_id"] > 0)
172  {
173  $rel_objs = array_merge(array(0), $rel_objs);
174  }
175 
176  foreach($rel_objs as $obj)
177  {
178  $this->tpl->setCurrentBlock("related_option");
179  $this->tpl->setVariable("VAL_RELATED",
180  $obj["rep_obj_id"]);
181 //echo "-".$obj["rep_obj_id"]."-".$obj["obj_type"]."-";
182  if ($obj["rep_obj_id"] > 0)
183  {
184  $type = ilObject::_lookupType($obj["rep_obj_id"]);
185  $type_str = (in_array($type, array("lm", "htlm", "sahs", "dbk")))
186  ? $lng->txt("learning_resource")
187  : $lng->txt("obj_".$type);
188  $this->tpl->setVariable("TXT_RELATED", $type_str.": ".
189  ilObject::_lookupTitle($obj["rep_obj_id"]));
190  }
191  else
192  {
193  $this->tpl->setVariable("TXT_RELATED",
194  $lng->txt("personal_desktop"));
195  }
196  if ($obj["rep_obj_id"] == $_GET["rel_obj"])
197  {
198  $this->tpl->setVariable("SEL", 'selected="selected"');
199  }
200  $this->tpl->parseCurrentBlock();
201  }
202 
203  $this->tpl->setCurrentBlock("related_selection");
204  $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
205  $this->tpl->setVariable("TXT_RELATED_TO", $lng->txt("related_to"));
206  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
207  $this->tpl->parseCurrentBlock();
208  }
209 
210  $this->tpl->setCurrentBlock("adm_content");
211  // output notes
212  $this->tpl->setVariable("NOTES", $html);
213  $this->tpl->parseCurrentBlock();
214 
215  }
216 
221  {
222  $this->ctrl->setParameter($this, "rel_obj", $_POST["rel_obj"]);
223  $this->ctrl->redirect($this);
224  }
225 
226 }
227 ?>