public function button($title, $options = array())
 {
     $defaults = array('class' => 'btn');
     $options = array_merge($defaults, $options);
     list($title, $options) = $this->_bootstrapGenerate($title, $options);
     return parent::button($title, $options);
 }
Exemple #2
0
 /**
  * Wraps the form button method and just applies the Bootstrap classes to
  * the button before passing the options on to the FormHelper button method.
  *
  * @param string $value
  * @param array $options
  * @access public
  * @return string
  */
 public function button($value = "Submit", $options = array())
 {
     $options = $this->buttonOptions($options);
     return parent::button($value, $options);
 }
Exemple #3
0
<h2>Pedidos</h2>
<?php 
Helper::js('App.Pedido');
FormHelper::button('novoPedido', 'Novo Pedido', array('onclick' => 'location.href="/' . APP_DIR . 'pedido/inserir"', 'class' => 'btn-primary btn-lg'));
?>
<div class="row" style="clear:both">
    <div class="col-md-12">
        <label for="buscarPedido">Pesquisa</label>
        <input class="form-control buscarPedido" placeholder="Digite número da nota fiscal ou nome do cliente" type="text" id="buscarPedido" name="buscarPedido" onkeyup="App.Pedido.Buscar()"/>
    </div>
</div>
<br/>
<div class="row" style="clear:both">
<div class="col-md-12">
    <div class="panel panel-default">
    <table class="table">
    <thead>
        <tr>
            <th>Protocolo</th>
            <th>Cliente</th>
            <th>Status</th>
            <th>Tipo</th>
            <th>NF</th>
            <th>Valor</th>
            <th>Data</th>
        </tr>
    </thead>
    <tbody id="listaPedidos">
        <?php 
global $db;
$pedidos = $db->query('select *,p.id as pedido_id,(select descricao from pedido_status where p.id = pedido_status.id) as pedido_status, (select descricao from pedido_tipo where p.pedido_tipo_id = id) as pedido_tipo from cliente c, pedido p where c.id = p.cliente_id limit 50');
 /**
  * Creates a cancel button. Used to dismiss modals
  *
  * @param string $title
  * @param array  $options
  * @return string
  */
 public function btnCancel($title = '', $options = [])
 {
     $title = empty($title) ? __('Cancel') : $title;
     $options = array_merge(['class' => 'btn btn-danger', 'type' => 'reset', 'data-dismiss' => 'modal'], $options);
     return parent::button($title, $options);
 }
$dataErrors = isset($validator) ? $validator->getErrors() : array();
$form = new FormHelper($data, $dataErrors);
//id is important, they should be unique
$form->create(array('class' => array('generic', 'addForm'), 'name' => 'addNewUserForm', 'method' => 'post', 'action' => BASE_DIR . '/admin/addUser.php'));
$form->input(array('class' => 'formRow', 'input' => array('type' => 'select', 'selected' => $userType, 'id' => 'userGroup', 'options' => array('admin' => 'Administrator', 'rmhstaff' => 'RMH Staff Approver', 'socialworker' => 'Social Worker')), 'label' => array('value' => 'User Category')));
$form->input(array('class' => 'formRow', 'input' => array('id' => 'title'), 'label' => array('value' => 'Title')));
$form->input(array('input' => array('id' => 'fname'), 'label' => array('value' => 'First Name')));
$form->input(array('input' => array('id' => 'lname'), 'label' => array('value' => 'Last Name')));
$form->input(array('input' => array('id' => 'phone', 'type' => 'tel'), 'label' => array('value' => 'Phone')));
$form->input(array('input' => array('id' => 'username'), 'label' => array('value' => 'Username')));
$form->input(array('class' => 'formRow', 'input' => array('id' => 'email', 'type' => 'email'), 'label' => array('value' => 'Email')));
if (isset($userType) && $userType == 'socialworker') {
    $form->input(array('input' => array('id' => 'hospital'), 'label' => array('value' => 'Hospital Affiliation')));
    $form->input(array('input' => array('id' => 'notify', 'selected' => 'yes', 'type' => 'radio', 'options' => array('yes' => 'Yes', 'no' => 'No')), 'label' => array('value' => 'Email Notification')));
}
$form->button();
$form->generate();
?>
	</div>
