Ejemplo n.º 1
0
 public static function getAllByTipoContenidoYFecha($tipoContenido, $fecha_limite, $limit)
 {
     // 			Collection<Contenido> $contenidos = new ArrayList<Contenido>();
     $contenidos = new ArrayCollection();
     /* Contenido */
     $c;
     /* MySQLAccess */
     $mysql = new MySQLAccess();
     try {
         /* java.sql.CallableStatement */
         $cstm = $mysql->IniciarStoredProc("CALL listarcontenidostipofecha(?, ?)");
         $cstm->bindParam(1, TipoContenido::name(tipo), \PDO::PARAM_STR);
         $cstm->bindParam(2, $fecha_limite->format('Y-m-d'), \PDO::PARAM_STR);
         /* ResultSet */
         $flag = $cstm->execute();
         $rs = $cstm->fetchAll();
         /*int */
         $cant = 0;
         while ($rs . next() && $limit > $cant) {
             try {
                 $c = self::mapear($rs, $mysql);
                 if (isset($c)) {
                     $contenidos->set($c->getID(), $c);
                     $cant += 1;
                 }
             } catch (\Exception $ex) {
                 print_r($ex->getMessage());
             }
         }
         // 				$rs.close();
         $cstm->closeCursor();
         $cstm = null;
     } catch (\PDOException $ex) {
         /*do nothing*/
         print_r($ex->getMessage());
     } finally {
         $mysql->close();
     }
     return $contenidos;
 }
 public static function GetAllByIds($ids)
 {
     // 			Collection<Categoria> categorias = Categoria.getAll($ids);
     $categorias = Categoria::getAllByIds($ids);
     // 			Collection<CategoriaLogica> categoriaslogica = new ArrayList<CategoriaLogica>();
     $categoriaslogica = new ArrayCollection();
     /*Iterator<Categoria> $it = $categorias->getIterator(); */
     //while ($it->hasNext())
     foreach ($categorias as $it) {
         // 				CategoriaLogica pl = new CategoriaLogica(it.next());
         $pl = new CategoriaLogica($it);
         $categoriaslogica->set($pl->ID, $pl);
     }
     return $categoriaslogica;
 }
 function formatear_categorias($cats)
 {
     // 		Collection<CategoriaLogica> categorias = new ArrayList<CategoriaLogica>();
     $categorias = new ArrayCollection();
     if ($cats != null) {
         // 			for (String cat : cats) {
         foreach ($cats as $cat) {
             try {
                 $id_cat = intval($cat);
                 $categoria = CategoriaLogica::Buscar($id_cat);
                 $categorias->set($categoria->getID(), $categoria);
             } catch (NumberFormatException $ex) {
                 print_r("Error agregando categoria\n");
             }
         }
     }
     return $categorias;
 }
Ejemplo n.º 4
0
 private static function cargar_categorias($mc, $mysql, $id_metacontenido)
 {
     //java.sql.CallableStatement cstm = $mysql.IniciarStoredProc("{CALL listarcategoriasmetacontenido(?)}");
     $cstm = $mysql->IniciarStoredProc("CALL listarcategoriasmetacontenido(?)");
     $cstm->bindParam(1, $id_metacontenido, \PDO::PARAM_INT);
     //ResultSet rst = cstm.executeQuery();
     $cstm->execute();
     $resultSet = $cstm->fetchAll();
     //Collection<Integer> $categorias = new ArrayList<Integer>();
     $categorias = new ArrayCollection();
     // 			while ($resultSet.next())
     foreach ($resultSet as $row) {
         //int p = MySQLAccess.GetSafeInt($resultSet, 1);
         $p = MySQLAccess::GetSafeInt($row, 0);
         $categorias->add($p);
     }
     // 			rst.close();
     $cstm->closeCursor();
     $cstm = null;
     $mc->categorias = $categorias;
     $mc->categorias_bd = $categorias;
 }
Ejemplo n.º 5
0
 public static function WrapContenidoList($contenidos)
 {
     // 			Collection<SerieLogica>
     $contenidoslogica = new ArrayCollection();
     // 			Iterator<Contenido>
     // 			$it = $contenidos.iterator();
     foreach ($contenidos as $cont) {
         // 				SerieLogica
         $serieLogica = new SerieLogica($cont);
         $contenidoslogica->set($serieLogica->ID, $serieLogica);
     }
     return $contenidoslogica;
 }
 private function getCategoriasId()
 {
     // 			Collection<Integer> categoriasIds = new ArrayList<Integer>();
     $categoriasIds = new ArrayCollection();
     if (isset($this->categorias)) {
         //for (CategoriaLogica cat: categorias)
         foreach ($this->categorias as $categoriaLogica) {
             $categoriasIds->add($categoriaLogica->getID());
         }
     }
     return $categoriasIds;
 }
Ejemplo n.º 7
0
 public static function getAllByIds($ids)
 {
     // 			Collection<Categoria> categorias = new ArrayList<Categoria>();
     $categorias = new ArrayCollection();
     // 			MySQLAccess mysql = new MySQLAccess();
     $mysql = new MySQLAccess();
     foreach ($ids as $id) {
         $categoria = self::GetOneInDB($id, $mysql);
         $categorias->set($categoria->getID(), $categoria);
     }
     $mysql->close();
     return $categorias;
 }