Example #1
0
 function form_agregar()
 {
     $respuesta = new stdClass();
     $this->form_validation->set_rules('codigo', 'Código', 'trim|required|numeric');
     $this->form_validation->set_rules('nombre', 'Nombre', 'trim|required');
     $this->form_validation->set_rules('sector_padre_codigo', 'Sector', 'trim|required');
     $this->form_validation->set_rules('lat', 'Latitud', 'trim|required');
     $this->form_validation->set_rules('lng', 'Longitud', 'trim|required');
     if ($this->form_validation->run() == TRUE) {
         $sector = new Sector();
         $sector->codigo = $this->input->post('codigo');
         $sector->nombre = $this->input->post('nombre');
         $sector->tipo = $this->input->post('tipo');
         $sector->sector_padre_codigo = $this->input->post('sector_padre_codigo');
         $sector->lat = $this->input->post('lat');
         $sector->lng = $this->input->post('lng');
         $sector->save();
         $this->session->set_flashdata('message', 'Sector creado exitosamente! :)');
         $respuesta->validacion = TRUE;
         $respuesta->redirect = site_url('backend/sectores/');
     } else {
         $respuesta->validacion = FALSE;
         $respuesta->errores = validation_errors('<p class="error">', '</p>');
     }
     echo json_encode($respuesta);
 }
Example #2
0
 public static function end()
 {
     $content = gzuncompress(gzcompress(ob_get_contents()));
     ob_end_clean();
     $r = RenderingStack::peek();
     if (self::$store_mode == self::STORE_MODE_OVERWRITE || self::$store_mode == self::STORE_MODE_ERROR_ON_OVERWRITE) {
         $r->set(self::$sector_path, $content);
     }
     if (self::$store_mode == self::STORE_MODE_APPEND) {
         if ($r->is_set(self::$sector_path)) {
             $old_content = $r->get(self::$sector_path);
             $r->set(self::$sector_path, $old_content . $content);
         } else {
             $r->set(self::$sector_path, $content);
         }
     }
     if (self::$store_mode == self::STORE_MODE_PREPEND) {
         if ($r->is_set(self::$sector_path)) {
             $old_content = $r->get(self::$sector_path);
             $r->set(self::$sector_path, $content . $old_content);
         } else {
             $r->set(self::$sector_path, $content);
         }
     }
     self::$sector_opened = false;
     self::$store_mode = null;
     self::$sector_path = null;
 }
Example #3
0
 public function get_region_provincia($region_id = null, $provincia_id = null)
 {
     $provincia = Sector::where_tipo('provincia')->where_codigo_padre($region_id)->where_codigo($provincia_id)->first();
     if (!$provincia) {
         return 'No se ha encontrado la provincia solicitada';
     }
     return $provincia->to_array();
 }
Example #4
0
 public function get_region($region_id = null)
 {
     $region = Sector::where_tipo('region')->where_codigo($region_id)->first();
     if (!$region) {
         return 'No se ha encontrado la región solicitada';
     }
     return $region->to_array();
 }
Example #5
0
 public function __construct(Area $area = null, $i = 0, $j = 0)
 {
     $this->area = $area;
     $this->i = $i;
     $this->j = $j;
     $this->id = Sector::MakeID();
     if ($this->i == -2 && $this->j == -2) {
         $this->oob = true;
     }
 }
Example #6
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();
         }
     }
 }
 function aplicaReserva(Request $request, Response $response)
 {
     $response = $response->withHeader('Content-type', 'application/json');
     $id = $request->getAttribute("idSucursal");
     $sucursal = Sucursal::select('sucursal.idEmpresa')->where('sucursal.id', '=', $id)->first();
     $sectorempresa = SectorEmpresa::select('sectorempresa.idSector')->where('sectorempresa.idEmpresa', '=', $sucursal->idEmpresa)->get();
     foreach ($sectorempresa as $row) {
         $sector = Sector::select('sector.aplicaReserva')->where('sector.id', '=', $row->idSector)->where('sector.aplicaReserva', '=', 'SI')->get();
     }
     $response->getBody()->write(json_encode($sector));
     return $response;
 }
