コード例 #1
0
ファイル: FiltroController.php プロジェクト: Telemedellin/tm
 public function actionBorrarElemento($id)
 {
     $filtro_item = FiltroItem::model()->findByPk($id);
     $filtro_item->delete();
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : '../');
     }
 }
コード例 #2
0
ファイル: Pagina.php プロジェクト: Telemedellin/tm
 protected function beforeDelete()
 {
     $this->transaccion = $this->dbConnection->getCurrentTransaction();
     if ($this->transaccion === null) {
         $this->transaccion = $this->dbConnection->beginTransaction();
     }
     try {
         // 1. Desasignar de los micrositios que la tengan por defecto.
         $micrositios = Micrositio::model()->findAllByAttributes(array('pagina_id' => $this->id));
         foreach ($micrositios as $m) {
             $m->pagina_id = NULL;
             $m->save();
         }
         // 3.Verifico el tipo de página para ver si tiene una tabla auxiliar
         $tabla = $this->tipoPagina->tabla;
         $t = new $tabla();
         $contenido = $t->findByAttributes(array('pagina_id' => $this->id));
         switch ($tabla) {
             case 'PgPrograma':
                 Horario::model()->deleteAllByAttributes(array('pg_programa_id' => $contenido->id));
                 break;
             case 'PgDocumental':
                 FichaTecnica::model()->deleteAllByAttributes(array('pg_documental_id' => $contenido->id));
                 break;
                 /*case 'Carpeta':
                 		Carpeta::model()->vaciar_carpeta( $contenido->id );
                 		break;/**/
             /*case 'Carpeta':
             		Carpeta::model()->vaciar_carpeta( $contenido->id );
             		break;/**/
             case 'PgFiltro':
                 FiltroItem::model()->deleteAllByAttributes(array('pg_filtro_id' => $contenido->id));
                 break;
             case 'PgBloques':
                 Bloque::model()->deleteAllByAttributes(array('pg_bloques_id' => $contenido->id));
                 break;
             case 'PgEventos':
                 Evento::model()->deleteAllByAttributes(array('pg_eventos_id' => $contenido->id));
                 break;
         }
         // 4. Borro la tabla pg_
         //$this->transaccion->commit();
         return parent::beforeDelete();
     } catch (Exception $e) {
         $this->transaccion->rollback();
         return false;
     }
 }
コード例 #3
0
ファイル: _form-elemento.php プロジェクト: Telemedellin/tm
        <div class="col-sm-6">
        	<?php 
echo $form->dropDownList($model, 'pg_filtro_id', CHtml::listData(PgFiltro::model()->findAll(), 'id', 'pagina.nombre'), array('class' => 'form-control'));
?>
        </div>
        <?php 
echo $form->error($model, 'pg_filtro_id');
?>
    </div>
	<div class="form-group">
	    <?php 
echo $form->label($model, 'padre', array('class' => 'col-sm-2 control-label'));
?>
	    <div class="col-sm-6">
	        <?php 
echo $form->dropDownList($model, 'padre', CHtml::listData(FiltroItem::model()->findAllByAttributes(array('pg_filtro_id' => $model->pg_filtro_id)), 'id', 'elemento'), array('class' => 'form-control chosen', 'empty' => 'Sin padre'));
?>
	    </div>
	    <?php 
echo $form->error($model, 'padre');
?>
	</div>
    <div class="form-group">
		<?php 
echo $form->label($model, 'elemento', array('class' => 'col-sm-2 control-label'));
?>
		<div class="col-sm-4">
			<?php 
echo $form->textField($model, 'elemento', array('class' => 'form-control'));
?>
		</div>