/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new FriendLink();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['FriendLink'])) {
         $model->attributes = $_POST['FriendLink'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
Example #2
0
	public function actionaddflink()
	{
		$model = new FriendLink;
		if(isset($_POST['FriendLink'])){
			$model->title = $_POST['FriendLink']['title'];
			$model->url = $_POST['FriendLink']['url'];
			$model->updatetime = time();
			if(empty($model->title) || empty($model->url)){
				Yii::app()->user->setFlash('error','标题和链接必须填写!');
			}else{
				if($model->save()){
					$this->redirect('/srbac/config/flink');
				}else{
					Yii::app()->user->setFlash('error','保存失败,请重试!');
				}
			}
		}
		$this->render('addflink',array(
				'model'=>$model,
				));
	}