Commit fc4126a3cb68a65474ea930b21015b3d0a73d0cf
1 parent
54f2fc2b
-Some chages
Showing
7 changed files
with
384 additions
and
315 deletions
Show diff stats
composer.json
| ... | ... | @@ -17,7 +17,8 @@ |
| 17 | 17 | "php": ">=5.4.0", |
| 18 | 18 | "yiisoft/yii2": "~2.0.6", |
| 19 | 19 | "yiisoft/yii2-bootstrap": "~2.0.0", |
| 20 | - "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0" | |
| 20 | + "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0", | |
| 21 | + "bower-asset/materialize": "^0.100.2" | |
| 21 | 22 | }, |
| 22 | 23 | "require-dev": { |
| 23 | 24 | "yiisoft/yii2-debug": "~2.0.0", | ... | ... |
composer.lock
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", |
| 5 | 5 | "This file is @generated automatically" |
| 6 | 6 | ], |
| 7 | - "content-hash": "630d5f1d19e73b0163f900453171fba5", | |
| 7 | + "content-hash": "ec09898700dcf10b1fe4b54e61ad8ad4", | |
| 8 | 8 | "packages": [ |
| 9 | 9 | { |
| 10 | 10 | "name": "bower-asset/bootstrap", |
| ... | ... | @@ -70,6 +70,25 @@ |
| 70 | 70 | ] |
| 71 | 71 | }, |
| 72 | 72 | { |
| 73 | + "name": "bower-asset/materialize", | |
| 74 | + "version": "v0.100.2", | |
| 75 | + "source": { | |
| 76 | + "type": "git", | |
| 77 | + "url": "https://github.com/Dogfalo/materialize.git", | |
| 78 | + "reference": "9bc43a1199ad5dfb78d58ba47726ab039218a939" | |
| 79 | + }, | |
| 80 | + "dist": { | |
| 81 | + "type": "zip", | |
| 82 | + "url": "https://api.github.com/repos/Dogfalo/materialize/zipball/9bc43a1199ad5dfb78d58ba47726ab039218a939", | |
| 83 | + "reference": "9bc43a1199ad5dfb78d58ba47726ab039218a939", | |
| 84 | + "shasum": null | |
| 85 | + }, | |
| 86 | + "require": { | |
| 87 | + "bower-asset/jquery": ">=3.0.0,<4.0.0|>=2.1.4,<3.0.0" | |
| 88 | + }, | |
| 89 | + "type": "bower-asset" | |
| 90 | + }, | |
| 91 | + { | |
| 73 | 92 | "name": "bower-asset/punycode", |
| 74 | 93 | "version": "v1.3.2", |
| 75 | 94 | "source": { | ... | ... |
frontend/assets/AppAsset.php
| 1 | +<?php | |
| 2 | + | |
| 3 | + namespace frontend\assets; | |
| 4 | + | |
| 5 | + use yii\web\AssetBundle; | |
| 6 | + | |
| 7 | + class MaterializeAsset extends AssetBundle | |
| 8 | + { | |
| 9 | + public $sourcePath = '@bower/materialize/dist'; | |
| 10 | + | |
| 11 | + public $js = [ | |
| 12 | + 'js/materialize.min.js', | |
| 13 | + ]; | |
| 14 | + | |
| 15 | + public $css = [ | |
| 16 | + 'css/materialize.min.css', | |
| 17 | + ]; | |
| 18 | + } | |
| 19 | + | |
| 0 | 20 | \ No newline at end of file | ... | ... |
frontend/controllers/SiteController.php
| 1 | 1 | <?php |
| 2 | -namespace frontend\controllers; | |
| 3 | - | |
| 4 | -use Yii; | |
| 5 | -use yii\base\InvalidParamException; | |
| 6 | -use yii\web\BadRequestHttpException; | |
| 7 | -use yii\web\Controller; | |
| 8 | -use yii\filters\VerbFilter; | |
| 9 | -use yii\filters\AccessControl; | |
| 10 | -use common\models\LoginForm; | |
| 11 | -use frontend\models\PasswordResetRequestForm; | |
| 12 | -use frontend\models\ResetPasswordForm; | |
| 13 | -use frontend\models\SignupForm; | |
| 14 | -use frontend\models\ContactForm; | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * Site controller | |
| 18 | - */ | |
| 19 | -class SiteController extends Controller | |
| 20 | -{ | |
| 2 | + | |
| 3 | + namespace frontend\controllers; | |
| 4 | + | |
| 5 | + use common\models\Call; | |
| 6 | + use Yii; | |
| 7 | + use yii\base\InvalidParamException; | |
| 8 | + use yii\web\BadRequestHttpException; | |
| 9 | + use yii\web\Controller; | |
| 10 | + use yii\filters\VerbFilter; | |
| 11 | + use yii\filters\AccessControl; | |
| 12 | + use common\models\LoginForm; | |
| 13 | + use frontend\models\PasswordResetRequestForm; | |
| 14 | + use frontend\models\ResetPasswordForm; | |
| 15 | + use frontend\models\SignupForm; | |
| 16 | + use frontend\models\ContactForm; | |
| 17 | + | |
| 21 | 18 | /** |
| 22 | - * {@inheritdoc} | |
| 19 | + * Site controller | |
| 23 | 20 | */ |
| 24 | - public function behaviors() | |
| 21 | + class SiteController extends Controller | |
| 25 | 22 | { |
| 26 | - return [ | |
| 27 | - 'access' => [ | |
| 28 | - 'class' => AccessControl::className(), | |
| 29 | - 'only' => ['logout', 'signup'], | |
| 30 | - 'rules' => [ | |
| 31 | - [ | |
| 32 | - 'actions' => ['signup'], | |
| 33 | - 'allow' => true, | |
| 34 | - 'roles' => ['?'], | |
| 23 | + /** | |
| 24 | + * {@inheritdoc} | |
| 25 | + */ | |
| 26 | + public function behaviors() | |
| 27 | + { | |
| 28 | + return [ | |
| 29 | + 'access' => [ | |
| 30 | + 'class' => AccessControl::className(), | |
| 31 | + // 'only' => ['logout', 'signup'], | |
| 32 | + 'rules' => [ | |
| 33 | + [ | |
| 34 | + 'actions' => [ 'signup' ], | |
| 35 | + 'allow' => true, | |
| 36 | + 'roles' => [ '?' ], | |
| 37 | + ], | |
| 38 | + [ | |
| 39 | + 'actions' => [ | |
| 40 | + 'logout', | |
| 41 | + 'index', | |
| 42 | + 'calls', | |
| 43 | + ], | |
| 44 | + 'allow' => true, | |
| 45 | + 'roles' => [ '@' ], | |
| 46 | + ], | |
| 47 | + [ | |
| 48 | + 'actions' => [ 'login' ], | |
| 49 | + 'allow' => true, | |
| 50 | + // 'roles' => ['*'], | |
| 51 | + ], | |
| 35 | 52 | ], |
| 36 | - [ | |
| 37 | - 'actions' => ['logout'], | |
| 38 | - 'allow' => true, | |
| 39 | - 'roles' => ['@'], | |
| 53 | + ], | |
| 54 | + 'verbs' => [ | |
| 55 | + 'class' => VerbFilter::className(), | |
| 56 | + 'actions' => [ | |
| 57 | + 'logout' => [ 'post' ], | |
| 40 | 58 | ], |
| 41 | 59 | ], |
| 42 | - ], | |
| 43 | - 'verbs' => [ | |
| 44 | - 'class' => VerbFilter::className(), | |
| 45 | - 'actions' => [ | |
| 46 | - 'logout' => ['post'], | |
| 60 | + ]; | |
| 61 | + } | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * {@inheritdoc} | |
| 65 | + */ | |
| 66 | + public function actions() | |
| 67 | + { | |
| 68 | + return [ | |
| 69 | + 'error' => [ | |
| 70 | + 'class' => 'yii\web\ErrorAction', | |
| 47 | 71 | ], |
| 48 | - ], | |
| 49 | - ]; | |
| 50 | - } | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * {@inheritdoc} | |
| 54 | - */ | |
| 55 | - public function actions() | |
| 56 | - { | |
| 57 | - return [ | |
| 58 | - 'error' => [ | |
| 59 | - 'class' => 'yii\web\ErrorAction', | |
| 60 | - ], | |
| 61 | - 'captcha' => [ | |
| 62 | - 'class' => 'yii\captcha\CaptchaAction', | |
| 63 | - 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, | |
| 64 | - ], | |
| 65 | - ]; | |
| 66 | - } | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * Displays homepage. | |
| 70 | - * | |
| 71 | - * @return mixed | |
| 72 | - */ | |
| 73 | - public function actionIndex() | |
| 74 | - { | |
| 75 | - return $this->render('index'); | |
| 76 | - } | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * Logs in a user. | |
| 80 | - * | |
| 81 | - * @return mixed | |
| 82 | - */ | |
| 83 | - public function actionLogin() | |
| 84 | - { | |
| 85 | - if (!Yii::$app->user->isGuest) { | |
| 86 | - return $this->goHome(); | |
| 72 | + 'captcha' => [ | |
| 73 | + 'class' => 'yii\captcha\CaptchaAction', | |
| 74 | + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, | |
| 75 | + ], | |
| 76 | + ]; | |
| 87 | 77 | } |
| 88 | - | |
| 89 | - $model = new LoginForm(); | |
| 90 | - if ($model->load(Yii::$app->request->post()) && $model->login()) { | |
| 91 | - return $this->goBack(); | |
| 92 | - } else { | |
| 93 | - $model->password = ''; | |
| 94 | - | |
| 95 | - return $this->render('login', [ | |
| 96 | - 'model' => $model, | |
| 97 | - ]); | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * Displays homepage. | |
| 81 | + * | |
| 82 | + * @return mixed | |
| 83 | + */ | |
| 84 | + public function actionIndex() | |
| 85 | + { | |
| 86 | + $calls = Call::find() | |
| 87 | + ->all(); | |
| 88 | + return $this->render( | |
| 89 | + 'index', | |
| 90 | + [ | |
| 91 | + 'calls' => $calls, | |
| 92 | + ] | |
| 93 | + ); | |
| 98 | 94 | } |
| 99 | - } | |
| 100 | - | |
| 101 | - /** | |
| 102 | - * Logs out the current user. | |
| 103 | - * | |
| 104 | - * @return mixed | |
| 105 | - */ | |
| 106 | - public function actionLogout() | |
| 107 | - { | |
| 108 | - Yii::$app->user->logout(); | |
| 109 | - | |
| 110 | - return $this->goHome(); | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * Displays contact page. | |
| 115 | - * | |
| 116 | - * @return mixed | |
| 117 | - */ | |
| 118 | - public function actionContact() | |
| 119 | - { | |
| 120 | - $model = new ContactForm(); | |
| 121 | - if ($model->load(Yii::$app->request->post()) && $model->validate()) { | |
| 122 | - if ($model->sendEmail(Yii::$app->params['adminEmail'])) { | |
| 123 | - Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.'); | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Logs in a user. | |
| 98 | + * | |
| 99 | + * @return mixed | |
| 100 | + */ | |
| 101 | + public function actionLogin() | |
| 102 | + { | |
| 103 | + if (!Yii::$app->user->isGuest) { | |
| 104 | + return $this->goHome(); | |
| 105 | + } | |
| 106 | + | |
| 107 | + $model = new LoginForm(); | |
| 108 | + if ($model->load(Yii::$app->request->post()) && $model->login()) { | |
| 109 | + return $this->goBack(); | |
| 124 | 110 | } else { |
| 125 | - Yii::$app->session->setFlash('error', 'There was an error sending your message.'); | |
| 111 | + $model->password = ''; | |
| 112 | + | |
| 113 | + return $this->render( | |
| 114 | + 'login', | |
| 115 | + [ | |
| 116 | + 'model' => $model, | |
| 117 | + ] | |
| 118 | + ); | |
| 126 | 119 | } |
| 127 | - | |
| 128 | - return $this->refresh(); | |
| 129 | - } else { | |
| 130 | - return $this->render('contact', [ | |
| 131 | - 'model' => $model, | |
| 132 | - ]); | |
| 133 | 120 | } |
| 134 | - } | |
| 135 | - | |
| 136 | - /** | |
| 137 | - * Displays about page. | |
| 138 | - * | |
| 139 | - * @return mixed | |
| 140 | - */ | |
| 141 | - public function actionAbout() | |
| 142 | - { | |
| 143 | - return $this->render('about'); | |
| 144 | - } | |
| 145 | - | |
| 146 | - /** | |
| 147 | - * Signs user up. | |
| 148 | - * | |
| 149 | - * @return mixed | |
| 150 | - */ | |
| 151 | - public function actionSignup() | |
| 152 | - { | |
| 153 | - $model = new SignupForm(); | |
| 154 | - if ($model->load(Yii::$app->request->post())) { | |
| 155 | - if ($user = $model->signup()) { | |
| 156 | - if (Yii::$app->getUser()->login($user)) { | |
| 157 | - return $this->goHome(); | |
| 121 | + | |
| 122 | + /** | |
| 123 | + * Logs out the current user. | |
| 124 | + * | |
| 125 | + * @return mixed | |
| 126 | + */ | |
| 127 | + public function actionLogout() | |
| 128 | + { | |
| 129 | + Yii::$app->user->logout(); | |
| 130 | + | |
| 131 | + return $this->goHome(); | |
| 132 | + } | |
| 133 | + | |
| 134 | + /** | |
| 135 | + * Displays contact page. | |
| 136 | + * | |
| 137 | + * @return mixed | |
| 138 | + */ | |
| 139 | + public function actionContact() | |
| 140 | + { | |
| 141 | + $model = new ContactForm(); | |
| 142 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { | |
| 143 | + if ($model->sendEmail(Yii::$app->params[ 'adminEmail' ])) { | |
| 144 | + Yii::$app->session->setFlash( | |
| 145 | + 'success', | |
| 146 | + 'Thank you for contacting us. We will respond to you as soon as possible.' | |
| 147 | + ); | |
| 148 | + } else { | |
| 149 | + Yii::$app->session->setFlash('error', 'There was an error sending your message.'); | |
| 158 | 150 | } |
| 151 | + | |
| 152 | + return $this->refresh(); | |
| 153 | + } else { | |
| 154 | + return $this->render( | |
| 155 | + 'contact', | |
| 156 | + [ | |
| 157 | + 'model' => $model, | |
| 158 | + ] | |
| 159 | + ); | |
| 159 | 160 | } |
| 160 | 161 | } |
| 161 | - | |
| 162 | - return $this->render('signup', [ | |
| 163 | - 'model' => $model, | |
| 164 | - ]); | |
| 165 | - } | |
| 166 | - | |
| 167 | - /** | |
| 168 | - * Requests password reset. | |
| 169 | - * | |
| 170 | - * @return mixed | |
| 171 | - */ | |
| 172 | - public function actionRequestPasswordReset() | |
| 173 | - { | |
| 174 | - $model = new PasswordResetRequestForm(); | |
| 175 | - if ($model->load(Yii::$app->request->post()) && $model->validate()) { | |
| 176 | - if ($model->sendEmail()) { | |
| 177 | - Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); | |
| 178 | - | |
| 179 | - return $this->goHome(); | |
| 180 | - } else { | |
| 181 | - Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for the provided email address.'); | |
| 162 | + | |
| 163 | + /** | |
| 164 | + * Displays about page. | |
| 165 | + * | |
| 166 | + * @return mixed | |
| 167 | + */ | |
| 168 | + public function actionAbout() | |
| 169 | + { | |
| 170 | + return $this->render('about'); | |
| 171 | + } | |
| 172 | + | |
| 173 | + /** | |
| 174 | + * Signs user up. | |
| 175 | + * | |
| 176 | + * @return mixed | |
| 177 | + */ | |
| 178 | + public function actionSignup() | |
| 179 | + { | |
| 180 | + $model = new SignupForm(); | |
| 181 | + if ($model->load(Yii::$app->request->post())) { | |
| 182 | + if ($user = $model->signup()) { | |
| 183 | + if (Yii::$app->getUser() | |
| 184 | + ->login($user)) { | |
| 185 | + return $this->goHome(); | |
| 186 | + } | |
| 187 | + } | |
| 182 | 188 | } |
| 189 | + | |
| 190 | + return $this->render( | |
| 191 | + 'signup', | |
| 192 | + [ | |
| 193 | + 'model' => $model, | |
| 194 | + ] | |
| 195 | + ); | |
| 183 | 196 | } |
| 184 | - | |
| 185 | - return $this->render('requestPasswordResetToken', [ | |
| 186 | - 'model' => $model, | |
| 187 | - ]); | |
| 188 | - } | |
| 189 | - | |
| 190 | - /** | |
| 191 | - * Resets password. | |
| 192 | - * | |
| 193 | - * @param string $token | |
| 194 | - * @return mixed | |
| 195 | - * @throws BadRequestHttpException | |
| 196 | - */ | |
| 197 | - public function actionResetPassword($token) | |
| 198 | - { | |
| 199 | - try { | |
| 200 | - $model = new ResetPasswordForm($token); | |
| 201 | - } catch (InvalidParamException $e) { | |
| 202 | - throw new BadRequestHttpException($e->getMessage()); | |
| 197 | + | |
| 198 | + /** | |
| 199 | + * Requests password reset. | |
| 200 | + * | |
| 201 | + * @return mixed | |
| 202 | + */ | |
| 203 | + public function actionRequestPasswordReset() | |
| 204 | + { | |
| 205 | + $model = new PasswordResetRequestForm(); | |
| 206 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { | |
| 207 | + if ($model->sendEmail()) { | |
| 208 | + Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); | |
| 209 | + | |
| 210 | + return $this->goHome(); | |
| 211 | + } else { | |
| 212 | + Yii::$app->session->setFlash( | |
| 213 | + 'error', | |
| 214 | + 'Sorry, we are unable to reset password for the provided email address.' | |
| 215 | + ); | |
| 216 | + } | |
| 217 | + } | |
| 218 | + | |
| 219 | + return $this->render( | |
| 220 | + 'requestPasswordResetToken', | |
| 221 | + [ | |
| 222 | + 'model' => $model, | |
| 223 | + ] | |
| 224 | + ); | |
| 203 | 225 | } |
| 204 | - | |
| 205 | - if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { | |
| 206 | - Yii::$app->session->setFlash('success', 'New password saved.'); | |
| 207 | - | |
| 208 | - return $this->goHome(); | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * Resets password. | |
| 229 | + * | |
| 230 | + * @param string $token | |
| 231 | + * | |
| 232 | + * @return mixed | |
| 233 | + * @throws BadRequestHttpException | |
| 234 | + */ | |
| 235 | + public function actionResetPassword($token) | |
| 236 | + { | |
| 237 | + try { | |
| 238 | + $model = new ResetPasswordForm($token); | |
| 239 | + } catch (InvalidParamException $e) { | |
| 240 | + throw new BadRequestHttpException($e->getMessage()); | |
| 241 | + } | |
| 242 | + | |
| 243 | + if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { | |
| 244 | + Yii::$app->session->setFlash('success', 'New password saved.'); | |
| 245 | + | |
| 246 | + return $this->goHome(); | |
| 247 | + } | |
| 248 | + | |
| 249 | + return $this->render( | |
| 250 | + 'resetPassword', | |
| 251 | + [ | |
| 252 | + 'model' => $model, | |
| 253 | + ] | |
| 254 | + ); | |
| 209 | 255 | } |
| 210 | - | |
| 211 | - return $this->render('resetPassword', [ | |
| 212 | - 'model' => $model, | |
| 213 | - ]); | |
| 214 | 256 | } |
| 215 | -} | ... | ... |
frontend/views/layouts/main.php
| 1 | 1 | <?php |
| 2 | + | |
| 3 | + /* @var $this \yii\web\View */ | |
| 4 | + | |
| 5 | + /* @var $content string */ | |
| 6 | + | |
| 7 | + use frontend\assets\MaterializeAsset; | |
| 8 | + use yii\helpers\Html; | |
| 9 | + use yii\web\View; | |
| 10 | + use yii\widgets\Breadcrumbs; | |
| 11 | + use frontend\assets\AppAsset; | |
| 12 | + use common\widgets\Alert; | |
| 13 | + | |
| 14 | + AppAsset::register($this); | |
| 15 | + MaterializeAsset::register($this); | |
| 16 | + | |
| 17 | + $js = <<< JS | |
| 18 | +$(".button-collapse").sideNav(); | |
| 19 | +JS; | |
| 20 | + | |
| 21 | + $this->registerJs($js, View::POS_READY); | |
| 2 | 22 | |
| 3 | -/* @var $this \yii\web\View */ | |
| 4 | -/* @var $content string */ | |
| 5 | - | |
| 6 | -use yii\helpers\Html; | |
| 7 | -use yii\bootstrap\Nav; | |
| 8 | -use yii\bootstrap\NavBar; | |
| 9 | -use yii\widgets\Breadcrumbs; | |
| 10 | -use frontend\assets\AppAsset; | |
| 11 | -use common\widgets\Alert; | |
| 12 | - | |
| 13 | -AppAsset::register($this); | |
| 14 | 23 | ?> |
| 15 | 24 | <?php $this->beginPage() ?> |
| 16 | 25 | <!DOCTYPE html> |
| 17 | 26 | <html lang="<?= Yii::$app->language ?>"> |
| 18 | -<head> | |
| 27 | + <head> | |
| 19 | 28 | <meta charset="<?= Yii::$app->charset ?>"> |
| 20 | 29 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 21 | 30 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 22 | - <?= Html::csrfMetaTags() ?> | |
| 31 | + <?= Html::csrfMetaTags() ?> | |
| 23 | 32 | <title><?= Html::encode($this->title) ?></title> |
| 24 | - <?php $this->head() ?> | |
| 25 | -</head> | |
| 26 | -<body> | |
| 27 | -<?php $this->beginBody() ?> | |
| 28 | - | |
| 29 | -<div class="wrap"> | |
| 30 | - <?php | |
| 31 | - NavBar::begin([ | |
| 32 | - 'brandLabel' => Yii::$app->name, | |
| 33 | - 'brandUrl' => Yii::$app->homeUrl, | |
| 34 | - 'options' => [ | |
| 35 | - 'class' => 'navbar-inverse navbar-fixed-top', | |
| 36 | - ], | |
| 37 | - ]); | |
| 38 | - $menuItems = [ | |
| 39 | - ['label' => 'Home', 'url' => ['/site/index']], | |
| 40 | - ['label' => 'About', 'url' => ['/site/about']], | |
| 41 | - ['label' => 'Contact', 'url' => ['/site/contact']], | |
| 42 | - ]; | |
| 43 | - if (Yii::$app->user->isGuest) { | |
| 44 | - $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; | |
| 45 | - $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; | |
| 46 | - } else { | |
| 47 | - $menuItems[] = '<li>' | |
| 48 | - . Html::beginForm(['/site/logout'], 'post') | |
| 49 | - . Html::submitButton( | |
| 50 | - 'Logout (' . Yii::$app->user->identity->username . ')', | |
| 51 | - ['class' => 'btn btn-link logout'] | |
| 52 | - ) | |
| 53 | - . Html::endForm() | |
| 54 | - . '</li>'; | |
| 55 | - } | |
| 56 | - echo Nav::widget([ | |
| 57 | - 'options' => ['class' => 'navbar-nav navbar-right'], | |
| 58 | - 'items' => $menuItems, | |
| 59 | - ]); | |
| 60 | - NavBar::end(); | |
| 61 | - ?> | |
| 62 | - | |
| 63 | - <div class="container"> | |
| 64 | - <?= Breadcrumbs::widget([ | |
| 65 | - 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | |
| 66 | - ]) ?> | |
| 67 | - <?= Alert::widget() ?> | |
| 68 | - <?= $content ?> | |
| 33 | + <?php $this->head() ?> | |
| 34 | + </head> | |
| 35 | + <body> | |
| 36 | + <?php $this->beginBody() ?> | |
| 37 | + | |
| 38 | + <div class="wrap"> | |
| 39 | + | |
| 40 | + <ul id="slide-out" class="side-nav"> | |
| 41 | + <li> | |
| 42 | + <div class="user-view"> | |
| 43 | + <div class="background"> | |
| 44 | + <img src="images/office.jpg"> | |
| 45 | + </div> | |
| 46 | + <a href="#!user"><img class="circle" src="images/yuna.jpg"></a> | |
| 47 | + <a href="#!name"><span class="white-text name">John Doe</span></a> | |
| 48 | + <a href="#!email"><span class="white-text email">jdandturk@gmail.com</span></a> | |
| 49 | + </div> | |
| 50 | + </li> | |
| 51 | + <li><a href="#!"><i class="material-icons">cloud</i>First Link With Icon</a></li> | |
| 52 | + <li><a href="#!">Second Link</a></li> | |
| 53 | + <li> | |
| 54 | + <div class="divider"></div> | |
| 55 | + </li> | |
| 56 | + <li><a class="subheader">Subheader</a></li> | |
| 57 | + <li><a class="waves-effect" href="#!">Third Link With Waves</a></li> | |
| 58 | + </ul> | |
| 59 | + <a href="#" data-activates="slide-out" class="button-collapse"><i class="material-icons">menu</i></a> | |
| 60 | + | |
| 61 | + <div class="container"> | |
| 62 | + <?= Breadcrumbs::widget( | |
| 63 | + [ | |
| 64 | + 'links' => isset($this->params[ 'breadcrumbs' ]) ? $this->params[ 'breadcrumbs' ] : [], | |
| 65 | + ] | |
| 66 | + ) ?> | |
| 67 | + <?= Alert::widget() ?> | |
| 68 | + <?= $content ?> | |
| 69 | + </div> | |
| 69 | 70 | </div> |
| 70 | -</div> | |
| 71 | - | |
| 72 | -<footer class="footer"> | |
| 73 | - <div class="container"> | |
| 74 | - <p class="pull-left">© <?= Html::encode(Yii::$app->name) ?> <?= date('Y') ?></p> | |
| 75 | - | |
| 76 | - <p class="pull-right"><?= Yii::powered() ?></p> | |
| 77 | - </div> | |
| 78 | -</footer> | |
| 79 | - | |
| 80 | -<?php $this->endBody() ?> | |
| 81 | -</body> | |
| 71 | + | |
| 72 | + <footer class="footer"> | |
| 73 | + <div class="container"> | |
| 74 | + <p class="pull-left">© Calls - ArtWeb <?= date('Y') ?></p> | |
| 75 | + </div> | |
| 76 | + </footer> | |
| 77 | + | |
| 78 | + <?php $this->endBody() ?> | |
| 79 | + </body> | |
| 82 | 80 | </html> |
| 83 | 81 | <?php $this->endPage() ?> | ... | ... |
frontend/views/site/index.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -/* @var $this yii\web\View */ | |
| 4 | - | |
| 5 | -$this->title = 'My Yii Application'; | |
| 2 | + | |
| 3 | + /** | |
| 4 | + * @var $this yii\web\View | |
| 5 | + * @var \common\models\Call[] $calls | |
| 6 | + */ | |
| 7 | + | |
| 8 | + $this->title = 'My Yii Application'; | |
| 6 | 9 | ?> |
| 7 | 10 | <div class="site-index"> |
| 8 | - | |
| 9 | - <div class="jumbotron"> | |
| 10 | - <h1>Congratulations!</h1> | |
| 11 | - | |
| 12 | - <p class="lead">You have successfully created your Yii-powered application.</p> | |
| 13 | - | |
| 14 | - <p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p> | |
| 15 | - </div> | |
| 16 | - | |
| 17 | - <div class="body-content"> | |
| 18 | - | |
| 19 | - <div class="row"> | |
| 20 | - <div class="col-lg-4"> | |
| 21 | - <h2>Heading</h2> | |
| 22 | - | |
| 23 | - <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | |
| 24 | - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | |
| 25 | - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
| 26 | - fugiat nulla pariatur.</p> | |
| 27 | - | |
| 28 | - <p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation »</a></p> | |
| 29 | - </div> | |
| 30 | - <div class="col-lg-4"> | |
| 31 | - <h2>Heading</h2> | |
| 32 | - | |
| 33 | - <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | |
| 34 | - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | |
| 35 | - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
| 36 | - fugiat nulla pariatur.</p> | |
| 37 | - | |
| 38 | - <p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum »</a></p> | |
| 39 | - </div> | |
| 40 | - <div class="col-lg-4"> | |
| 41 | - <h2>Heading</h2> | |
| 42 | - | |
| 43 | - <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | |
| 44 | - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | |
| 45 | - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
| 46 | - fugiat nulla pariatur.</p> | |
| 47 | - | |
| 48 | - <p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions »</a></p> | |
| 49 | - </div> | |
| 50 | - </div> | |
| 51 | - | |
| 11 | + | |
| 12 | + <div class="jumbotron"> | |
| 13 | + | |
| 14 | + </div> | |
| 15 | + | |
| 16 | + <div class="body-content"> | |
| 17 | + | |
| 18 | + <div class="row"> | |
| 19 | + <table class="bordered"> | |
| 20 | + <thead> | |
| 21 | + <tr> | |
| 22 | + <th>Company</th> | |
| 23 | + <th>Status</th> | |
| 24 | + <th>Duration</th> | |
| 25 | + </tr> | |
| 26 | + </thead> | |
| 27 | + <tbody> | |
| 28 | + <?php | |
| 29 | + foreach ($calls as $call) { | |
| 30 | + ?> | |
| 31 | + <tr> | |
| 32 | + <td><?= $call->company ?></td> | |
| 33 | + <td><?= $call->status ?></td> | |
| 34 | + <td><?= $call->duration ?></td> | |
| 35 | + </tr> | |
| 36 | + <?php | |
| 37 | + } | |
| 38 | + ?> | |
| 39 | + </tbody> | |
| 40 | + </table> | |
| 52 | 41 | </div> |
| 42 | + | |
| 43 | + </div> | |
| 53 | 44 | </div> | ... | ... |