Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00033 class ilSearchResult
00034 {
00035
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
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
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 }
00177 ?>