Exemplo n.º 1
0
/* @var $this ModuloNivelController */
/* @var $model ModuloNivel */
$this->menu = array(array('label' => 'Crear Nivel', '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\$('#modulo-nivel-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Nivel</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' => 'modulo-nivel-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '20')), array('name' => 'modulo_id', 'filter' => CHtml::listData(Modulo::model()->findAll(), 'id', 'modulo'), 'value' => '$data[\'modulo\'][\'modulo\']', 'htmlOptions' => array('width' => '110')), 'nombre_nivel', 'numero_lecciones', 'tipo', 'precio_nivel', array('class' => 'CButtonColumn'))));
?>

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

            location.href = '<?php 
echo Yii::app()->createUrl('moduloNivel/view');
?>
Exemplo n.º 2
0
$form = $this->beginWidget('CActiveForm', array('id' => 'modulo-nivel-form', 'enableAjaxValidation' => false));
?>

	<p class="note">Campos con <span class="required">*</span> son requeridos.</p>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<div class="span4">
			<?php 
echo $form->labelEx($model, 'modulo_id');
?>
			<?php 
echo $form->dropDownList($model, 'modulo_id', CHtml::listData(Modulo::model()->findAll("activo = 1"), 'id', 'modulo'), array('class' => 'input-normal', 'empty' => ""));
?>
			<a href="index.php?r=modulo/create" role="button" class="btn btn-small btn-success" data-toggle="modal"><i class="icon-plus icon-white"></i> Agregar</a>	
			<?php 
echo $form->error($model, 'modulo_id');
?>
		</div>

		<div class="span5">
			<?php 
echo $form->labelEx($model, 'nombre_nivel');
?>
			<?php 
echo $form->textField($model, 'nombre_nivel', array('size' => 50, 'maxlength' => 50, 'class' => 'input-xlarge'));
?>
			<?php 
Exemplo n.º 3
0
 public function actionDemo($id)
 {
     $model = Modulo::model()->findAllByAttributes(array('PER_ID' => $id));
     $this->render('Evaluation/demo', array('model' => $model, 'id' => $id));
 }
Exemplo n.º 4
0
 /**
  * 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 $id the ID of the model to be loaded
  * @return Modulo the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Modulo::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }