public function actionChallanQueryByPlace() { $model = new Challan('searchReport'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Challan'])) { $model->attributes = $_GET['Challan']; //print_r($model->attributes);exit; } $this->render('challanQueryByPlace', array('model' => $model)); }
/** * Manages all models. */ public function actionAdmin() { $model = new Challan('search'); if (!empty($_POST)) { foreach ($_POST['chk'] as $k => $v) { $modelA = new ChallanAssignments(); $modelA->user_id = $_POST['Challan']['user_id']; $modelA->created = date("Y-m-d H:i:s", time()); $modelA->modified = date("Y-m-d H:i:s", time()); $modelA->challan_id = $v; $modelA->assigned_by_user_id = Yii::app()->User->Id; $exist = ChallanAssignments::model()->findAllByAttributes(array("challan_id" => $v)); if (count($exist) == 0) { if ($modelA->save()) { Yii::app()->user->setFlash('success1 message1', "Challan(s) has been assigned successfully"); } else { Yii::app()->user->setFlash('error1 message1', "There was a problem in assignment."); } } // else // { // Yii::app()->user->setFlash('error1 message1', "Challan is already assined."); // } } } $model->unsetAttributes(); // clear any default values if (isset($_GET['Challan'])) { $model->attributes = $_GET['Challan']; } $this->render('admin', array('model' => $model)); }