/**
  * Show the widget at the screen
  */
 public function show()
 {
     TPage::include_js('lib/adianti/include/tfile/tfile.js');
     // define the tag properties
     $this->tag->id = $this->name . '_' . uniqid();
     $this->tag->name = 'file_' . $this->name;
     // tag name
     $this->tag->value = $this->value;
     // tag value
     $this->tag->type = 'file';
     // input type
     $this->tag->style = "width:{$this->size}px;height:{$this->height}px";
     // size
     $hdFileName = new THidden($this->name);
     $hdFileName->setValue($this->value);
     // verify if the widget is editable
     if (!parent::getEditable()) {
         // make the field read-only
         $this->tag->readonly = "1";
         $this->tag->type = 'text';
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     $div = new TElement('div');
     $div->style = "display:inline;width:100%;";
     $div->id = 'div_file_' . uniqid();
     $div->add($hdFileName);
     $div->add($this->tag);
     $div->show();
     $script = new TElement('script');
     $script->{'type'} = 'text/javascript';
     $action = 'engine.php?class=TFileUploader';
     $script->add("\n            \$(document).ready( function()\n            {\n                \$('#{$this->tag->id}').change( function()\n                {\n                    var tfile = new TFileAjaxUpload('{$this->tag->id}','{$action}','{$div->id}');\n                    \n                    tfile.initFileAjaxUpload();\n                });\n            });");
     $script->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);
 }
Beispiel #3
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     TPage::include_js('lib/adianti/include/tentry/tentry.js');
     // define the tag properties
     $this->tag->name = $this->name;
     // TAG name
     $this->tag->value = $this->value;
     // TAG value
     $this->tag->type = 'text';
     // input type
     $this->tag->style = "width:{$this->size}px";
     // size
     if ($this->id) {
         $this->tag->id = $this->id;
     }
     // verify if the widget is non-editable
     if (parent::getEditable()) {
         if (isset($this->exitAction)) {
             $string_action = $this->exitAction->serialize(FALSE);
             $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)");
         }
         if ($this->mask) {
             TPage::include_js('app/lib/include/jquery.meiomaskmoney.js');
             if ($this->mask == 'msk:money') {
                 $this->tag->{'class'} = 'tfield money';
                 $this->tag->{'id'} = $this->name;
             } else {
                 if ($this->mask == 'msk:decimal') {
                     $this->tag->{'class'} = 'tfield decimal';
                     $this->tag->{'id'} = $this->name;
                 } else {
                     if (substr($this->mask, 3) == 'msk') {
                         $this->tag->{'msk'} = substr($this->mask, 4);
                         $this->tag->{'id'} = $this->name;
                     } else {
                         $this->tag->onKeyPress = "return entryMask(this,event,'{$this->mask}')";
                     }
                 }
             }
         }
     } else {
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
         $this->tag->style = "width:{$this->size}px;" . "-moz-user-select:none;";
         $this->tag->onmouseover = "style.cursor='default'";
     }
     // shows the tag
     $this->tag->show();
     if (isset($this->completion)) {
         $options = json_encode($this->completion);
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').autocomplete({source: {$options} });");
         $script->show();
     }
 }
Beispiel #4
0
 /**
  * Class Constructor
  * @param $source Image path
  */
 public function __construct($type = 'danger', $msg = 'alerta', $titulo = "Alerta")
 {
     TPage::include_js('app/lib/PComponetes/util/js/bootstrap.js');
     TPage::include_css('app/lib/PComponetes/util/css/bootstrap.css');
     parent::__construct('div');
     $this->setType($type);
     $this->titulo = $titulo;
     $this->msg = $msg;
     $this->class = "alert alert-dismissable {$this->type} ";
     $this->role = "alert";
 }
