Esempio n. 1
0
 private function _getRoles()
 {
     $roles = array();
     foreach (Role::getAll(true, null, DaoQuery::DEFAUTL_PAGE_SIZE, array('r.name' => 'asc')) as $role) {
         $roles[] = $role->getJson();
     }
     return $roles;
 }
 public function getDropDownArray()
 {
     $roles = Role::getAll();
     $rolesData = array();
     foreach ($roles as $role) {
         $rolesData[$role->id] = strval($role);
     }
     return $rolesData;
 }
Esempio n. 3
0
 /**
  * Display the main page of the permission settings
  */
 public function index()
 {
     $permissionGroups = Permission::getAllGroupByPlugin();
     $example = isset($this->roleId) ? array('roleId' => $this->roleId) : array();
     $data = RolePermission::getListByExample(new DBExample($example));
     $values = array();
     foreach ($data as $value) {
         $values[$value->permissionId][$value->roleId] = $value->value;
     }
     $roles = isset($this->roleId) ? array(Role::getById($this->roleId)) : Role::getAll(null, array(), array(), true);
     $param = array('id' => 'permissions-form', 'fieldsets' => array('form' => array(), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get('main.valid-button'))))));
     foreach ($roles as $role) {
         foreach ($permissionGroups as $group => $permissions) {
             if (Plugin::get($group)) {
                 foreach ($permissions as $permission) {
                     if ($role->id == Role::ADMIN_ROLE_ID) {
                         $default = 1;
                     } elseif (isset($values[$permission->id][$role->id])) {
                         $default = $values[$permission->id][$role->id];
                     } else {
                         $default = 0;
                     }
                     $param['fieldsets']['form'][] = new CheckboxInput(array('name' => "permission-{$permission->id}-{$role->id}", 'disabled' => $role->id == Role::ADMIN_ROLE_ID || $role->id == Role::GUEST_ROLE_ID && !$permission->availableForGuests, 'default' => $default, 'class' => $permission->id == Permission::ALL_PRIVILEGES_ID ? 'select-all' : '', 'nl' => false));
                 }
             }
         }
     }
     $form = new Form($param);
     if (!$form->submitted()) {
         $page = View::make(Plugin::current()->getView("permissions.tpl"), array('permissions' => $permissionGroups, 'fields' => $form->inputs, 'roles' => $roles));
         return NoSidebarTab::make(array('icon' => 'unlock-alt', 'title' => Lang::get('permissions.page-title'), 'page' => $form->wrap($page)));
     } else {
         try {
             foreach ($form->inputs as $name => $field) {
                 if (preg_match('/^permission\\-(\\d+)\\-(\\d+)$/', $name, $match)) {
                     $permissionId = $match[1];
                     $roleId = $match[2];
                     $value = App::request()->getBody($name) ? 1 : 0;
                     if ($roleId != Role::ADMIN_ROLE_ID && !($roleId == Role::GUEST_ROLE_ID && !$permission->availableForGuests)) {
                         $permission = new RolePermission();
                         $permission->set(array('roleId' => $roleId, 'permissionId' => $permissionId, 'value' => $value));
                         $permission->save();
                     }
                 }
             }
             App::logger()->info('Permissions were succesfully updated');
             return $form->response(Form::STATUS_SUCCESS, Lang::get("roles.permissions-update-success"));
         } catch (Exception $e) {
             App::logger()->error('An error occured while updating permissions');
             return $form->response(Form::STATUS_ERROR, DEBUG_MODE ? $e->getMessage() : Lang::get("roles.permissions-update-error"));
         }
     }
 }
 /**
  * @depends testGetRole
  */
 public function testListRoles()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $authenticationData = $this->login();
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     $roles = Role::getAll();
     $compareData = array();
     foreach ($roles as $role) {
         $compareData[] = $this->getModelToApiDataUtilData($role);
     }
     //Test List
     $response = $this->createApiCallWithRelativeUrl('list/', 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(count($roles), count($response['data']['items']));
     $this->assertEquals(count($roles), $response['data']['totalCount']);
     $this->assertEquals(1, $response['data']['currentPage']);
     $this->assertEquals($compareData, $response['data']['items']);
 }
