public function __construct($type, $message)
 {
     $div = new Element('div');
     if ($type == 'info') {
         $div->class = 'alert alert-info';
     } else {
         if ($type == 'error') {
             $div->class = 'alert alert-danger';
         }
     }
     $div->add($message);
     $div->show();
 }
Beispiel #2
0
 /**
  * Executa determinado método de acordo com os parâmetros recebidos
  */
 public function show()
 {
     if ($_GET) {
         $class = isset($_GET['class']) ? $_GET['class'] : NULL;
         $method = isset($_GET['method']) ? $_GET['method'] : NULL;
         if ($class) {
             $object = $class == get_class($this) ? $this : new $class();
             if (method_exists($object, $method)) {
                 call_user_func(array($object, $method), $_GET);
             }
         }
     }
     parent::show();
 }
 public function __construct()
 {
     parent::__construct();
     $button1 = new Element('a');
     $button1->add('Ação 1');
     $button1->class = 'btn btn-success';
     $button2 = new Element('a');
     $button2->add('Ação 2');
     $button2->class = 'btn btn-primary';
     $action1 = new Action(array($this, 'executaAcao1'));
     $action1->setParameter('codigo', 4);
     $action2 = new Action(array($this, 'executaAcao2'));
     $action2->setParameter('codigo', 5);
     $button1->href = $action1->serialize();
     $button2->href = $action2->serialize();
     $button1->show();
     $button2->show();
 }
 function __construct($message, Action $action_yes, Action $action_no = NULL)
 {
     $div = new Element('div');
     $div->class = 'alert alert-warning';
     $url_yes = $action_yes->serialize();
     $link_yes = new Element('a');
     $link_yes->href = $url_yes;
     $link_yes->class = 'btn btn-success';
     $link_yes->add('Sim');
     $message .= ' ' . $link_yes;
     if ($action_no) {
         $url_no = $action_no->serialize();
         $link_no = new Element('a');
         $link_no->href = $url_no;
         $link_no->class = 'btn btn-default';
         $link_no->add('Não');
         $message .= $link_no;
     }
     $div->add($message);
     $div->show();
 }
Beispiel #5
0
 /**
  * Exibe o formulário
  */
 public function show()
 {
     $element = new Element('form');
     $element->class = "form-horizontal";
     $element->enctype = "multipart/form-data";
     $element->method = 'post';
     // método de transferência
     $element->name = $this->decorated->getName();
     foreach ($this->decorated->getFields() as $field) {
         $group = new Element('div');
         $group->class = 'form-group';
         $label = new Element('label');
         $label->class = 'col-sm-2 control-label';
         $label->add($field->getLabel());
         $group->add($label);
         $col = new Element('div');
         $col->class = 'col-sm-10';
         $col->add($field);
         $field->class = 'form-control';
         $group->add($col);
         $element->add($group);
     }
     $group = new Element('div');
     $group->class = 'form-group';
     $col = new Element('div');
     $col->class = 'col-sm-offset-2 col-sm-10"';
     $i = 0;
     foreach ($this->decorated->getActions() as $action) {
         $col->add($action);
         $class = $i == 0 ? 'btn-success' : 'btn-default';
         $action->class = 'btn ' . $class;
         $i++;
     }
     $group->add($col);
     $element->add($group);
     $element->width = '100%';
     $element->show();
 }
Beispiel #6
0
 /**
  * exibe o widget na tela
  */
 public function show()
 {
     if ($this->items) {
         // percorre cada uma das opções do rádio
         foreach ($this->items as $index => $label) {
             $button = new CheckButton("{$this->name}[]");
             $button->setValue($index);
             // verifica se deve ser marcado
             if (in_array($index, (array) $this->value)) {
                 $button->setProperty('checked', '1');
             }
             $obj = new Label($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // exibe uma tag de quebra de linha
                 $br = new Element('br');
                 $br->show();
                 echo "\n";
             }
         }
     }
 }
Beispiel #7
0
 /**
  * Exibe o widget na tela
  */
 public function show()
 {
     if ($this->items) {
         // percorre cada uma das opções do rádio
         foreach ($this->items as $index => $label) {
             $button = new RadioButton($this->name);
             $button->setValue($index);
             // se o índice coincide
             if ($this->value == $index) {
                 // marca o radio button
                 $button->setProperty('checked', '1');
             }
             $obj = new Label($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // exibe uma tag de quebra de linha
                 $br = new Element('br');
                 $br->show();
             }
             echo "\n";
         }
     }
 }