Beispiel #1
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open("sample");
         $evento = new Agenda(R);
         $evento->nome = "Curso Adianti framework";
         $evento->lugar = "Progs Scholl alterado";
         $evento->descricao = "Curso basico";
         $evento->data_ev = date("Y-m-d");
         $evento->hora_ev = date("h:m:");
         $evento->store();
         TTransaction::close();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     TPage::include_css('app/resources/styles.css');
     $this->html = new THtmlRenderer('app/resources/wellcome.html');
     // define replacements for the main section
     $replace = array();
     // replace the main section variables
     $this->html->enableSection('main', $replace);
     // add the template to the page
     parent::add($this->html);
 }
Beispiel #2
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();
     }
 }
Beispiel #3
0
 /**
  * Class Constructor
  * @param  $value text label
  */
 public function __construct($type = 'plus')
 {
     TPage::include_css('app/lib/PComponetes/util/glyphicons.min.css');
     // create a new element
     $this->tag = new TElement('i');
     $this->tag->{'class'} = "glyphicon glyphicon-{$type}";
 }
 public function __construct()
 {
     parent::__construct();
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // define the CSS class
     $this->datagrid->class = 'customized-table';
     // import the CSS file
     parent::include_css('app/resources/custom-table.css');
     // add the columns
     $this->datagrid->addQuickColumn('ID', 'id', 'left', 50);
     $this->datagrid->addQuickColumn('Description', 'description', 'left', 250);
     $this->datagrid->addQuickColumn('Amount', 'amount', 'right', 140);
     $this->datagrid->addQuickColumn('Price', 'sale_price', 'right', 140);
     // add the actions
     $this->datagrid->addQuickAction('Delete', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // creates the datagrid model
     $this->datagrid->createModel();
     $form_back = new TQuickForm();
     $form_back->addQuickAction('Back', new TAction(array($this, 'onGoToCatalog')), 'ico_back.png');
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', 'ProductCatalogView'));
     $vbox->add($this->datagrid);
     $vbox->add($form_back);
     parent::add($vbox);
 }
 /**
  * Constructor method
  */
 public function __construct()
 {
     parent::__construct();
     // load the styles
     TPage::include_css('app/resources/styles.css');
     // define two actions
     $action1 = new TAction(array($this, 'onAction1'));
     $action2 = new TAction(array($this, 'onAction2'));
     // create a quick form with two action buttons
     $form = new TQuickForm();
     $form->addQuickAction('Action 1', $action1, 'ico_view.png');
     $form->addQuickAction('Action 2', $action2, 'ico_view.png');
     try {
         // create the HTML Renderer
         $this->html = new THtmlRenderer('app/resources/content.html');
         // define replacements for the main section
         $replace = array();
         $replace['name'] = 'Test name';
         $replace['address'] = 'Test address';
         // replace the main section variables
         $this->html->enableSection('main', $replace);
         // Table wrapper (form and HTML)
         $table = new TTable();
         $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
         $table->addRow()->addCell($form);
         $table->addRow()->addCell($this->html);
         parent::add($table);
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
 public function __construct($width = 500, $height = 400)
 {
     parent::__construct('div');
     $this->id = "PPanelGrupe" . uniqid();
     $this->style = "\nborder:1px solid #000;\nwidth :{$width}px;\nheight :{$height}px;\n";
     TPage::include_css('app/lib/PComponetes/util/fieldset.css');
     $this->code = array();
 }
Beispiel #7
0
 public function __construct($banco, $model, $criteria, $timer)
 {
     TPage::include_css('app/lib/PComponetes/util/css/bootstrap.css');
     $this->datagrid = new TQuickGrid();
     $this->datagrid->class = "table table-hover";
     $this->timer = new PTimer($banco, $model, $criteria, $timer);
     $this->time = $timer;
 }
Beispiel #8
0
 /**
  * Class Constructor
  * @param  $value text label
  */
 public function __construct($value, $type = 'default')
 {
     TPage::include_css('app/lib/PComponetes/util/label.min.css');
     // set the label's content
     $this->setValue($value);
     $this->setType($type);
     // create a new element
     $this->tag = new TElement('a');
     $this->tag->{'class'} = $this->type;
 }
Beispiel #9
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";
 }
 /**
  * Método construtor
  * @param $widths vetor contendo as larguras das colunas
  */
 public function __construct()
 {
     TPage::include_css('app/lib/PComponetes/util/table.min.css');
     // cria uma nova tabela
     $this->table = new TElement('table');
     $this->table->cellspacing = 0;
     $this->table->cellpadding = 0;
     $this->table->class = "ptable ptable-striped";
     $this->thead = new TElement('thead');
     $this->tbody = new TElement('tbody');
 }
Beispiel #11
0
 /**
  * Class Constructor
  * @param  $name widget's name
  */
 public function __construct($name)
 {
     // executes the parent class constructor
     parent::__construct($name);
     $this->id = 'tcombo_' . uniqid();
     TPage::include_css('lib/adianti/include/tcombo/tcombo.css');
     // creates a <select> tag
     $this->tag = new TElement('select');
     $this->tag->{'class'} = 'tcombo';
     // CSS
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     TPage::include_css('app/resources/styles.css');
     $this->html = new THtmlRenderer('app/resources/wellcome.html');
     // define replacements for the main section
     $replace = array();
     // replace the main section variables
     $this->html->enableSection('main', $replace);
     // add the template to the page
     parent::add($this->html);
 }
Beispiel #13
0
 /**
  * Class Constructor
  * @param $name Name of the widget
  */
 public function __construct($name)
 {
     parent::__construct($name);
     self::$counter++;
     $this->id = 'tdate_' . uniqid();
     $this->mask = 'yyyy-mm-dd';
     TPage::include_css('lib/adianti/include/tdate/tdate.css');
     $newmask = $this->mask;
     $newmask = str_replace('dd', '99', $newmask);
     $newmask = str_replace('mm', '99', $newmask);
     $newmask = str_replace('yyyy', '9999', $newmask);
     parent::setMask($newmask);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     TSession::freeSession();
     TPage::include_css('app/view/css/login.css');
     $this->html = new THtmlRenderer('app/view/frmLogin.html');
     // define replacements for the main section
     $replace = array();
     // replace the main section variables
     $this->html->enableSection('main', $replace);
     // add the template to the page
     parent::add($this->html);
 }
Beispiel #15
0
 /**
  * Class Constructor
  * @param  $name name of the field
  */
 public function __construct($name)
 {
     // define some default properties
     self::setEditable(TRUE);
     self::setName($name);
     self::setSize(200);
     // initialize validations array
     $this->validations = array();
     TPage::include_css('lib/adianti/include/tfield/tfield.css');
     // creates a <input> tag
     $this->tag = new TElement('input');
     $this->tag->{'class'} = 'tfield';
     // classe CSS
 }
 /**
  * Show customer data and sales
  */
 public function onCheckSales()
 {
     try {
         $data = $this->form->getData();
         // get form data
         $this->form->setData($data);
         // keep the form filled
         // load the html template
         $html = new THtmlRenderer('app/resources/customer_status.html');
         // load CSS styles
         parent::include_css('app/resources/styles.css');
         TTransaction::open('samples');
         $customer = new Customer();
         // load customer identified in the form
         $object = $customer->load($data->customer_id);
         if ($object) {
             // create one array with the customer data
             $array_object = $object->toArray();
             $array_object['city_name'] = $object->city_name;
             $array_object['category_name'] = $object->category_name;
             // replace variables from the main section with the object data
             $html->enableSection('main', $array_object);
             $replaces = array();
             $sales = $object->getSales();
             if ($sales) {
                 $total = 0;
                 // iterate the customer sales
                 foreach ($sales as $sale) {
                     // foreach sale item
                     foreach ($sale->getSaleItems() as $item) {
                         // define the multidimensional array with the sale items
                         $replaces[] = array('date' => $sale->date, 'product_id' => $item->product_id, 'product_description' => $item->product->description, 'sale_price' => number_format($item->sale_price, 2), 'amount' => $item->amount, 'discount' => $item->discount, 'total' => number_format($item->total, 2));
                         $total += $item->total;
                     }
                 }
                 $totals['total'] = number_format($total, 2);
                 // replace sale items and totals
                 $html->enableSection('sale-details', $replaces, TRUE);
                 $html->enableSection('sale-totals', $totals);
             }
         } else {
             throw new Exception('Customer not found');
         }
         TTransaction::close();
         parent::add($html);
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
 /**
  * Class Constructor
  * @param  $name widget's name
  */
 public function __construct($name)
 {
     // executes the parent class constructor
     parent::__construct($name);
     self::$counter++;
     $this->id = 'tsortlist_' . uniqid();
     $this->initialItems = array();
     $this->items = array();
     TPage::include_css('lib/adianti/include/tsortlist/tsortlist.css');
     // creates a <ul> tag
     $this->tag = new TElement('ul');
     $this->tag->{'class'} = 'tsortlist';
     $this->tag->{'id'} = $this->id;
     $this->tag->{'itemname'} = $name;
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     TPage::include_css('app/resources/styles.css');
     $html1 = new THtmlRenderer('app/resources/welcome.html');
     $html2 = new THtmlRenderer('app/resources/bemvindo.html');
     // replace the main section variables
     $html1->enableSection('main', array());
     $html2->enableSection('main', array());
     $panel1 = new TPanelGroup('Welcome!');
     $panel1->add($html1);
     $panel2 = new TPanelGroup('Bem-vindo!');
     $panel2->add($html2);
     // add the template to the page
     parent::add(TVBox::pack($panel1, $panel2));
 }
 /**
  * Class Constructor
  * @param  $name name of the field
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $this->useOutEvent = TRUE;
     $this->setProperty('class', 'tfield tseekentry', TRUE);
     // classe CSS
     TPage::include_css('lib/adianti/include/tseekbutton/tseekbutton.css');
     $image = new TImage('lib/adianti/images/ico_find.png');
     $this->button = new TElement('button');
     $this->button->{'class'} = 'btn tseekbutton';
     $this->button->{'type'} = 'button';
     $this->button->{'onmouseover'} = 'style.cursor = \'pointer\'';
     $this->button->{'name'} = '_' . $this->name . '_link';
     $this->button->{'onmouseout'} = 'style.cursor = \'default\'';
     $this->button->add($image);
 }
Beispiel #20
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();
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // load the styles
     TPage::include_css('app/resources/formdecorator.css');
     // create the HTML Renderer
     $html = new THtmlRenderer('app/resources/formdecorator.html');
     // create the form using TQuickForm class
     $this->form = new TQuickForm();
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $date = new TDate('date');
     $time = new TEntry('time');
     $number = new TEntry('number');
     $text = new TText('text');
     $description->setTip('Type the description here...');
     $date->setMask('dd/mm/yyyy');
     // define date mask
     $time->setMask('99:99');
     $number->setNumericMask(2, ',', '.');
     // define numeric input
     // add the fields inside the form
     $this->form->addQuickField('Id', $id, 40);
     $this->form->addQuickField('Description', $description, 200);
     $this->form->addQuickField('Date (dd/mm/yyyy)', $date, 80);
     $this->form->addQuickField('Time (99:99)', $time, 60);
     $this->form->addQuickField('Numeric Input (9.999,99)', $number, 100);
     $this->form->addQuickField('Text', $text, 120);
     $text->setSize(200, 100);
     // define the form action
     $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png');
     // replace the main section variables
     $replace = array('form' => $this->form);
     $html->enableSection('main', $replace);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($html);
     parent::add($vbox);
 }
 /**
  * Mostra os dados criados dinamicamente
  */
 public function show($context = null)
 {
     TPage::include_css('lib/adianti/include/tmessage/tmessage.css');
     $ok_button = '';
     if ($this->useOKButton) {
         $ok_button = '  OK: function() { ' . $this->action . ' $( this ).remove(); }';
     }
     // creates a pannel to show the dialog
     $painel = new TElement('div');
     $painel->{'class'} = 'tmessage';
     $painel->id = 'tmessage_' . $this->id;
     if (is_object($context)) {
         // add the table to the pannel
         $painel->add($context);
     }
     // show the pannel
     $painel->show();
     $script = new TElement('script');
     $script->{'type'} = 'text/javascript';
     $script->add(' $(function() {
         $( "#' . $painel->id . '" ).dialog({
             height:' . $this->height . ',
             width:' . $this->width . ',
             stack: false,
             zIndex: 3000,
             modal: false,
             ' . $this->accordion . '
             close: function(ev, ui) { $(this).remove(); },
             buttons: {
                 ' . $ok_button . '
             }
             }).css("visibility", "visible");
             
             $( "#' . $painel->id . ' a" ).click(function () {
                 window.open($(this).attr(\'href\'));
             }); 
         });');
     $script->show();
 }
 /**
  * Constructor method
  */
 public function __construct()
 {
     parent::__construct();
     // load the styles
     TPage::include_css('app/resources/catalog.css');
     // create the HTML Renderer
     $this->html = new THtmlRenderer('app/resources/catalog.html');
     // define replacements for the main section
     $replace = array();
     // replace the main section variables
     $this->html->enableSection('main', $replace);
     $this->enableManagement();
     try {
         // load the products
         TTransaction::open('samples');
         $criteria = new TCriteria();
         $criteria->add(new TFilter('photo_path', '<>', ''));
         $products = Product::getObjects($criteria);
         TTransaction::close();
         $replace_detail = array();
         if ($products) {
             // iterate products
             foreach ($products as $product) {
                 $replace_detail[] = $product->toArray();
                 // array of replacements
             }
         }
         // enable products section as repeatable
         $this->html->enableSection('products', $replace_detail, TRUE);
         // wrap the page content using vertical box
         $vbox = new TVBox();
         $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
         $vbox->add($this->html);
         parent::add($vbox);
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
 public function __construct()
 {
     parent::__construct();
     // creates one datagrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // define the CSS class
     $this->datagrid->class = 'tdatagrid_table customized-table';
     // import the CSS file
     parent::include_css('app/resources/custom-table.css');
     // add the columns
     $this->datagrid->addQuickColumn('Code', 'code', 'right', 70);
     $this->datagrid->addQuickColumn('Name', 'name', 'left', 180);
     $this->datagrid->addQuickColumn('Address', 'address', 'left', 180);
     $this->datagrid->addQuickColumn('Phone', 'fone', 'left', 160);
     $this->datagrid->addQuickAction('View', new TDataGridAction(array($this, 'onView')), 'name', 'ico_find.png');
     // creates the datagrid model
     $this->datagrid->createModel();
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->datagrid);
     parent::add($vbox);
 }
 public function __construct()
 {
     parent::__construct();
     // load the html template
     $html = new THtmlRenderer('app/resources/testeformview.html');
     // load CSS styles
     parent::include_css('app/resources/formview.css');
     TTransaction::open('samples');
     $customer = new Customer();
     $replace = array();
     $html->enableSection('main', $replace);
     $replaces = array();
     $total = 0;
     for ($n = 0; $n <= 3; $n++) {
         // define the multidimensional array with the sale items
         $replaces[] = array('id' => 1, 'descricao' => 'sdf', 'preco' => 123, 'qtde' => 10, 'desconto' => 10, 'total' => 1230);
         $total += 123;
     }
     $totals['total'] = number_format($total, 2);
     // replace sale items and totals
     $html->enableSection('details', $replaces, TRUE);
     $html->enableSection('totals', $totals);
     parent::add($html);
 }
 /**
  * Constructor method
  */
 public function __construct()
 {
     parent::__construct();
     // load the styles
     TPage::include_css('app/resources/styles.css');
     // create the HTML Renderer
     $this->html = new THtmlRenderer('app/resources/customer.html');
     try {
         // look for customer 1
         TTransaction::open('samples');
         $customer = new Customer(1);
         // define replacements for the main section
         $replace = array();
         $replace['code'] = $customer->id;
         $replace['name'] = $customer->name;
         $replace['address'] = $customer->address;
         // replace the main section variables
         $this->html->enableSection('main', $replace);
         // define the replacements based on customer contacts
         $replace = array();
         foreach ($customer->getContacts() as $contact) {
             $replace[] = array('type' => $contact->type, 'value' => $contact->value);
         }
         // define with sections will be enabled
         $this->html->enableSection('contacts');
         $this->html->enableSection('contacts-detail', $replace, TRUE);
         // wrap the page content using vertical box
         $vbox = new TVBox();
         $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
         $vbox->add($this->html);
         parent::add($vbox);
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
Beispiel #27
0
 /**
  * Class Constructor
  * @param  $message    A string containint the question
  * @param  $action_yes Action taken for YES response
  * @param  $action_no  Action taken for NO  response
  */
 public function __construct($message, TAction $action_yes = NULL, TAction $action_no = NULL)
 {
     $this->id = uniqid();
     if (TPage::isMobile()) {
         $img = new TElement('img');
         $img->src = "lib/adianti/images/question.png";
         $yes = new TElement('a');
         $yes->href = $action_yes->serialize();
         $yes->generator = 'adianti';
         $yes->add(TAdiantiCoreTranslator::translate('Yes'));
         $no = new TElement('a');
         $no->href = $action_no->serialize();
         $no->generator = 'adianti';
         $no->add(TAdiantiCoreTranslator::translate('No'));
         $table = new TTable();
         $table->width = '250px';
         $table->bgcolor = '#E5E5E5';
         $table->style = "border-collapse:collapse";
         $row = $table->addRow();
         $row->addCell($img);
         $table2 = new TTable();
         $row->addCell($table2);
         $row = $table2->addRow();
         $c = $row->addCell($message);
         $c->colspan = 2;
         $row = $table2->addRow();
         $row->addCell($yes);
         $row->addCell($no);
         $table->show();
     } else {
         TPage::include_css('lib/adianti/include/tmessage/tmessage.css');
         // creates a layer to show the dialog
         $painel = new TElement('div');
         $painel->{'class'} = "tmessage";
         $painel->id = 'tquestion_' . $this->id;
         $url_yes = '';
         $url_no = '';
         if ($action_yes) {
             // convert the actions into URL's
             $url_yes = TAdiantiCoreTranslator::translate('Yes') . ': function () { $( this ).dialog( "close" ); __adianti_load_page(\'' . $action_yes->serialize() . '\');},';
         }
         if ($action_no) {
             $url_no = TAdiantiCoreTranslator::translate('No') . ': function () { $( this ).dialog( "close" ); __adianti_load_page(\'' . $action_no->serialize() . '\');},';
         } else {
             $url_no = TAdiantiCoreTranslator::translate('No') . ': function () { $( this ).dialog( "close" );},';
         }
         // 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/question.png"));
         $scroll = new TScroll();
         $scroll->setSize(400, 200);
         $scroll->add($message);
         $cell = $row->addCell($scroll);
         // add the table to the pannel
         $painel->add($table);
         // show the pannel
         $painel->show();
         $script = new TElement('script');
         $script->add(' $(function() {
             $( "#' . $painel->id . '" ).dialog({
                 height: 340,
                 width: 500,
                 modal: true,
                 stack: false,
                 zIndex: 3000,
                 buttons: {
                 ' . $url_yes . $url_no . TAdiantiCoreTranslator::translate('Cancel') . ': function() {
                         $( this ).dialog( "close" );
                     }
                 }
                 }).css("visibility", "visible");
             });');
         $script->show();
     }
 }
Beispiel #28
0
 /**
  * Shows the form at the screen
  */
 public function show()
 {
     TPage::include_css('lib/adianti/include/tform/tform.css');
     // define form properties
     $this->element->enctype = "multipart/form-data";
     $this->element->name = $this->name;
     // form name
     $this->element->id = $this->name;
     // form id
     $this->element->method = 'post';
     // transfer method
     // add the container to the form
     if (isset($this->child)) {
         $this->element->add($this->child);
     }
     // show the form
     $this->element->show();
 }
 /**
  * Shows the DataGrid
  */
 function show()
 {
     TPage::include_css('lib/adianti/include/tdatagrid/tdatagrid.css');
     // shows the datagrid
     parent::show();
     $params = $_REQUEST;
     unset($params['class']);
     unset($params['method']);
     // to keep browsing parameters (order, page, first_page, ...)
     $urlparams = '&' . http_build_query($params);
     // inline editing treatment
     $script = new TElement('script');
     $script->add('$(function() {
     	$(".inlineediting").editInPlace({
     		callback: function(unused, enteredText)
     		{
     		    __adianti_load_page($(this).attr("action")+"' . $urlparams . '&key="+$(this).attr("key")+"&field="+$(this).attr("field")+"&value="+encodeURIComponent(enteredText));
     		    return enteredText;
     		},
     		show_buttons: false,
     		text_size:20,
     		params:column=name
 	    });
     });');
     $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();
 }