public function actionAjaxGetSubsectorBySector()
 {
     if (Yii::app()->request->isAjaxRequest) {
         if (isset($_POST['sector_id']) && $_POST['sector_id'] != '') {
             $data = Subsector::model()->activos()->findAll(array("condition" => "sector_id =:sector_id", "order" => "nombre", "params" => array(':sector_id' => $_POST['sector_id'])));
             if ($data) {
                 $data = CHtml::listData($data, 'id', 'nombre');
                 echo CHtml::tag('option', array('value' => null, 'id' => 'p'), '- Subsectores -', true);
                 foreach ($data as $value => $name) {
                     echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
                 }
             } else {
                 echo CHtml::tag('option', array('value' => null), '- No existen opciones -', true);
             }
         } else {
             echo CHtml::tag('option', array('value' => null, 'id' => 'p'), '- Seleccione un sector -', true);
         }
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id, $modelClass = __CLASS__)
 {
     $model = Subsector::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #3
0
/** @var Participante $model */
$this->menu = array(array('label' => Yii::t('AweCrud.app', 'Create'), 'icon' => 'plus', 'url' => array('create')));
Util::tsRegisterAssetJs('admin.js');
?>
<div id="flashMsg"  class="flash-messages">

</div> 
<br/>
<div class="panel panel-default">
    <div class="panel-heading"><?php 
echo Yii::t('AweCrud.app', 'Manage');
?>
 <?php 
echo Participante::label(2);
?>
</div>
    <div class="panel-body">
        <div style='overflow:auto'> 
            <?php 
$this->widget('booster.widgets.TbGridView', array('id' => 'participante-grid', 'type' => 'striped  hover advance', 'template' => "{items} {summary} {pager}", 'dataProvider' => $model->activos()->search(), 'filter' => $model, 'columns' => array('nombres', 'apellidos', 'cedula', array('name' => 'telefono', 'value' => '$data->telefono ? $data->telefono : "<span style=\\"color:#EBBBAA; font-style:italic\\" class=\\"vacios\\">--vacío--</span>"', 'type' => 'raw'), array('name' => 'celular', 'value' => '$data->celular ? $data->celular : "<span style=\\"color:#EBBBAA; font-style:italic\\" class=\\"vacios\\">--vacío--</span>"', 'type' => 'raw'), array('name' => 'sector_id', 'value' => 'isset($data->sector) ? $data->sector : null', 'filter' => CHtml::listData(Sector::model()->findAll(), 'id', Sector::representingColumn())), array('name' => 'subsector_id', 'value' => 'isset($data->subsector) ? $data->subsector : null', 'filter' => CHtml::listData(Subsector::model()->findAll(), 'id', Subsector::representingColumn())), array('name' => 'rama_actividad_id', 'value' => 'isset($data->ramaActividad) ? $data->ramaActividad : "<span style=\\"color:#EBBBAA; font-style:italic\\" class=\\"vacios\\">--vacío--</span>"', 'filter' => CHtml::listData(RamaActividad::model()->findAll(), 'id', RamaActividad::representingColumn()), 'type' => 'raw'), array('name' => 'actividad_id', 'value' => '$data->actividad ? $data->actividad : "<span style=\\"color:#EBBBAA; font-style:italic\\" class=\\"vacios\\">--vacío--</span>"', 'filter' => CHtml::listData(Actividad::model()->findAll(), 'id', Actividad::representingColumn()), 'type' => 'raw'), array('htmlOptions' => array('nowrap' => 'nowrap'), 'class' => 'booster.widgets.TbButtonColumn', 'template' => '{view} {update} {delete}', 'afterDelete' => 'function(link,success,data){ 
                    if(success) {
                         $("#flashMsg").empty();
                         $("#flashMsg").css("display","");
                         $("#flashMsg").html(data).animate({opacity: 1.0}, 5500).fadeOut("slow");
                    }
                    }', 'buttons' => array('view' => array('label' => '<button class="btn btn-primary"><i class="icon-pencil"></i></button>', 'options' => array('title' => 'Ver Info'), 'imageUrl' => false), 'update' => array('label' => '<button class="btn btn-primary"><i class="icon-pencil"></i></button>', 'options' => array('title' => 'Actualizar'), 'url' => 'Yii::app()->createUrl("/crm/participante/update/id/".$data->id."/r/0")', 'imageUrl' => false), 'delete' => array('label' => '<button class="btn btn-danger"><i class="icon-trash"></i></button>', 'options' => array('title' => 'Eliminar'), 'imageUrl' => false)), 'htmlOptions' => array('width' => '80px')))));
?>
        </div>
    </div>
</div>
Exemple #4
0
Util::tsRegisterAssetJs('index.js');
?>
<div class="panel panel-default">
    <div class="panel-heading">Gestionar Reportes</div>
    <div class="panel-body">
        <?php 
$this->widget('ext.booster.widgets.TbButton', array('label' => Yii::t('AweCrud.app', 'Exportar'), 'htmlOptions' => array('class' => 'btn-sm btn-danger', 'onclick' => 'ExporCont()')));
?>
        <hr>
        <?php 
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array('type' => 'inline', 'id' => 'reporte-form', 'enableAjaxValidation' => true, 'action' => Yii::app()->createUrl('/eventos/reporte/exportExcel'), 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false), 'enableClientValidation' => false));
?>
        <?php 
$data_evento = CHtml::listData(Evento::model()->getEventos(), 'id', 'nombre');
$data_sector = CHtml::listData(Sector::model()->activos()->findAll(), 'id', 'nombre');
$data_subsector = CHtml::listData(Subsector::model()->activos()->findAll(), 'id', 'nombre');
$data_rama_actividad = CHtml::listData(RamaActividad::model()->activos()->findAll(), 'id', 'nombre');
$data_actividad = CHtml::listData(Actividad::model()->activos()->findAll(), 'id', 'nombre');
?>
        <?php 
echo $form->select2Group($model, 'evento_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-8'), 'widgetOptions' => array('data' => $data_evento ? array(null => ' -- Evento -- ') + $data_evento : array(null => ' -- Ninguno -- '), 'asDropDownList' => true, 'options' => array('tokenSeparators' => array(',', ' ')), 'htmlOptions' => array('data-toogle' => 'tooltip'))));
?>
        <?php 
echo $form->select2Group($model, 'sector_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-8'), 'widgetOptions' => array('data' => $data_sector ? array(null => ' -- Sector -- ') + $data_sector : array(null => ' -- Ninguno -- '), 'asDropDownList' => true, 'options' => array('tokenSeparators' => array(',', ' ')))));
?>
        <?php 
echo $form->select2Group($model, 'subsector_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-8'), 'widgetOptions' => array('data' => $data_subsector ? array(null => ' -- Subsector -- ') + $data_subsector : array(null => ' -- Ninguno -- '), 'asDropDownList' => true, 'options' => array('tokenSeparators' => array(',', ' ')))));
?>
        <?php 
echo $form->select2Group($model, 'rama_actividad_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-8'), 'widgetOptions' => array('data' => $data_rama_actividad ? array(null => ' -- Rama Actividad -- ') + $data_rama_actividad : array(null => ' -- Ninguno -- '), 'asDropDownList' => true, 'options' => array('tokenSeparators' => array(',', ' ')))));
?>
Exemple #5
0
            <?php 
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array('type' => 'horizontal', 'id' => 'actividad-form', 'enableAjaxValidation' => true, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false), 'enableClientValidation' => false));
?>

            <?php 
echo $form->textFieldGroup($model, 'nombre', array('maxlength' => 45));
?>

            <?php 
if ($model->isNewRecord) {
    $data_sector = CHtml::listData(Sector::model()->activos()->findAll(), 'id', Sector::representingColumn());
    $data_subsector = null;
    $data_ramaActividad = null;
} else {
    $data_sector = CHtml::listData(Sector::model()->activos()->findAll(), 'id', Sector::representingColumn());
    $data_subsector = CHtml::listData(Subsector::model()->activos()->findAll(array("condition" => "sector_id =:sector_id", "order" => "nombre", "params" => array(':sector_id' => $model->ramaActividad->subsector->sector->id))), 'id', Subsector::representingColumn());
    $data_ramaActividad = CHtml::listData(RamaActividad::model()->activos()->findAll(array("condition" => "subsector_id =:subsector_id", "order" => "nombre", "params" => array(':subsector_id' => $model->ramaActividad->subsector->id))), 'id', Subsector::representingColumn());
    $model->sector_id = $model->ramaActividad->subsector->sector->id;
    $model->subsector_id = $model->ramaActividad->subsector->id;
}
?>

            <?php 
echo $form->select2Group($model, 'sector_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-8'), 'widgetOptions' => array('data' => $data_sector ? array(null => ' -- Seleccione -- ') + $data_sector : array(null => ' -- Ninguno -- '), 'asDropDownList' => true, 'options' => array('tokenSeparators' => array(',', ' ')))));
?>

            <?php 
echo $form->select2Group($model, 'subsector_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-8'), 'widgetOptions' => array('data' => $data_subsector ? array(null => ' -- Seleccione -- ') + $data_subsector : array(null => ' -- Ninguno -- '), 'asDropDownList' => true, 'options' => array('tokenSeparators' => array(',', ' ')))));
?>

            <?php