public function actionAjaxGetRamaActiBySubSector() { if (Yii::app()->request->isAjaxRequest) { if (isset($_POST['subsector_id']) && $_POST['subsector_id'] != '') { $data = RamaActividad::model()->activos()->findAll(array("condition" => "subsector_id =:subsector_id", "order" => "nombre", "params" => array(':subsector_id' => $_POST['subsector_id']))); if ($data) { $data = CHtml::listData($data, 'id', 'nombre'); echo CHtml::tag('option', array('value' => null, 'id' => 'p'), '- Ramas -', 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, 'id' => 'p'), '- No existen opciones -', true); } } else { echo CHtml::tag('option', array('value' => null, 'id' => 'p'), '- Seleccione un subsector -', true); } } }
<?php /** @var RamaActividadController $this */ /** @var RamaActividad $model */ $this->menu = array(array('label' => "<div>" . CHtml::image(Yii::app()->baseUrl . "/images/topbar/administrar.png") . "</div>" . Yii::t('AweCrud.app', 'Manage'), 'url' => array('admin')), array('label' => "<div>" . CHtml::image(Yii::app()->baseUrl . "/images/topbar/nuevo.png") . "</div>" . Yii::t('AweCrud.app', 'Create'), 'url' => array('create'))); ?> <fieldset> <legend> <?php echo Yii::t('AweCrud.app', 'List'); ?> <?php echo RamaActividad::label(2); ?> </legend> <?php $this->widget('booster.widgets.TbListView', array('dataProvider' => $dataProvider, 'itemView' => '_view')); ?> </fieldset>
/** @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>
?> <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(',', ' '))))); ?> <?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 echo $form->select2Group($model, 'rama_actividad_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-8'), 'widgetOptions' => array('data' => $data_ramaActividad ? array(null => ' -- Seleccione -- ') + $data_ramaActividad : array(null => ' -- Ninguno -- '), 'asDropDownList' => true, 'options' => array('tokenSeparators' => array(',', ' ')))));
<?php /** @var RamaActividadController $this */ /** @var RamaActividad $model */ /** @var AweActiveForm $form */ Util::tsRegisterAssetJs('_form.js'); ?> <div class="col-md-12"> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title"><?php echo Yii::t('AweCrud.app', $model->isNewRecord ? 'Create' : 'Update') . ' ' . RamaActividad::label(1); ?> </h3> </div> <div class="panel-body"> <?php $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array('type' => 'horizontal', 'id' => 'rama-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; } 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->subsector->sector->id))), 'id', Subsector::representingColumn());
/** @var ActividadController $this */ /** @var Actividad $model */ $this->menu = array(array('label' => Yii::t('AweCrud.app', 'Create'), 'icon' => 'plus', 'url' => array('create'))); ?> <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 Actividad::label(2); ?> </div> <div class="panel-body"> <div style='overflow:auto'> <?php $this->widget('booster.widgets.TbGridView', array('id' => 'actividad-grid', 'type' => 'striped hover advance', 'template' => "{items} {summary} {pager}", 'dataProvider' => $model->activos()->search(), 'columns' => array('nombre', array('name' => 'sector_id', 'value' => 'isset($data->ramaActividad) ? $data->ramaActividad->subsector->sector : null', 'filter' => CHtml::listData(RamaActividad::model()->findAll(), 'id', RamaActividad::representingColumn())), array('name' => 'subsector_id', 'value' => 'isset($data->ramaActividad) ? $data->ramaActividad->subsector : null', 'filter' => CHtml::listData(RamaActividad::model()->findAll(), 'id', RamaActividad::representingColumn())), array('name' => 'rama_actividad_id', 'value' => 'isset($data->ramaActividad) ? $data->ramaActividad : null', 'filter' => CHtml::listData(RamaActividad::model()->findAll(), 'id', RamaActividad::representingColumn())), array('htmlOptions' => array('nowrap' => 'nowrap'), 'class' => 'booster.widgets.TbButtonColumn', 'template' => '{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('update' => array('label' => '<button class="btn btn-primary"><i class="icon-pencil"></i></button>', 'options' => array('title' => 'Actualizar'), '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>
/** * 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 = RamaActividad::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }