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

Services/Search/classes/class.ilUserResult.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 
00033 class ilUserResult
00034 {
00035         // OBJECT VARIABLES
00036         var $ilias;
00037 
00038         var $title;
00039         var $obj_id;
00040         var $user_id;
00041         var $target;
00042 
00047         function ilUserResult($a_user_id,$a_obj_id = 0)
00048         {
00049                 global $ilias;
00050 
00051                 define("TABLE_SEARCH_DATA","search_data");
00052 
00053                 $this->ilias =& $ilias;
00054 
00055                 $this->obj_id = $a_obj_id;
00056                 $this->user_id = $a_user_id;
00057 
00058                 $this->__init();
00059         }
00060 
00061         // SET/GET
00062         function getUserId()
00063         {
00064                 return $this->user_id;
00065         }
00066 
00067         function getType()
00068         {
00069                 return "sea";
00070         }
00071         function setObjId($a_obj_id)
00072         {
00073                 $this->obj_id = $a_obj_id;
00074         }
00075         function getObjId()
00076         {
00077                 return $this->obj_id;
00078         }
00079         function setTitle($a_title)
00080         {
00081                 $this->title = $a_title;
00082         }
00083         function getTitle()
00084         {
00085                 return $this->title;
00086         }
00087         function setTarget($a_target)
00088         {
00089                 $this->target = $a_target;
00090         }
00091         function getTarget()
00092         {
00093                 return $this->target;
00094         }
00095 
00096         function createLink()
00097         {
00098                 $target = $this->getTarget();
00099 
00100                 include_once 'Services/Search/classes/class.ilSearchObjectListFactory.php';
00101                 
00102                 $item_list_gui =& ilSearchObjectListFactory::_getInstance($target['type']);
00103                 $item_list_gui->initItem($target['id'],ilObject::_lookupObjId($target['id']));
00104 
00105                 return array($item_list_gui->getCommandLink('view'),
00106                                          $item_list_gui->getCommandFrame('view'));
00107         }
00108 
00109         function updateTitle($a_title)
00110         {
00111                 $query = "UPDATE ".TABLE_SEARCH_DATA." ".
00112                         "SET title = '".addslashes($a_title)."' ".
00113                         "WHERE obj_id = '".$this->getObjId()."' ".
00114                         "AND user_id = '".$this->getUserId()."'";
00115 
00116                 $res = $this->ilias->db->query($query);
00117 
00118                 return true;
00119         }
00120                 
00121                 
00122         // PRIVATE METHODS
00123         function __init()
00124         {
00125                 if($this->getObjId())
00126                 {
00127                         $query = "SELECT * FROM ".TABLE_SEARCH_DATA." ".
00128                                 "WHERE obj_id = '".$this->getObjId()."' ".
00129                                 "AND user_id = '".$this->getUserId()."'";
00130 
00131                         $res = $this->ilias->db->query($query);
00132                         while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00133                         {
00134                                 $this->setTitle($row->title);
00135                                 $this->setTarget(unserialize(stripslashes($row->target)));
00136                         }
00137                         return true;
00138                 }
00139         }
00140 } // END class.Search
00141 ?>

Generated on Fri Dec 13 2013 10:18:31 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1