Esempio n. 1
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     $table = new TTable();
     $table->width = '100%';
     // creates the form
     $this->form = new TForm('form_User');
     $this->form->class = 'tform';
     $this->form->style = 'width: 450px;margin:auto; margin-top:10px;';
     // add the notebook inside the form
     $this->form->add($table);
     // create the form fields
     $login = new TEntry('login');
     $password = new TPassword('password');
     // define the sizes
     $login->setSize(320, 40);
     $password->setSize(320, 40);
     $login->style = 'height:35px; font-size:14px;float:left;border-bottom-left-radius: 0;border-top-left-radius: 0;';
     $password->style = 'height:35px;margin-bottom: 15px;font-size:14px;float:left;border-bottom-left-radius: 0;border-top-left-radius: 0;';
     $row = $table->addRow();
     $row->addCell(new TLabel('Login'))->colspan = 2;
     $row->class = 'tformtitle';
     $login->placeholder = _t('User');
     $password->placeholder = _t('Password');
     $user = '******';
     $locker = '<span style="float:left;width:35px;margin-left:45px;height:35px;" class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>';
     $container1 = new TElement('div');
     $container1->add($user);
     $container1->add($login);
     $container2 = new TElement('div');
     $container2->add($locker);
     $container2->add($password);
     $row = $table->addRow();
     $row->addCell($container1)->colspan = 2;
     // add a row for the field password
     $row = $table->addRow();
     $row->addCell($container2)->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Log in'));
     $save_button->class = 'btn btn-success btn-defualt';
     $save_button->style = 'margin-left:32px;width:355px;height:40px;border-radius:6px;font-size:18px';
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($save_button);
     $cell->colspan = 2;
     $this->form->setFields(array($login, $password, $save_button));
     // add the form to the page
     $caixa = new TVBox();
     $caixa->style = "text-align:center";
     $caixa->add(new TImage("app/images/pgo.png"));
     $caixa->add($this->form);
     parent::add($caixa);
 }
Esempio n. 2
0
 public function show()
 {
     foreach ($this->elements as $item => $value) {
         $li = new TElement('li');
         $a = new TElement('a');
         $a->href = "#{$item}";
         $a->add($item);
         $li->add($a);
         $this->ul->add($li);
     }
     parent::add($this->ul);
     foreach ($this->elements as $item => $value) {
         $conteudo = new TElement('div');
         $conteudo2 = new TElement('div');
         $conteudo->id = $item;
         $conteudo->add($value);
         parent::add($conteudo);
     }
     $script = new TElement('script');
     $script->type = 'text/javascript';
     $code = "  \$(function() {\n\$( '#{$this->id}' ).tabs();\n});";
     $script->add($code);
     parent::add($script);
     parent::show();
 }
Esempio n. 3
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     $link = new TElement('a');
     if ($this->action) {
         //$url['class'] = $this->action;
         //$url_str = http_build_query($url);
         $action = str_replace('#', '&', $this->action);
         $link->href = "index.php?class={$action}";
         $link->generator = 'adianti';
     } else {
         $link->href = '#';
     }
     if (isset($this->image)) {
         $image = new TImage($this->image);
         $image->style = 'padding-right: 8px';
         $link->add($image);
     }
     $link->add($this->label);
     // converts into ISO
     $this->add($link);
     if ($this->menu instanceof TMenu) {
         $this->{'class'} = 'dropdown-submenu';
         parent::add($this->menu);
     }
     parent::show();
 }
Esempio n. 4
0
 public function show()
 {
     foreach ($this->sources as $s) {
         parent::add($s);
     }
     parent::show();
 }