</section>
<script>
<?php 
$pageJavaScript = <<<EOF
\$(function(){
    \$('#userGroup').change(function(){
            var userType = \$(this).children('option:selected').val();
            window.location = '{$cst(BASE_DIR)}/admin/addUser.php?type='+userType;
              });
});
EOF;
include ROOT_DIR . '/footer.php';
Exemple #6
0
 public function button($fieldName, $options = array())
 {
     $options = array_merge(array('class' => 'btn defalut', 'type' => 'button', 'div' => false), $options);
     return parent::button($fieldName, $options);
 }
 public function testButton()
 {
     $html = $this->object->button('element', 'value', array('class' => 'test-class-1', 'arbitrary' => 'arbitrary'), 'test-class-2');
     $this->assertAttributes($html, array('class' => array('test-class-1', 'test-class-2', 'ccm-input-button'), 'value' => 'value'));
 }
 /**
  *
  * Create & return a Twitter Like button.
  *
  * New options:
  *  - bootstrap-type: Twitter bootstrap button type (primary, danger, info, etc.)
  *  - bootstrap-size: Twitter bootstrap button size (mini, small, large)
  *
  **/
 public function button($title, $options = array())
 {
     $options = $this->_addButtonClasses($options);
     $options['type'] = FALSE;
     return parent::button($title, $options);
 }
 /**
  * Generate a span element for BsFormHelper::inputGroup() with his content.
  *
  * @param string/array $options Array of options
  *
  * @return string HTML <span> element
  */
 private function __createAddon($options)
 {
     if (is_array($options)) {
         // Check if the span content is a button
         if (isset($options['type'])) {
             $buttonOptions = array();
             if (isset($options['state'])) {
                 $state = 'btn btn-' . $options['state'];
             } else {
                 $state = 'btn btn-default';
             }
             $out = '<span class="input-group-btn">';
             if (isset($options['class'])) {
                 $options['class'] .= ' ' . $state;
             } else {
                 $options['class'] = $state;
             }
             $buttonOptions['div'] = false;
             $buttonOptions['escape'] = false;
             $buttonOptions['type'] = $options['type'];
             $buttonOptions['class'] = $options['class'];
             if ($options['type'] == 'image') {
                 $buttonOptions['src'] = $options['src'];
                 $buttonOptions['type'] = 'image';
                 $buttonOptions['label'] = false;
                 $out .= parent::input($options['content'], $buttonOptions);
             } else {
                 $out .= parent::button($options['content'], $buttonOptions);
             }
             $out .= '</span>';
         } else {
             if (isset($options['class'])) {
                 $options['class'] .= ' input-group-addon';
             } else {
                 $options['class'] = 'input-group-addon';
             }
             $out = '<span class="' . $options['class'] . '">' . $options['content'] . '</span>';
         }
     } else {
         $out = '<span class="input-group-addon">' . $options . '</span>';
     }
     return $out;
 }
Exemple #10
0
                
            <?php 
        $counter++;
    }
    ?>
    </div>
    <?php 
}
FormHelper::startGroup();
if (!$id && Session::hasPermission('usuario', Session::INSERIR) || Session::hasPermission('usuario', Session::EDITAR)) {
    FormHelper::submitAjax("Salvar", "salvar/" . $u['id'], array('class' => 'button button-md'));
}
if ($id && Session::hasPermission('usuario', Session::EXCLUIR)) {
    FormHelper::button("excluir", "Excluir", array('style' => 'margin-left:10px', 'onclick' => 'App.Usuario.Excluir("' . $u["name"] . '",' . $u['id'] . ")"));
}
FormHelper::button('cancelar', "Cancelar", array('style' => 'margin-left:10px', 'onclick' => "location.href=\"/" . APP_DIR . "usuario\""));
FormHelper::endGroup();
FormHelper::end();
?>
    <script type="text/javascript">
        App.Usuario.Excluir = function(nome, id) {
            if (App.Modal.Show("Excluir usuário", 'Deseja realmente excluir o usuário <strong>' + nome + '</strong>?', "Excluir", function() {
                location.href = '<?php 
echo "/" . APP_DIR . "service/usuario/excluir/";
?>
' + id;
            }));
        }
    </script>
    
</div></div>
 /**
  * Create & return a Twitter Like button.
  * 
  * Extra options:
  * 	- ga_type       : string Button type GA_PRIMARY|GA_INFO|GA_SUCCESS|GA_WARNING|GA_DANGER|GA_INVERSE|GA_LINK
  * 	- ga_size       : string Button size GA_MINI|GA_SMALL|GA_LARGE
  * 	- ga_icon       : string Icon name.
  * 	- ga_icon_after : bool true|false Default: false
  */
 public function button($title, $options = [])
 {
     $title = $this->generateButtonTitle($title, $options);
     unset($options['ga_icon'], $options['ga_icon_after']);
     $options = $this->addButtonClasses($options);
     return parent::button($title, $options);
 }