Example #8
0
function doEdit()
{
    if (isset($_POST['submit'])) {
        $SECTORID = $_POST['sector_id'];
        $SECTORNAME = $_POST['sectorname'];
        $sector = new Sector();
        $sector->sector_name = $SECTORNAME;
        $sector->sector_id = $SECTORID;
    }
    if ($SECTORID == "") {
        message('ID Number is required!', "error");
        redirect('index.php?view=edit&id=' . $SECTORID);
    } elseif ($SECTORNAME == "") {
        message('Sector Name is required!', "error");
        redirect('index.php?view=edit&id=' . $SECTORID);
    } else {
        $sector->update($_GET['id']);
        message('Sector information updated successfully!', "info");
        redirect('index.php');
    }
}
Example #9
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);
 }
 public function getSectoresnicho()
 {
     $sectores_nicho = Sector::select('sector.id as sector_id', 'recinto.id as recinto_id', DB::raw('CONCAT("Nicho ",sector.nombre, " ", "Recinto ", recinto.nombre) AS product_name'))->join('recinto', 'sector.id', '=', 'recinto.sector_id')->get();
     return Response::Json($sectores_nicho);
 }
Example #11
0
							</div>
						</div>
						
					</div>
				</div>
				
				<div class="form-group">
					<div class="rows">
						
						<div class="col-md-8">
							<label class="col-md-4 control-label" for="psector">Project Sector</label>
							
							<div class="col-md-8">
								<?php 
$project_sector_id = $list->project_sector_id;
$sector = new Sector();
$listSector = $sector->single_sector($project_sector_id);
?>
								<input class="form-control input-sm" id="project_id" name="project_id" type="text" value="<?php 
echo $listSector->name;
?>
" readonly>
								
							</div>
						</div>
					</div>
				</div>
				
				<?php 
