public function actionChange_my_password() { if (Yii::app()->user->id == '') { $this->redirect(array('login')); } $model = MyFormat::loadModelByClass(Yii::app()->user->id, 'Users'); $model->scenario = 'changeMyPassword'; $model->md5pass = $model->password_hash; if (isset($_POST['Users'])) { $model->currentpassword = $_POST['Users']['currentpassword']; $model->newpassword = $_POST['Users']['newpassword']; $model->password_confirm = $_POST['Users']['password_confirm']; if ($model->validate()) { $model->newpassword = $_POST['Users']['newpassword']; $model->password_hash = md5($model->newpassword); $model->temp_password = $model->newpassword; if ($model->save()) { Yii::app()->user->setFlash('successChangeMyPassword', "Your password has been successfully changed."); $this->redirect(array('change_my_password')); } } } $this->render('change_my_password', array('model' => $model)); }
public function actionPrintvoucher($id) { $model = MyFormat::loadModelByClass($id, 'FiPaymentVoucher'); if ($model) { $dataTmp = FiPaymentVoucherDetail::getDataWithWithVoucherID($id, 'type'); } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } $this->render('payment_vouchers/print_voucher', array('actions' => $this->listActionsCanAccess, 'model' => $model, 'dataTmp' => $dataTmp)); }
/** * @Author: ANH DUNG Jul 09, 2014 * @Todo: view invoice for transaction * @Param: $id */ public function actionViewInvoice($id) { $model = MyFormat::loadModelByClass($id, 'ProTransactionsInvoice'); $mTransactions = ProTransactions::LoadModelRelationByPk($model->transactions_id); $this->render('ViewInvoice/print_invoice', array('model' => $model, 'mTransactions' => $mTransactions, 'actions' => $this->listActionsCanAccess)); }
/** * @Author: ANH DUNG Feb 11, 2015 * @Todo: delete tenancy * @Param: $id */ public function actionDelete_tenancy($id) { try { if (Yii::app()->request->isPostRequest) { // we only allow deletion via POST request $model = MyFormat::loadModelByClass($id, 'ProTransactions'); if ($model && ProTransactions::CanDeleteTenancy($model)) { if ($model->delete()) { Yii::log("Delete record " . print_r($model->attributes, true), 'info'); } } // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index')); } } 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(400, $e->getMessage()); } }