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
00035 include_once 'Services/Search/classes/class.ilAbstractSearch.php';
00036
00037 class ilTestSearch extends ilAbstractSearch
00038 {
00043 function ilTestSearch(&$query_parser)
00044 {
00045 parent::ilAbstractSearch($query_parser);
00046 }
00047
00048 function &__searchTestIntroduction()
00049 {
00050 $this->setFields(array('introduction'));
00051
00052 $where = $this->__createWhereCondition(implode(',',$this->getFields()));
00053 $locate = $this->__createLocateString();
00054
00055 $query = "SELECT obj_fi ".
00056 $locate.
00057 "FROM tst_tests ".
00058 $where;
00059
00060 $res = $this->db->query($query);
00061 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00062 {
00063 $this->search_result->addEntry($row->obj_fi,'tst',$this->__prepareFound($row));
00064 }
00065 return $this->search_result;
00066 }
00067 function &__searchTestTitle()
00068 {
00069 $this->setFields(array('title','comment'));
00070
00071 $where = $this->__createWhereCondition(implode(',',$this->getFields()));
00072 $locate = $this->__createLocateString();
00073
00074 $query = "SELECT obj_fi ".
00075 $locate.
00076 "FROM qpl_questions ".
00077 $where;
00078
00079 $res = $this->db->query($query);
00080 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00081 {
00082 $this->search_result->addEntry($row->obj_fi,'qpl',$this->__prepareFound($row));
00083 }
00084 return $this->search_result;
00085 }
00086 function &__searchSurveyIntroduction()
00087 {
00088 $this->setFields(array('introduction'));
00089
00090 $where = $this->__createWhereCondition(implode(',',$this->getFields()));
00091 $locate = $this->__createLocateString();
00092
00093 $query = "SELECT obj_fi ".
00094 $locate.
00095 "FROM survey_survey ".
00096 $where;
00097
00098 $res = $this->db->query($query);
00099 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00100 {
00101 $this->search_result->addEntry($row->obj_fi,'svy',$this->__prepareFound($row));
00102 }
00103 return $this->search_result;
00104 }
00105 function &__searchSurveyTitle()
00106 {
00107 $this->setFields(array('title','description'));
00108
00109 $where = $this->__createWhereCondition(implode(',',$this->getFields()));
00110 $locate = $this->__createLocateString();
00111
00112 $query = "SELECT obj_fi ".
00113 $locate.
00114 "FROM survey_question ".
00115 $where;
00116
00117 $res = $this->db->query($query);
00118 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00119 {
00120 $this->search_result->addEntry($row->obj_fi,'spl',$this->__prepareFound($row));
00121 }
00122 return $this->search_result;
00123 }
00124
00125
00126 function &performSearch()
00127 {
00128 $this->__searchTestTitle();
00129 $this->__searchTestIntroduction();
00130 $this->__searchSurveyTitle();
00131 $this->__searchSurveyIntroduction();
00132
00133 return $this->search_result;
00134 }
00135 }
00136 ?>