本文整理汇总了PHP中Criteria::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::save方法的具体用法?PHP Criteria::save怎么用?PHP Criteria::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
try {
$model = new Criteria();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Criteria'])) {
$model->attributes = $_POST['Criteria'];
if ($model->save()) {
Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, '<strong>Well!</strong> Criteria created with sucess!');
Yii::app()->controller->refresh();
}
}
} catch (Exception $e) {
Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, '<strong>Ops!</strong> ERROR!');
Yii::app()->controller->refresh();
}
$this->render('create', array('model' => $model));
}
示例2: actionAddCriteria
/**
* Add notification criteria.
*
* This method is called by a form on the "Manage Notification Criteria" page
* and is used to create a new criteria for generation notifications.
*/
public function actionAddCriteria()
{
$criteria = new Criteria();
$users = User::getNames();
$dataProvider = new CActiveDataProvider('Criteria');
unset($users['']);
unset($users['Anyone']);
$criteria->users = Yii::app()->user->getName();
if (isset($_POST['Criteria'])) {
$criteria->attributes = $_POST['Criteria'];
$str = "";
$arr = $criteria->users;
if ($criteria->type == 'assignment' && count($arr) > 1) {
$this->redirect('addCriteria');
}
if (isset($arr)) {
$str = implode(', ', $arr);
}
$criteria->users = $str;
if ($criteria->modelType != null && $criteria->comparisonOperator != null) {
if ($criteria->save()) {
}
$this->refresh();
}
}
$this->render('addCriteria', array('users' => $users, 'model' => $criteria, 'dataProvider' => $dataProvider));
}
示例3: actionAddCriteria
public function actionAddCriteria()
{
$criteria = new Criteria();
$users = User::getNames();
$dataProvider = new CActiveDataProvider('Criteria');
unset($users['']);
if (isset($_POST['Criteria'])) {
$criteria->attributes = $_POST['Criteria'];
$str = "";
$arr = $criteria->users;
if ($criteria->type == 'assignment' && count($arr) > 1) {
$this->redirect('addCriteria');
}
if (isset($arr)) {
foreach ($arr as $user) {
$str .= $user . ", ";
}
$str = substr($str, 0, -2);
}
$criteria->users = $str;
if ($criteria->modelType != null && $criteria->comparisonOperator != null) {
if ($criteria->save()) {
}
$this->redirect('index');
}
}
$this->render('addCriteria', array('users' => $users, 'model' => $criteria, 'dataProvider' => $dataProvider));
}