Beispiel #5
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     TPage::include_css('lib/valums/fileuploader.css');
     TPage::include_js('lib/valums/fileuploader.js');
     // define the tag properties
     $this->tag->name = $this->name;
     // tag name
     $this->tag->value = $this->value;
     // tag value
     $this->tag->type = 'text';
     // input type
     $this->tag->style = "width:{$this->size}px";
     // size
     // verify if the widget is editable
     if (!parent::getEditable()) {
         // make the field read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     $div = new TElement('div');
     $div->style = "display:inline";
     $div->id = 'div_file_' . uniqid();
     $table = new TTable();
     $table->cellspacing = 0;
     $row = $table->addRow();
     $row->addCell($this->tag);
     $row->addCell($div);
     $table->show();
     $script = new TElement('script');
     $script->{'type'} = 'text/javascript';
     $class = 'TFileUploader';
     $script->add('
         new qq.FileUploader({
             element: document.getElementById("' . $div->id . '"),
             action: "engine.php?class=' . $class . '",
             debug: true,
             onComplete: function(id, fileName, responseJSON)
             {
                 document.getElementsByName("' . $this->name . '")[0].value= responseJSON.target;
             }
         });');
     $script->show();
 }
 /**
  * Show the notebook at the screen
  */
 public function show()
 {
     // includes the CSS and JavaScript functions to handle notebooks
     TPage::include_css('lib/adianti/include/tnotebook/tnotebook.css');
     TPage::include_js('lib/adianti/include/tnotebook/tnotebook.js');
     // count the pages
     $pages = $this->getPageCount();
     // creates a table
     $note_table = new TTable();
     $note_table->{'width'} = $this->width;
     $note_table->{'border'} = 0;
     $note_table->{'cellspacing'} = 0;
     $note_table->{'cellpadding'} = 0;
     $note_table->{'class'} = 'notebook-table';
     // add a row for the tabs
     $row = $note_table->addRow();
     $i = 0;
     $id = $this->id;
     // get javascript code to show/hide sub-notebooks
     $subnotes_hide = $this->_getHideCode();
     $subnotes_show = $this->_getShowCode();
     if ($this->pages) {
         // iterate the tabs, showing them
         foreach ($this->pages as $title => $content) {
             // verify if the current page is to be shown
             $classe = $i == $this->currentPage ? 'tnotebook_aba_sim' : 'tnotebook_aba_nao';
             // add a cell for this tab
             if ($this->tabsVisibility) {
                 $cell = $row->addCell("&nbsp;{$title}&nbsp;");
                 $cell->{'class'} = $classe;
                 $cell->id = "aba_{$id}_{$i}";
                 $cell->height = '23px';
                 $cell->onclick = $subnotes_hide . "tnotebook_hide({$id}, {$pages});" . "tnotebook_show_tab({$id},{$i});" . $this->getShowPageCode($title);
                 // show only this page sub-contents
                 if ($this->tabAction) {
                     $this->tabAction->setParameter('current_page', $i + 1);
                     $string_action = $this->tabAction->serialize(FALSE);
                     $cell->onclick = $cell->onclick . "ajaxExec('{$string_action}')";
                 }
                 $cell->onmouseover = "javascript:tnotebook_prelight(this, {$id}, {$i})";
                 $cell->onmouseout = "javascript:tnotebook_unprelight(this, {$id}, {$i})";
                 // creates the cell spacer
                 $cell = $row->addCell('&nbsp;');
                 $cell->{'class'} = 'tnotebook_spacer';
                 $cell->width = '3px';
                 $i++;
             }
         }
     }
     // creates the cell terminator
     $cell = $row->addCell('&nbsp;');
     $cell->{'class'} = 'tnotebook_end';
     if ($this->tabsVisibility) {
         $row = $note_table->addRow();
         $row->height = '7px';
         $cell = $row->addCell('<span></span>');
         $cell->{'class'} = 'tnotebook_down';
         $cell->colspan = 100;
     }
     // show the table
     $note_table->show();
     // creates a <div> around the content
     $quadro = new TElement('div');
     $quadro->{'class'} = 'tnotebook_quadro';
     $width = $this->width - 7;
     $quadro->style = "height:{$this->height}px;width:{$width}px";
     if ($this->id == 1) {
         self::$subNotes = $this->_getSubNotes();
     }
     $i = 0;
     // iterate the tabs again, now to show the content
     if ($this->pages) {
         foreach ($this->pages as $title => $content) {
             // verify if the current page is to be shown
             if ($i == $this->currentPage and ($this->id == 1 or in_array($this->id, self::$subNotes))) {
                 $classe = 'tnotebook_painel_sim';
             } else {
                 $classe = 'tnotebook_painel_nao';
             }
             // creates a <div> for the contents
             $painel = new TElement('div');
             $painel->{'class'} = $classe;
             // CSS
             $painel->id = "painel_{$id}_{$i}";
             // ID
             $quadro->add($painel);
             // check if the content is an object
             if (is_object($content)) {
                 $painel->add($content);
             }
             $i++;
         }
     }
     $quadro_table = new TTable();
     $quadro_table->width = $this->width;
     $quadro_table->{'class'} = 'tnotebook_table';
     $quadro_table->border = 0;
     $quadro_table->cellspacing = 0;
     $quadro_table->cellpadding = 0;
     $row = $quadro_table->addRow();
     $row->addCell($quadro);
     $quadro_table->show();
 }
 /**
  * Shows the tag
  */
 public function show()
 {
     TPage::include_js('lib/adianti/include/ttreeview/jquery.treeview.js');
     TPage::include_css('lib/adianti/include/ttreeview/jquery.treeview.css');
     $collapsed = $this->collapsed ? 'true' : 'false';
     $script = new TElement('script');
     $script->type = 'text/javascript';
     $script->add("\n        \t\$(document).ready(function(){\n        \t    \$('#{$this->id}').treeview({\n        \t\tpersist: 'location',\n        \t\tanimated: 'fast',\n        \t\tcollapsed: {$collapsed}\n        \t}); });");
     parent::add($script);
     parent::show();
 }
Beispiel #8
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     if ($this->mask) {
         TPage::include_js('lib/adianti/include/tentry/tentry.js');
     } else {
         if ($this->numericMask) {
             TPage::include_js('lib/adianti/include/tentry/jquery-imask-min.js');
         }
     }
     // define the tag properties
     $this->tag->name = $this->name;
     // TAG name
     $this->tag->value = $this->value;
     // TAG value
     $this->tag->type = 'text';
     // input type
     $this->tag->style = "width:{$this->size}px";
     // size
     if ($this->id) {
         $this->tag->id = $this->id;
     }
     // verify if the widget is non-editable
     if (parent::getEditable()) {
         if (isset($this->exitAction)) {
             $string_action = $this->exitAction->serialize(FALSE);
             $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)", FALSE);
         }
         if ($this->mask) {
             $this->tag->onKeyPress = "return entryMask(this,event,'{$this->mask}')";
         }
     } else {
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
         $this->tag->style = "width:{$this->size}px;" . "-moz-user-select:none;";
         $this->tag->onmouseover = "style.cursor='default'";
     }
     // shows the tag
     $this->tag->show();
     if (isset($this->completion)) {
         $options = json_encode($this->completion);
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').autocomplete({source: {$options} });");
         $script->show();
     }
     if ($this->numericMask) {
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').iMask({\n\t\t                        type : 'number',\n\t\t                        decDigits   : {$this->decimals},\n\t\t                        decSymbol   : '{$this->decimalsSeparator}',\n\t\t                        groupSymbol : '{$this->thousandSeparator}'\n\t                    });");
         $script->show();
     }
 }
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     if ($this->mask) {
         TPage::include_js('lib/adianti/include/tentry/tentry.js');
     } else {
         if ($this->numericMask) {
             TPage::include_js('lib/adianti/include/tentry/jquery-imask-min.js');
         }
     }
     // define the tag properties
     $this->tag->name = $this->name;
     // TAG name
     $this->tag->value = $this->value;
     // TAG value
     $this->tag->type = 'text';
     // input type
     $this->setProperty('style', "width:{$this->size}px", FALSE);
     //aggregate style info
     if ($this->id) {
         $this->tag->id = $this->id;
     }
     // verify if the widget is non-editable
     if (parent::getEditable()) {
         if (isset($this->exitAction)) {
             if (!TForm::getFormByName($this->formName) instanceof TForm) {
                 throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
             }
             $string_action = $this->exitAction->serialize(FALSE);
             $this->setProperty('exitaction', "serialform=(\$('#{$this->formName}').serialize());\n                                                 ajaxLookup('{$string_action}&'+serialform, document.{$this->formName}.{$this->name})", FALSE);
             $this->setProperty('onBlur', $this->getProperty('exitaction'), FALSE);
         }
         if ($this->mask) {
             $this->tag->onKeyPress = "return entryMask(this,event,'{$this->mask}')";
         }
     } else {
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
         $this->tag->onmouseover = "style.cursor='default'";
     }
     // shows the tag
     $this->tag->show();
     if (isset($this->completion)) {
         $options = json_encode($this->completion);
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').autocomplete({source: {$options} });");
         $script->show();
     }
     if ($this->numericMask) {
         $script = new TElement('script');
         $script->add("\$('input[name=\"{$this->name}\"]').iMask({\n\t\t                        type : 'number',\n\t\t                        decDigits   : {$this->decimals},\n\t\t                        decSymbol   : '{$this->decimalsSeparator}',\n\t\t                        groupSymbol : '{$this->thousandSeparator}'\n\t                    });");
         $script->show();
     }
 }