Ejemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     $this->form = new TQuickForm();
     $this->form->class = 'tform';
     $this->form->setFormTitle(_t('Profile'));
     $name = new TEntry('name');
     $login = new TEntry('login');
     $email = new TEntry('email');
     $password1 = new TPassword('password1');
     $password2 = new TPassword('password2');
     $login->setEditable(FALSE);
     $this->form->addQuickField(_t('Name'), $name, '80%', new TRequiredValidator());
     $this->form->addQuickField(_t('Login'), $login, '80%', new TRequiredValidator());
     $this->form->addQuickField(_t('Email'), $email, '80%', new TRequiredValidator());
     $table = $this->form->getContainer();
     $row = $table->addRow();
     $row->style = 'background: #FFFBCB;';
     $cell = $row->addCell(new TLabel(_t('Change password') . ' (' . _t('Leave empty to keep old password') . ')'));
     $cell->colspan = 2;
     $this->form->addQuickField(_t('Password'), $password1, '80%');
     $this->form->addQuickField(_t('Password confirmation'), $password2, '80%');
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'fa:save');
     $bc = new TBreadCrumb();
     $bc->addHome();
     $bc->addItem('Profile');
     $container = TVBox::pack($bc, $this->form);
     $container->style = 'width:80%';
     parent::add($container);
 }
 /**
  * Handle paths from a XML file
  * @param $xml_file path for the file
  */
 public function __construct($xml_file, $controller)
 {
     parent::__construct();
     $path = array();
     if (file_exists($xml_file)) {
         $menu_string = file_get_contents($xml_file);
         if (utf8_encode(utf8_decode($menu_string)) == $menu_string) {
             $xml = new SimpleXMLElement($menu_string);
         } else {
             $xml = new SimpleXMLElement(utf8_encode($menu_string));
         }
         foreach ($xml as $xmlElement) {
             $atts = $xmlElement->attributes();
             $label = (string) $atts['label'];
             $action = (string) $xmlElement->action;
             $icon = (string) $xmlElement->icon;
             $this->parse($xmlElement->menu->menuitem, array($label));
         }
         if (isset($this->paths[$controller]) and $this->paths[$controller]) {
             $total = count($this->paths[$controller]);
             parent::addHome($path);
             $count = 1;
             foreach ($this->paths[$controller] as $path) {
                 parent::addItem($path, $count == $total);
                 $count++;
             }
         } else {
             throw new Exception(TAdiantiCoreTranslator::translate('Class ^1 not found in ^2', $controller, $xml_file));
         }
     } else {
         throw new Exception(TAdiantiCoreTranslator::translate('File not found') . ': ' . $xml_file);
     }
 }
 public function __construct()
 {
     parent::__construct();
     $html = new THtmlRenderer('app/resources/profile.html');
     $replaces = array();
     try {
         TTransaction::open('permission');
         $user = SystemUser::newFromLogin(TSession::getValue('login'));
         $replaces = $user->toArray();
         $replaces['frontpage'] = $user->frontpage_name;
         $replaces['groupnames'] = $user->getSystemUserGroupNames();
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
     $html->enableSection('main', $replaces);
     $html->enableTranslation();
     $bc = new TBreadCrumb();
     $bc->addHome();
     $bc->addItem('Perfil');
     $container = TVBox::pack($bc, $html);
     $container->style = 'width:60%';
     parent::add($container);
 }
Ejemplo n.º 4
0
 /**
  * Define the home controller
  * @param $class Home controller class
  */
 public static function setHomeController($className)
 {
     self::$homeController = $className;
 }