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

classes/class.ilSearchResult.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 ilSearchResult
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 ilSearchResult($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                 switch($target["type"])
00101                 {
00102                         case "lm":
00103                                 include_once "./content/classes/class.ilObjContentObject.php";
00104                                 
00105                                 if($target["subtype"] == "meta")
00106                                 {
00107                                         return list($book["link"],$book["target"]) = ilObjContentObject::_getLinkToObject($target["id"],"meta");
00108                                 }
00109                                 else
00110                                 {
00111                                         return list($book["link"],$book["target"]) = 
00112                                                 ilObjContentObject::_getLinkToObject($target["id"],"content",$target["page_id"]);
00113                                 }
00114                                 break;
00115                                 
00116                         case "dbk":
00117 
00118                                 include_once "./content/classes/class.ilObjDlBook.php";
00119                                 
00120                                 if($target["subtype"] == "meta")
00121                                 {
00122                                         return list($book["link"],$book["target"]) = ilObjDlBook::_getLinkToObject($target["id"],"meta");
00123                                 }
00124                                 else
00125                                 {
00126                                         return list($book["link"],$book["target"]) = 
00127                                                 ilObjDlBook::_getLinkToObject($target["id"],"content",$target["page_id"]);
00128                                 }
00129                                 break;
00130 
00131                         case "grp":
00132                                 
00133                                 include_once "./classes/class.ilObjGroup.php";
00134                                 
00135                                 return list($group["link"],$group["target"]) = ilObjGroup::_getLinkToObject($target["id"]);
00136 
00137                         case "usr":
00138 
00139                                 include_once "./classes/class.ilObjUser.php";
00140                                 
00141                                 return list($group["link"],$group["target"]) = ilObjUser::_getLinkToObject($target["id"]);
00142                 }
00143         }
00144 
00145         function updateTitle($a_title)
00146         {
00147                 $query = "UPDATE ".TABLE_SEARCH_DATA." ".
00148                         "SET title = '".addslashes($a_title)."' ".
00149                         "WHERE obj_id = '".$this->getObjId()."' ".
00150                         "AND user_id = '".$this->getUserId()."'";
00151 
00152                 $res = $this->ilias->db->query($query);
00153 
00154                 return true;
00155         }
00156                 
00157                 
00158         // PRIVATE METHODS
00159         function __init()
00160         {
00161                 if($this->getObjId())
00162                 {
00163                         $query = "SELECT * FROM ".TABLE_SEARCH_DATA." ".
00164                                 "WHERE obj_id = '".$this->getObjId()."' ".
00165                                 "AND user_id = '".$this->getUserId()."'";
00166 
00167                         $res = $this->ilias->db->query($query);
00168                         while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00169                         {
00170                                 $this->setTitle($row->title);
00171                                 $this->setTarget(unserialize(stripslashes($row->target)));
00172                         }
00173                         return true;
00174                 }
00175         }
00176 } // END class.Search
00177 ?>

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