testsModel.php
50 lines
| 1.5 KiB
| text/x-php
|
PhpLexer
|
r0 | <?php | ||
class testsModel extends ModelBase{ | ||||
public $tableName = 'sis_tests'; | ||||
public function dolist(){ | ||||
$query = "SELECT * FROM ".$this->tableName | ||||
." ORDER BY idtest"; | ||||
$result = $this->db->prepare($query); | ||||
$result->execute(); | ||||
$num_rows = $result->rowCount(); | ||||
return array($result, $num_rows); | ||||
} | ||||
public function getTest($id){ | ||||
$query = "SELECT * FROM ".$this->tableName | ||||
." WHERE idtest = ".$id; | ||||
$result = $this->db->prepare($query); | ||||
$result->execute(); | ||||
return $result; | ||||
} | ||||
public function getCompleteTestByNumber($number){ | ||||
$query = "SELECT st.* FROM ".$this->tableName." AS st" | ||||
." INNER JOIN sis_detail_test AS sdt" | ||||
." ON st.idtest = sdt.idtest" | ||||
." INNER JOIN sis_category AS scat" | ||||
." ON sdt.idcategory = scat.idcategory" | ||||
." WHERE st.ordering = ".$number; | ||||
$result = $this->db->prepare($query); | ||||
$result->execute(); | ||||
return $result; | ||||
} | ||||
public function Getappl_test($id){ | ||||
$this->setQuery("Select * | ||||
From sis_tests | ||||
Where num_form =".$id); | ||||
$consulta = $this->loadObjectList(); | ||||
return $consulta; | ||||
} | ||||
public function getTestbyNumForm($number){ | ||||
$query = "SELECT idtest FROM ".$this->tableName | ||||
." WHERE num_form = ".$number; | ||||
$result = $this->db->prepare($query); | ||||
$result->execute(); | ||||
return $result; | ||||
} | ||||
} | ||||
?> | ||||