public function actionAdmin()
 {
     $model = new Ciudades('search');
     $model->unsetAttributes();
     if (isset($_GET['Ciudades'])) {
         $model->setAttributes($_GET['Ciudades']);
     }
     $this->render('admin', array('model' => $model));
 }
<?php

require_once 'ConexionMongodb.php';
/**
* Clase catalogo completo Ciudades
*/
class Ciudades extends ConexionMongodb
{
    function getCiudades()
    {
        $ciudades = $this->db->catalogoCiudades->find();
        $all = array();
        foreach ($ciudades as $key => $value) {
            $array = array("id" => $key, "value" => $value['value'], "label" => $value['label'], "desc_estado" => $value['desc_estado'], "id_estado" => $value['id_estado'], "locacion" => $value['locacion']);
            array_push($all, $array);
        }
        return json_encode($all);
    }
}
$ciudad = new Ciudades();
$result = $ciudad->getCiudades();
echo $result;
Exemple #3
0
<?php

$this->breadcrumbs = array(Ciudades::label(2), Yii::t('app', 'Index'));
$this->menu = array(array('label' => Yii::t('app', 'Agregar') . ' ' . Ciudades::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Administrar') . ' ' . Ciudades::label(2), 'url' => array('admin')));
?>

<h1><?php 
echo GxHtml::encode(Ciudades::label(2));
?>
</h1>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'emptyText' => 'No hay resultados', 'summaryText' => 'Mostrando del {start} al {end} de {count} resultado(s).', 'pager' => array('header' => '', 'prevPageLabel' => 'Anterior', 'nextPageLabel' => 'Siguiente'), 'itemView' => '_view'));
Exemple #4
0
<?php

$this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Administrar'));
$this->menu = array(array('label' => Yii::t('app', 'Listar') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Agregar') . ' ' . $model->label(), 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('proveedores-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1><?php 
echo Yii::t('app', 'Administrar') . ' ' . GxHtml::encode($model->label(2));
?>
</h1>


<?php 
echo GxHtml::link(Yii::t('app', 'Busqueda Avanzada'), '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'proveedores-grid', 'dataProvider' => $model->search(), 'emptyText' => 'No hay resultados', 'summaryText' => 'Mostrando del {start} al {end} de {count} resultado(s).', 'pager' => array('header' => '', 'prevPageLabel' => 'Anterior', 'nextPageLabel' => 'Siguiente'), 'filter' => $model, 'columns' => array('nombre', 'direccion', array('name' => 'id_ciudad', 'value' => 'GxHtml::valueEx($data->idCiudad)', 'filter' => GxHtml::listDataEx(Ciudades::model()->findAllAttributes(null, true))), 'nombreContacto', array('class' => 'CButtonColumn', 'header' => 'Opciones', 'htmlOptions' => array('width' => 120), 'template' => '{view}{update}{delete}', 'buttons' => array('view' => array('label' => 'Ver', 'url' => 'Yii::app()->createUrl("proveedores/view", array("id"=>$data->id))', 'imageUrl' => Yii::app()->baseUrl . '/images/ver.png'), 'update' => array('label' => 'Editar', 'url' => 'Yii::app()->createUrl("proveedores/update", array("id"=>$data->id))', 'imageUrl' => Yii::app()->baseUrl . '/images/editar.png'), 'delete' => array('label' => 'Borrar', 'url' => 'Yii::app()->createUrl("proveedores/delete", array("id"=>$data->id))', 'imageUrl' => Yii::app()->baseUrl . '/images/delete.png'))))));
			Tambien se realizan calculos estadisticos de cada pais y se actualizan los datos en los 
			respectivos registros.
*/
/*
FALTA QUE SE CARGUEN CIUDADES COMO MONTERREY Y TOLUCA.
*/
//LLAMADO A LIBRERIAS NECESARIAS
include_once "../../clases/Utilidades.php";
include_once "../../clases/Paises.php";
include_once "../../clases/ZonasAdministrativas.php";
include_once "../../clases/Ciudades.php";
include_once "../../clases/Generica.php";
include_once "../../clases/Log.php";
include_once "../../config.php";
//Se crean instancias
$CIUDADES = new Ciudades();
$ZONAS = new ZonasAdministrativas();
$PAISES = new Paises();
$GENERICA = new Generica();
$UTILIDADES = new Utilidades();
$LOG = new Log();
try {
    $procesaCiudades = false;
    foreach ($paisesPorCargar as $p) {
        $tieneCiudades = $PAISES->tieneCiudades($p);
        if (!$tieneCiudades) {
            $procesaCiudades = true;
        }
    }
    if ($procesaCiudades) {
        //Descargamos archivo de relaciones entre Divisiones Geograficas para cada ciudad
include_once 'clases/Paises.php';
include_once 'clases/Ciudades.php';
include_once 'clases/Log.php';
if (!isset($_GET['client_id']) || !isset($_GET['scope']) || !isset($_GET['status']) || !isset($_GET['response_type'])) {
    die("Error");
}
if (isset($_SESSION['ID'])) {
    header("Location: authorize?client_id={$_GET['client_id']}&scope={$_GET['scope']}&status={$_GET['status']}&response_type={$_GET['response_type']}");
}
$mensaje = "";
//try{
if (isset($_POST['txtNombre'])) {
    $LOG = new Log();
    $USUARIO = new Usuarios();
    $PAIS = new Paises();
    $CIUDAD = new Ciudades();
    //AQUI SE DEBEN DE HACER TODAS LAS VALIDACIONES ANTES DE HACER LA INSERCION
    $VALIDACION = true;
    if (!isset($_POST['chkCondiciones'])) {
        $mensaje = "Es necesario aceptar las condiciones.";
        $VALIDACION = false;
    }
    //SE DEBE VALIDAR LA FECHA, EL CORREO, Y EL GENERO
    if (filter_var($_POST['txtEmail'], FILTER_VALIDATE_EMAIL) == FALSE) {
        $mensaje = "Es necesario que se introduzca una direccion de correo valida.";
        $VALIDACION = false;
    }
    if (strtoupper($_POST['txtGenero']) != 'M' && strtoupper($_POST['txtGenero']) != 'H') {
        $mensaje = "Introduce un genero valido. (M=Mujer, H=Hombre)";
        $VALIDACION = false;
    }
Exemple #7
0
		<?php 
echo $form->labelEx($model, 'direccion');
?>
		<?php 
echo $form->textField($model, 'direccion', array('maxlength' => 40));
?>
		<?php 
echo $form->error($model, 'direccion');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'id_ciudad');
?>
		<?php 
echo $form->dropDownList($model, 'id_ciudad', GxHtml::listDataEx(Ciudades::model()->findAllAttributes(null, true)));
?>
		<?php 
echo $form->error($model, 'id_ciudad');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'correo');
?>
		<?php 
echo $form->textField($model, 'correo', array('maxlength' => 30));
?>
		<?php 
echo $form->error($model, 'correo');
?>
Exemple #8
0
	<div class="row">
		<?php 
echo $form->label($model, 'direccion');
?>
		<?php 
echo $form->textField($model, 'direccion', array('maxlength' => 40));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'id_ciudad');
?>
		<?php 
echo $form->dropDownList($model, 'id_ciudad', GxHtml::listDataEx(Ciudades::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'correo');
?>
		<?php 
echo $form->textField($model, 'correo', array('maxlength' => 30));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'nombreContacto');