예제 #1
0
 /**
  * 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
  */
 public function loadModel($id)
 {
     $model = GroupCourse::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #2
0
파일: _view.php 프로젝트: stan5621/eduwind
<div>
<?php 
$groupCourse = GroupCourse::model()->findByAttributes(array('courseId' => $courseId, 'groupId' => $data->id));
if ($groupCourse) {
    echo CHtml::ajaxLink(Yii::t('app', '取消收藏'), array('groupCourse/delete', 'id' => $groupCourse->id), array('type' => 'post', 'success' => 'js:function(data){window.location.reload();}'), array('class' => 'btn pull-right'));
} else {
    echo CHtml::ajaxLink(Yii::t('app', '收藏'), array('groupCourse/create', 'groupId' => $data->id, 'courseId' => $courseId), array('success' => 'js:function(data){window.location.reload();}'), array('class' => 'btn  btn-success pull-right'));
}
echo $data->name;
?>
<div class="clearfix"></div>
</div>