PATH:
home
/
letacommog
/
letaweb
/
admin
/
modules
/
newslist
<?php class CWidgetNewslist extends CWidgetCMS { public $text,$display_image, $show_more; public $display_datetime, $display_summary,$page,$no_news_label,$readmore_label,$show_readmore,$margin,$expand,$dataProvider; public $calc_height, $column,$masonry,$thumb_size; public $layout_type, $thumbnail; public $thumb_width, $thumb_height; public $filter, $logic, $max, $start_index, $order_sql, $total; public $number_per_page,$order, $current_page,$offset,$where; public $list_data = array(); public $post_per_page = 10; public function decodeData() { $data = $this->module_data; $this->page = $this->newsdetail_page; $this->no_news_label = '<p>No News were found</p>'; $this->display_image = getIndex($data, 'image', false, 'boolean'); $this->show_more = !(getIndex($data, 'hide_panigation', false, 'boolean')); $this->show_readmore = getIndex($data, 'readmore', false, 'boolean'); $this->readmore_label = trim(getIndex($data, 'readmore_label', '', 'string')); if (strlen($this->readmore_label) == 0) { $this->readmore_label = ('Read more'); } $this->display_datetime = getIndex($data, 'datetime', false, 'boolean'); $this->display_summary = getIndex($data, 'summary', false, 'boolean'); $this->calc_height = getIndex($data, 'calc_height', false, 'boolean'); $this->column = getIndex($data, 'column', 1, 'int'); $this->masonry = getIndex($data, 'masonry', false, 'boolean'); $this->layout_type = getIndex($data, 'layout_type', 0, 'int'); $this->thumbnail = getIndex($data, 'thumbnail', true, 'boolean'); $this->post_per_page = getIndex($data, 'post_per_page', 10, 'int'); $this->thumb_size = getIndex($data, 'thumb_size', 0, 'int'); $this->max = getIndex($data, 'maxlength', 400, 'int'); $category = getIndex($_GET, "category",0, 'int'); $criteria = new CDbCriteria; $criteria->order = "date_added desc"; if (($category) > 0) { $criteria->with = array( 'news_news_category' ); $criteria->together = true; $criteria->condition = 'news_news_category.category_id=:category_id'; $criteria->params = array( ':category_id' => $category); } $this->dataProvider = new CActiveDataProvider('BNews', array( 'criteria'=> $criteria, 'pagination' => array( 'pageSize' => $this->post_per_page, ), )); } protected function getRequestQuery() { $request_name = array( Yii::app()->cms->getRequestPrefix().'year', Yii::app()->cms->getRequestPrefix().'month', Yii::app()->cms->getRequestPrefix().'date', Yii::app()->cms->getRequestPrefix().'hour', Yii::app()->cms->getRequestPrefix().'minute', Yii::app()->cms->getRequestPrefix().'second', Yii::app()->cms->getRequestPrefix().'search', Yii::app()->cms->getRequestPrefix().'tag', Yii::app()->cms->getRequestPrefix().'category', ); $replace_query = array( 'cast(strftime("%Y","date_added") as INTEGER)="%d"', 'cast(strftime("%m","date_added") as INTEGER)="%d"', 'cast(strftime("%d","date_added") as INTEGER)="%d"', 'cast(strftime("%h","date_added") as INTEGER)="%d"', 'cast(strftime("%i","date_added") as INTEGER)="%d"', 'cast(strftime("%s","date_added") as INTEGER)="%d"', 'name like "%d"', 'tag="%s"', 'category like "%%,%d,%%"', ); $where = '1= 1 '; for ($i = 0; $i < sizeof($request_name); ++$i) { $request = $request_name[$i]; $replace = $replace_query[$i]; if (isset($_REQUEST[$request])) { $value = trim($_REQUEST[$request]); switch ($request) { case CMS::getRequestPrefix().'category': $vs = explode('-', $value); if (sizeof($vs) > 0) { $value = $vs[0]; } break; } $where .= sprintf(' and '.$replace, $value); } } return $where; } public function generate_tag_link($id, $class = '') { $new = BNews::model()->findByPk($id); $tags = $new->tags; $rs = ''; if (isset($tags) && !is_null($tags)) { $tag = explode(',', $tags); if (sizeof($tag) > 0) { foreach ($tag as $t) { $t = trim($t); if (strlen($t) > 0) { $tl = '<a class="'.$class.'" href="'.$this->createTagUrl($t).'">'.$t.'</a>'; $rs .= $tl; } } if (strlen($rs) > 0) { return $rs; } } } $rs = Yii::app()->lang->term('LBL_NO_TAG', true); return $rs; } public function generate_category_link($id, $class = '') { $new = BNews::model()->findByPk($id); $category = $new->main_category; $rs = ''; if (isset($category)) { $rs .= '<a class="'.$class.'" href="'.$this->createCategoryUrl($category->id).'">'.$category['name'].'</a>'; return $rs; } $rs = Yii::app()->lang->term('LBL_NO_CATEGORY', true); return $rs; $rs = ''; if (isset($tags) && !is_null($tags)) { $tag = explode(',', $tags); foreach ($tag as $t) { $tl = "<a class='".$class."' href=\"".$this->createTagUrl($t).'">'.$t.'</a>'; $rs .= $tl; } } return $rs; } }
[+]
..
[-] frontend_class.php
[edit]
[-] backend.php
[edit]
[-] frontend_view.php
[edit]
[-] backend.js
[edit]