if ($projectFrom == "school") {
    echo '<div class="form-group">
Example #12
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 #13
0
 /**
  ** StreamObjects
  ** Streams objects for a player.
  **
  ** Parameters:
  ** - player: The player who needs to get the objects streamed
  **/
 public function StreamObjects(Player $player, Position $position, Sector $sector)
 {
     if ($this->sight != -1) {
         $last_object = $player->object;
         $nearest = null;
         $distance = 0;
         $sector->FindNearestObject($position, &$nearest, &$distance);
         $player->object = $nearest;
         if ($last_object != null && $player->object != null && $last_object->Equals($player->object)) {
             return;
         }
         if ($last_object == null) {
             if ($player->object != null) {
                 foreach ($player->object->Nearest() as $o) {
                     $o->CreateForPlayer($player);
                 }
             }
         } else {
             if ($player->object == null) {
                 if ($last_object != null) {
                     foreach ($last_object->Nearest() as $o) {
                         $o->DestroyForPlayer($player);
                     }
                 }
             } else {
                 $oldobjs = $last_object->Nearest();
                 $newobjs = $player->object->Nearest();
                 reset($oldobjs);
                 reset($newobjs);
                 $cur = current($newobjs);
                 do {
                     for ($old = current($oldobjs); $old && $old->ID() < $cur->ID(); $old = next($oldobjs)) {
                         $old->DestroyForPlayer($player);
                     }
                     if ($old && $old->ID() == $cur->ID()) {
                         next($oldobjs);
                     }
                     $cur->CreateForPlayer($player);
                     $cur = next($newobjs);
                 } while ($cur);
                 for ($old = current($oldobjs); $old; $old = next($oldobjs)) {
                     $old->DestroyForPlayer($player);
                 }
                 /*          while ($oldobjs != null && $oldobjs->object->ID() < $newobjs->object->ID())
                           {
                             $oldobjs->object->DestroyForPlayer($player);
                             $oldobjs = $oldobjs->next;
                           }
                           if ($oldobjs != null && $oldobjs->object->ID() == $newobjs->object->ID())
                             $oldobjs = $oldobjs->next;
                 
                           $newobjs->object->CreateForPlayer($player);
                           $newobjs = $newobjs->next;
                         } while ($newobjs != null);
                 
                         while ($oldobjs != null)
                         {
                           $oldobjs->object->DestroyForPlayer($player);
                           $oldobjs = $oldobjs->next;
                         }*/
             }
         }
     }
 }
Example #14
0
								</a
								</p>
							</div>
							<div class="col-xs-6">
								<p align="right"><a href="<?php 
echo WEB_ROOT;
?>
admin/logout.php"
								class="btn btn-info btn-xsm"><span class="glyphicon glyphicon-log-out"></span>Log out</a></p>
							</div>
						</div>
					</div>
				</div>
		</div> 
<?php 
$sector = new Sector();
$list = $sector->single_sector($_GET['sectorId']);
?>
<form class="form-horizontal well span9" action="controller.php?action=edit&id=<?php 
echo $list->sector_id;
?>
" method="POST">
	
	<fieldset>
		<legend>Sector Information</legend>
		<div class="form-group" id="sector_id">
			<div class="col-md-8">
				<label class="col-md-4 control-label" for="sector_id">Sector Number </label>
				
				<div class="col-md-8">
					<input class="form-control input-sm" id="sector_id" name="sector_id" type="text" value="<?php 
Example #15
0
<div class="container">
	<div class="panel panel-primary">
		<div class="panel-heading">
			<div class="row">
				<div class="col-xs-3"><p align="left"><a href="<?php 
echo WEB_ROOT;
?>
admin/index.php?page=2" class="btn btn-info btn-xsm"><span class="glyphicon glyphicon-home"></span>&nbsp;Home</a><p>
				</div>
				
				<div class="col-xs-9">
					<div class="col-xs-8">
						<p ><strong><h5 align="right">
						<?php 
echo $_SESSION['ACCOUNT_FNAME'] . " " . $_SESSION['ACCOUNT_LNAME'];
?>
</h5></strong></p>
					</div>
					<div class="col-xs-4">
						<div class="col-xs-6">
							<p align="left"><a href="<?php 
echo WEB_ROOT;
?>
admin/modules/sector/index.php" class="btn btn-info btn-xsm">
								<span class="glyphicon glyphicon-step-backward"></span>Back
								</a
								</p>
							</div>
							<div class="col-xs-6">
								<p align="right"><a href="<?php 
echo WEB_ROOT;
Example #16
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(',', ' ')))));
}
echo "^_^" . $percent . "^_^" . $auxUnits . "^_^" . $auxTimes . "^_^" . implode(",", $availableUnits) . "^_^" . implode(",", $speeds) . "^_^";
$queuedNumbers = array();
foreach ($player->getAvailableUnits() as $unit) {
    $queuedNumbers[$unit->getId()] = 0;
}
if ($unitQueueListArr) {
    foreach ($queuedUnits as $queuedUnit) {
        $queuedNumbers[$queuedUnit]++;
    }
}
$divisionsArr = $divisionConn->getOwnDivisionsBySector($coordinateX, $coordinateY);
$divisions = array();
foreach ($divisionsArr as $divisionArr) {
    $division = new Division($divisionArr[0], $divisionArr[1], $divisionArr[3], $divisionArr[4]);
    $divisions[$division->getUnitId()] = $division;
}
$player->setVisibleSectors(Sector::indexByCoordinate($player->getVisibleSectors()));
$reachableSectors = array();
$startX = $sector->getCoordinateX();
$startY = $sector->getCoordinateY();
Sector::getReachables($player->getVisibleSectors(), $sector->getCoordinateX(), $sector->getCoordinateY(), 0);
$reachableSectors = Sector::sortByCoordinate($reachableSectors);
$player->setReachableSectors($reachableSectors);
$distances = array();
foreach ($player->getReachableSectors() as $reachableSector) {
    $distances[] = $reachableSector->getDistance();
}
echo implode(",", $distances) . "^_^";
$detailType = 'units';
require "../../views/detailBox/unitsDetailsView.php";
Example #18
0
<?php

