Разработка web-сайта о кафе, барах и ресторанах города Челябинска
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
6.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);
escape(false)->orderBy(t1.createdesc)->escape(true);">$q->escape(false)->orderBy(t1.create desc)->escape(true);
groupBy(t1.id);($is_main)">$q->groupBy(t1.id);($is_main)
{
$q->limit($this->count_per_page_last);
$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);
}
}FirmDescriptor extends CMSK_Descriptor
{$className = Firm;$common_fields = array(
slug=>array(name=>Условное обозначение,type=>text,slug=>name_ru,rules=>trim|required,display_in_index=>text,),
address=>array(name=>Адрес,type=>text,rules=>trim|required,for_out=>true,),
point=>array(name=>Координаты,type=>point),
avg_price=>array(name=>Средняя цена на человека,type=>text,rules=>trim,for_out=>true,),
date_open=>array(name=>Дата открытия,type=>date,rules=>trim,for_out=>true,),
raion_id=>array(name=>Район,type=>select,model=>Raion,value_field=>id,name_field=>name,),
cat_id=>array(name=>Основная категория,type=>select,model=>Cat,value_field=>id,name_field=>name,)
showed=>array(name=>Показывать,type=>checkbox,default_value=>true,display_in_index=>showed_toogler,),
tags=>array(name=>Категории,type=>multiselect,model=>Tag,value_field=>id,name_field=>name,table=>firms_tags,inner_field=>firm_id,outer_field=>tag_id),
);$multi_language_fields = array(
name=>array(name=>Название,type=>text,rules=>trim|required,display_in_index=>text,),
short=>array(name=>Кратко,type=>textarea,rules=>trim,),
full=>array(name=>Особенности,type=>textarea,rules=>trim,for_out=>true,),
count_zal=>array(name=>Количество залов,type=>text,rules=>trim,for_out=>true,),
order_table=>array(name=>Заказ столика,type=>text,rules=>trim,for_out=>true,),
advanced_services=>array(name=>Дополнительные услуги,type=>text,rules=>trim,for_out=>true,),
count_places=>array(name=>Общее количество мест,type=>text,rules=>trim,for_out=>true,),
parking=>array(name=>Парковка,type=>text,rules=>trim,for_out=>true,),
phones=>array(name=>Телефоны,type=>text,rules=>trim,for_out=>true,),
timetable=>array(name=>Время работы,type=>text,rules=>trim,for_out=>true,),
programm=>array(name=>Развлечения и программа,type=>text,rules=>trim,for_out=>true,),
title=>array(name=>Title,type=>text,),
keywords=>array(name=>Keywords,type=>text,),
description=>array(name=>Description,type=>text,),
);$orderby = t1.orderby,t1.id;$multi_lang_field = firm_id;
}
/* End of file firm.php */
/* Location: ./application/models/firm.php */
Приложение В
<?php if (!defined(BASEPATH)) exit(No direct script access allowed);Tag extends CMSK_Model {$count_per_page_for_cloud = 20;
/**
* список тэгов отсортированных по количеству фирм
*
* @return array
*/function getListOrderByCount()
{
$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.tag_id",array());">$q->join(firms_tags, "t1.id=t4.tag_id", array());
join(firms,"t5.id=t4.firm_id",array());">$q->join(firms, "t5.id=t4.firm_id", array());
escape(false)->column(count(distinctt5.id)ascount_tags,t1.*)->escape(true);">$q->escape(false)->column(count(distinct t5.id) as count_tags,t1.*)->escape(true);
where(t1.showed,true);">$q->where(t1.showed, true);
where(t5.showed,true);">$q->where(t5.showed, true);
escape(false)->orderBy(t2.name,t1.id)->escape(true);">$q->escape(false)->orderBy(t2.name,t1.id)->escape(true);
groupBy(t1.id);">$q->groupBy(t1.id);
$q->limit($this->count_per_page_for_cloud);
$items = $q->get()->result();$items;
}
/**
* список тэгов фирмы
*
* @param object $firm фирма
*
* @return array
*/function getListByFirm($firm)
{
$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);