Файл: adultscript-2.0.3-pro/files/admin/modules/adv/models/adv.php
Строк: 12
<?php
class VModel_Admin_adv extends VModel
{
public function __construct()
{
parent::__construct();
}
public function advs($params, $limit = 0, $fields = array())
{
$fields = ($fields) ? $fields : array(
'a.adv_id', 'a.adv_name'
);
$where = (isset($params['where']) && $params['where']) ? 'WHERE '.$params['where'] : '';
if (!isset($params['sort'])) {
$params['sort'] = 'a.adv_id';
}
if (!isset($params['order'])) {
$params['order'] = 'ASC';
}
$limit = ($limit) ? " LIMIT ".$limit : '';
$this->db->query("
SELECT ".implode(', ', $fields)."
FROM #__adv AS a
LEFT JOIN #__adv_groups AS g ON (g.adv_group_id = a.adv_group_id)".$where."
ORDER BY ".$params['sort'].' '.$params['order'].$limit
);
return ($this->db->affected_rows())
? $this->db->fetch_rows()
: array();
}
}