From 5e06c10ef907249cabae7200cf9d8ca9cbf26e7c Mon Sep 17 00:00:00 2001 From: Awilum Date: Wed, 15 Jan 2014 00:39:00 +0200 Subject: [PATCH] Users Plugin: Improvements --- plugins/box/users/users.admin.php | 9 -- plugins/box/users/users.plugin.php | 8 +- plugins/box/users/views/backend/add.view.php | 94 +++++++++---------- plugins/box/users/views/backend/edit.view.php | 7 +- .../box/users/views/backend/index.view.php | 2 +- 5 files changed, 56 insertions(+), 64 deletions(-) diff --git a/plugins/box/users/users.admin.php b/plugins/box/users/users.admin.php index c72e7cc..7611422 100755 --- a/plugins/box/users/users.admin.php +++ b/plugins/box/users/users.admin.php @@ -1,14 +1,5 @@

+ ); +?>
-
- (isset($errors['users_this_user_alredy_exists']) || isset($errors['users_empty_login'])) ? 'form-control error-field' : 'form-control')) - ); +
+ (isset($errors['users_this_user_alredy_exists']) || isset($errors['users_empty_login'])) ? 'form-control error-field' : 'form-control')) + ); - if (isset($errors['users_this_user_alredy_exists'])) echo ''.$errors['users_this_user_alredy_exists'].''; - if (isset($errors['users_empty_login'])) echo ''.$errors['users_empty_login'].''; - ?> -
+ if (isset($errors['users_this_user_alredy_exists'])) echo ''.$errors['users_this_user_alredy_exists'].''; + if (isset($errors['users_empty_login'])) echo ''.$errors['users_empty_login'].''; + ?> +
-
- (isset($errors['users_empty_password'])) ? 'form-control error-field' : 'form-control')) - ); - if (isset($errors['users_empty_password'])) echo ''.$errors['users_empty_password'].''; - ?> -
+
+ (isset($errors['users_empty_password'])) ? 'form-control error-field' : 'form-control')) + ); + if (isset($errors['users_empty_password'])) echo ''.$errors['users_empty_password'].''; + ?> +
-
- + (isset($errors['users_this_email_alredy_exists']) || isset($errors['users_empty_email'])) ? 'form-control error-field' : 'form-control')) - ); + echo ( + Form::label('email', __('Email', 'users')). + Form::input('email', null, array('class' => (isset($errors['users_this_email_alredy_exists']) || isset($errors['users_empty_email'])) ? 'form-control error-field' : 'form-control')) + ); - if (isset($errors['users_this_email_alredy_exists'])) echo ''.$errors['users_this_email_alredy_exists'].''; - if (isset($errors['users_empty_email'])) echo ''.$errors['users_empty_email'].''; - ?> -
-
- __('Admin', 'users'), 'editor' => __('Editor', 'users'), 'user' => __('User', 'users')), null, array('class' => 'form-control')) - ); - ?> -
- 'btn btn-primary')).Html::nbsp(2). - Html::anchor(__('Cancel', 'users'), 'index.php?id=users', array('title' => __('Cancel', 'users'), 'class' => 'btn btn-default')). - Form::close() - ); - ?> -
+ if (isset($errors['users_this_email_alredy_exists'])) echo ''.$errors['users_this_email_alredy_exists'].''; + if (isset($errors['users_empty_email'])) echo ''.$errors['users_empty_email'].''; + ?> +
+
+ __('Admin', 'users'), 'editor' => __('Editor', 'users'), 'user' => __('User', 'users')), null, array('class' => 'form-control')) + ); + ?> +
+ 'btn btn-primary')).Html::nbsp(2). + Html::anchor(__('Cancel', 'users'), 'index.php?id=users', array('title' => __('Cancel', 'users'), 'class' => 'btn btn-default')). + Form::close() + ); + ?> \ No newline at end of file diff --git a/plugins/box/users/views/backend/edit.view.php b/plugins/box/users/views/backend/edit.view.php index f27a340..205bfba 100644 --- a/plugins/box/users/views/backend/edit.view.php +++ b/plugins/box/users/views/backend/edit.view.php @@ -16,7 +16,7 @@ Form::hidden('user_id', Request::get('user_id')) ); - if (isset($_SESSION['user_role']) && in_array($_SESSION['user_role'], array('admin'))) { + if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) { ?>
-
'btn btn-primary')); ?> 'btn btn-danger', 'onclick' => "return confirmDelete('".__('Delete user: :user', 'users', array(':user' => Html::toText($user['login'])))."')"));