/** * Reordenada los elmentos * @return type */ public function ReordenarAction() { $relaciones = new CpanRelaciones(); $dbName = $relaciones->getDataBaseName(); $tableName = $relaciones->getTableName(); $filtro = "EntidadOrigen='{$this->entity}' and IdEntidadOrigen='{$this->request[$this->entity]['Id']}'"; $em = new EntityManager($relaciones->getConectionName()); if ($em->getDbLink()) { // Recorro los elementos que vienen en el acordeon, y los reordeno $orden = 0; foreach ($this->request['acordeon'] as $id => $elemento) { $query = "UPDATE {$dbName}.{$tableName} SET SortOrder = '{$orden}' WHERE ({$filtro}) AND (IdEntidadDestino = '{$id}')"; $em->query($query); $orden += 1; } $em->desConecta(); } unset($em); $this->request['METHOD'] = 'GET'; $boletin = new BolBoletines($this->request[$this->entity]['Id']); $this->request[2] = $boletin->getPrimaryKeyMD5(); unset($boletin); return $this->EditAction(); }
/** * Devuelve array de dos dimensiones con los * boletines a los que está suscrito el cliente en curso. * * @return array */ public function getSuscripciones() { $array = array(); $tipoBoletines = new BolTipos(); $tipos = $tipoBoletines->cargaCondicion("Id,Titulo"); foreach ($tipos as $tipo) { $boletin = new BolBoletines(); $boletines = $boletin->cargaCondicion("Id,Titulo", "IDTipo='{$tipo['Id']}'"); foreach ($boletines as $boletin) { $relaciones = new CpanRelaciones(); $idRelacion = $relaciones->getIdRelacion("Clientes", $this->IDCliente, "BolBoletines", $boletin['Id']); $array[$tipo['Titulo']][$boletin['Id']] = array('titulo' => $boletin['Titulo'], 'suscrito' => $idRelacion); } } return $array; }