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

classes/class.ilObjNote.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 
00035 require_once "class.ilObject.php";
00036 
00037 require_once "classes/class.ilObject.php";
00038 
00039 class ilObjNote extends ilObject
00040 {
00041         var $ilias;
00042 
00049         function ilObjNote($a_id = 0,$a_call_by_reference = false)
00050         {
00051                 global $ilias;
00052                 $this->ilias =& $ilias;
00053                 
00054                 $this->type = "note";
00055                 $this->ilObject($a_id,$a_call_by_reference);
00056         }
00057 
00065         function viewObject($a_note_id)
00066         {
00067                 $query = "SELECT * FROM note_data WHERE note_id = '".$a_note_id."'";
00068                 $res = $this->ilias->db->query($query);
00069                 $note_data = $res->fetchRow(DB_FETCHMODE_OBJECT);
00070                 return $note_data;              
00071         }
00072 
00081         function createObject($lo_title, $note_text)
00082         {
00083                 global $rbacadmin, $rbacsystem;         // not used (see below)
00084 
00085                 $this->setType("note");
00086                 $this->setTitle($lo_title);
00087                 $this->setDescription($note_text);
00088                 parent::create();
00089                 $note_id = $this->getId();
00090 
00091                 return $note_id;        
00092         }
00093 
00102         function saveNote($obj_id, $ref_lo, $lo_title, $text, $rate)
00103         {
00104                 $create_date = date("Y-m-d G:i:s");
00105 
00106                 $query = "INSERT INTO note_data (note_id, lo_id,  text, create_date, important, good, question, bad)".
00107                                  " VALUES ('".$obj_id."','".$ref_lo."','".$text."','".$create_date."','".$rate["important"]."','".$rate["good"]."','".$rate["question"]."','".$rate["bad"]."')";
00108 
00109                 $res = $this->ilias->db->query($query);
00110         }
00111 
00112         function updateNote($obj_id, $note_text, $rate)
00113         {
00114                 $create_date = date("Y-m-d G:i:s");     // not used
00115                 
00116                 //update table note_data
00117                 $q = "UPDATE note_data SET text='".$note_text."', question='".$rate["question"]."', ".
00118                          "important='".$rate["important"]."', good='".$rate["good"]."', ".
00119                          "bad='".$rate["bad"]."' WHERE note_id='".$obj_id."'";
00120                 $this->ilias->db->query($q);
00121 
00122                 //update table object_data
00123                 $this->setTitle($note_text);
00124                 $this->setDescription($note_text);
00125                 $this->update();
00126         }
00127         function edit()
00128         {
00129         }
00130         
00131         function owner()
00132         {
00133         }
00134 } //END class.NoteObject
00135 ?>

Generated on Fri Dec 13 2013 13:52:07 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1