Esempio n. 5
0
 /**
  * Create or edit an user
  */
 public function edit()
 {
     $roles = array_map(function ($role) {
         return $role->getLabel();
     }, Role::getAll('id'));
     $user = User::getByUsername($this->username);
     $param = array('id' => 'user-form', 'upload' => true, 'model' => 'User', 'reference' => array('username' => $this->username), 'fieldsets' => array('general' => array('nofieldset' => true, new TextInput(array('name' => 'username', 'required' => true, 'unique' => true, 'readonly' => $user && $user->id !== App::session()->getUser()->id, 'insert' => !$user || $user->id === App::session()->getUser()->id, 'label' => Lang::get($this->_plugin . '.user-form-username-label'))), new EmailInput(array('name' => 'email', 'required' => true, 'unique' => true, 'readonly' => $user && $user->id !== App::session()->getUser()->id, 'insert' => !$user || $user->id !== App::session()->getUser()->id, 'label' => Lang::get($this->_plugin . '.user-form-email-label'))), new CheckboxInput(array('name' => 'active', 'label' => Lang::get($this->_plugin . '.user-form-active-label'))), new SelectInput(array('name' => 'roleId', 'options' => $roles, 'label' => Lang::get($this->_plugin . '.user-form-roleId-label'))), $user ? null : new PasswordInput(array('name' => 'password', 'required' => true, 'label' => Lang::get($this->_plugin . '.user-form-password-label'), 'encrypt' => array('Hawk\\Crypto', 'saltHash'))), $user ? null : new PasswordInput(array('name' => 'passagain', 'label' => Lang::get($this->_plugin . '.user-form-passagain-label'), 'required' => true, 'compare' => 'password', 'independant' => true)), new HiddenInput(array('name' => 'createTime', 'default' => time()))), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get('main.valid-button'))), new DeleteInput(array('name' => 'delete', 'value' => Lang::get('main.delete-button'), 'notDisplayed' => !($user && $user->isRemovable()))), new ButtonInput(array('name' => 'cancel', 'value' => Lang::get('main.cancel-button'), 'onclick' => 'app.dialog("close")')))), 'onsuccess' => 'app.dialog("close"); app.lists["admin-users-list"].refresh();');
     $form = new Form($param);
     if (!$form->submitted()) {
         return View::make(Theme::getSelected()->getView("dialogbox.tpl"), array('page' => $form, 'title' => Lang::get($this->_plugin . '.user-form-title'), 'icon' => 'user'));
     } else {
         if ($form->submitted() == "delete") {
             $this->remove();
         } else {
             if ($form->check()) {
                 return $form->register();
             }
         }
     }
 }
 public function overwriteForm($return, $returnfull)
 {
     $r = new Role();
     $arr = $r->getAll();
     foreach ($arr as $rol) {
         if ($rol->role_active) {
             $arrNew[$rol->role_id] = $rol->role_id;
         }
     }
     $acc = new Account();
     $acc->default_read_coloms = "admin_id,admin_nama_depan,admin_aktiv";
     $arr = $acc->getAll();
     foreach ($arr as $ac) {
         if ($ac->admin_aktiv) {
             $arrNew2[$ac->admin_id] = $ac->admin_id . " - " . $ac->admin_nama_depan;
         }
     }
     $return['role_admin_id'] = new Leap\View\InputSelect($arrNew2, "role_admin_id", "role_admin_id", $this->role_admin_id);
     $return['role_id'] = new Leap\View\InputSelect($arrNew, "role_id", "role_id", $this->role_id);
     $return['account_username'] = new Leap\View\InputText("hidden", "account_username", "account_username", $this->account_username);
     return $return;
 }
 public function overwriteForm($return, $returnfull)
 {
     $r = new Role();
     $arr = $r->getAll();
     foreach ($arr as $rol) {
         if ($rol->role_active) {
             $arrNew[$rol->role_id] = $rol->role_id;
         }
     }
     $return['role_big'] = new Leap\View\InputSelect($arrNew, "role_big", "role_big", $this->role_big);
     $return['role_small'] = new Leap\View\InputSelect($arrNew, "role_small", "role_small", $this->role_small);
     return $return;
 }
Esempio n. 8
0
								<td><label for="address">Dirección</label></td>
								<td><input type="text" name="address" id="address" class="inputbox required address" value="<?php 
