Example #1
0
 public function afterSave()
 {
     parent::afterSave();
     if (count($this->data) == 0) {
         foreach (Sector::model()->findAll() as $sector) {
             $data = new Data();
             $data->metric_id = $this->id;
             $data->sector_id = $sector->id;
             $data->save();
         }
     }
 }
Example #2
0
 public static function getJson()
 {
     $res = array('type' => "FeatureCollection");
     foreach (Sector::model()->with(array('data', 'polygons', 'data.metric'))->findAll() as $sector) {
         $tmp = array();
         $tmp['type'] = "Polygon";
         $tmp['properties'] = $sector->properties;
         foreach ($sector->polygons as $polygon) {
             $tmp['coordinates'][] = $polygon->coordinates;
         }
         $res['features'][$sector->id] = $tmp;
     }
     $res['metrics'] = CHtml::listData(Metric::model()->findAll(), 'name', 'attributes');
     return CJSON::encode($res);
 }
Example #3
0
echo $form->textFieldRow($model, 'codigo_postal', array('maxlength' => 16));
?>

<?php 
echo $form->textFieldRow($model, 'calle_1', array('maxlength' => 128));
?>

<?php 
echo $form->textFieldRow($model, 'calle_2', array('maxlength' => 128));
?>

<?php 
echo $form->textAreaRow($model, 'referencia', array('rows' => 3, 'cols' => 50));
?>

