/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Christmas the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Christmas::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionCustomerReply() { $this->layout = '//layouts/maindate'; if (isset($_POST['customer']) && isset($_POST['customer']['ajax'])) { $customer_questions = $this->loadModel(getCurCusId()); $customer_questions->provisional_date = isset($_POST['customer']['provisional_date']) ? $_POST['customer']['provisional_date'] : ""; $customer_questions->call_date = isset($_POST['customer']['call_date']) ? $_POST['customer']['call_date'] : ""; // mErrors($customer_questions); $customer_questions->save(); echo json_encode(array('success' => 1)); exit; } DynamicCall::GetEdit1stPdf(getCurCusId()); $id = $_GET['id']; $customer = Customer::model()->findByPk($id); // $magic_spoon = MagicSpool::model()->findByAttributes(array('cus_id' => getCurCusId())); // $magic_spoon = MagicSpool::model()->find()->findByAttributes(array('cus_id' => getCurCusId())); $magic_spoon = MagicSpool::model()->findAll(array('select' => 'one,two,three,four,five', 'condition' => 'cus_id=:cus_id', 'limit' => 1, 'params' => array(':cus_id' => $id))); $lunch_count = Lunch::model()->findAll(array('condition' => 'cus_id=:cus_id', 'params' => array(':cus_id' => $id))); $break_count = Breakfast::model()->findAll(array('condition' => 'cus_id=:cus_id', 'params' => array(':cus_id' => $id))); $hotf_count = HotFood::model()->findAll(array('condition' => 'cus_id=:cus_id', 'params' => array(':cus_id' => $id))); $sandw_count = Sandwiches::model()->findAll(array('condition' => 'cus_id=:cus_id', 'params' => array(':cus_id' => $id))); $sundr_count = Sundries::model()->findAll(array('condition' => 'cus_id=:cus_id', 'params' => array(':cus_id' => $id))); $IndusFood_count = IndusFood::model()->findAll(array('condition' => 'cus_id=:cus_id', 'params' => array(':cus_id' => $id))); $Christmas_count = Christmas::model()->findAll(array('condition' => 'cus_id=:cus_id', 'params' => array(':cus_id' => $id))); $customer = Customer::model()->findByPk($id); $selProdt = array(); if (count(Yii::app()->session['sel_prod'])) { $criteria = new CDbCriteria(); $criteria->select = 't.name,t.desc'; $criteria->addInCondition('id', Yii::app()->session['sel_prod']); $selProdt = Product::model()->findAll($criteria); } $this->render('customerreply', array('magic_spoon' => $magic_spoon, 'lunch_count' => $lunch_count, 'break_count' => $break_count, 'hotf_count' => $hotf_count, 'sandw_count' => $sandw_count, 'sundr_count' => $sundr_count, 'indusFood_count' => $IndusFood_count, 'christmas_count' => $Christmas_count, 'selProdt' => $selProdt, 'customer' => $customer)); }