/** * This is invoked after the record is deleted. */ protected function afterDelete() { parent::afterDelete(); //Comment::model()->deleteAll('post_id='.$this->id); HopamTag::model()->updateFrequency($this->tags, ''); Ban::model()->updateFrequency($this->ban_artist, ''); }
/** * 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 Ban the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Ban::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionBans() { if (isset($_GET['q']) && ($keyword = trim($_GET['q'])) !== '') { $tags = Ban::model()->suggestTags($keyword); if ($tags !== array()) { echo implode("\n", $tags); } } }
<div class="row"> <?php echo $form->label($model, 'view'); ?> <?php echo $form->textField($model, 'view'); ?> </div> <div class="row"> <?php echo $form->label($model, 'ban_id'); ?> <?php echo $form->dropDownList($model, 'ban_id', GxHtml::listDataEx(Ban::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'user_id'); ?> <?php echo $form->dropDownList($model, 'user_id', GxHtml::listDataEx(XfUser::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'create_time');
<?php $this->breadcrumbs = array('Bản nhạc' => array('admin'), 'Quản lý'); $this->menu = array(array('label' => 'Danh sách', 'url' => array('admin')), array('label' => 'Tạo mới', 'url' => array('create'))); ?> <h1>Quản lý bản nhạc</h1> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'song-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'title', array('name' => 'tid', 'value' => 'GxHtml::valueEx($data->t)', 'filter' => GxHtml::listDataEx(Term::model()->findAllAttributes(null, true, 'vid=4'))), 'view', array('name' => 'ban_id', 'value' => 'GxHtml::valueEx($data->ban)', 'filter' => GxHtml::listDataEx(Ban::model()->findAllAttributes(null, true))), array('class' => 'CButtonColumn', 'template' => '{update}{delete}'))));