Esempio n. 5
0
 /**
  * Class Constructor
  * @param $type    Type of the message (info, error)
  * @param $message Message to be shown
  * @param $action  Action to process
  */
 public function __construct($type, $message, TAction $action = NULL)
 {
     $this->id = uniqid();
     if (!is_null($action)) {
         $this->action = '__adianti_load_page(\'' . $action->serialize() . '\');';
     }
     if (TPage::isMobile()) {
         $img = new TElement('img');
         $img->src = "lib/adianti/images/{$type}.png";
         $table = new TTable();
         $table->width = '250px';
         $table->bgcolor = '#E5E5E5';
         $table->style = "border-collapse:collapse";
         $row = $table->addRow();
         $row->addCell($img);
         $row->addCell($message);
         $table->show();
     } else {
         TPage::include_css('lib/adianti/include/tmessage/tmessage.css');
         // creates a pannel to show the dialog
         $painel = new TElement('div');
         $painel->{'class'} = 'tmessage';
         $painel->id = 'tmessage_' . $this->id;
         // creates a table for layout
         $table = new TTable();
         // creates a row for the icon and the message
         $row = $table->addRow();
         $row->addCell(new TImage("lib/adianti/images/{$type}.png"));
         $scroll = new TScroll();
         $scroll->setSize(350, 70);
         $scroll->add($message);
         $scroll->setTransparency(true);
         $cell = $row->addCell($scroll);
         // add the table to the pannel
         $painel->add($table);
         // show the pannel
         $painel->show();
         $script = new TElement('script');
         $script->{'type'} = 'text/javascript';
         $script->add(' $(function() {
             $( "#' . $painel->id . '" ).dialog({
                 height: 180,
                 width: 440,
                 stack: false,
                 zIndex: 3000,
                 modal: true,
                 buttons: {
                     OK: function() {
                         $( this ).dialog( "close" ); ' . $this->action . '
                     }
                 }
                 }).css("visibility", "visible");
                 
             	$( "#' . $painel->id . ' a" ).click(function () {
             	    window.open($(this).attr(\'href\'));
                 }); 
             });');
         $script->show();
     }
 }
 /**
  * método construtor
  * instancia objeto TQuestion
  * @param $message = pergunta ao usuário
  * @param $action_yes = ação para resposta positiva
  * @param $action_no = ação para resposta negativa
  */
 function __construct($message, $url_yes, $url_no)
 {
     // instancia o painel para exibir o diálogo
     $painel = new TElement('div');
     $painel->class = "tquestion";
     // cria um botão para a resposta positiva
     $button1 = new TElement('input');
     $button1->type = 'button';
     $button1->value = 'Sim';
     $button1->onclick = "javascript:location='{$url_yes}'";
     $button1->id = 'bt1';
     // cria um botão para a resposta negativa
     $button2 = new TElement('input');
     $button2->type = 'button';
     $button2->value = 'Não';
     $button2->onclick = "javascript:location='{$url_no}'";
     // cria uma tabela para organizar o layout
     $table = new TTable();
     $table->align = 'center';
     $table->cellspacing = 10;
     // cria uma linha para o ícone e a mensagem
     $row = $table->addRow();
     $row->addCell(new TImage('app.misc/images/question.png'));
     $row->addCell($message);
     // cria uma linha para os botões
     $row = $table->addRow();
     $row->addCell($button1);
     $row->align = 'left';
     $row->addCell($button2);
     // adiciona a tabela ao painél
     $painel->add($table);
     // exibe o painél
     $painel->show();
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // loads the galleria javascript library
     TPage::include_js('app/lib/jquery/galleria/galleria-1.2.2.min.js');
     // creates a table
     $table = new TTable();
     // creates the DIV element with the images
     $galleria = new TElement('div');
     $galleria->id = 'images';
     $galleria->style = "width:600px;height:460px";
     for ($n = 1; $n <= 4; $n++) {
         $img = new TElement('img');
         $img->src = "app/images/nature/nature{$n}.jpg";
         $galleria->add($img);
     }
     // add the DIV to the table
     $table->addRow()->addCell($galleria);
     // creates the script element
     $script = new TElement('script');
     $script->type = 'text/javascript';
     $script->add('
         Galleria.loadTheme("app/lib/jquery/galleria/themes/classic/galleria.classic.min.js");
         $("#images").galleria();
     ');
     // add the script to the table
     $table->addRow()->addCell($script);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }
 /**
  * method onEdit()
  * Executed whenever the user clicks at the edit button da datagrid
  */
 function onView($param)
 {
     try {
         if (isset($param['key'])) {
             // get the parameter $key
             $key = $param['key'];
             // open a transaction with database 'changeman'
             TTransaction::open('changeman');
             // instantiates object Document
             $object = new Document($key);
             $element = new TElement('div');
             $element->add($object->content);
             parent::add($element);
             // close the transaction
             TTransaction::close();
         } else {
             $this->form->clear();
         }
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
 /**
  * Show the highlighted source code
  */
 public function show()
 {
     $span = new TElement('span');
     $span->style = 'font-size:10pt';
     $span->add(highlight_string($this->content, TRUE));
     $span->show();
 }
 /**
  * método addCell
  * agrega um novo objeto célula (TTableCell) à linha
  * @param $value = conteúdo da célula
  */
 public function addCell($value)
 {
     // instancia objeto célula
     $cell = new TTableCell($value);
     parent::add($cell);
     // retorna o objeto instanciado
     return $cell;
 }
Esempio n. 11
0
 /**
  * Add a new row (TTableRow object) to the table
  * @return TTableRow
  */
 public function addRow()
 {
     // creates a new Table Row
     $row = new TTableRow();
     // add this row to the table element
     parent::add($row);
     return $row;
 }
Esempio n. 12
0
 /**
  * Add an child element
  * @param $child Any object that implements the show() method
  */
 public function add($child)
 {
     $wrapper = new TElement('div');
     $wrapper->{'style'} = 'display:inline-block;';
     $wrapper->add($child);
     parent::add($wrapper);
     return $wrapper;
 }
Esempio n. 13
0
 /**
  * Add an child element
  * @param $child Any object that implements the show() method
  */
 public function add($child)
 {
     $wrapper = new TElement('div');
     $wrapper->style = 'clear:both';
     $wrapper->add($child);
     parent::add($wrapper);
     return $wrapper;
 }
Esempio n. 14
0
 /**
  * mщtodo addRow
  * agrega um novo objeto linha (TTableRow) na tabela
  */
 public function addRow()
 {
     // instancia objeto linha
     $row = new TTableRow();
     // armazena no array de linhas
     parent::add($row);
     return $row;
 }
Esempio n. 15
0
 /**
  * Add a new cell (TTableCell) to the Table Row
  * @param  $value Cell Content
  * @return TTableCell
  */
 public function addCell($value)
 {
     // creates a new Table Cell
     $cell = new TTableCell($value);
     parent::add($cell);
     // returns the cell object
     return $cell;
 }
Esempio n. 16
0
 public function addCellTitle($content, $align, $stylename = 'active', $colspan = 1)
 {
     $td = new TElement('th');
     $td->add($content);
     $td->class = $stylename;
     $td->style = "text-align: {$align}";
     $td->colspan = $colspan;
     $this->trT->add($td);
 }
Esempio n. 17
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     if ($this->items) {
         foreach ($this->items as $item) {
             parent::add($item);
         }
     }
     parent::show();
 }
Esempio n. 18
0
 /**
  * método put()
  * posiciona um objeto no painel
  * @param $widget = objeto a ser inserido no painel
  * @param $col     = coluna em pixels.
  * @param $row     = linha em pixels.
  */
 public function put($widget, $col, $row)
 {
     // cria uma camada para o widget
     $camada = new TElement('div');
     // define a posição da camada
     $camada->style = "position:absolute; left:{$col}px; top:{$row}px;";
     // adiciona o objeto (widget) à camada recém-criada
     $camada->add($widget);
     // adiciona widget no array de elementos
     parent::add($camada);
 }
Esempio n. 19
0
 /**
  * Create an element
  * @param $tagname Element name
  * @param $value Element value
  * @param $attributes Element attributes
  */
 public static function tag($tagname, $value, $attributes = NULL)
 {
     $object = new TElement($tagname);
     $object->add($value);
     if ($attributes) {
         foreach ($attributes as $att_name => $att_value) {
             $object->{$att_name} = $att_value;
         }
     }
     return $object;
 }
Esempio n. 20
0
 /**
  * Put a widget inside the panel
  * @param  $widget = widget to be shown
  * @param  $col    = column in pixels.
  * @param  $row    = row in pixels.
  */
 public function put($widget, $col, $row)
 {
     // creates a layer to put the widget inside
     $camada = new TElement('div');
     // define the layer position
     $camada->style = "position:absolute; left:{$col}px; top:{$row}px;";
     // add the widget to the layer
     $camada->add($widget);
     // add the widget to the element's array
     parent::add($camada);
 }
Esempio n. 21
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     $js_mask = str_replace('yyyy', 'yy', $this->mask);
     if (parent::getEditable()) {
         $script = new TElement('script');
         $script->type = 'text/javascript';
         $script->add("\n            \t\$(function() {\n                \$(\"#{$this->id}\").datepicker({\n                    showOn: 'button',\n                    buttonImage: 'lib/adianti/images/tdate.png',\n                    buttonImageOnly: true,    \n            \t\tchangeMonth: true,\n            \t\tchangeYear: true,\n            \t\tdateFormat: '{$js_mask}',\n            \t\tshowButtonPanel: true\n            \t});\n            });");
         $script->show();
     }
     parent::show();
 }
Esempio n. 22
0
 /**
  * Show
  */
 public function show()
 {
     $script = new TElement('script');
     $script->{'type'} = 'text/javascript';
     $code = '$(document).ready( function() {
                  $(\'.dropdown-toggle\').dropdown()
              });';
     $script->add($code);
     $script->show();
     parent::show();
 }
Esempio n. 23
0
 /**
  * Add a new cell (TTableCell) to the Table Row
  * @param  $value Cell Content
  * @return TTableCell
  */
 public function addCell($value)
 {
     if (is_null($value)) {
         throw new Exception(TAdiantiCoreTranslator::translate('Method ^1 does not accept null values', __METHOD__));
     } else {
         // creates a new Table Cell
         $cell = new TTableCell($value);
         parent::add($cell);
         // returns the cell object
         return $cell;
     }
 }
Esempio n. 24
0
 public function show()
 {
     $btn = '  <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
     $titulo = new TElement('h4');
     $titulo->add($this->titulo);
     $msg = new TElement('p');
     $msg->add($this->msg);
     $this->add($btn);
     $this->add($titulo);
     $this->add($msg);
     parent::show();
 }
 /**
  * método construtor
  * Cria a página e o formulário de cadastro
  */
 function __construct()
 {
     parent::__construct();
     ob_start();
     phpinfo();
     $content = ob_get_contents();
     ob_end_clean();
     $content = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$' . '1', $content);
     $div = new TElement('div');
     $div->{'id'} = 'phpinfo';
     // Está assim (um por linha), por que o parser ignora linhas que iniciam com "#"
     $styles = '<style type="text/css">';
     $styles .= '#phpinfo pre {margin: 0px; font-family: monospace;} ';
     $styles .= '#phpinfo a:link {color: #000099; text-decoration: none; background-color: #ffffff;} ';
     $styles .= '#phpinfo a:hover {text-decoration: underline;} ';
     $styles .= '#phpinfo table {border-collapse: collapse;} ';
     $styles .= '#phpinfo .center {text-align: center;} ';
     $styles .= '#phpinfo .center table { margin-left: auto; margin-right: auto; text-align: left;} ';
     $styles .= '#phpinfo .center th { text-align: center !important; } ';
     $styles .= '#phpinfo td, th { border: 1px solid gray; font-size: 75%; vertical-align: baseline; padding: 5px} ';
     $styles .= '#phpinfo h1 {font-size: 150%;} ';
     $styles .= '#phpinfo h2 {font-size: 125%;} ';
     $styles .= '#phpinfo .p {text-align: left;} ';
     $styles .= '#phpinfo .e {background-color: whiteSmoke; font-weight: bold; color: #000000;} ';
     $styles .= '#phpinfo .h {background-color: #599FC7; font-weight: bold; color: white;} ';
     $styles .= '#phpinfo .v {background-color: white; color: #000000;} ';
     $styles .= '#phpinfo i {color: #666666; background-color: #cccccc;} ';
     $styles .= '#phpinfo img {float: right; border: 0px;} ';
     $styles .= '#phpinfo hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;} ';
     $styles .= '#phpinfo table { width: 100%;} ';
     $styles .= '#phpinfo td, th{ font-size: 90% !important;} ';
     $styles .= '#phpinfo td.e{    width: 30%;} </style>';
     $div->add($styles);
     $div->add($content);
     $container = new TVBox();
     $container->style = 'width: 97%';
     $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->add($div);
     parent::add($container);
 }
Esempio n. 26
0
 public function __construct()
 {
     parent::__construct('ul');
     $this->class = 'dropdown-menu dropdown-messages';
     $messages = array();
     $messages[] = array(TSession::getValue('login'), 'Yesterday', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...');
     $messages[] = array(TSession::getValue('login'), 'Yesterday', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...');
     $messages[] = array(TSession::getValue('login'), 'Yesterday', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...');
     $a = new TElement('a');
     $a->{'class'} = "dropdown-toggle";
     $a->{'data-toggle'} = "dropdown";
     $a->{'href'} = "#";
     $a->add(TElement::tag('i', '', array('class' => "fa fa-envelope fa-fw")));
     $a->add(TElement::tag('span', count($messages), array('class' => "badge badge-notify")));
     $a->add(TElement::tag('i', '', array('class' => "fa fa-caret-down")));
     $a->show();
     foreach ($messages as $message) {
         $name = $message[0];
         $date = $message[1];
         $body = $message[2];
         $li = new TElement('li');
         $a = new TElement('a');
         $div = new TElement('div');
         $a->href = '#';
         $li->add($a);
         $a->add($div);
         $div->add(TElement::tag('strong', $name));
         $div->add(TElement::tag('span', TElement::tag('em', $date), array('class' => 'pull-right text-muted')));
         $div2 = new TElement('div');
         $div2->add($body);
         $a->add($div2);
         parent::add($li);
         parent::add(TElement::tag('li', '', array('class' => 'divider')));
     }
     $li = new TElement('li');
     $a = new TElement('a');
     $li->add($a);
     $a->class = 'text-center';
     $a->href = '#';
     $a->add(TElement::tag('strong', 'Read messages'));
     $a->add($i = TElement::tag('i', '', array('class' => 'fa fa-inbox')));
     parent::add($li);
     parent::add(TElement::tag('li', '', array('class' => 'divider')));
     $li = new TElement('li');
     $a = new TElement('a');
     $li->add($a);
     $a->class = 'text-center';
     $a->href = '#';
     $a->add(TElement::tag('strong', 'Send message'));
     $a->add($i = TElement::tag('i', '', array('class' => 'fa fa-envelope-o')));
     parent::add($li);
 }
Esempio n. 27
0
 public function show()
 {
     $c = "";
     foreach ($this->code as $frames) {
         $c .= "\$( '#" . $frames->id . "' ).resizable({\ncontainment: '#{$this->id}'\n});";
     }
     $code = "\$(function() {\n \n" . $c . "\n\n});";
     $script = new TElement('script');
     $script->type = 'text/javascript';
     $script->add($code);
     parent::add($script);
     parent::show();
 }
Esempio n. 28
0
 public function show()
 {
     $code = '  google.load("visualization", "1", {packages:["corechart"]});';
     $code .= "google.setOnLoadCallback(drawChart);\n      function drawChart() {\n        var data = google.visualization.arrayToDataTable([\n          ['Year', 'Sales', 'Expenses'],\n          ['2013',  1000,      400],\n          ['2014',  1170,      460],\n          ['2015',  660,       1120],\n          ['2016',  1030,      540]\n        ]);\n\n        var options = {\n          title: 'Company Performance',\n          hAxis: {title: 'Year',  titleTextStyle: {color: '#333'}},\n          vAxis: {minValue: 0}\n        };\n\n        var chart = new google.visualization.AreaChart(document.getElementById('{$this->id}'));\n        chart.draw(data, options);\n      }\n";
     $scriptApi = new TElement('script');
     $scriptApi->type = 'text/javascript';
     $scriptApi->src = "https://www.google.com/jsapi";
     $script = new TElement('script');
     $script->type = 'text/javascript';
     $script->add($code);
     parent::add($scriptApi);
     parent::add($script);
     parent::show();
 }
Esempio n. 29
0
 public function show()
 {
     if ($this->height == null || $this->width == null) {
         throw new Exception('size não especificado');
     }
     if ($this->height == null) {
         throw new Exception('title não especificado');
     }
     $script = new TElement('script');
     $script->type = 'text/javascript';
     $code = "\$(function() {\n\$('#{$this->id}').dialog({ minWidth: {$this->width},minHeight: {$this->height} {$this->modal} {$this->title}} );\n});";
     $script->add($code);
     parent::add($script);
     parent::show();
 }
Esempio n. 30
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     foreach ($this->elements as $child) {
         $title = new TElement('h3');
         $title->add($child[0]);
         $content = new TElement('div');
         $content->add($child[1]);
         parent::add($title);
         parent::add($content);
     }
     TScript::create('$(document).ready( function() {
                         $( "#' . $this->id . '" ).accordion();
                     });');
     parent::show();
 }