Example #1
0
 /**
  * Adiciona um elemento filho
  * @param $child Objeto filho
  */
 public function add($child)
 {
     $wrapper = new Element('div');
     $wrapper->{'style'} = 'clear:both';
     $wrapper->add($child);
     parent::add($wrapper);
     return $wrapper;
 }
Example #2
0
 /**
  * Adiciona um elemento filho
  * @param $child Objeto filho
  */
 public function add($child)
 {
     $wrapper = new Element('div');
     $wrapper->{'style'} = 'display:inline-block;';
     $wrapper->add($child);
     parent::add($wrapper);
     return $wrapper;
 }
 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();
 }
Example #4
0
 /**
  * Agrega um novo objeto linha (TableRow) na tabela
  */
 public function addRow()
 {
     // instancia objeto linha
     $row = new TableRow();
     // armazena no array de linhas
     parent::add($row);
     return $row;
 }
Example #5
0
 /**
  * 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 TableCell($value);
     parent::add($cell);
     // retorna o objeto instanciado
     return $cell;
 }
 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();
 }
 public function __construct()
 {
     parent::__construct();
     $div = new Element('div');
     $div->style = 'text-align:center;';
     $div->style .= 'font-weight: bold;';
     $div->style .= 'font-size: 14pt';
     $p = new Element('p');
     $p->add('Sport Club Internacional');
     $div->add($p);
     $img = new Element('img');
     $img->src = 'App/images/inter.png';
     $div->add($img);
     $p = new Element('p');
     $p->add('Clube do povo do Rio Grande do Sul');
     $div->add($p);
     parent::add($div);
 }
Example #8
0
 /**
  * Instancia o formulário
  * @param $name = nome do formulário
  */
 public function __construct($name = 'my_form')
 {
     parent::__construct('form');
     $this->enctype = "multipart/form-data";
     $this->method = 'post';
     // método de transferência
     $this->setName($name);
     $this->table = new Table();
     $this->table->width = '100%';
     parent::add($this->table);
 }
 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();
 }
Example #10
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();
 }
Example #11
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();
 }
Example #12
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";
             }
         }
     }
 }
Example #13
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";
         }
     }
 }
 public function __construct($panel_title = NULL)
 {
     parent::__construct('div');
     $this->class = 'panel panel-default';
     if ($panel_title) {
         $head = new Element('div');
         $head->class = 'panel-heading';
         $label = new Element('h4');
         $label->add($panel_title);
         $title = new Element('div');
         $title->class = 'panel-title';
         $title->add($label);
         $head->add($title);
         parent::add($head);
     }
     $this->body = new Element('div');
     $this->body->class = 'panel-body';
     parent::add($this->body);
 }
Example #15
0
 /**
  * Adiciona um objeto na grid
  * @param $object = Objeto que contém os dados
  */
 public function addItem($object)
 {
     // adiciona uma linha na Datagrid
     $row = parent::addRow();
     // verifica se a listagem possui ações
     if ($this->actions) {
         // percorre as ações
         foreach ($this->actions as $action) {
             // obtém as propriedades da ação
             $url = $action->serialize();
             $label = $action->getLabel();
             $image = $action->getImage();
             $field = $action->getField();
             // obtém o campo do objeto que será passado adiante
             $key = $object->{$field};
             // cria um link
             $link = new Element('a');
             $link->href = "{$url}&key={$key}&{$field}={$key}";
             // verifica se o link será com imagem ou com texto
             if ($image) {
                 // adiciona a imagem ao link
                 $img = new Element('img');
                 $img->src = "App/Images/{$image}";
                 $img->title = $label;
                 $link->add($img);
             } else {
                 // adiciona o rótulo de texto ao link
                 $link->add($label);
             }
             // adiciona a célula à linha
             $row->addCell($link);
         }
     }
     if ($this->columns) {
         // percorre as colunas da Datagrid
         foreach ($this->columns as $column) {
             // obtém as propriedades da coluna
             $name = $column->getName();
             $align = $column->getAlign();
             $width = $column->getWidth();
             $function = $column->getTransformer();
             $data = $object->{$name};
             // verifica se há função para transformar os dados
             if ($function) {
                 // aplica a função sobre os dados
                 $data = call_user_func($function, $data);
             }
             // adiciona a célula na linha
             $celula = $row->addCell($data);
             $celula->align = $align;
             $celula->width = $width;
         }
     }
     // incrementa o contador de linhas
     $this->rowcount++;
 }
 public function __construct($value)
 {
     parent::__construct('td');
     parent::add($value);
 }
 public function addRow()
 {
     $row = new TableRow();
     parent::add($row);
     return $row;
 }
 public function addCell($value)
 {
     $cell = new TableCell($value);
     parent::add($cell);
     return $cell;
 }