FOYDALANILGAN ADABIYOTLAR bet 5/5 Sana 24.12.2023 Hajmi 1,03 Mb. #127882
Bog'liq
Individual loyiha (2) Bu sahifa navigatsiya:ILOVA FOYDALANILGAN ADABIYOTLAR
MySQl architecture guide, 2018.
https://www.php.net/
https://www.mysql.com/
https://demos.krajee.com/
https://www.yiiframework.com/
ILOVA
Dastur kodi:
{
return [
'access' => [
'class' => AccessControl::className (), 'only' => ['logout'],
'rules' => [
[
'actions' => ['logout'], 'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className (), 'actions' => [
'logout' => ['post'],
],
],
];
}
/**
* {@inheritdoc }
*/
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'captcha' => [
'class' => 'yii\captcha\CaptchaAction', 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
],
];
}
/**
*
*/
public function actionIndex(){
$model = new User();
if ($model->load(Yii::$app ->request->post())) {
$k = 0;
$users = User::find ()->all();
foreach ($users as $user){
if ($user['username'] == $model->username &&
$user['password'] == $model->password){
$k++;
}
}
if ($k !=0) {
return $this->redirect(['site/list']);
}else{
Yii::$app ->session->setFlash('error', 'Parol yoki Login xato kiritildi!!!');
}
}
return $this->render('index',['model'=>$model]);
}
public function actionCreate()
{
$model = new Xodimlar();
if ($model->load(Yii::$app ->request->post())) {
$image = UploadedFile::getInstance ($model,'image');
$model->image = $image->name;
$model->validate();
$image->saveAs(Yii::$app ->basePath. '/web/img/avatar/'
.$image->name);
if ($model->save(false))
Yii::$app ->session->setFlash('success', 'Ro`yxatdan o`tdingiz!!!');
else
Yii::$app ->session->setFlash('danger', 'Xatolik bo`ldi!!!');
return $this->redirect(['site/list']);
}
return $this->render('create', [
'model' => $model,
]);
}
public function actionList(){
$model = Xodimlar::find ()-
>select(['id','ism','familiya','image'])->all();
return $this->render('list',['model'=>$model]);
}
public function actionAnketa($id)
{
$model = Xodimlar::findAll ($id);
$fan = Fanlar::findAll ($model[0]['fanlar_id']);
return $this->render('anketa',['model'=>$model,'fan'=>$fan]);
namespace app\controllers;
use Yii;
use app\models\Fanlar;
use app\models\FanlarSearch; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\filters\VerbFilter;
/**
* FanlarController implements the CRUD actions for Fanlar model.
*/
class FanlarController extends Controller
{
/**
* {@inheritdoc }
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className (), 'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
Lists all Fanlar models.
@return mixed
*/
public function actionIndex()
{
$searchModel = new FanlarSearch();
$dataProvider = $searchModel->search(Yii::$app ->request-
>queryParams);
return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider,
]);
}
/**
Displays a single Fanlar 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 Fanlar model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
*/
public function actionCreate()
{
$model = new Fanlar();
if ($model->load(Yii::$app ->request->post()) && $model->save())
{
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('create', [ 'model' => $model,
]);
}
/**
Updates an existing Fanlar 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 Fanlar 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 Fanlar model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Fanlar the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Fanlar::findOne ($id)) !== null) {
return $model;
}
throw new NotFoundHttpException(Yii::t ('app', 'The requested page does not exist.'));
}
}
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\LoginForm */
use app\models\LoginForm; use yii\helpers\Html;
use yii\bootstrap\ActiveForm; use yii\web\View;
?>
html>
Login V1
=======================================================================
========================-->
=======================================================================
========================-->
=======================================================================
========================-->
=======================================================================
========================-->
=======================================================================
========================-->
=======================================================================
========================-->
=======================================================================
========================-->
=======================================================================
========================-->
$form
=
ActiveForm::
begin ([
'id'
=>
'login-form',
'options'
=>
['class'
=>
'form-horizontal'],
= "Password is required">
=
$form->field($model,
'password')-
>passwordInput() ?>
= Html::submitButton ('Login', ['class' => 'login100-form-btn', 'name' => 'login-button']) ?>
ActiveForm::end (); ?>
= Html::a ('Ro`yxatdan o`tish', Yii::$app ->getUrlManager()-
>createUrl(['site/create']), ['class' => 'btn btn-info']); ?>
21 - umumiy o`tra talim maktabi xodimlari
foreach
($model
as
$avatar):
?>
endforeach;?>