Example #1
0
 public function actionDelete($id)
 {
     $genero = Genero::model()->findByPk($id);
     if ($genero->delete()) {
         $this->redirect(Yii::app()->request->urlReferrer);
     }
 }
Example #2
0
include_once "../../data/config.php";
//echo "<pre>";print_r(json_decode($_POST['json']));  echo "</pre>";
$datos = json_decode($_POST['json']);
//$libros = LibroQuery::create()->find();
//$usuarios = UsuarioQuery::create()->find();
switch ($datos->accion) {
    case "e":
        //Edit
        $generoObj = GeneroQuery::create()->findOneById($datos->id);
        //echo $generosObj->toArray();
        $generoObj->setNombre($datos->nombre);
        $generoObj->save();
        echo json_encode(array('error' => 0, 'msg' => "Genero modificado correctamente"));
        break;
    case "d":
        //Delete
        $generoObj = GeneroQuery::create()->findOneById($datos->id);
        //$objTerapia = TerapiasQuery::create()->findOneById($_GET["id"]);
        if ($generoObj != null) {
            $generoObj->delete();
        }
        echo json_encode(array('error' => 0, 'msg' => "genero borrado correctamente"));
        break;
    case "n":
        //New
        $generoObj = new Genero();
        $generoObj->setNombre($datos->nombre);
        $generoObj->save();
        echo json_encode(array('error' => 0, 'msg' => "Genero creado correctamente"));
        break;
}
Example #3
0
 /**
  * Declares an association between this object and a Genero object.
  *
  * @param      Genero $v
  * @return     Lista The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setGenero(Genero $v = null)
 {
     if ($v === null) {
         $this->setId_genero(NULL);
     } else {
         $this->setId_genero($v->getId());
     }
     $this->aGenero = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Genero object, it will not be re-added.
     if ($v !== null) {
         $v->addLista($this);
     }
     return $this;
 }
Example #4
0
					</div>
					<?php 
echo $form->error($model, 'apellidos');
?>
				</div>
			</div>

			<div class="row">
				<div class="span4">
					<?php 
echo $form->labelEx($model, 'genero_id');
?>
					<div class="input-prepend">
      				<span class="add-on"><i class="icon-list-alt"></i></span>
						<?php 
echo $form->dropDownList($model, 'genero_id', CHtml::listData(Genero::model()->findAll(), 'id', 'genero'), array('class' => 'input-medium', 'empty' => ""));
?>
					</div>
					<?php 
echo $form->error($model, 'genero_id');
?>
				</div>

				<div class="span4">
					<?php 
echo $form->labelEx($model, 'estado_civil_id');
?>
					<div class="input-prepend">
      				<span class="add-on"><i class="icon-list-alt"></i></span>
						<?php 
echo $form->dropDownList($model, 'estado_civil_id', CHtml::listData(EstadoCivil::model()->findAll(), 'id', 'estado_civil'), array('class' => 'input-normal', 'empty' => ""));
		<br/>	
		<label>Quantidade*</label>
		<br/><input id="<?php 
echo Proxy::encrypt('quantidade');
?>
" name="<?php 
echo Proxy::encrypt('quantidade');
?>
" type="text" onfocus='ajuda(this, "ajuda_<?php 
echo Proxy::encrypt('quantidade');
?>
");'/>
		<br/>
		<label>Genero*</label>
		<?php 
$generos = Genero::generos();
?>
			<br/><select id="<?php 
echo Proxy::encrypt('genero');
?>
" name="<?php 
echo Proxy::encrypt('genero');
?>
">
				<?php 
foreach ($generos as $genero) {
    ?>
				<option value="<?php 
    echo $genero;
    ?>
"><?php 
 /**
  * Filter the query by a related Genero object
  *
  * @param     Genero|PropelCollection $genero The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    ProductoQuery The current query, for fluid interface
  */
 public function filterByGenero($genero, $comparison = null)
 {
     if ($genero instanceof Genero) {
         return $this->addUsingAlias(ProductoPeer::IDGENERO, $genero->getIdgenero(), $comparison);
     } elseif ($genero instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ProductoPeer::IDGENERO, $genero->toKeyValue('PrimaryKey', 'Idgenero'), $comparison);
     } else {
         throw new PropelException('filterByGenero() only accepts arguments of type Genero or PropelCollection');
     }
 }
 /**
  * Exclude object from result
  *
  * @param     Genero $genero Object to remove from the list of results
  *
  * @return    GeneroQuery The current query, for fluid interface
  */
 public function prune($genero = null)
 {
     if ($genero) {
         $this->addUsingAlias(GeneroPeer::ID, $genero->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Example #8
0
                    </td>
                </tr>
                <tr>
                    <td>
                        <?php 
echo $form->labelEx($model, 'GENERO');
?>
                        <?php 
if ($model->GENERO != "") {
    $valtemp = $model->GENERO;
} elseif ($modelold->GENERO != "") {
    $valtemp = $modelold->GENERO;
} else {
    $valtemp = "";
}
echo $form->dropDownList($model, 'GENERO', CHtml::listData(Genero::model()->findAll(), 'codigo', 'descripcion'), array('prompt' => 'Seleccione...', 'class' => 'Ccombo', 'options' => array($valtemp => array('selected' => true))));
?>
                        <?php 
echo $form->error($model, 'GENERO');
?>
                    </td>
                    <td>
                        <?php 
echo $form->labelEx($model, 'TIPO_DOCUMENTO');
?>
                        <?php 
if ($model->TIPO_DOCUMENTO != "") {
    $valtemp = $model->TIPO_DOCUMENTO;
} elseif ($modelold->TIPO_DOCUMENTO != "") {
    $valtemp = $modelold->TIPO_DOCUMENTO;
} else {
Example #9
0
 public function run()
 {
     DB::table('Generos')->delete();
     Genero::create(array('nombre' => 'Accion', 'descripcion' => '.....', 'funcionarioId' => '1'));
 }
Example #10
0
/* @var $this AlumnosController */
/* @var $model Alumnos */
$this->menu = array(array('label' => 'Crear Alumno', '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\$('#alumnos-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Alumnos</h1>

<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' => 'alumnos-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerNacimiento', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '20')), 'nombres', 'apellidos', 'n_identificacion', array('name' => 'genero_id', 'filter' => CHtml::listData(Genero::model()->findAll(), 'id', 'genero'), 'value' => '$data[\'genero\'][\'genero\']', 'htmlOptions' => array('width' => '110')), array('name' => 'estado_civil_id', 'filter' => CHtml::listData(EstadoCivil::model()->findAll(), 'id', 'estado_civil'), 'value' => '$data[\'estadoCivil\'][\'estado_civil\']', 'htmlOptions' => array('width' => '150')), array('header' => 'Fecha de Nacimiento', 'name' => 'fecha_nacimiento', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_nacimiento', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '1900:2000'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_nacimiento', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_nacimiento\']);', 'htmlOptions' => array('width' => '80')), array('name' => 'jornada_id', 'filter' => CHtml::listData(Jornada::model()->findAll(), 'id', 'jornada'), 'value' => '$data[\'jornada\'][\'jornada\']', 'htmlOptions' => array('width' => '150')), array('header' => 'Fecha de Ingreso', 'name' => 'fecha_ingreso', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_ingreso', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '1900:2000'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_ingreso', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_ingreso\']);', 'htmlOptions' => array('width' => '80')), array('class' => 'CButtonColumn', 'template' => '{view}{update}'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerNacimiento(id, data) {\n    \$('#datepicker_for_fecha_nacimiento').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    \$('#datepicker_for_fecha_ingreso').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n}\n");
?>


<script>
    $(document).ready(function()
    {
        $('body').on('dblclick', '#alumnos-grid tbody tr', function(event)
        {
            var
                rowNum = $(this).index(),
                keys = $('#alumnos-grid > div.keys > span'),
                rowId = keys.eq(rowNum).text();

            location.href = '<?php 
Example #11
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($idGenero)
 {
     $genero = Genero::find($idGenero);
     $genero->delete();
     return Response::json(array('error' => false, 'message' => 'Genero eliminado'), 200);
 }
 public function postGeneros()
 {
     return Genero::all();
 }
Example #13
0
<div class="row">
    <?php 
if (Yii::app()->user->checkAccess('asignar_generos')) {
    ?>
    <div class="col-sm-12">
        <?php 
    $form = $this->beginWidget('CActiveForm', array('id' => 'url-form', 'action' => $this->createUrl('genero/asignar'), 'enableAjaxValidation' => false, 'htmlOptions' => array('role' => 'form')));
    $mxg = new MicrositioXGenero();
    ?>
        <div class="nav navbar-right input-group col-sm-12">
            <?php 
    echo $form->hiddenField($mxg, 'micrositio_id', array('value' => $model->id));
    ?>
            <?php 
    echo $form->dropDownList($mxg, 'genero_id', CHtml::listData(Genero::model()->getGeneros($model->id), 'id', 'nombre'), array('class' => 'form-control'));
    ?>
            <span class="input-group-btn">
                <?php 
    echo CHtml::submitButton('Asignar +', array('class' => 'btn btn-primary btn-block'));
    ?>
            </span>
        </div>
        <?php 
    $this->endWidget();
    ?>
    </div>
    <?php 
}
?>
    <?php 
if ($generos->getData()) {