Разработка web-сайта о кафе, барах и ресторанах города Челябинска

Дипломная работа - Компьютеры, программирование

Другие дипломы по предмету Компьютеры, программирование



ray());

escape(false)->column(count(distinctt1.id)asc)->escape(true);">$q->escape(false)->column(count(distinct t1.id) as c)->escape(true);

where(t1.showed,true);">$q->where(t1.showed, true);

where(t5.showed,true);">$q->where(t5.showed, true);

$this->_sub_search($q, $search);

$count_items = $q->get()->result();

$count = $count_items[0]->c;

$count_page = ceil($count/$this->count_per_page);array($items, $count, $count_page);

}

/**

* список фирм по тэгу

*

* @param string $tag_slug slug тэга

*

* @return array

*/function getListByTag($tag_slug, $page=0)

{

$q = $this->db->select()->from($this->descriptor->getTable(), array());($this->descriptor->multi_lang_field) {

join($this->descriptor->getTable()._content,t1.id=t2..$this->descriptor->multi_lang_field,array());">$q->join($this->descriptor->getTable()._content, t1.id=t2..$this->descriptor->multi_lang_field, array());

join(langs,"t2.lang_id=t3.id",array());">$q->join(langs, "t2.lang_id=t3.id", array());

where(t3.short,$this->Lang->default_lang);">$q->where(t3.short, $this->Lang->default_lang);

whereIsNotNull(t3.short);">$q->whereIsNotNull(t3.short);

$q->escape(false)->column(t3.*, t2.*)->escape(true);

}

join(firms_tags,"t1.id=t4.firm_id",array());">$q->join(firms_tags, "t1.id=t4.firm_id", array());

join(tags,"t5.id=t4.tag_id",array());">$q->join(tags, "t5.id=t4.tag_id", array());

$q->escape(false)->column(x(point) as point_x, y(point) as point_y, t1.*)->escape(true);

escape(false)->column(round(avg(t6.rate))asrate,count(distinctt6.id)ascount_rate)->escape(true);">$q->escape(false)->column(round(avg(t6.rate)) as rate,count(distinct t6.id) as count_rate)->escape(true);

join(firms_rates,"t1.id=t6.firm_id",array());">$q->join(firms_rates, "t1.id=t6.firm_id", array());

escape(false)->column(t7.imgascat_img,t8.nameascat_name)->escape(true);">$q->escape(false)->column(t7.img as cat_img,t8.name as cat_name)->escape(true);

join(cats,"t7.id=t1.cat_id",array());">$q->join(cats, "t7.id=t1.cat_id", array());

join(cats_content,t7.id=t8.cat_id,array());">$q->join(cats_content, t7.id=t8.cat_id, array());

join(langs,"t8.lang_id=t9.id",array());">$q->join(langs, "t8.lang_id=t9.id", array());

where(t1.showed,true);">$q->where(t1.showed, true);

where(t5.showed,true);">$q->where(t5.showed, true);

where(t5.slug,$tag_slug);">$q->where(t5.slug, $tag_slug);

escape(false)->orderBy(t1.id)->escape(true);">$q->escape(false)->orderBy(t1.id)->escape(true);

groupBy(t1.id);">$q->groupBy(t1.id);

$q->limit($this->count_per_page, $this->count_per_page*$page);

$items = $q->get()->result();

// общее число записей

$q = $this->db->select()->from($this->descriptor->getTable(), array());

join(firms_tags,"t1.id=t2.firm_id",array());">$q->join(firms_tags, "t1.id=t2.firm_id", array());

join(tags,"t3.id=t2.tag_id",array());">$q->join(tags, "t3.id=t2.tag_id", array());

escape(false)->column(count(distinctt1.id)asc)->escape(true);">$q->escape(false)->column(count(distinct t1.id) as c)->escape(true);

where(t1.showed,true);">$q->where(t1.showed, true);

where(t3.showed,true);">$q->where(t3.showed, true);

where(t3.slug,$tag_slug);">$q->where(t3.slug, $tag_slug);

$count_items = $q->get()->result();

$count = $count_items[0]->c;

$count_page = ceil($count/$this->count_per_page);array($items, $count, $count_page);

}

