Дипломная работа: Автоматизация процессов управления взаимоотношениями с клиентами для предприятия (на примере ООО "Орландо Коммерц")

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
107
case \app\models\User::USER_TYPE_ADMIN :
{
$result = $model->id_request_status ==
Request::REQUEST_STATUS_FULL;
} break;
}
if ($exception)
{
if ($result == false)
throw new UserException (Yii::t('app', 'Request Is Not
Editable'));
}
else
return $result;
}
/**
* Creates a new Request model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
return $this->redirect(['view', 'id' => RequestController::RequestCreate
()]);
}
/**
* Updates an existing Request model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
108
/**
* Deletes an existing Request model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
RequestController::RequestEditable ($id);
$model = $this->findModel($id);
$model->delete();
return $this->redirect(['index']);
}
/**
* Finds the Request model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Request the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
public static function findModel($id)
{
$model = Request::findOne($id);
if (($model) !== null)
{
/*
if (Yii::$app->user->identity->IsAdmin == false)
{
if ($model->id_executor != Yii::$app->user->identity->id)
{
throw new UserException (Yii::t('app', 'Access
denied'));
}
}
*/
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
Источник: https://baza.diplomsite.ru/previewfile/2166