Current File : /home/karenpetzb/application/models/CategoryTypeTri.php |
<?php
class CategoryTypeTri extends Zend_Db_Table
{
protected $_name = 'category_type_tri';
protected $_primary = 'ID';
public function getListTriByCategory($idcat) {
try { return $this->select()->where("IDCATEGORY = ?", $idcat)->query()->fetchAll();
} catch (Zend_Exception $e) { return array(); }
}
public function getListTriByCategoryInOneRow($idcat) {
try {
$list = $this->getListTriByCategory($idcat);
if (!empty($list)) {
$data = array();
foreach ($list as $row) {
if (!empty($row['TITRE'])) { $data['TITRE_'.$row['TYPE'].'_'.$row['IDTRI']] = $row['TITRE']; }
if (!empty($row['DESCRIPTION'])) { $data['DESC_'.$row['TYPE'].'_'.$row['IDTRI']] = $row['DESCRIPTION']; }
if (!empty($row['KEYWORDS'])) { $data['KEYWORD_'.$row['TYPE'].'_'.$row['IDTRI']] = $row['KEYWORDS']; }
}
return $data;
}
} catch (Zend_Exception $e) { return array(); }
return array();
}
public function getInfoByCatTypeTri($idcat, $type, $idtri) {
try {
return $this->select()->where("IDCATEGORY = ?", $idcat)
->where("TYPE = ?", $type)
->where("IDTRI = ?", $idtri)
->query()->fetch();
} catch (Zend_Exception $e) { return array(); }
}
}
?>