示例#1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Constants();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Constants'])) {
         $model->attributes = $_POST['Constants'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->_key));
         }
     }
     $this->render('create', array('model' => $model));
 }
示例#2
0
	public function setCvalue($key,$value)
	{
		$this->_key=$key;
		$model=$this->find("_key='".$key."'");
		if($model===null)
		{
			$model= new Constants;
			$model->setAttribute('_key',$key);
			$model->setAttribute('_value',$value);
			$model->save();
		}
		else 
		{
			$model->setAttribute('_value',$value);
			$model->save();
		}

	}