Example #1
0
 public static function listCategoryNews()
 {
     return ANewsCategories::model()->findAll('status=:status', array(':status' => 1));
 }
Example #2
0
<?php

$this->breadcrumbs = array(Yii::t('adm/news', 'manage_news'));
$this->menu = array(array('label' => Yii::t('adm/news', 'create_cate'), 'url' => array('create'), 'linkOptions' => array('class' => 'link-new')));
?>

<h3><?php 
echo Yii::t('adm/news', 'manage_news');
?>
</h3>

<?php 
$this->widget('ext.selgridview.SelGridView', array('id' => 'anews-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'selectableRows' => 2, 'columns' => array(array('class' => 'CCheckBoxColumn'), array('name' => 'news_category_id', 'value' => '$data->newsCategory->category_title', 'filter' => CHtml::listData(ANewsCategories::model()->findAll(), "id", "category_title")), 'news_title', array('name' => 'status', 'type' => 'raw', 'value' => 'CHtml::link(($data->status == 1) ? CHtml::image(Yii::app()->request->baseUrl.\'/images/icons/tick.png\',\'image\') : CHtml::image(Yii::app()->request->baseUrl.\'/images/icons/publish_x.png\',\'image\'),"javascript:void();",array(\'onclick\'=>"changeStatus($data->status,\'$data->id\')"))'), 'created_time', array('class' => 'CButtonColumn'))));
?>
<ul id="content_toolbar">
    <li><input type="button" name="" id="activeAll" value="<?php 
echo Yii::t('adm/news', 'activeAll');
?>
"/></li>
    <li><input type="button" name="" id="unActiveAll" value="<?php 
echo Yii::t('adm/news', 'unactiveAll');
?>
"/></li>
    <li><input type="button" name="" id="deleteAll" value="<?php 
echo Yii::t('adm/news', 'deleteAll');
?>
"/></li>
</ul>
<script type="text/javascript">
    $(document).ready(function(){
        $('#activeAll').click(function(){
Example #3
0
echo $form->textField($model, 'news_title', array('size' => 79, 'maxlength' => 255));
?>
		<?php 
echo $form->error($model, 'news_title');
?>
	</div>
    
    <div class="row">
		<?php 
echo $form->labelEx($model, 'news_category_id');
?>
		<?php 
//echo $form->textField($model,'news_category_id');
?>
        <?php 
echo $form->dropDownList($model, 'news_category_id', CHtml::listData(ANewsCategories::model()->findAll(), "id", "category_title"));
?>
		<?php 
echo $form->error($model, 'news_category_id');
?>
	</div>
    
	<div class="row">
		<?php 
echo $form->labelEx($model, 'news_short_description');
?>
		<?php 
//echo $form->textField($model,'news_short_description',array('size'=>60,'maxlength'=>255));
?>
        <?php 
$this->widget('ext.widgets.xheditor.XHeditor', array('model' => $model, 'modelAttribute' => 'news_short_description', 'config' => array('id' => 'xheditor_2', 'tools' => 'mini', 'skin' => 'o2007blue', 'width' => '500px', 'height' => '200px', 'loadCSS' => Yii::app()->baseUrl . '/css/editor.css', 'upImgUrl' => $this->createUrl('request/uploadFile'), 'upImgExt' => 'jpg,jpeg,gif,png')));
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = ANewsCategories::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }