Example #1
0
	public function setCvalue($key,$value)
	{
		$this->name=$key;
		$model=$this->find("name='".$key."'");
		if($model===null)
		{
			$model= new Mainoptions;
			$model->setAttribute('name',$key);
			$model->setAttribute('value',$value);
			$model->save();
		}
		else 
		{
			$model->setAttribute('value',$value);
			$model->save();
		}

	}
Example #2
0
	public function actionMocreate()
	{
   		$model=new Mainoptions;

		// Uncomment the following line if AJAX validation is needed
		// $this->performAjaxValidation($model);

		if(isset($_POST['Mainoptions']))
		{
			$model->attributes=$_POST['Mainoptions'];
			if($model->save())
				$this->redirect(array('moadmin'));
		}

		$test=array('guide'=>$this->loadContact(Yii::app()->user->cid),'tours'=>$this->loadTours(),'todo'=>$this->loadUnreported());

		$this->render('mocreate',array(
				'info'=>$test,
		'model'=>$model,
		));
	}