} Yii::app()->theme = 'onehome'; Yii::app()->clientScript->coreScriptPosition = CClientScript::POS_BEGIN; Yii::app()->clientScript->defaultScriptFilePosition = CClientScript::POS_END; $this->layout = '/layouts/onehome/1-col'; $this->render('contact_us', array('model' => $model));
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { try { $model = ProTestimonial::model()->findByPk($id); if ($model === null) { Yii::log("The requested page does not exist."); throw new CHttpException(404, 'The requested page does not exist.'); } return $model; } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }
if ($model = $this->loadModelVendorPurchaserDetail($id)) { // $model->need_delete = 1; // $model->update(array('need_delete')); if ($model->delete()) { Yii::log("Delete record " . print_r($model->attributes, true), 'info'); } } } else { Yii::log("Invalid request. Please do not repeat this request again."); throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } } /** * @Author: ANH DUNG Mar 28, 2014 * @Todo: load model ProTransactionsVendorPurchaserDetail * @Param: $id is pk * @Return: model */ public function loadModelVendorPurchaserDetail($id, $modelName = 'ProTransactionsVendorPurchaserDetail') { try { $model_ = call_user_func(array($modelName, 'model')); $model = $model_->findByPk($id); if ($model === null) { Yii::log("The requested page does not exist."); throw new CHttpException(404, 'The requested page does not exist.');