Ilova - O'zbekiston respublikasi raqamli texnologiyalar vazirligi muxammad al-xorazmiy nomidagi toshkent axborot...

|
O'zbekiston respublikasi raqamli texnologiyalar vazirligi muxammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universiteti
|
bet | 22/22 | Sana | 10.06.2024 | Hajmi | 13,87 Mb. | | #262242 |
Bog'liq Dadajonov Hikmatillo diplom ishiIlova.
NewyorkController.php
namespace frontend\controllers;
use frontend\models\ResendVerificationEmailForm;
use frontend\models\VerifyEmailForm;
use Yii;
use yii\db\ActiveQuery;
use yii\base\InvalidArgumentException;
use yii\web\BadRequestHttpException;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use common\models\LoginForm;
use frontend\models\PasswordResetRequestForm;
use frontend\models\ResetPasswordForm;
use frontend\models\SignupForm;
use frontend\models\ContactForm;
use frontend\models\Comment;
use backend\models\About;
use backend\models\Carousel;
use backend\models\Categoryblogs;
use backend\models\Blog;
use backend\models\Student;
use backend\models\Image;
use backend\models\Classes;
use backend\models\Categorycourses;
use backend\models\Levelcourses;
use backend\models\Sentence;
use backend\models\Information;
use backend\models\Teacher;
// use backend\models\Comment;
use yii\data\Pagination;
/**
* Site controller
*/
class NewyorkController extends Controller
{
public function actionChangelan($lan) {
Yii::$app->language=$lan;
Yii::$app->session->set("lan",$lan);
return $this->redirect(Yii::$app->request->referrer);
}
public function actionClassSingle()
{
$this->layout="shablon";
$id=Yii::$app->request->get('id');
if($id){
$i=Classes::findOne("$id");
}
else{
$i=Classes::find()
->orderBy(['created_at' => SORT_DESC])->one();
}
$h=Student::find()
->where(['class_id'=>$id])
->count();
$n=Levelcourses::find()
->limit(30)
->all();
$m=Categorycourses::find()
->limit(15)
->all();
$o=Sentence::find()->all();
return $this->render("class_single",['i'=>$i,'h'=>$h,'n'=>$n,'m'=>$m,'o'=>$o]);
}
/**
* {@inheritdoc}
*/
public function actionIndexkids()
{
$this->layout="shablonkids";
$n=About::find( )->all();
return $this->render("indexkids",['n'=>$n]);
}
public function actionIndex()
{
$this->layout="shablon";
$n=About::find()->one();
$a=Carousel::find()->all();
$d=Image::find()
->where(['category_images_id' => '1'])
->count();
$e=Student::find()
->count();
$f=Classes::find()
->count();
$q=Image::find()
->where(['category_images_id'=>'1']);
$pages = new Pagination(['totalCount' => $q->count(),
'defaultPageSize'=>8,]);
$items = $q->offset($pages->offset)
->limit($pages->limit)
->all();
$o=Sentence::find()->all();
return $this->render("indexcontent",['n'=>$n,'a'=>$a,'d'=>$d,'e'=>$e,'f'=>$f,'pages'=>$pages,'items'=>$items,'o'=>$o]);
}
public function actionAbout()
{
$this->layout="shablon";
$n=About::find()->one();
$a=Carousel::find()->one();
$o=Sentence::find()->all();
$r=Image::find()
->where(['category_images_id'=>'2']);
$pages1 = new Pagination(['totalCount' => $r->count(),
'defaultPageSize'=>12,]);
$items1 = $r->offset($pages1->offset)
->limit($pages1->limit)
->all();
return $this->render("about",['items1'=>$items1,'pages1'=>$pages1,'n'=>$n,'a'=>$a,'o'=>$o,'q'=>$q,'r'=>$r]);
}
public function actionCourse()
{
$this->layout="shablon";
$id=Yii::$app->request->get('id');
if($id){
$g=Classes::find()
->where(['category_courses_id'=>$id]);
$pages = new Pagination(['totalCount' => $g->count(),
'defaultPageSize'=>2,]);
$items = $g->offset($pages->offset)
->limit($pages->limit)
->all();
$l=Categorycourses::findOne("$id");
}
else{
$g=Classes::find();
$pages = new Pagination(['totalCount' => $g->count(),
'defaultPageSize'=>2,]);
$items = $g->offset($pages->offset)
->limit($pages->limit)
->all();
}
$a=Carousel::find()->one();
$n=Levelcourses::find()
->limit(30)
->all();
$m=Categorycourses::find()
->limit(15)
->all();
$o=Sentence::find()->all();
$p=Sentence::findOne('14');
return $this->render("course",['model'=>$model,'items'=>$items,'pages'=>$pages,'l'=>$l,'n'=>$n,'a'=>$a,'m'=>$m,'o'=>$o,'p'=>$p]);
}
public function actionBlog()
{
$this->layout="shablon";
$id=Yii::$app->request->get('id');
if($id){
$b=Blog::find()
->where(['category_blogs_id'=>$id]);
$pages = new Pagination(['totalCount' => $b->count(),
'defaultPageSize'=>3,]);
$items = $b->offset($pages->offset)
->limit($pages->limit)
->all();
}
else{
$b=Blog::find()
->orderBy(['created_at' => SORT_DESC]);
$pages = new Pagination(['totalCount' => $b->count(),
'defaultPageSize'=>3,]);
$items = $b->offset($pages->offset)
->limit($pages->limit)
->all();
}
if (Yii::$app->language=='uz') {
$k=Blog::find()
->orderBy(['created_at' => SORT_DESC])
->limit(20)
->groupBy(['tag_uz'])
->all();
}
if (Yii::$app->language=='ru') {
$k=Blog::find()
->orderBy(['created_at' => SORT_DESC])
->limit(20)
->groupBy(['tag_ru'])
->all();
}if (Yii::$app->language=='en') {
$k=Blog::find()
->orderBy(['created_at' => SORT_DESC])
->limit(20)
->groupBy(['tag_en'])
->all();
}
$j=Categoryblogs::find()
->limit(15)
->all();
$a=Carousel::find()->one();
$o=Sentence::find()->all();
return $this->render("blog",['items'=>$items,'pages'=>$pages,'b'=>$b,'k'=>$k,'j'=>$j,'o'=>$o,'a'=>$a]);
}
public function actionBlogSingle()
{
$this->layout="shablon";
$id=Yii::$app->request->get('id');
if($id){
$c=Blog::findOne("$id");
}
else{
$c=Blog::find()
->orderBy(['created_at' => SORT_DESC])->one();
}
if (Yii::$app->language=='uz') {
$k=Blog::find()
->orderBy(['created_at' => SORT_DESC])
->limit(20)
->groupBy(['tag_uz'])
->all();
}
if (Yii::$app->language=='ru') {
$k=Blog::find()
->orderBy(['created_at' => SORT_DESC])
->limit(20)
->groupBy(['tag_ru'])
->all();
}if (Yii::$app->language=='en') {
$k=Blog::find()
->orderBy(['created_at' => SORT_DESC])
->limit(20)
->groupBy(['tag_en'])
->all();
}
$j=Categoryblogs::find()
->limit(15)
->all();
$a=Carousel::find()->one();
$o=Sentence::find()->all();
return $this->render("blog_single",['c'=>$c,'id'=>$id,'j'=>$j,'k'=>$k,'o'=>$o,'a'=>$a]);
}
public function actionTeachers()
{
$this->layout="shablon";
$o=Sentence::find()->all();
$p=Teacher::find();
$pages = new Pagination(['totalCount' => $p->count(),
'defaultPageSize'=>8,]);
$items = $p->offset($pages->offset)
->limit($pages->limit)
->all();
$a=Carousel::find()->one();
return $this->render("teachers",['o'=>$o,'p'=>$p,'pages'=>$pages,'items'=>$items,'a'=>$a]);
}
public function actionContact()
{
$this->layout="shablon";
$o=Sentence::find()->all();
$a=Carousel::find()->one();
return $this->render("contact",['o'=>$o,'a'=>$a]);
}
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'only' => ['logout', 'signup'],
'rules' => [
[
'actions' => ['signup'],
'allow' => true,
'roles' => ['?'],
],
[
'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,
],
];
}
/**
* Displays homepage.
*
* @return mixed
*/
}
|
|
Bosh sahifa
Aloqalar
Bosh sahifa
O'zbekiston respublikasi raqamli texnologiyalar vazirligi muxammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universiteti
|