Beispiel #1
0
 /**
  * Adiciona um botão na Toolbar
  * 
  * @param ZendT_View_Button $button 
  * @param string $name
  * @return \ZendT_View_Toolbar
  */
 public function addButton(ZendT_View_Button $button, $name = null)
 {
     if ($name == null) {
         $name = $button->getId();
     }
     $button->addClass('item');
     $this->_buttons[$name] = $button;
     $this->_buttonsOrder[] = $name;
     return $this;
 }
Beispiel #2
0
 /**
  * Cria botões para window
  *
  * @param array $buttons
  * @return array
  */
 protected function _createButtons(array $buttons)
 {
     $retorno = array();
     foreach ($buttons as $button) {
         if ($button['onClick'] != '') {
             $button['onClick'] = stripslashes(urldecode($button['onClick']));
             if (substr($button['onClick'], 0, 7) == 'base64:') {
                 $button['onClick'] = base64_decode(substr($button['onClick'], 7));
             }
             $_button = new ZendT_View_Button('button' . str_replace(' ', '_', $button['caption']), $button['caption'], new ZendT_JS_Command($button['onClick']));
             $_button->setIcon($button['icon']);
             if (isset($button['class'])) {
                 $_button->addClass($button['class']);
             }
             //$idButton = $_button->getId();
             $retorno['buttons'] .= $_button->render();
             $key = strtolower(substr(trim($button['caption']), 0, 1));
             if ($key != 'c') {
                 $this->view->hotkeys()->add('key_' . $_button->getId(), 'ctrl+' . $key, "jQuery('#" . $_button->getId() . "').click();");
             }
             /* $retorno['functions'].= "$('#" . $idButton . "').click(" .  . ");\n"; */
         }
     }
     return $retorno;
 }