<?php 
echo $form->dropDownListRow($model, 'sector_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Sector::model()->findAll(), 'id', Sector::representingColumn()), array('prompt' => Yii::t('AweApp', 'None')));
?>

<?php 
echo $form->dropDownListRow($model, 'ciudad_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Ciudad::model()->findAll(), 'id', Ciudad::representingColumn()), array('prompt' => Yii::t('AweApp', 'None')));
?>

<div class="form-actions">
    <?php 
$this->widget('bootstrap.widgets.TbButton', array('type' => 'primary', 'label' => Yii::t('AweCrud.app', 'Search')));
?>
</div>

<?php 
$this->endWidget();
Example #4
0
 /**
  * Vista para la informacion cuando se requiera exportar
  */
 public function actionInformacion()
 {
     if (!Yii::app()->user->isGuest) {
         $tipo = Tipo::model()->findAll();
         $tipos = '';
         $es_internacional = "'No' => 0 <br> 'Sí' => 1";
         $sect = Sector::model()->findAll();
         $sectores = '';
         $est = Estado::model()->findAll();
         $estados = '';
         $pais = Paises::model()->findAll();
         $paises = '';
         $tipo_m = TipoMedios::model()->findAll();
         $tipo_medios = '';
         $grupo = Grupos::model()->findAll();
         $grupos = '';
         $usuario = Usuarios::model()->findAll();
         $usuarios = '';
         $es_internacional = "'No' => 0 <br> 'Sí' => 1";
         foreach ($tipo as $t) {
             $tipos .= "'" . $t->nombre . "' => " . $t->id . " <br>";
         }
         foreach ($sect as $s) {
             $sectores .= "'" . $s->nombre . "' => " . $s->id . " <br>";
         }
         foreach ($usuario as $u) {
             $usuarios .= "'" . $u->nombre . ' ' . $u->apellido . "' => " . $u->id . " <br>";
         }
         foreach ($est as $e) {
             $estados .= "'" . $e->nombre . "' => " . $e->id . " <br>";
         }
         foreach ($pais as $p) {
             $paises .= "'" . $p->nombre . "' => " . $p->id . " <br>";
         }
         foreach ($tipo_m as $tm) {
             $tipo_medios .= "'" . $tm->nombre . "' => " . $tm->id . " <br>";
         }
         foreach ($grupo as $g) {
             $grupos .= "'" . $g->nombre . "' => " . $g->id . " <br>";
         }
         $datos = array('es_internacional' => $es_internacional, 'tipos' => $tipos, 'sectores' => $sectores, 'usuarios' => $usuarios, 'estados' => $estados, 'paises' => $paises, 'tipo_medios' => $tipo_medios, 'grupos' => $grupos);
         $this->render('informacion', array('datos' => $datos));
     } else {
         $this->redirect(Yii::app()->homeUrl);
     }
 }
Example #5
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>
 /**
  * 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 = Sector::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionAjaxGetSectoresByCiudad()
 {
     if (Yii::app()->request->isAjaxRequest) {
         //            die(var_dump($_POST));
         if (isset($_POST['ciudad_id']) && $_POST['ciudad_id'] > 0) {
             $data = Sector::model()->findAll(array("condition" => "ciudad_id =:ciudad_id ", "order" => "nombre", "params" => array(':ciudad_id' => $_POST['ciudad_id'])));
             if ($data) {
                 $data = CHtml::listData($data, 'id', 'nombre');
                 echo CHtml::tag('option', array('value' => 0, 'id' => 'p'), '- Sectores -', true);
                 foreach ($data as $value => $name) {
                     echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
                 }
             } else {
                 echo CHtml::tag('option', array('value' => 0, 'id' => 'p'), '- No existen opciones -', true);
             }
         } else {
             echo CHtml::tag('option', array('value' => 0, 'id' => 'p'), '- Seleccione un sector -', true);
         }
     }
 }
Example #8
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(',', ' ')))));
Example #9
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(',', ' ')))));
?>
Example #10
0
/** @var SubsectorController $this */
/** @var Subsector $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 Subsector::label(2);
?>
 </div>
    <div class="panel-body">
        <div style='overflow:auto'> 

            <?php 
$this->widget('booster.widgets.TbGridView', array('id' => 'subsector-grid', 'type' => 'striped  hover advance', 'template' => "{items} {summary} {pager}", 'dataProvider' => $model->activos()->search(), 'columns' => array('nombre', array('name' => 'sector_id', 'value' => 'isset($data->sector) ? $data->sector : null', 'filter' => CHtml::listData(Sector::model()->findAll(), 'id', Sector::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>
Example #11
0
 public function actionDeleteSector($id)
 {
     Sector::model()->findByPk($id)->delete();
     $this->redirect('/regions/index/index');
 }
Example #12
0
            <!-- widget header -->
            <div class="widget-header bg-cyan">
                <!-- widget title -->
                <h4 class="widget-title"><i class="aweso-user"></i> <?php 
echo Yii::t('AweCrud.app', 'Manage');
?>
 <?php 
echo Direccion::label(2);
?>
</h4>
                <!-- widget action, you can also use btn, btn-group, nav-tabs or nav-pills (also support dropdown). enjoy! -->
                <div class="widget-action">
                    <button data-toggle="collapse" data-collapse="#widget-button" class="btn">
                        <i class="aweso-chevron-up color-cyan" data-toggle-icon="aweso-chevron-down  aweso-chevron-up"></i>
                    </button>
                </div>
            </div><!-- /widget header -->
            <!-- widget content -->
            <div class="widget-content bg-white">
                <div style='overflow:auto'> 
                    <?php 
//$this->widget('bootstrap.widgets.TbGridView',array(
$this->widget('ext.selgridview.BootSelGridView', array('id' => 'direccion-grid', 'type' => 'striped bordered hover advance ', 'template' => '{summary}{items}{pager}', 'dataProvider' => $model->search(), 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'columns' => array('id', 'codigo_postal', 'calle_1', 'calle_2', 'referencia', array('name' => 'sector_id', 'value' => 'isset($data->sector) ? $data->sector : null', 'filter' => CHtml::listData(Sector::model()->findAll(), 'id', Sector::representingColumn())), array('class' => 'CButtonColumn', 'template' => '{view} {update} {delete}', 'deleteConfirmation' => CrugeTranslator::t('admin', 'Are you sure you want to delete this user'), 'buttons' => array('view' => array('label' => '<button class="btn btn-success"><i class="aweso-eye-open"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'View')), 'imageUrl' => false), 'update' => array('label' => '<button class="btn btn-info"><i class="aweso-pencil"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'Update')), 'imageUrl' => false), 'delete' => array('label' => '<button class="btn btn-danger"><i class="aweso-trash"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'Delete')), 'imageUrl' => false)), 'htmlOptions' => array('width' => '206px')))));
?>
                </div>
            </div>
        </div>
    </div>
</div>
<!--</fieldset>-->