/**

* список популярных фирм

*

* @return array

*/

public function getListFavorites($is_main=true, $page=0)

{

$q = $this->db->select()->from($this->descriptor->getTable(), array());($this->descriptor->multi_lang_field) {

join($this->descriptor->getTable()._content,t1.id=t2..$this->descriptor->multi_lang_field,array());">$q->join($this->descriptor->getTable()._content, t1.id=t2..$this->descriptor->multi_lang_field, array());

join(langs,"t2.lang_id=t3.id",array());">$q->join(langs, "t2.lang_id=t3.id", array());

where(t3.short,$this->Lang->default_lang);">$q->where(t3.short, $this->Lang->default_lang);

whereIsNotNull(t3.short);">$q->whereIsNotNull(t3.short);

$q->escape(false)->column(t3.*, t2.*)->escape(true);

}

$q->escape(false)->column(x(point) as point_x, y(point) as point_y, t1.*)->escape(true);

escape(false)->column(round(avg(t4.rate))asrate,count(distinctt4.id)ascount_rate)->escape(true);">$q->escape(false)->column(round(avg(t4.rate)) as rate,count(distinct t4.id) as count_rate)->escape(true);

join(firms_rates,"t1.id=t4.firm_id",array());">$q->join(firms_rates, "t1.id=t4.firm_id", array());

escape(false)->column(t5.imgascat_img,t6.nameascat_name)->escape(true);">$q->escape(false)->column(t5.img as cat_img,t6.name as cat_name)->escape(true);

join(cats,"t5.id=t1.cat_id",array());">$q->join(cats, "t5.id=t1.cat_id", array());

join(cats_content,t5.id=t6.cat_id,array());">$q->join(cats_content, t5.id=t6.cat_id, array());

join(langs,"t6.lang_id=t7.id",array());">$q->join(langs, "t6.lang_id=t7.id", array());

where(t1.showed,true);">$q->where(t1.showed, true);

$q->escape(false)->orderBy(rate desc)->escape(true);

groupBy(t1.id);($is_main)">$q->groupBy(t1.id);($is_main)

{

$q->limit($this->count_per_page_favorites);

$count = 0;

$count_page = 0;

}

{

$q->limit($this->count_per_page, $this->count_per_page*$page);

}

$items = $q->get()->result();

(!$is_main) {

// общее число записей

$q = $this->db->select()->from($this->descriptor->getTable(), array());

escape(false)->column(count(distinctt1.id)asc)->escape(true);">$q->escape(false)->column(count(distinct t1.id) as c)->escape(true);

where(t1.showed,true);">$q->where(t1.showed, true);

$count_items = $q->get()->result();

$count = $count_items[0]->c;

$count_page = ceil($count/$this->count_per_page);

}array($items, $count, $count_page);

}

/**

* список новых фирм

*

* @return array

*/

public function getListLatest($is_main=true, $page=0)

{

$q = $this->db->select()->from($this->descriptor->getTable(), array());($this->descriptor->multi_lang_field) {

join($this->descriptor->getTable()._content,t1.id=t2..$this->descriptor->multi_lang_field,array());">$q->join($this->descriptor->getTable()._content, t1.id=t2..$this->descriptor->multi_lang_field, array());

join(langs,"t2.lang_id=t3.id",array());">$q->join(langs, "t2.lang_id=t3.id", array());

where(t3.short,$this->Lang->default_lang);">$q->where(t3.short, $this->Lang->default_lang);

whereIsNotNull(t3.short);">$q->whereIsNotNull(t3.short);

$q->escape(false)->column(t3.*, t2.*)->escape(true);

}

$q->escape(false)->column(x(point) as point_x, y(point) as point_y, t1.*)->escape(true);

escape(false)->column(round(avg(t4.rate))asrate,count(distinctt4.id)ascount_rate)->escape(true);">$q->escape(false)->column(round(avg(t4.rate)) as rate,count(distinct t4.id) as count_rate)->escape(true);

join(firms_rates,"t1.id=t4.firm_id",array());">$q->join(firms_rates, "t1.id=t4.firm_id", array());

escape(false)->column(t5.imgascat_img,t