• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilPDNotesGUI.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004         +-----------------------------------------------------------------------------+
00005         | ILIAS open source                                                           |
00006         +-----------------------------------------------------------------------------+
00007         | Copyright (c) 1998-2005 ILIAS open source, University of Cologne            |
00008         |                                                                             |
00009         | This program is free software; you can redistribute it and/or               |
00010         | modify it under the terms of the GNU General Public License                 |
00011         | as published by the Free Software Foundation; either version 2              |
00012         | of the License, or (at your option) any later version.                      |
00013         |                                                                             |
00014         | This program is distributed in the hope that it will be useful,             |
00015         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00016         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00017         | GNU General Public License for more details.                                |
00018         |                                                                             |
00019         | You should have received a copy of the GNU General Public License           |
00020         | along with this program; if not, write to the Free Software                 |
00021         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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                 // initiate variables
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();          // forwardCommand is invoked in view() method
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                 // set locator
00100 /*
00101                 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
00102                 $this->tpl->touchBlock("locator_separator");
00103                 $this->tpl->touchBlock("locator_item");
00104                 //$this->tpl->setCurrentBlock("locator_item");
00105                 //$this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
00106                 //$this->tpl->setVariable("LINK_ITEM",
00107                 //      $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
00108                 //$this->tpl->parseCurrentBlock();
00109                 
00110                 $this->tpl->setCurrentBlock("locator_item");
00111                 $this->tpl->setVariable("ITEM", $this->lng->txt("private_notes"));
00112                 $this->tpl->setVariable("LINK_ITEM",
00113                         $this->ctrl->getLinkTargetByClass("ilpdnotesgui"));
00114                 $this->tpl->parseCurrentBlock();
00115 */
00116                 
00117                 // catch feedback message
00118                 ilUtil::sendInfo();
00119                 // display infopanel if something happened
00120                 ilUtil::infoPanel();
00121 
00122         }
00123 
00124         /*
00125         * display notes
00126         */
00127         function view()
00128         {
00129                 global $ilUser, $lng;
00130 
00131                 //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
00132                 include_once("Services/Notes/classes/class.ilNoteGUI.php");
00133                 
00134                 // output related item selection (if more than one)
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                         // prepend personal dektop, if first object 
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 //echo "-".$obj["rep_obj_id"]."-".$obj["obj_type"]."-";
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                 // output notes
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 ?>

Generated on Fri Dec 13 2013 17:56:48 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1