Ejemplo n.º 1
0
  <!-- hinh anh -->
  <?php 
require_once dirname(__FILE__) . './../jfileupload/_upload.php';
?>
  <?php 
$selected_categories = array();
foreach ($model->categories as $categories) {
    array_push($selected_categories, $categories->id);
}
?>
  <div class="control-group">
    <div class="control-label">
      <label>Loại bài viết</label>
    </div>
    <div class="controls"> <?php 
echo CHtml::checkBoxList('categories', $selected_categories, CHtml::listData(ArticleCategories::model()->findAll('t.active=1 AND t.delete=0'), 'id', 'name'), array('template' => '<label class="checkbox">{input} {label}</label>', 'labelOptions' => array('style' => 'display:inline;'), 'separator' => ''));
?>
 </div>
  </div>
  
  <div class="control-group">
    <div class="control-label"><?php 
echo $form->labelEx($model, 'summary');
?>
</div>
    <div class="controls"><?php 
echo $form->textArea($model, 'summary', array('class' => 'input-xxlarge', 'size' => 60, 'maxlength' => 500));
?>
</div>
    <div class="controls"><?php 
echo $form->error($model, 'summary');
 public function actionArticleOfAreaDetail($id)
 {
     $model = ArticleOfArea::model()->findByAttributes(array('non_utf8_name' => $id));
     if ($model === null || $model->active == 0 || $model->delete == 1) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $this->pageTitle = $model->name . ' - ' . Config::model()->getValueByKey('sitetitle');
     $this->metaDescription = $model->metadescription;
     $this->metaKeywords = $model->metakeywords;
     // danh sach cac bai viet khac cung the loai
     $otherArticle = array();
     // danh sach cac category
     $criteria = new CDbCriteria();
     $criteria->addCondition("t.active=1");
     $criteria->addCondition("t.delete=0");
     $criteria->addCondition("t.id!=1");
     $criteria->order = "t.order, t.id DESC";
     $categories = ArticleCategories::model()->findAll($criteria);
     $this->render('article', array('model' => $model, 'otherArticle' => $otherArticle, 'categories' => $categories));
 }
 public function getDropdown()
 {
     global $dataDropdown;
     $dataDropdown = array();
     $parents = ArticleCategories::model()->with('levelTop')->findALl();
     foreach ($parents as $parent) {
         $dataDropdown[$parent->id] = $parent->name;
         $this->_subDropDown($parent->childCategories);
     }
     return $dataDropdown;
 }
 /**
  * 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 $id the ID of the model to be loaded
  * @return ArticleCategories the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ArticleCategories::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }