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 ilUserResult
00034 {
00035
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
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
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 }
00141 ?>