public function eliminar($id)
 {
     if ($id) {
         $prodecimiento = new Procedimientos();
         $this->prodecimiento = $prodecimiento->find($id);
         $url = getcwd() . "/" . $this->prodecimiento->url;
         if ($this->prodecimiento->delete()) {
             if (!file_exists($url) or !unlink($url)) {
                 Flash::error("El archivo no se puedo eliminar del servidor");
             }
             Flash::valid("Archivo Eliminado");
         } else {
             Flash::error("No se elimino el archivo");
         }
         Redirect::to("procedimientos/index");
     } else {
         Flash::info("El recurso no existe");
     }
 }
 /**
  * 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 = Procedimientos::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 3
0
				),
			),
			'wrapperHtmlOptions' => array(
				'class' => 'col-sm-5',
			),
			'hint' => 'Coloque la fecha de generación de la factura.',
			'prepend' => '<i class="glyphicon glyphicon-calendar"></i>'
		)
	); ?>

	<?php //echo $form->textFieldGroup($model,'anho',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>


<div class="form-group">
	<?php 	
		$list = CHtml::listData(Procedimientos::model()->findAllByAttributes(array('ente_organo_id'=>Usuarios::model()->findByPk(Yii::app()->user->getId())->enteOrgano->ente_organo_id, 'anho'=>Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho'])), 'id', 'num_contrato');
	
		echo CHtml::label('Seleccionar procedimiento', 'Procedimeinto');
		echo "<br>";
		$this->widget(
		    'booster.widgets.TbSelect2',
		    array(
		        'asDropDownList' => true,
		        'model' => $model,
		         'attribute' => 'procedimiento_id',
		        //'name' => 'procedimiento_id',
		        'data' => $list,
		        'htmlOptions'=>array('id'=>'Procedimiento',),
		        'options' => array(
		            //'tags' => array('procedimientos'),
		            'placeholder' => 'Procedimientos',