/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { $model = Contato::model()->findByPk($id); $model->listaNomeGrupos = Grupo::model()->getGroups($id); $this->render('view', array('model' => $model)); // $this->render('view', array( // 'model' => $this->loadModel($id), // )); }
$this->breadcrumbs = array('Grupocontactos' => array(Yii::t('app', 'index')), Yii::t('app', 'Manage')); } if (!isset($this->menu) || $this->menu === array()) { $this->menu = array(array('label' => Yii::t('app', 'List') . ' Grupocontacto', 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' Grupocontacto', 'url' => array('create'))); } Yii::app()->clientScript->registerScript('search', "\n\t\t\t\$('.search-button').click(function(){\n\t\t\t\t\$('.search-form').toggle();\n\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t\$('.search-form form').submit(function(){\n\t\t\t\t\$.fn.yiiGridView.update('grupocontacto-grid', {\ndata: \$(this).serialize()\n});\n\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t"); ?> <h1> <?php echo Yii::t('app', 'Manage'); ?> Grupocontactos</h1> <?php echo "<ul>"; foreach ($model->relations() as $key => $relation) { echo "<li>" . substr(str_replace("Relation", "", $relation[0]), 1) . " " . CHtml::link(Yii::t("app", $relation[1]), array($this->resolveRelationController($relation) . "/admin")) . " (" . $relation[2] . ")" . " </li>"; } echo "</ul>"; echo CHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div> <?php $locale = CLocale::getInstance(Yii::app()->language); $this->widget('zii.widgets.grid.CGridView', array('id' => 'grupocontacto-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', array('name' => 'contactoid', 'value' => 'CHtml::value($data,\'contacto.recordTitle\')', 'filter' => CHtml::listData(Contacto::model()->findAll(), 'contactoid', 'recordTitle')), array('name' => 'grupoid', 'value' => 'CHtml::value($data,\'grupo.nombre\')', 'filter' => CHtml::listData(Grupo::model()->findAll(), 'grupoid', 'nombre')), array('class' => 'CButtonColumn'))));
<div class="row"> <?php echo $form->label($model, 'contactoid'); ?> <?php echo $form->dropDownList($model, 'contactoid', CHtml::listData(Contacto::model()->findAll(), 'contactoid', 'recordTitle'), array('prompt' => Yii::t('app', 'All'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'grupoid'); ?> <?php echo $form->dropDownList($model, 'grupoid', CHtml::listData(Grupo::model()->findAll(), 'grupoid', 'nombre'), array('prompt' => Yii::t('app', 'All'))); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton(Yii::t('app', 'Search')); ?> </div> <?php $this->endWidget(); ?> </div><!-- search-form -->
<?php $form = $this->beginWidget('CActiveForm', array('id' => 'confronto-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <span>Grupo</span> <?php echo $form->dropDownList($model, 'id_grupo', CHtml::listData(Grupo::model()->findAll(), 'id', 'nome')); ?> <?php echo $form->error($model, 'id_grupo'); ?> </div> <div class="row"> <span>Time da Casa</span> <?php echo $form->dropDownList($model, 'id_time_casa', CHtml::listData(Time::model()->findAll(), 'id', 'nome')); ?> <?php echo $form->error($model, 'id_time_casa'); ?> </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. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Grupo::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, Yii::t('App', 'The requested page does not exist.')); } } return $this->_model; }
<div class="wide form"> <?php $cs = Yii::app()->getClientScript(); $form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl('../EnviosFiltrados/'), 'method' => 'post')); ?> <div class="row" style="text-align:justify"> <?php echo CHtml::dropDownList('cbogrupos', array(), CHtml::listData(Grupo::model()->findAll(), 'grupoid', 'nombre'), array('multiple' => 'multiple', 'class' => 'cbogrupo', 'data-placeholder' => 'Seleccione grupos...')); ?> <input type="hidden" id="grupoInicial" name="grupoInicial" /> </div> <div class="row jui"> <strong>Desde: </strong> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'fechaInicio', 'language' => 'es', 'value' => array(), 'htmlOptions' => array('size' => 10, 'style' => 'width:80px !important'), 'options' => array('showAnim' => 'slide', 'dateFormat' => 'yy-mm-dd', 'showButtonPanel' => true, 'defaultDate' => "-4w", 'changeMonth' => true, 'numberOfMonths' => 3, 'onSelect' => 'js:function(selectedDate){ var option = this.id == "fechaInicio" ? "minDate" : "maxDate", instance = $(this).data("datepicker"), date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings ); $("#fechaInicio,#fechaFin").not(this).datepicker("option", option, date ); }'))); ?> <strong> hasta:</strong> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'fechaFin', 'language' => 'es', 'value' => array(), 'htmlOptions' => array('size' => 10, 'style' => 'width:80px !important'), 'options' => array('showAnim' => 'slide', 'dateFormat' => 'yy-mm-dd', 'showButtonPanel' => true, 'defaultDate' => "-4w", 'changeMonth' => true, 'numberOfMonths' => 3, 'onSelect' => 'js:function(selectedDate){ var option = this.id == "fechaInicio" ? "minDate" : "maxDate", instance = $(this).data("datepicker"),
protected function guardar_combos($CODIGO_DANE_SEDE, $TIPO_JORNADA, $GRADO, $GRUPO_CURSO) { if ($CODIGO_DANE_SEDE != "") { if ($TIPO_JORNADA != "") { $jornada = Jornada::model()->find("idjornada=" . $TIPO_JORNADA . " AND codigo_dane_sede='" . $CODIGO_DANE_SEDE . "'"); if ($jornada == null) { $newjornada = new Jornada(); $newjornada->idjornada = $TIPO_JORNADA; $newjornada->codigo_dane_sede = $CODIGO_DANE_SEDE; $newjornada->jornada = JornadaEducativa::model()->findByPk($TIPO_JORNADA)->Descripcion; $newjornada->save(); } if ($GRADO != "") { $grado = Grado::model()->find("idgrado=" . $GRADO . " AND jornada_id=" . $TIPO_JORNADA . " AND codigo_dane_sede='" . $CODIGO_DANE_SEDE . "'"); if ($grado == null) { $newgrado = new Grado(); $newgrado->jornada_id = $TIPO_JORNADA; $newgrado->codigo_dane_sede = $CODIGO_DANE_SEDE; $newgrado->idgrado = $GRADO; $newgrado->grado = GradoEducativo::model()->find("Codigo=" . $GRADO)->Descripcion; $newgrado->save(); } if ($GRUPO_CURSO != "") { $grupo = Grupo::model()->find("grado=" . $GRADO . " AND grupo_curso=" . $GRUPO_CURSO . " AND codigo_dane_sede='" . $CODIGO_DANE_SEDE . "'"); if ($grupo == null) { $newgrupo = new Grupo(); $newgrupo->grado = $GRADO; $newgrupo->codigo_dane_sede = $CODIGO_DANE_SEDE; $newgrupo->grupo_curso = $GRUPO_CURSO; $newgrupo->save(); } } } } } }
/** * 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) { $model = Grupo::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
?> </div> <?php } ?> </div> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'grupos'); ?> <?php echo CHtml::dropDownList('cbogrupos', explode('|', $model->grupos), CHtml::listData(Grupo::model()->with(array('grupocontactos' => array('select' => false, 'joinType' => 'INNER JOIN')))->findAll('activo=1'), 'grupoid', 'nombre'), array('multiple' => 'multiple', 'class' => 'cbogrupo', 'data-placeholder' => 'Seleccione grupos...')); ?> <?php echo $form->hiddenField($model, 'grupos', array('size' => 60, 'maxlength' => 100)); ?> <?php echo $form->error($model, 'grupos'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'asunto'); ?> <?php echo $form->textField($model, 'asunto', array('size' => 60, 'maxlength' => 150, 'class' => 'textinput'));
<?php /* @var $this ContatoController */ /* @var $data Contato */ $data->listaNomeGrupos = Grupo::model()->getGroups($data->id); ?> <div class="view"> <b><?php echo CHtml::encode($data->getAttributeLabel('id')); ?> :</b> <?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id' => $data->id)); ?> <br/> <b><?php echo CHtml::encode($data->getAttributeLabel('nome')); ?> :</b> <?php echo CHtml::encode($data->nome); ?> <br/> <b><?php echo CHtml::encode($data->getAttributeLabel('telefone')); ?> :</b>
<?php echo $form->error($model, 'telefono'); ?> </div> <div class="row"> <?php //print_r(explode('|',$model->grupoInicial)); ?> <?php echo $form->labelEx($model, 'grupos'); ?> <?php echo CHtml::dropDownList('cbogrupos', explode('|', rtrim($model->grupoInicial)), CHtml::listData(Grupo::model()->findAll(), 'nombre', 'nombre'), array('multiple' => 'multiple', 'class' => 'cbogrupo', 'data-placeholder' => 'Seleccione grupos...')); ?> <?php echo $form->hiddenField($model, 'grupoInicial', array('size' => 60, 'maxlength' => 100)); ?> <?php echo $form->error($model, 'grupos'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'activo'); ?> <?php
<?php $this->breadcrumbs = array('Contactos' => array('admin'), Yii::t('App', 'Manage')); $this->menu = array(array('label' => Yii::t('App', 'List') . ' Contacto', 'url' => array('admin')), array('label' => Yii::t('App', 'Create') . ' Contacto', 'url' => array('create')), array('label' => Yii::t('App', 'Export') . ' a Excel', 'url' => array('exportxls'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').slideToggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('contacto-grid', {\n\t\tdata: \$(this).serialize(),\n\t});\n \$('.cgrupo').corner('3px');\n\treturn false;\n});\n"); ?> <h1><?php echo Yii::t('App', 'Manage'); ?> Contactos</h1> <?php echo CHtml::link(Yii::t('App', 'Advanced Search'), '#', 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' => 'contacto-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'afterAjaxUpdate' => 'function(){$(\'.cgrupo\').corner(\'3px\');}', 'columns' => array(array('class' => 'CCheckBoxColumn'), array('name' => 'contactoid', 'htmlOptions' => array('style' => 'width:50px')), 'nombres', array('name' => 'telefono', 'htmlOptions' => array('style' => 'width:80px')), array('name' => 'createtime', 'value' => 'date("d.m.Y h:i a",strtotime($data->createtime))'), array('name' => 'grupos', 'type' => 'raw', 'filter' => CHtml::listData(Grupo::model()->findAll(), 'grupoid', 'nombre'), 'htmlOptions' => array('style' => 'width:150px;white-space: normal;')), array('name' => 'activo', 'value' => '$data->activo?Yii::t("App","Yes"):Yii::t("App","No")', 'filter' => array('0' => Yii::t("App", "No"), '1' => Yii::t("App", "Yes"))), array('class' => 'CButtonColumn', 'template' => '{update} {delete}')))); $cs = Yii::app()->getClientScript(); //$cs->registerCssFile('http://harvesthq.github.com/chosen/chosen/chosen.css'); $cs->registerScriptFile('/js/jquery.corner.js?v2.11', CClientScript::POS_END); $cs->registerScript("checkGrupo", "\$('.cgrupo').corner('3px');", CClientScript::POS_END);
public function GetPosicaoTime($posicao, $grupo) { $modelGrupo = new Grupo(); $Criteria = new CDbCriteria(); $Criteria->condition = "nome = '{$grupo}'"; $classificacao = array(); $modelGrupo = Grupo::model()->find($Criteria); $Criteria = new CDbCriteria(); $Criteria->condition = "id_grupo={$modelGrupo->id}"; $model = GrupoTime::model()->findAll($Criteria); foreach ($model as $item) { $itemArray = array("id" => $item->id_time, "id_grupo" => $item->id_grupo, "nome" => $item->idTime->nome, "escudo" => $item->idTime->escudo, "pontos" => ConfrontoController::GetPontosDoTime($item->id_time)); array_push($classificacao, $itemArray); } $classificacao = ConfrontoController::aasort($classificacao, "pontos"); $conta = 1; foreach ($classificacao as $item) { if ($conta == $posicao) { $time = Time::model()->findByPk($item["id"]); } $conta = $conta + 1; } return $time; }
/** * Para ver el catalogo de grupos */ public function actionGrupos() { header('Content-type: application/json; charset=UTF-8'); $resultados = Grupo::model()->findAll(); $data = array(); $json = array(); foreach ($resultados as $k) { $grupo = Grupo::model()->findByPk($k["id"]); $json["grupos"] = $grupo->attributes; array_push($data, $json); } //echo json_encode($data, JSON_UNESCAPED_UNICODE); echo preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U\$1')))", json_encode($data)); }
<!-- BUSCADOR --> <div id="buscar_des" class="c_buscador perspective"> <form name="buscador" id="buscador" method="get" action="<?php echo Yii::app()->request->baseUrl; ?> /index.php/peces/resultado"> <div style="float:left; width:100%; padding-bottom:15px;"> <input style="float:left; width:29%; margin-right:17px;" type="text" name="nombre_comun" id="buscador_nombre_comun" placeholder="Nombre común"> <input style="float:left; width:29%; margin-right:17px;" type="text" name="nombre_cientifico" id="buscador_nombre_cientifico" placeholder="Nombre científico"> <label for="select"></label> <?php echo CHtml::dropDownList('grupo', null, CHtml::listData(Grupo::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombre'), array('id' => 'buscador_grupo', 'prompt' => '---Grupo---', 'style' => 'float:left; width:32%;')); ?> </div> <div style="float:left; width:100%;"> <p><b>También puedes buscar los peces seleccionando su recomendación en el semáforo y zona pesquera:</b></p> <div id="recomendaciones" style="float:left; width:60%; margin-left: 30px;"> <input type="checkbox" name="recomendacion" value="0" id="buscador_recomendable"> <label for="buscador_recomendable" class="rec"> <span class="seleccionar"></span> <b>Recomendable</b><br> Especies que puedes consumir sin ninguna preocupación en base a que sus poblaciones están estables y son capturadas sin dañar al ambiente ni a otras especies. </label> <input type="checkbox" name="recomendacion" value="1" id="buscador_poco_recomendable"> <label for="buscador_poco_recomendable" class="prec"> <span class="seleccionar"></span>
<div class="row"> <?php echo $form->labelEx($model, 'aniversario'); ?> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'aniversario', 'id' => 'aniversario', 'value' => $model->aniversario, 'model' => $model, 'attribute' => 'aniversario', 'options' => array('showAnimin' => 'slide', 'dateFormat' => 'mm-dd', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeYear' => false, 'changeMonth' => true, 'minDate' => '01-01', 'maxDate' => '12-31'), 'htmlOptions' => array('style' => 'height:20px;', 'size' => '10', 'maxlength' => '10'))); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'grupos'); ?> <?php echo CHtml::dropDownList('grupos', 'grupos', CHtml::listData(Grupo::model()->findAll(array('order' => 'nome')), 'id', 'nome'), array('empty' => '(Selecione um Grupo', 'multiple' => true)); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?> </div><!-- form -->