Sahifa fonini berish misoli



Download 0,66 Mb.
bet16/17
Sana07.06.2021
Hajmi0,66 Mb.
#65754
1   ...   9   10   11   12   13   14   15   16   17
Bog'liq
loyiha ishi word comp

Backend qismi


Backend qismini tashkillashda Admin LTE widgetidan foydalanildi. Backend qismi to`la holda YII2 texnologiyasida tashkillangan.

MVC texnologiyasidan foydalanilgan ushbu frameworkda asosan contollerlar orqali ma’lumotlar uzatilib borildi:





namespace backend\controllers;

use Yii;

use backend\models\About;

use backend\models\AboutSearch; use yii\web\Controller;

use yii\web\NotFoundHttpException; use yii\filters\VerbFilter;

use yii\filters\AccessControl;

/**

* AboutController implements the CRUD actions for About model.

*/

class AboutController extends Controller

{

/**

* {@inheritdoc}

*/

public function behaviors()

{

return [

'access' => [

'class' => AccessControl::className(), 'rules' => [

[

'actions' => ['login', 'error'], 'allow' => true,

], [

'actions' => ['logout', 'index', '_form', '_search', 'create', 'update', 'view','delete'], 'allow' => true,

'roles' => ['@'],

],

],

],

'verbs' => [

'class' => VerbFilter::className(), 'actions' => [

'delete' => ['POST'],

],

],

];

}

/**

  • Lists all About models.

  • @return mixed

*/

public function actionIndex()

{

$searchModel = new AboutSearch();

$dataProvider = $searchModel->search(Yii::$app->request->queryParams);

return $this->render('index', [

'searchModel' => $searchModel, 'dataProvider' => $dataProvider,

]);

}

/**

  • Displays a single About model.

  • @param integer $id

  • @return mixed

  • @throws NotFoundHttpException if the model cannot be found

*/

public function actionView($id)

{

return $this->render('view', [ 'model' => $this->findModel($id),

]);

}

/**

  • Creates a new About model.

  • If creation is successful, the browser will be redirected to the 'view' page.

  • @return mixed

*/

public function actionCreate()

{

$model = new About();

if ($model->load(Yii::$app->request->post())) {

$model->img=\yii\web\UploadedFile::getInstance($model, 'img');

$model->img->saveAs("../../frontend/web/images/".date("YMDHmi").".".$model->img->extension);

$model->img= date("YMDHmi").".".$model->img->extension;

$model->save();

return $this->redirect(['view', 'id' => $model->id]);

}

return $this->render('create', [

'model' => $model,

]);

}

/**

  • Updates an existing About model.

  • If update is successful, the browser will be redirected to the 'view' page.

  • @param integer $id

  • @return mixed

  • @throws NotFoundHttpException if the model cannot be found

*/

public function actionUpdate($id)

{

$model = $this->findModel($id);

if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]);

}

return $this->render('update', [ 'model' => $model,

]);

}

/**

  • Deletes an existing About model.

  • If deletion is successful, the browser will be redirected to the 'index' page.

  • @param integer $id

  • @return mixed

  • @throws NotFoundHttpException if the model cannot be found

*/

public function actionDelete($id)

{

$this->findModel($id)->delete();

return $this->redirect(['index']);

}

/**

  • Finds the About model based on its primary key value.

  • If the model is not found, a 404 HTTP exception will be thrown.

  • @param integer $id

  • @return About the loaded model

  • @throws NotFoundHttpException if the model cannot be found

*/

protected function findModel($id)

{

if (($model = About::findOne($id)) !== null) { return $model;

}

throw new NotFoundHttpException('The requested page does not exist.');

}

}

Xavfsizlik tizimini tashkillashda ActiveForm dan foydalanilgan:





use yii\helpers\Html;

use yii\widgets\ActiveForm;

/* @var $this yii\web\View */

/* @var $model backend\models\About */

/* @var $form yii\widgets\ActiveForm */

?>





field($model, 'title_uz')->textInput(['maxlength' => true]) ?>

field($model, 'title_en')->textInput(['maxlength' => true]) ?>

field($model, 'text_uz')->textarea(['rows' => 6]) ?>

field($model, 'text_en')->textarea(['rows' => 6]) ?>

field($model, 'address')->textInput(['maxlength' => true]) ?>

field($model, 'tel')->textInput(['maxlength' => true]) ?>

field($model, 'email')->textInput(['maxlength' => true]) ?>

field($model, 'site')->textInput(['maxlength' => true]) ?>

field($model, 'img')->fileInput(['maxlength' => true]) ?>



'btn btn-success']) ?>






Xulosa


Ushbu saytni yaratish davomida aniq ma’lumotlar va topshiriq olish maqsadida Buloq boshi Nayman qishlogining 17-sonli umumta’lim maktabi direktori bilan suhabt o`tkazdim. U bergan topshiriqlar bo`yicha saytda ishlarni amalga oshrdim. Va shu bilan birga sayt tizimi to`la php Yii2 frameworkida yaratdim.



Download 0,66 Mb.

Do'stlaringiz bilan baham:
1   ...   9   10   11   12   13   14   15   16   17




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish