Skip to content

Commit

Permalink
Added separate theme asset manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammy Barasa committed Mar 6, 2017
1 parent fa98c3e commit ee58aac
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
9 changes: 8 additions & 1 deletion components/AccountStates.php → components/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@
* Date: 3/5/2017
* Time: 02:44
*/
class AccountStates
class Constants
{
//Account Status
const NOT_ACTIVATED = 'NOT ACTIVATED';
const ACTIVATED = 'ACTIVATED';
const SUSPENDED = 'SUSPENDED';
const CLOSED = 'CLOSED';

//Files privacy
/**
* Indicates if a file is private or public
*/
const FILE_PRIVACY = ['PRIVATE' => 1, 'PUBLIC' => 0];
}
4 changes: 2 additions & 2 deletions models/LoginModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace app\models;


use app\components\AccountStates;
use app\components\Constants;
use app\modules\user\models\AuthenticationModel;
use app\modules\user\models\ProfileModel;
use yii\web\IdentityInterface;
Expand Down Expand Up @@ -79,7 +79,7 @@ public static function findByUsername($username)
->select(['USER_ID', 'USER_NAME'])//select only specific fields
->where(['USER_NAME' => $username])
->orWhere(['EMAIL_ADDRESS' => $username])
//->andWhere(['ACCOUNT_STATUS' => AccountStates::NOT_ACTIVATED])
//->andWhere(['ACCOUNT_STATUS' => Constants::NOT_ACTIVATED])
->one();
if ($userModel != null) {
$account_found = static::findOne(['USER_ID' => $userModel->USER_ID]);
Expand Down
1 change: 0 additions & 1 deletion modules/user/controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function actionIndex()

/**
* Displays a single UserProfile model.
* @param integer $id
* @return mixed
*/
public function actionView()
Expand Down
4 changes: 2 additions & 2 deletions modules/user/models/ProfileModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace app\modules\user\models;

use app\components\AccountStates;
use app\components\Constants;
use Yii;
use yii\db\ActiveRecord;
use yii\db\Expression;
Expand Down Expand Up @@ -81,7 +81,7 @@ public function beforeSave($insert)
if (parent::beforeSave($insert)) {
if ($this->isNewRecord) {
$this->DATE_REGISTERED = $date;
$this->ACCOUNT_STATUS = AccountStates::NOT_ACTIVATED;
$this->ACCOUNT_STATUS = Constants::NOT_ACTIVATED;
//these belong to another model
$this->ACCOUNT_AUTH_KEY = \Yii::$app->security->generateRandomString();
$this->PASSWORD = sha1($this->PASSWORD); //hash the user password
Expand Down
7 changes: 4 additions & 3 deletions modules/user/views/uploads/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<?php $form = ActiveForm::begin(); ?>

<?= $form->field($model, 'USER_ID')->textInput() ?>
<?= $form->field($model, 'USER_ID')->hiddenInput()->label(false) ?>

<?= $form->field($model, 'FILE_SELECTOR')->widget(\kartik\file\FileInput::className(), [
'options' => [
Expand All @@ -24,7 +24,7 @@
'maxFileCount' => 10,
'uploadAsync' => true,
'showPreview' => false,
//'showUpload' => false,
'showUpload' => true,
'uploadExtraData' => [
'USER_ID' => $model->USER_ID,
'_csrf' => Yii::$app->request->csrfToken
Expand All @@ -40,7 +40,8 @@
]); ?>
<?= $form->field($model, 'FILE_PATH')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'COMMENTS')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'PUBLICLY_AVAILABLE')->textInput() ?>

<?= $form->field($model, 'PUBLICLY_AVAILABLE')->dropDownList(\app\components\Constants::FILE_PRIVACY) ?>

<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
Expand Down

0 comments on commit ee58aac

Please sign in to comment.