Example #1
0
 /**
  * Edit User profile
  *
  * @return  void
  */
 public function _default()
 {
     // load dictionaries
     $this->dict->get_wordarray(array('form', 'login', 'users', 'profile'));
     // get object
     $user = new User_model();
     $u = $user->get_by_id($_SESSION['xuid']);
     // build the form
     $fields = array();
     $fields[] = array('label' => null, 'type' => 'hidden', 'value' => $u->id, 'name' => 'id');
     $lmod = new Language_model();
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '<div class="band inner-pad clearfix"><div class="one-half xs-one-whole">');
     $fields[] = array('label' => _LANGUAGE, 'type' => 'select', 'value' => $u->lang, 'options' => array($lmod->get_alanguages(1), 'code', 'language'), 'name' => 'lang', 'extra' => 'class="large"');
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '</div><div class="one-half xs-one-whole">');
     $fields[] = array('label' => _USERNAME, 'type' => 'text', 'value' => $u->username, 'name' => 'username', 'suggestion' => _USERNAME_RULE, 'rule' => 'required|alphanumeric|minlength§5', 'extra' => 'class="large"');
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '</div></div>');
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '<h4 class="acenter">' . _PASSWORD_CHANGE_MSG . '</h4>');
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '<div class="band inner-pad clearfix"><div class="one-half xs-one-whole">');
     $fields[] = array('label' => _PASSWORD, 'type' => 'password', 'value' => '', 'name' => 'password', 'suggestion' => _PASSWORD_RULE, 'rule' => 'alphanumeric|minlength§5', 'extra' => 'class="large"');
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '</div><div class="one-half xs-one-whole">');
     $fields[] = array('label' => _REPEAT_PASSWORD, 'type' => 'password', 'value' => '', 'name' => 'password2', 'rule' => 'equal-password', 'extra' => 'class="large"');
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '</div></div>');
     $fields[] = array('label' => _DESCRIPTION, 'type' => 'textarea', 'value' => $u->description, 'name' => 'description', 'sanitize' => 'string', 'rule' => 'required');
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '<div class="band inner-pad clearfix"><div class="one-half xs-one-whole">');
     $fields[] = array('label' => _EMAIL, 'type' => 'text', 'value' => $u->mail, 'name' => 'mail', 'rule' => 'required|mail', 'extra' => 'class="large"');
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '</div><div class="one-half xs-one-whole">');
     $fields[] = array('label' => _PHONE, 'type' => 'text', 'value' => $u->phone, 'name' => 'phone', 'rule' => 'phone', 'extra' => 'class="large"');
     $fields[] = array('label' => null, 'type' => 'html', 'value' => '</div></div>');
     // if submitted
     if (X4Route_core::$post) {
         $e = X4Validation_helper::form($fields, 'profile');
         if ($e) {
             $this->profiling($_POST);
         } else {
             $this->notice($fields);
         }
         die;
     }
     // get page
     $page = $this->get_page('profile');
     // content
     $view = new X4View_core('container');
     $view->content = new X4View_core('editor');
     $view->content->close = false;
     $view->content->page = $page;
     // form builder
     $view->content->title = _EDIT_PROFILE;
     $view->content->form = '<div class="band"><div class="one-third push-one-third sm-one-whole sm-push-none">' . X4Form_helper::doform('profile', $_SERVER["REQUEST_URI"], $fields, array(_RESET, _SUBMIT, 'buttons'), 'post', '', 'onclick="setForm(\'profile\');"') . '</div></div>';
     $view->render(TRUE);
 }
Example #2
0
 /**
  * Admin area home page
  * This page displays Notices and Bookmarks
  *
  * @param   string  $start_page URL of first page to load
  * @param   string  $start_title Title of first page to load
  * @return  void
  */
 public function start($start_page = 'home-dashboard', $start_title = 'Home')
 {
     // load dictionaries
     $this->dict->get_wordarray(array('home'));
     // get page
     $page = $this->get_page('home');
     $view = new X4View_core(X4Utils_helper::set_tpl('x3ui'));
     $view->page = $page;
     $view->menus = $this->site->get_menus(1);
     $view->start_page = str_replace('-', '/', $start_page);
     $view->start_title = urldecode($start_title);
     // languages
     $mod = new Language_model();
     $view->langs = $mod->get_alanguages($page->id_area);
     $view->render(TRUE);
 }