echo $u->prepareAddress();
?>
" /></td>
								<td><label for="password">Contraseña</label></td>
								<td><input type="password" name="password" id="password" class="inputbox" /></td>
							</tr>
							
							<tr>
								<td><label for="role">Rol</label></td>
								<td>
									<select id="role" name="role">
										<option value="0">Rol</option>
										<?php 
$roles = Role::getAll();
foreach ($roles as $item) {
    if ($item->getIdRole() == 1 && !fAuthorization::checkAuthLevel('super')) {
        continue;
    }
    if ($item->getIdRole() != $u->getIdRole()) {
        ?>
										<option value="<?php 
        echo $item->getIdRole();
        ?>
"><?php 
        echo $item->prepareName();
        ?>
</option>
										<?php 
    } else {
 protected static function rebuildViaSlowWay($modelClassName)
 {
     // The slow way will remain here as documentation
     // for what the optimized way is doing.
     $mungeTableName = self::getMungeTableName($modelClassName);
     self::recreateTable($mungeTableName);
     //Specifically call RedBeanModel to avoid the use of the security in OwnedSecurableItem since for
     //rebuild it needs to look at all models regardless of permissions of the current user.
     $modelCount = RedBeanModel::getCount(null, null, $modelClassName);
     $subset = intval($modelCount / 20);
     if ($subset < 100) {
         $subset = 100;
     } elseif ($subset > 1000) {
         $subset = 1000;
     }
     $users = User::getAll();
     $groups = Group::getAll();
     $roles = Role::getAll();
     for ($i = 0; $i < $modelCount; $i += $subset) {
         //Specifically call RedBeanModel to avoid the use of the security in OwnedSecurableItem since for
         //rebuild it needs to look at all models regardless of permissions of the current user.
         $models = RedBeanModel::getSubset(null, $i, $subset, null, null, $modelClassName);
         foreach ($models as $model) {
             assert('$model instanceof SecurableItem');
             $securableItemId = $model->getClassId('SecurableItem');
             foreach ($users as $user) {
                 list($allowPermissions, $denyPermissions) = $model->getExplicitActualPermissions($user);
                 $effectiveExplicitPermissions = $allowPermissions & ~$denyPermissions;
                 if (($effectiveExplicitPermissions & Permission::READ) == Permission::READ) {
                     self::incrementCount($mungeTableName, $securableItemId, $user);
                 }
             }
             foreach ($groups as $group) {
                 list($allowPermissions, $denyPermissions) = $model->getExplicitActualPermissions($group);
                 $effectiveExplicitPermissions = $allowPermissions & ~$denyPermissions;
                 if (($effectiveExplicitPermissions & Permission::READ) == Permission::READ) {
                     self::incrementCount($mungeTableName, $securableItemId, $group);
                     foreach ($group->users as $user) {
                         if ($user->role->id > 0) {
                             self::incrementParentRolesCounts($mungeTableName, $securableItemId, $user->role);
                         }
                     }
                     foreach ($group->groups as $subGroup) {
                         self::processNestedGroupWhereParentHasReadPermissionOnSecurableItem($mungeTableName, $securableItemId, $subGroup);
                     }
                 }
             }
             foreach ($roles as $role) {
                 $count = self::getRoleMungeCount($model, $role);
                 assert('$count >= 0');
                 if ($count > 0) {
                     self::setCount($mungeTableName, $securableItemId, $role, $count);
                 }
             }
         }
     }
 }
Esempio n. 10
0
 protected function renderModalList($modalViewName, $pageTitle)
 {
     $rolesModalTreeView = new $modalViewName($this->getId(), $this->getModule()->getId(), $_GET['modalTransferInformation']['sourceModelId'], Role::getAll('name'), $_GET['modalTransferInformation']['sourceIdFieldId'], $_GET['modalTransferInformation']['sourceNameFieldId'], $_GET['modalTransferInformation']['modalId']);
     Yii::app()->getClientScript()->setToAjaxMode();
     $view = new ModalView($this, $rolesModalTreeView);
     return $view->render();
 }
Esempio n. 11
0
 /**
  * Edit a profile question
  */
 public function edit()
 {
     $q = ProfileQuestion::getByName($this->name);
     $roles = Role::getAll();
     // Get roles associate to this ProfileQuestion in json parameters
     if ($q) {
         $attributesRoles = $q->getRoles();
     } else {
         $attributesRoles = array();
     }
     $allowedTypes = ProfileQuestion::$allowedTypes;
     $param = array('id' => 'profile-question-form', 'model' => 'ProfileQuestion', 'reference' => array('name' => $this->name), 'labelWidth' => '200px', 'fieldsets' => array('general' => array('legend' => Lang::get($this->_plugin . '.profile-question-form-general-legend'), new TextInput(array('name' => 'name', 'unique' => true, 'maxlength' => 32, 'label' => Lang::get($this->_plugin . '.profile-question-form-name-label') . ' ' . Lang::get($this->_plugin . '.profile-question-form-name-description'), 'required' => true)), new SelectInput(array('name' => 'type', 'required' => true, 'options' => array_combine($allowedTypes, array_map(function ($type) {
         return Lang::get($this->_plugin . '.profile-question-form-type-' . $type);
     }, $allowedTypes)), 'label' => Lang::get($this->_plugin . '.profile-question-form-type-label'), 'attributes' => array('e-value' => 'type'))), new CheckboxInput(array('name' => 'displayInRegister', 'label' => Lang::get($this->_plugin . '.profile-question-form-displayInRegister-label'))), new CheckboxInput(array('name' => 'displayInProfile', 'label' => Lang::get($this->_plugin . '.profile-question-form-displayInProfile-label'))), new HiddenInput(array('name' => 'editable', 'value' => 1))), 'parameters' => array('legend' => Lang::get($this->_plugin . '.profile-question-form-parameters-legend'), new ObjectInput(array('name' => 'parameters', 'id' => 'question-form-parameters', 'hidden' => true, 'attributes' => array('e-value' => 'parameters'))), new CheckboxInput(array('name' => 'required', 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-required-label'), 'attributes' => array('e-value' => "required"))), new CheckboxInput(array('name' => 'readonly', 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-readonly-label'), 'attributes' => array('e-value' => "readonly"))), new DatetimeInput(array('name' => 'minDate', 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-minDate-label'), 'attributes' => array('e-value' => "minDate"))), new DatetimeInput(array('name' => 'maxDate', 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-maxDate-label'), 'attributes' => array('e-value' => "maxDate"))), new HtmlInput(array('name' => 'parameters-description', 'value' => '<p class="alert alert-info">' . Icon::make(array('icon' => 'exclamation-circle')) . Lang::get($this->_plugin . '.profile-question-form-translation-description') . '</p>')), new TextInput(array('name' => 'label', 'required' => true, 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-label-label'), 'default' => $this->name != '_new' ? Lang::get($this->_plugin . '.profile-question-' . $this->name . '-label') : '')), new TextareaInput(array('name' => 'options', 'independant' => true, 'required' => App::request()->getBody('type') == 'select' || App::request()->getBody('type') == 'radio', 'label' => Lang::get($this->_plugin . '.profile-question-form-options-label') . '<br />' . Lang::get($this->_plugin . '.profile-question-form-options-description'), 'labelClass' => 'required', 'attributes' => array('e-value' => "options"), 'cols' => 20, 'rows' => 10))), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get('main.valid-button'))), new DeleteInput(array('name' => 'delete', 'value' => Lang::get('main.delete-button'), 'notDisplayed' => $this->name == '_new')), new ButtonInput(array('name' => 'cancel', 'value' => Lang::get('main.cancel-button'), 'onclick' => 'app.dialog("close")')))), 'onsuccess' => 'app.dialog("close"); app.load(app.getUri("profile-questions"), {selector : "#admin-questions-tab"})');
     $form = new Form($param);
     if (!$form->submitted()) {
         $this->addJavaScript($this->getPlugin()->getJsUrl('question-form.js'));
         $content = View::make(Plugin::current()->getView("question-form.tpl"), array('form' => $form));
         return View::make(Theme::getSelected()->getView("dialogbox.tpl"), array('title' => Lang::get($this->_plugin . ".users-questions-title"), 'icon' => 'file-word-o', 'page' => $content));
     } else {
         if ($form->submitted() == "delete") {
             $this->delete();
             return $form->response(Form::STATUS_SUCCESS);
         } else {
             if ($form->check()) {
                 $form->register(Form::NO_EXIT);
                 Language::current()->saveTranslations(array('admin' => array('profile-question-' . $form->getData("name") . '-label' => App::request()->getBody('label'))));
                 // Create the lang options
                 if ($form->inputs['options']->required) {
                     $keys = array('admin' => array());
                     foreach (explode(PHP_EOL, $form->getData("options")) as $i => $option) {
                         if (!empty($option)) {
                             $keys['admin']['profile-question-' . $form->getData("name") . '-option-' . $i] = trim($option);
                         }
                     }
                     Language::current()->saveTranslations($keys);
                 }
                 return $form->response(Form::STATUS_SUCCESS);
             }
         }
     }
 }
Esempio n. 12
0
 /**
  * Add a new permission in the database
  *
  * @param string $name               The permission name, formatted as "<plugin>.<key>"
  * @param int    $default            The default value for this permission
  * @param int    $availableForGuests Defines if the permission can be set to true for guest users
  *
  * @return Permission The created permission
  */
 public static function add($name, $default = 1, $availableForGuests = 0)
 {
     list($plugin, $key) = explode('.', $name);
     $permission = parent::add(array('plugin' => $plugin, 'key' => $key, 'availableForGuests' => $availableForGuests));
     $roles = Role::getAll();
     foreach ($roles as $role) {
         $value = $role->id == Role::GUEST_ROLE_ID ? $availableForGuests ? $default : 0 : $default;
         RolePermission::add(array('roleId' => $role->id, 'permissionId' => $permission->id, 'value' => $value));
     }
     return $permission;
 }
Esempio n. 13
0
echo $form->labelEx($model, 'middlename');
?>
        <?php 
echo $form->textField($model, 'middlename', array('size' => 60, 'maxlength' => 128));
?>
        <?php 
echo $form->error($model, 'middlename');
?>
    </div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'setRole');
?>
        <?php 
echo $form->dropDownList($model, 'setRole', Role::getAll());
?>
        <?php 
echo $form->error($model, 'setRole');
?>
    </div>

    <div id="showFormStudent">
        <div class="row">
        <?php 
echo $form->labelEx($student, 'id_specialty');
?>
        <?php 
echo $form->dropDownList($student, 'id_specialty', Specialty::getAll(), array('empty' => 'Выберите специальность'));
?>
        <?php 
Esempio n. 14
0
 /**
  * Create or edit an user
  */
 public function edit()
 {
     $user = App::session()->getUser();
     $roles = array_map(function ($role) {
         return $role->getLabel();
     }, Role::getAll('id'));
     $param = array('id' => 'user-profile-form', 'upload' => true, 'object' => $user, 'fieldsets' => array('general' => array('legend' => Lang::get('admin.user-form-general-legend'), new TextInput(array('name' => 'username', 'required' => true, 'label' => Lang::get('admin.user-form-username-label'), 'disabled' => true)), new EmailInput(array('name' => 'email', 'required' => true, 'label' => Lang::get('admin.user-form-email-label')))), 'profile' => array('legend' => Lang::get('admin.user-form-profile-legend')), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get($this->_plugin . '.valid-button'))))), 'onsuccess' => 'app.dialog("close")');
     // Get the user profile questions
     $questions = ProfileQuestion::getAll('name', array(), array('order' => DB::SORT_ASC));
     // Generate the question fields
     foreach ($questions as $question) {
         if ($question->displayInProfile && $question->isAllowedForRole($user->roleId)) {
             $classname = '\\Hawk\\' . ucwords($question->type) . 'Input';
             $field = json_decode($question->parameters, true);
             $field['name'] = $question->name;
             $field['id'] = 'user-form-' . $question->name . '-input';
             $field['independant'] = true;
             $field['label'] = Lang::get('admin.profile-question-' . $question->name . '-label');
             if (isset($field['readonly'])) {
                 if ($field['readonly']) {
                     $field['required'] = false;
                 }
             }
             if ($user) {
                 if ($question->type == "file") {
                     $field['after'] = sprintf('<img src="%s" class="profile-image" />', $user->getProfileData($question->name) ? $user->getProfileData($question->name) : '');
                 } else {
                     $field['default'] = $user->getProfileData($question->name);
                 }
             }
             if ($question->name == 'language') {
                 // Get language options
                 $languages = Language::getAllActive();
                 $options = array();
                 foreach ($languages as $language) {
                     $options[$language->tag] = $language->label;
                 }
                 $field['options'] = $options;
                 if (!$field['default']) {
                     $field['default'] = Option::get($this->_plugin . '.language');
                 }
             }
             $param['fieldsets']['profile'][] = new $classname($field);
         }
     }
     $form = new Form($param);
     if (!$form->submitted()) {
         return NoSidebarTab::make(array('title' => Lang::get('admin.user-form-title'), 'page' => array('content' => $form)));
     } else {
         try {
             foreach ($questions as $question) {
                 if ($question->displayInProfile && $question->isAllowedForRole($user->roleId)) {
                     if ($question->type === 'file') {
                         $upload = Upload::getInstance($question->name);
                         if ($upload) {
                             $file = $upload->getFile(0);
                             $dir = Plugin::current()->getPublicUserfilesDir() . 'img/';
                             $url = Plugin::current()->getUserfilesUrl() . 'img/';
                             if (!is_dir($dir)) {
                                 mkdir($dir, 0755, true);
                             }
                             $basename = uniqid() . $file->extension;
                             $upload->move($file, $dir, $basename);
                             $user->setProfileData($question->name, $url . $basename);
                         }
                     } else {
                         $user->setProfileData($question->name, $form->inputs[$question->name]->dbvalue());
                     }
                 }
             }
             $user->saveProfile();
             if ($form->getData('email') !== $user->email) {
                 // The user asked to reset it email
                 // Check this email is not used by another user on the application
                 $existingUser = User::getByExample(new DBExample(array('id' => array('$ne' => $user->id), 'email' => $form->getData('email'))));
                 if ($existingUser) {
                     return $form->response(Form::STATUS_CHECK_ERROR, Lang::get($this->_plugin . '.reset-email-already-used'));
                 }
                 // Send the email to validate the new email
                 // Create the token to validate the new email
                 $tokenData = array('userId' => $user->id, 'currentEmail' => $user->email, 'newEmail' => $form->getData('email'), 'createTime' => time());
                 $token = base64_encode(Crypto::aes256Encode(json_encode($tokenData)));
                 // Create the email content
                 $emailContent = View::make($this->getPlugin()->getView('change-email-validation.tpl'), array('sitename' => Option::get($this->_plugin . '.sitename'), 'validationUrl' => App::router()->getUrl('validate-new-email', array('token' => $token))));
                 $email = new Mail();
                 $email->to($form->getData('email'))->from(Option::get('main.mailer-from'), Option::get('main.mailer-from-name'))->title(Lang::get($this->_plugin . '.reset-email-title', array('sitename' => Option::get($this->_plugin . '.sitename'))))->content($emailContent)->subject(Lang::get($this->_plugin . '.reset-email-title', array('sitename' => Option::get($this->_plugin . '.sitename'))))->send();
                 return $form->response(Form::STATUS_SUCCESS, Lang::get($this->_plugin . '.user-profile-update-success-with-email'));
             }
             return $form->response(Form::STATUS_SUCCESS, Lang::get($this->_plugin . '.user-profile-update-success'));
         } catch (Exception $e) {
             return $form->response(Form::STATUS_ERROR, Lang::get($this->_plugin . '.user-profile-update-error'));
         }
     }
 }
Esempio n. 15
0
	switch( strtolower($user->gender) ){
		case 'm':
			$tmpl->icon = 'user';
			break;
		case 'f':
			$tmpl->icon = 'user-female';
			break;
		default:
			$tmpl->icon = 'user-silhouette';
			break;
	}

	$tmpl->user = $user;
	$tmpl->data = $data;
	$tmpl->roles = Role::toArray(Role::getAll());

	$html = $tmpl->build('account.html');
	$css = $tmpl->build('account.css');
	$js = $tmpl->build('account.js');

	$appContent = array(
						'html'	=>	$html,
						'css'	=>	array(	'code' => $css,
											'link' => 'account'
											),
						'js' => array(	'code' => $js,
										'link' => 'account'
										)
						);