• Main Page
  • Related Pages
  • 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 
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                 // initiate variables
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();          // forwardCommand is invoked in view() method
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                 // set locator
00101                 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
00102                 $this->tpl->touchBlock("locator_separator");
00103                 $this->tpl->setCurrentBlock("locator_item");
00104                 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
00105                 $this->tpl->setVariable("LINK_ITEM",
00106                         $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
00107                 $this->tpl->parseCurrentBlock();
00108                 
00109                 $this->tpl->setCurrentBlock("locator_item");
00110                 $this->tpl->setVariable("ITEM", $this->lng->txt("private_notes"));
00111                 $this->tpl->setVariable("LINK_ITEM",
00112                         $this->ctrl->getLinkTargetByClass("ilpdnotesgui"));
00113                 $this->tpl->parseCurrentBlock();
00114                 
00115                 // catch feedback message
00116                 sendInfo();
00117                 // display infopanel if something happened
00118                 infoPanel();
00119 
00120         }
00121 
00122         /*
00123         * display notes
00124         */
00125         function view()
00126         {
00127                 global $ilUser, $lng;
00128 
00129                 //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
00130                 include_once("Services/Notes/classes/class.ilNoteGUI.php");
00131                 
00132                 // output related item selection (if more than one)
00133                 include_once("Services/Notes/classes/class.ilNote.php");
00134                 $rel_objs = ilNote::_getRelatedObjectsOfUser();
00135                 
00136                 if ($_GET["rel_obj"] > 0)
00137                 {
00138                         $notes_gui = new ilNoteGUI($_GET["rel_obj"], 0,
00139                                 ilObject::_lookupType($_GET["rel_obj"]),true);
00140                 }
00141                 else
00142                 {
00143                         $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
00144                 }
00145                                 
00146                 $notes_gui->enablePrivateNotes();
00147                 $notes_gui->enableHiding(false);
00148                 $notes_gui->enableTargets(true);
00149                 $notes_gui->enableMultiSelection(true);
00150 
00151                 $next_class = $this->ctrl->getNextClass($this);
00152 
00153                 if ($next_class == "ilnotegui")
00154                 {
00155                         $html = $this->ctrl->forwardCommand($notes_gui);
00156                 }
00157                 else
00158                 {
00159                         $html = $notes_gui->getNotesHTML();
00160                 }
00161 
00162                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.pd_notes.html", "Services/Notes");
00163                 
00164                 if (count($rel_objs) > 1 ||
00165                         ($rel_objs[0]["rep_obj_id"] > 0))
00166                 {
00167                         // prepend personal dektop, if first object 
00168                         if ($rel_objs[0]["rep_obj_id"] > 0)
00169                         {
00170                                 $rel_objs = array_merge(array(0), $rel_objs);
00171                         }
00172 
00173                         foreach($rel_objs as $obj)
00174                         {
00175                                 $this->tpl->setCurrentBlock("related_option");
00176                                 $this->tpl->setVariable("VAL_RELATED",
00177                                         $obj["rep_obj_id"]);
00178 //echo "-".$obj["rep_obj_id"]."-".$obj["obj_type"]."-";
00179                                 if ($obj["rep_obj_id"] > 0)
00180                                 {
00181                                         $type = ilObject::_lookupType($obj["rep_obj_id"]);
00182                                         $type_str = (in_array($type, array("lm", "htlm", "sahs", "dbk")))
00183                                                 ? $lng->txt("learning_resource")
00184                                                 : $lng->txt("obj_".$type);
00185                                         $this->tpl->setVariable("TXT_RELATED", $type_str.": ".
00186                                                 ilObject::_lookupTitle($obj["rep_obj_id"]));
00187                                 }
00188                                 else
00189                                 {
00190                                         $this->tpl->setVariable("TXT_RELATED",
00191                                                 $lng->txt("personal_desktop"));
00192                                 }
00193                                 if ($obj["rep_obj_id"] == $_GET["rel_obj"])
00194                                 {
00195                                         $this->tpl->setVariable("SEL", 'selected="selected"');
00196                                 }
00197                                 $this->tpl->parseCurrentBlock();
00198                         }
00199                         
00200                         $this->tpl->setCurrentBlock("related_selection");
00201                         $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
00202                         $this->tpl->setVariable("TXT_RELATED_TO", $lng->txt("related_to"));
00203                         $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00204                         $this->tpl->parseCurrentBlock();
00205                 }
00206                 
00207                 $this->tpl->setCurrentBlock("adm_content");
00208                 // output notes
00209                 $this->tpl->setVariable("NOTES", $html);
00210                 $this->tpl->parseCurrentBlock();
00211 
00212         }
00213         
00217         function changeRelatedObject()
00218         {
00219                 $this->ctrl->setParameter($this, "rel_obj", $_POST["rel_obj"]);
00220                 $this->ctrl->redirect($this);
00221         }
00222 
00223 }
00224 ?>

Generated on Fri Dec 13 2013 11:57:55 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1