/** @var SectorController $this */
/** @var Sector $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 Sector::label(2);
?>
    </legend>

<?php 
$this->widget('booster.widgets.TbListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
?>
</fieldset>
Example #19
0
Util::tsRegisterAssetJs('_form.js');
/** @var SectorController $this */
/** @var Sector $model */
/** @var AweActiveForm $form */
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array('id' => 'sector-form', 'type' => 'horizontal', 'enableAjaxValidation' => true, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => true), 'enableClientValidation' => false));
?>
<div class="row-fluid">
    <div class="span12">
        <!-- widget button -->
        <div class="widget border-cyan" id="widget-button">

            <!-- widget header -->
            <div class="widget-header bg-cyan">
                <!-- widget title -->
                <h4 class="widget-title"><i class="aweso-map-marker"></i> <?php 
echo Yii::t('AweCrud.app', $model->isNewRecord ? 'Create' : 'Update') . ' ' . Sector::label();
?>
</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 -->
            <div class="widget-content form bg-white">


                <p class="note">
                    <?php 
echo Yii::t('AweCrud.app', 'Fields with');
Example #20
0
function render_sector($sector_path)
{
    echo Sector::get($sector_path);
}
 public function reporteCultivo($request, $filtros)
 {
     //Castear fechas
     $fecha = $request->fechaInicio . " 00:00:00";
     $fechaInf = Carbon::createFromFormat("d/m/Y H:i:s", $fecha);
     $fecha = $request->fechaFin . " 23:59:59";
     $fechaSup = Carbon::createFromFormat("d/m/Y H:i:s", $fecha);
     $cultivo = cultivo::find($request->cultivo);
     $siembras = null;
     $sectores = null;
     if ($request->sector != "") {
         $sectores = Sector::select('id', 'nombre')->where('id', $request->sector)->get();
         $siembras = $cultivo->siembras()->where('id_sector', $request->sector)->whereBetween('fecha', array($fechaInf, $fechaSup))->orderBy('fecha', 'asc')->get();
     } else {
         $siembras = $cultivo->siembras()->whereBetween('fecha', array($fechaInf, $fechaSup))->orderBy('fecha', 'asc')->get();
         $sectores = DB::table('cultivo')->where('cultivo.id', '=', $request->cultivo)->join('siembra_sector', 'siembra_sector.id_cultivo', '=', 'cultivo.id')->where('siembra_sector.fecha', '>=', $fechaInf)->where('siembra_sector.fecha', '<=', $fechaSup)->join('sector', 'sector.id', '=', 'siembra_sector.id_sector')->select('sector.id', 'sector.nombre')->distinct()->orderby('sector.nombre', 'asc')->get();
     }
     // $sectores=array_unique($sectores);
     // if(empty($sectores)){
     //   dd("vacio");
     //}
     /*Un arreglo para almacenar resultado de busqueda de cada filtro*/
     $arrayPreparaciones = null;
     $arraySiembras = null;
     $arrayFertilizaciones = null;
     $arrayRiegos = null;
     $arrayMantenimientos = null;
     $arrayCosechas = null;
     ///////////////////////////////Preparaciones////////////////////////////////////////////////////
     if ($filtros['preparaciones']) {
         $arrayPreparaciones[0]['Sector'] = "";
         $arrayPreparaciones[0]['Maquinaria'] = "";
         $arrayPreparaciones[0]['Número de pasadas'] = 0;
         $arrayPreparaciones[0]['Fecha'] = "";
         $i = 0;
         foreach ($sectores as $sector) {
             $sector = sector::find($sector->id);
             $preparaciones = $sector->preparaciones()->whereBetween('fecha', array($fechaInf, $fechaSup))->orderBy('fecha', 'asc')->get();
             foreach ($preparaciones as $preparacion) {
                 $maquinaria = maquinaria::findOrFail($preparacion->id_maquinaria);
                 $arrayPreparaciones[$i]['Sector'] = $sector->nombre;
                 $arrayPreparaciones[$i]['Maquinaria'] = $maquinaria->nombre;
                 $arrayPreparaciones[$i]['Número de pasadas'] = $preparacion->numPasadas;
                 $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $preparacion->fecha);
                 $preparacion->fecha = $fecha->format('d/m/Y');
                 $arrayPreparaciones[$i]['Fecha'] = $preparacion->fecha;
                 $i++;
             }
         }
     }
     ///////////////////////////////Siembras////////////////////////////////////////////////////
     if ($filtros['siembras']) {
         $arraySiembras[0]['Sector'] = "";
         $arraySiembras[0]['Cultivo'] = "";
         $arraySiembras[0]['Variedad'] = "";
         $arraySiembras[0]['Tipo de siembra'] = "";
         $arraySiembras[0]['Temporada'] = "";
         $arraySiembras[0]['Fecha de siembra'] = "";
         $arraySiembras[0]['Status'] = "";
         $arraySiembras[0]['Fecha de terminación'] = "";
         $arraySiembras[0]['Comentario'] = "";
         $i = 0;
         foreach ($siembras as $siembra) {
             $arraySiembras[$i]['Sector'] = $siembra->sector->nombre;
             $arraySiembras[$i]['Cultivo'] = $cultivo->nombre;
             $arraySiembras[$i]['Variedad'] = $siembra->variedad;
             $arraySiembras[$i]['Tipo de siembra'] = $siembra->tipo;
             $arraySiembras[$i]['Temporada'] = $siembra->temporada;
             $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $siembra->fecha);
             $fecha = $fecha->format('d/m/Y');
             $arraySiembras[$i]['Fecha de siembra'] = $fecha;
             $arraySiembras[$i]['Status'] = $siembra->status;
             $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $siembra->fechaTerminacion);
             $fecha = $fecha->format('d/m/Y');
             $arraySiembras[$i]['Fecha de terminación'] = $fecha;
             $arraySiembras[$i]['Comentario'] = $siembra->comentario;
             $i++;
         }
     }
     //////////////////////////////////////Fertilizaciones///////////////////////////////////////////////////
     if ($request->sector != "") {
         $siembras = $cultivo->siembras()->where('id_sector', $request->sector)->orderBy('fecha', 'asc')->get();
     } else {
         $siembras = $cultivo->siembras()->orderBy('fecha', 'asc')->get();
     }
     if ($filtros['fertilizaciones']) {
         $arrayFertilizaciones[0]['Sector'] = "";
         $arrayFertilizaciones[0]['Siembra'] = "";
         $arrayFertilizaciones[0]['Tipo'] = "";
         $arrayFertilizaciones[0]['Fuente'] = "";
         $arrayFertilizaciones[0]['Cantidad'] = "";
         $arrayFertilizaciones[0]['Programa NPK'] = "";
         $arrayFertilizaciones[0]['Fecha'] = "";
         $i = 0;
         foreach ($siembras as $siembra) {
             $fertilizaciones = $siembra->fertilizaciones()->whereBetween('fecha', array($fechaInf, $fechaSup))->orderBy('fecha', 'asc')->get();
             foreach ($fertilizaciones as $fertilizacion) {
                 $arrayFertilizaciones[$i]['Sector'] = $siembra->sector->nombre;
                 $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $siembra->fecha);
                 $fecha = $fecha->format('d/m/Y');
                 $arrayFertilizaciones[$i]['Siembra'] = $cultivo->nombre . ' ' . $siembra->variedad . ' ' . $fecha;
                 $arrayFertilizaciones[$i]['Tipo'] = $fertilizacion->tipo;
                 $arrayFertilizaciones[$i]['Fuente'] = $fertilizacion->fuente;
                 $arrayFertilizaciones[$i]['Cantidad'] = $fertilizacion->cantidad;
                 $arrayFertilizaciones[$i]['Programa NPK'] = $fertilizacion->programaNPK;
                 $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $fertilizacion->fecha);
                 $fertilizacion->fecha = $fecha->format('d/m/Y');
                 $arrayFertilizaciones[$i]['Fecha'] = $fertilizacion->fecha;
                 $i++;
             }
         }
     }
     //////////////////////////////////////Riegos///////////////////////////////////////////////////
     if ($filtros['riegos']) {
         $arrayRiegos[0]['Sector'] = "";
         $arrayRiegos[0]['Siembra'] = "";
         $arrayRiegos[0]['Tiempo'] = "";
         $arrayRiegos[0]['Distancia entre líneas'] = "";
         $arrayRiegos[0]['Litros/Hectárea'] = "";
         $arrayRiegos[0]['Lámina'] = "";
         $arrayRiegos[0]['Fecha'] = "";
         $i = 0;
         foreach ($siembras as $siembra) {
             $riegos = $siembra->riegos()->whereBetween('fecha', array($fechaInf, $fechaSup))->orderBy('fecha', 'asc')->get();
             foreach ($riegos as $riego) {
                 $arrayRiegos[$i]['Sector'] = $siembra->sector->nombre;
                 $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $siembra->fecha);
                 $fecha = $fecha->format('d/m/Y');
                 $arrayRiegos[$i]['Siembra'] = $cultivo->nombre . ' ' . $siembra->variedad . ' ' . $fecha;
                 $arrayRiegos[$i]['Tiempo'] = $riego->tiempo;
                 $arrayRiegos[$i]['Distancia entre líneas'] = $riego->distanciaLineas;
                 $arrayRiegos[$i]['Litros/Hectárea'] = $riego->litrosHectarea;
                 $arrayRiegos[$i]['Lámina'] = $riego->lamina;
                 $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $riego->fecha);
                 $riego->fecha = $fecha->format('d/m/Y');
                 $arrayRiegos[$i]['Fecha'] = $riego->fecha;
                 $i++;
             }
         }
     }
     //////////////////////////////////////Mantenimiento///////////////////////////////////////////////////
     if ($filtros['mantenimientos']) {
         $arrayMantenimientos[0]['Sector'] = "";
         $arrayMantenimientos[0]['Siembra'] = "";
         $arrayMantenimientos[0]['Actividad'] = "";
         $arrayMantenimientos[0]['Tipo de aplicación'] = "";
         $arrayMantenimientos[0]['Producto'] = "";
         $arrayMantenimientos[0]['Cantidad'] = "";
         $arrayMantenimientos[0]['Fecha'] = "";
         $arrayMantenimientos[0]['Comentario'] = "";
         $i = 0;
         foreach ($siembras as $siembra) {
             $mantenimientos = $siembra->mantenimientos()->whereBetween('fecha', array($fechaInf, $fechaSup))->orderBy('fecha', 'asc')->get();
             foreach ($mantenimientos as $mantenimiento) {
                 $arrayMantenimientos[$i]['Sector'] = $siembra->sector->nombre;
                 $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $siembra->fecha);
                 $fecha = $fecha->format('d/m/Y');
                 $arrayMantenimientos[$i]['Siembra'] = $cultivo->nombre . ' ' . $siembra->variedad . ' ' . $fecha;
                 $arrayMantenimientos[$i]['Actividad'] = $mantenimiento->actividad;
                 $arrayMantenimientos[$i]['Tipo de aplicación'] = $mantenimiento->tipoAplicacion;
                 $arrayMantenimientos[$i]['Producto'] = $mantenimiento->producto;
                 $arrayMantenimientos[$i]['Cantidad'] = $mantenimiento->cantidad;
                 $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $mantenimiento->fecha);
                 $mantenimiento->fecha = $fecha->format('d/m/Y');
                 $arrayMantenimientos[$i]['Fecha'] = $mantenimiento->fecha;
                 $arrayMantenimientos[$i]['Comentario'] = $mantenimiento->comentario;
                 $i++;
             }
         }
     }
     ///////////////////////////////Cosecha////////////////////////////////////////////////////
     if ($filtros['cosechas']) {
         $arrayCosechas[0]['Sector'] = "";
         $arrayCosechas[0]['Siembra'] = "";
         $arrayCosechas[0]['Fecha'] = "";
         $arrayCosechas[0]['Descripción'] = "";
         $i = 0;
         foreach ($siembras as $siembra) {
             $cosechas = $siembra->cosechas()->whereBetween('fecha', array($fechaInf, $fechaSup))->orderBy('fecha', 'asc')->get();
             foreach ($cosechas as $cosecha) {
                 $arrayCosechas[$i]['Sector'] = $siembra->sector->nombre;
                 $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $siembra->fecha);
                 $fecha = $fecha->format('d/m/Y');
                 $arrayCosechas[$i]['Siembra'] = $cultivo->nombre . ' ' . $siembra->variedad . ' ' . $fecha;
                 $fecha = Carbon::createFromFormat('Y-m-d H:i:s', $cosecha->fecha);
                 $cosecha->fecha = $fecha->format('d/m/Y');
                 $arrayCosechas[$i]['Fecha'] = $cosecha->fecha;
                 $arrayCosechas[$i]['Descripción'] = $cosecha->descripcion;
                 $i++;
             }
         }
     }
     $arrays[0][0] = $arrayPreparaciones;
     $arrays[0][1] = "Preparaciones";
     $arrays[1][0] = $arraySiembras;
     $arrays[1][1] = "Siembras";
     $arrays[2][0] = $arrayFertilizaciones;
     $arrays[2][1] = "Fertilizaciones";
     $arrays[3][0] = $arrayRiegos;
     $arrays[3][1] = "Riegos";
     $arrays[4][0] = $arrayMantenimientos;
     $arrays[4][1] = "Mantenimientos";
     $arrays[5][0] = $arrayCosechas;
     $arrays[5][1] = "Cosechas";
     $arrays[6][0] = null;
     $arrays[6][1]['fechaInf'] = $request->fechaInicio;
     $arrays[7][0] = null;
     $arrays[7][1]['fechaSup'] = $request->fechaFin;
     $string = str_random(40);
     $request->session()->put($string, $arrays);
     return $string;
 }
 /**
  * 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;
 }
Example #23
0
					
					<div class="col-md-8">
						<label class="col-md-4 control-label" for="projecttypeid">Project Type </label>
						
						<div class="col-md-8">
							<input class="form-control input-sm" id="projecttypeid" name="projecttypeid" placeholder="Project Type" type="text" value="">
						</div>
					</div> <br /><br />
					
					<div class="col-md-8">
						<label class="col-md-4 control-label" for="psector">Project-Sector</label>
						
						<div class="col-md-8">
							<select class="form-control input-sm" name="psector" id="psector">';
								<?php 
$sector = new Sector();
$cur = $sector->listOfSectors();
foreach ($cur as $sector) {
    echo '<option value="' . $sector->sector_id . '">' . $sector->name . '</option>';
}
?>
								
							</select>	
						</div>
					</div>
					<br /><br />
					
					<?php 
if ($projectFrom == "school") {
    echo '<div class="col-md-8">
							<label class="col-md-4 control-label" for="pschool">Project-School</label>
Example #24
0
$allSectors = array();
$visibleSectors = array();
$owned_sectors = array();
unset($_SESSION['capitolSector']);
foreach ($sectorsArr as $sectorArr) {
    if (isset($allPlayers[$sectorArr[4]])) {
        $occupantId = $allPlayers[$sectorArr[4]]->getNick();
    } else {
        $occupantId = NULL;
    }
    if (isset($allPlayers[$sectorArr[5]])) {
        $ownerId = $allPlayers[$sectorArr[5]]->getNick();
    } else {
        $ownerId = NULL;
    }
    $sector = new Sector($sectorArr[0], $sectorArr[1], $sectorArr[2], $sectorArr[3], $sectorArr[4], $sectorArr[5], $sectorArr[6], $sectorArr[7], explode(",", $sectorArr[8]), explode(",", $sectorArr[9]), $sectorArr[10], explode(",", $sectorArr[11]));
    $battleArr = $sectorConn->getBattleBySectorId($sector->getId());
    if (count($battleArr)) {
        $battle = new Battle($battleArr[0], 0, 0, $battleArr[2], $battleArr[3], $battleArr[4], $battleArr[5]);
        $sector->setBattle($battle);
    }
    $sectorBuildingsArr = $sectorConn->getSectorBuildings($sector->getId());
    $sectorBuildings = array();
    foreach ($sectorBuildingsArr as $sectorBuildingArr) {
        $buildingClass = $sectorBuildingArr[1];
        $building = clone $allBuildings[$buildingClass];
        $building->setLevel($sectorBuildingArr[3]);
        $building->setDateStarted($sectorBuildingArr[4]);
        $building->setDateStopped($sectorBuildingArr[5]);
        $sectorBuildings[$building->getId()] = $building;
    }
Example #25
0
?>
" readonly>
					</div>
				</div>
				
			</div>
		</div>
		<div class="form-group">
			<div class="rows">
				<div class="col-md-8">
					<label class="col-md-4 control-label" for="psector"> Sector</label>
					
					<div class="col-md-8">
					<?php 
$domain_sector_id = $list->domain_sector_id;
$sector = new Sector();
$listSector = $sector->single_sector($domain_sector_id);
?>
						<input class="form-control input-sm" id="domain_id" name="domain_id" type="text" value="<?php 
echo $list->domain_sector_id;
?>
" readonly>
						
					</div>
				</div>
				</div>
		</div>
</center>
</form>
<!--	</div><!--End of well-->
 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 #27
0
								<input class="form-control input-sm" id="subject_id" name="subject_id" type="text" value="<?php 
echo $list->description;
?>
" readonly>
							</div>
						</div>	
					</div>
				</div>
				<div class="form-group">
					<div class="rows">
						<div class="col-md-8">
							<label class="col-md-4 control-label" for="psector"> Sector</label>
							<div class="col-md-8">
								<?php 
$sector_id = $list->sector_id;
$sector = new Sector();
$listSector = $sector->single_sector($sector_id);
?>
								<input class="form-control input-sm" id="project_id" name="project_id" type="text" value="<?php 
echo $listSector->sector_name;
?>
" readonly>
							</div>
						</div>
					</div>
				</div>
				
				<div class="form-group">
					<div class="rows">
						<div class="col-md-8">
							<label class="col-md-4 control-label" for="domain"> Domain</label>
Example #28
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>
$capitolSectorArr = $sectorConn->getCapitolSector($playerId);
if ($capitolSectorArr) {
    $capitolSectorX = $capitolSectorArr[1];
    $capitolSectorY = $capitolSectorArr[2];
} else {
    $distanceFromCapitol = $maxDistance;
}
foreach ($manteinancesArr as $manteinanceArr) {
    $sectorId = $manteinanceArr["sector_id"];
    $costs = explode(",", $manteinanceArr["manteinanceCost"]);
    $multiplier = $manteinanceArr["multiplier"];
    $concept = $manteinanceArr["concept"];
    $battleId = $manteinanceArr["battle_id"];
    if ($concept == 'Division' || $concept == 'BattleCosts') {
        $sectorArr = $sectorConn->getSectorById($sectorId);
        $sector = new Sector($sectorArr[0], $sectorArr[1], $sectorArr[2], $sectorArr[3], $sectorArr[4], $sectorArr[5], $sectorArr[6], $sectorArr[7], explode(",", $sectorArr[8]), explode(",", $sectorArr[9]));
        if ($capitolSectorArr) {
            $distanceFromCapitol = $sector->getDistanceFrom($capitolSectorX, $capitolSectorY);
        }
        $unit = new Unit(0, '', 0, 0, 0, 0, 0, '', 0, array(0, 0, 0, 0, 0), $costs, array(0, 0, 0, 0, 0), 0, '', NULL, 0);
        $costs = $unit->getEfectiveManteinanceCosts($distanceFromCapitol);
    }
    $newCosts = array();
    foreach ($costs as $index => $cost) {
        $newCosts[$index] = $cost * $multiplier;
    }
    if ($concept == 'BattleCosts') {
        $battleConn->updateBattleCosts($battleId, $playerId, $newCosts, 1, '+');
    } else {
        $sectorConn->updateSectorCosts($sectorId, $newCosts, 1, '+');
    }
Example #30
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);
     }
 }