Exemplo n.º 1
0
 /**
  * Retorna l'arbre de nodes del directori
  **/
 public function getArbre()
 {
     //Variable per assegurar uqe no hi hagi cap error en l'arbre.
     $i = 0;
     $RET = array($this->getIdnodes() => $this);
     $NODE_ACTUAL = NodesPeer::retrieveByPK($this->getIdpare());
     while (!is_null($NODE_ACTUAL) && $i++ < 10) {
         $RET[$NODE_ACTUAL->getIdnodes()] = $NODE_ACTUAL;
         $NODE_ACTUAL = NodesPeer::retrieveByPK($NODE_ACTUAL->getIdpare());
     }
     return $RET;
 }
Exemplo n.º 2
0
 public static function initialize($idN, $idS, $editor = false)
 {
     $ON = NodesPeer::retrieveByPK($idN);
     if (!$ON instanceof Nodes) {
         $ON = new Nodes();
         $ON->setSiteId($idS);
         $ON->setActiu(true);
     }
     if ($editor) {
         return new EditorHtmlForm($ON, array('IDS' => $idS));
     } else {
         return new NodesForm($ON, array('IDS' => $idS));
     }
 }
Exemplo n.º 3
0
function creaOpcions($IDN)
{
    $R = '<a href="' . url_for('gestio/gEstructura?idN=' . $IDN . '&accio=E') . '" class="tt2">' . image_tag('tango/32x32/actions/edit-find-replace.png', array('size' => '16x16', 'alt' => 'Edita la pàgina')) . '<span>Edita les característiques de la pàgina</span></a>';
    if (!NodesPeer::getIsCategoria($IDN) && !NodesPeer::getIsExterna($IDN)) {
        $R .= '<a href="' . url_for('gestio/gEstructura?idN=' . $IDN . '&accio=H') . '" class="tt2">' . image_tag('tango/32x32/apps/internet-web-browser.png', array('size' => '16x16', 'alt' => 'Edita continguts')) . '<span>Edita el contingut de la pàgina</span></a>';
    }
    $R .= '<a onClick="return confirm(\'Segur que vols esborrar la pàgina?\');" href="' . url_for('gestio/gEstructura?idN=' . $IDN . '&accio=D') . '" class="tt2">' . image_tag('tango/32x32/places/user-trash.png', array('size' => '16x16', 'alt' => 'Esborra la pàgina')) . '<span>Esborra la pàgina</span></a>';
    return $R;
}
Exemplo n.º 4
0
 public function save($conn = null)
 {
     $ONodes = $this->getObject();
     NodesPeer::gestionaOrdre($this->getValue('Ordre'), $ONodes->getOrdre(), $this->getOption('IDS'));
     parent::save();
 }
Exemplo n.º 5
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->setLayout('web');
     $accio = $request->getParameter('accio', 'home');
     $this->IDS = 1;
     $this->PAGE = $request->getParameter('page', 1);
     // Definim el captcha
     $val1 = rand(0, 9);
     $val2 = rand(0, 9);
     $this->getUser()->setAttribute('CAPTCHA1', $val1);
     $this->getUser()->setAttribute('CAPTCHA2', $val2);
     $this->CAPTCHA = "i la suma de " . $val1 . " + " . $val2;
     $this->SELECCIONAT = "CAP";
     switch ($accio) {
         //Cliquem del menú esquerra, i mostrem els submenús a la dreta. Si no hi ha submenús, mostrem el home
         case 'menu_click':
             $this->A_LLISTA = array();
             $ON = NodesPeer::retrieveByPK($request->getParameter('node'));
             if ($ON instanceof Nodes) {
                 $AON = NodesPeer::getFillsNextLevel($ON);
                 $Arbre = $ON->getArbre();
                 $this->SELECCIONAT = array_pop($Arbre);
                 switch ($ON->getCategories()) {
                     //Si la categoria del node és manual
                     case NodesPeer::CATEGORIA_MANUAL:
                         //Mirem si conté subdirectoris... o bé és de contingut.
                         if (!empty($AON)) {
                             $this->A_LLISTA[1]['mode'] = 1;
                             $this->A_LLISTA[1]['titol'] = "Categories dins aquest menú";
                             foreach ($AON as $ON) {
                                 //Mirem si la imatge existeix
                                 $img = $this->Image_exists('front', $ON->getIdnodes() . '-L') ? '/images/front/' . $ON->getIdnodes() . '-L.jpg' : 'color';
                                 $url = strlen($ON->getUrl()) > 0 ? $ON->getUrl() : '@web_menu_click?node=' . $ON->getIdnodes() . '&titol=' . $ON->getNomForUrl();
                                 $this->A_LLISTA[1]['elements'][] = array('url' => $url, 'titol' => $ON->getTitolmenu(), 'img' => $img);
                             }
                             $this->mode = 'llista';
                             //No té cap més subdirectori, carreguem els continguts
                         } else {
                             //Si el contingut és html, l'interpretem, altrament el mostrem tal com està.
                             if ($ON->getIsphp()) {
                                 $this->CONTINGUT = $ON->getHtml();
                                 $this->IMG = self::Get_Images('front', $ON->getIdnodes() . '-XL');
                                 $this->mode = 'detall';
                             } else {
                                 $this->CONTINGUT = $ON->getHtml();
                                 $this->IMG = self::Get_Images('front', $ON->getIdnodes() . '-XL');
                                 $this->mode = 'detall';
                             }
                         }
                         break;
                         //Si el node és d'exposicions, mostrem un llistat amb les exposicions
                     //Si el node és d'exposicions, mostrem un llistat amb les exposicions
                     case NodesPeer::CATEGORIA_EXPOSICIONS:
                         //Carreguem les exposicions actuals ( Sala Fita i Sala d'exposicions ) i les futures, si hi són.
                         $this->A_LLISTA = $this->CarregaInfoExposicions();
                         $this->mode = 'llista';
                         break;
                     case NodesPeer::CATEGORIA_ACTIVITATS_NORMALS:
                         $this->A_LLISTA = $this->CarregaInfoActivitats();
                         $this->mode = 'llista';
                         break;
                     case NodesPeer::CATEGORIA_FORMACIO:
                         $this->A_LLISTA = $this->CarregaInfoCategories('44', 'CICLES DE FORMACIÓ', null, 1);
                         $this->mode = 'llista';
                         break;
                     case NodesPeer::CATEGORIA_CURSOS:
                         $this->A_LLISTA = $this->CarregaInfoCursos($this->IDS, 0);
                         $this->mode = 'llista';
                         break;
                     case NodesPeer::CATEGORIA_GIROSCOPI:
                         break;
                     case NodesPeer::CATEGORIA_CICLES:
                         $this->A_LLISTA = $this->CarregaInfoCicles();
                         $this->mode = 'llista';
                         break;
                     case NodesPeer::CATEGORIA_MUSICA:
                         $this->redirect('@web_menu_click_cicle?idCicle=394&titol=Musica');
                         break;
                     case NodesPeer::CATEGORIA_CONEIXEMENT:
                         $this->A_LLISTA = $this->CarregaInfoConeixement($this->IDS, 0);
                         $this->mode = 'llista';
                         break;
                 }
             } else {
                 //Entrem a la home
                 $this->mode = 'home';
             }
             break;
             //Quan cliquem l'enllaç d'un curs, mostrem el seu contingut.
         //Quan cliquem l'enllaç d'un curs, mostrem el seu contingut.
         case 'menu_click_cursos':
             $this->SELECCIONAT = NodesPeer::retrieveByPK(62);
             $idC = $request->getParameter('idCurs');
             //Si no hem seleccionat el curs, mostrem els cursos dins una categoria
             if ($idC == 0) {
                 $this->A_LLISTA = $this->CarregaInfoCursos($this->IDS, $request->getParameter('idCategoria'));
                 $this->mode = 'llista';
                 //Hem entrat clicant un curs, mostrem el detall del curs
             } else {
                 $OC = CursosPeer::retrieveByPK($idC);
                 if ($OC instanceof Cursos) {
                     $this->CONTINGUT = $OC->getDescripcio();
                     $this->HORARIS = $OC->getHoraris();
                     $this->TITOL = $OC->getTitolcurs();
                     $this->IMG = self::Get_Images('cursos', 'C-' . $OC->getIdcursos() . '-XL');
                     $this->PDF = $this->PDF_exists('cursos', 'C-' . $OC->getIdcursos() . '-PDF') ? '/images/cursos/C-' . $OC->getIdcursos() . '-PDF.pdf' : '';
                     $this->mode = "detall";
                 } else {
                     $this->mode = "home";
                 }
             }
             break;
             //Quan cliquem l'enllaç d'una activitat mostrem el contingut
         //Quan cliquem l'enllaç d'una activitat mostrem el contingut
         case 'menu_click_activitats':
             $idA = $request->getParameter('idActivitat');
             $OA = ActivitatsPeer::retrieveByPK($idA);
             if ($OA instanceof Activitats) {
                 $this->SELECCIONAT = NodesPeer::retrieveByPK(substr_count($OA->getCategories(), '46') > 0 ? 58 : 61);
                 $OC = CiclesPeer::retrieveByPK($OA->getCiclesCicleid());
                 $this->CONTINGUT = $OA->getDMig();
                 $this->HORARIS = $OA->getHorariss();
                 $this->TITOL = $OA->getTMig();
                 $this->IMG = self::Get_Images('activitats', 'A-' . $OA->getActivitatid() . '-XL');
                 $this->PDF = $this->PDF_exists('activitats', 'A-' . $OA->getActivitatid() . '-PDF') ? '/images/activitats/A-' . $OA->getActivitatid() . '-PDF.pdf' : '';
                 $this->INFO_PRACTICA = $OA->getInfopractica();
                 $this->A_LLISTA = $this->CarregaInfoCategories(null, $OC instanceof Cicles ? 'Altres activitats de: ' . $OC->getTMig() : 'Altres activitats del cicle', $OA->getCiclesCicleid(), 3);
                 $this->mode = "detall";
             } else {
                 $this->mode = "home";
             }
             break;
             //Quan cliquem el botó de cicles, els mostrem tots.
         //Quan cliquem el botó de cicles, els mostrem tots.
         case 'menu_click_cicles':
             $idC = $request->getParameter('idCicle');
             $OC = CiclesPeer::retrieveByPK($idC);
             if ($OC instanceof Cicles) {
                 $this->SELECCIONAT = NodesPeer::retrieveByPK(61);
                 //Miro el primer i últim horari.
                 $PH = "";
                 $PA = $OC->getPrimeraActivitat();
                 if ($PA instanceof Activitats) {
                     $PH = $PA->getPrimerHorari();
                 }
                 $UH = "";
                 $UA = $OC->getUltimaActivitat();
                 if ($UA instanceof Activitats) {
                     $UH = $UA->getUltimHorari();
                 }
                 $HORARIS = array($PH, $UH);
                 $this->CONTINGUT = $OC->getDMig();
                 $this->HORARIS = CiclesPeer::getHorariss($OC->getCicleid(), $OC->getSiteid());
                 $this->TITOL = $OC->getTMig();
                 $this->INFO_PRACTICA = "";
                 $this->IMG = self::Get_Images('cicles', 'C-' . $OC->getCicleid() . '-XL');
                 $this->PDF = $this->PDF_exists('cicles', 'C-' . $OC->getCicleid() . '-PDF') ? '/images/cicles/C-' . $OC->getCicleid() . '-PDF.pdf' : '';
                 $this->A_LLISTA = $this->CarregaInfoCategories(null, 'Activitats del cicle', $OC->getCicleid(), 2);
                 $this->mode = "detall";
             } else {
                 $this->mode = "home";
             }
             break;
             //Quan cliquem l'enllaç d'un curs, mostrem el seu contingut.
         //Quan cliquem l'enllaç d'un curs, mostrem el seu contingut.
         case 'menu_click_noticies':
             $this->SELECCIONAT = NodesPeer::retrieveByPK(60);
             $idN = $request->getParameter('idNoticia', 0);
             //Si no hem escollit una notícia, mostrem les notícies
             if ($idN == 0) {
                 $this->A_LLISTA = $this->CarregaInfoNoticies();
                 $this->mode = 'llista';
                 //Hem entrat clicant un curs, mostrem el detall del curs
             } else {
                 $ON = NoticiesPeer::retrieveByPK($idN);
                 if ($ON instanceof Noticies) {
                     $this->CONTINGUT = $ON->getTextnoticia();
                     $this->HORARIS = "";
                     $this->TITOL = $ON->getTitolnoticia();
                     $this->IMG = self::Get_Images('noticies', 'N-' . $ON->getIdnoticia() . '-XL');
                     $this->PDF = $this->PDF_exists('noticies', 'N-' . $ON->getIdnoticia() . '-PDF') ? '/images/noticies/N-' . $ON->getIdnoticia() . '-PDF.pdf' : '';
                     $this->mode = "detall";
                 } else {
                     $this->mode = "home";
                 }
             }
             break;
         case "cerca":
             $text = $request->getParameter('text', null);
             $data = $request->getParameter('data', null);
             //Convertim la data
             if (!is_null($data)) {
                 list($dia, $mes, $any) = explode('/', $data);
                 $data = mktime(0, 0, 0, $mes, $dia, $any);
             }
             $llista = $this->CarregaInfoActivitats($data, $text, null);
             return $this->renderPartial('llista', array('A_LLISTA' => $llista));
             break;
         default:
             $this->mode = 'home';
             break;
     }
     $this->A_MENU = NodesPeer::retornaMenu(1, false);
     $avui = date('Y-m-d', time());
     //Carreguem per la home... només?
     $this->A_ACTIVITATS_AVUI = ActivitatsPeer::getActivitatsDia($this->IDS, $avui, $this->PAGE, 'activitats');
     $this->A_ACTIVITATS_FUTURES = ActivitatsPeer::getActivitatsProperes($this->IDS, $avui, $this->PAGE, 'horari', 100);
     $this->A_EXPOSICIONS = self::CarregaInfoExposicions();
     $this->A_NOVETATS = NoticiesPeer::getNoticies("", 1, true, false, 1);
 }
Exemplo n.º 6
0
 public function executeGEstructura(sfWebRequest $request)
 {
     $this->setLayout('gestio');
     $this->IDS = $this->getUser()->getSessionPar('idS');
     $this->IDN = $request->getParameter('idN', 0);
     $this->ERRORS = array();
     $this->NOU = false;
     $this->EDICIO = false;
     $this->HTML = false;
     $accio = $request->getParameter('accio');
     if ($request->hasParameter('SaveHTML')) {
         $accio = 'SAVE_HTML';
     } elseif ($request->hasParameter('BSAVE')) {
         $accio = 'SAVE';
     } elseif ($request->hasParameter('BDELETE')) {
         $accio = 'D';
     }
     switch ($accio) {
         case 'N':
             $this->FNode = NodesPeer::initialize($this->IDN, $this->IDS);
             $this->NOU = true;
             break;
         case 'E':
             $this->FNode = NodesPeer::initialize($this->IDN, $this->IDS);
             $this->EDICIO = true;
             break;
         case 'H':
             $this->FHtml = NodesPeer::initialize($this->IDN, $this->IDS, true);
             $this->HTML = true;
             break;
         case 'D':
             $this->FNode = NodesPeer::initialize($this->IDN, $this->IDS);
             $this->NODE = $this->FNode->getObject();
             $this->NODE->setActiu(false);
             $this->NODE->save();
             $this->getUser()->addLogAction('delete', 'gEstructura', $this->NODE);
             break;
         case 'CC':
             $this->getUser()->addLogAction('inside', 'gEstructura');
             break;
         case 'SAVE':
             $RP = $request->getParameter('nodes');
             $this->IDN = $RP['idNodes'];
             $this->FNode = NodesPeer::initialize($this->IDN, $this->IDS);
             $this->FNode->bind($RP);
             if ($this->FNode->isValid()) {
                 $this->FNode->save();
                 $this->getUser()->addLogAction('save', 'gEstructura', null, $this->FNode->getObject());
             }
             $this->EDICIO = false;
             break;
         case 'SAVE_HTML':
             $RP = $request->getParameter('editor');
             $this->IDN = $RP['idNodes'];
             $this->FHtml = NodesPeer::initialize($this->IDN, $this->IDS, true);
             $this->FHtml->bind($RP);
             if ($this->FHtml->isValid()) {
                 $this->FHtml->save();
                 $this->getUser()->addLogAction('saveHTML', 'gEstructura', $this->FHtml->getObject());
             }
             $this->HTML = true;
             break;
     }
     $this->NODES = NodesPeer::selectNodesPares($this->IDS, true);
     // $this->NODES = NodesPeer::retornaMenu($this->IDS,true);
 }
Exemplo n.º 7
0
 public function LoadWEB(sfWebRequest $request)
 {
     $this->redirect('w/NotFound');
     //Carrego els banners i les fotos que mostraré
     //Si s'entra un menú, carrego el contingut que toca segons el menú
     //Si el menú és només títol, mostro l'estructura de directoris
     //Si el menú té contingut,
     //Si el contingut és automàtic, mostro el contingut automàtic
     //Si el contingut és manual, mostro el contingut manual
     //Si s'entra una cerca, carrego les activitats que corresponen a la cerca i marco el calendari els dies
     //Si s'entra un dia del calendari, cerco les activitats d'aquell dia
     //Si no es cap, carrego les notícies de les últimes activitats...
     $this->setLayout('layout');
     $this->IDS = 1;
     $this->FOTOS = $this->getFotos();
     $this->BANNERS = $this->getBanners();
     $this->MENU = NodesPeer::retornaMenu($this->IDS);
     $this->USUARI = $this->getUser()->getSessionPar('idU', 0);
     $this->SELECCIONAT = 0;
     $this->LLISTAT_ACTIVITATS = array();
     $this->ACTIVITATS_CALENDARI = array();
     $this->MISSATGE = array();
     if ($this->getUser()->isAuthenticated()) {
         $this->TIPUS_MENU = 'ADMIN';
     } else {
         $this->TIPUS_MENU = 'WEB';
     }
     $this->DATACAL = $this->getUser()->ParReqSesForm($request, 'DATACAL', time());
     $this->PAGINA = $this->getUser()->ParReqSesForm($request, 'p', 1);
     //Gestió de menús
     $idN = $request->getParameter('node', 0);
     $this->OBERT = $this->gestionaNodes($idN);
     $this->accio = $request->getParameter('accio');
     if ($request->hasParameter('BCERCA_x') || $request->hasParameter('CERCA') || $this->accio == 'c') {
         $this->CERCA = $this->getUser()->ParReqSesForm($request, 'CERCA', "");
         $this->accio = 'c';
     } else {
         $this->CERCA = "";
     }
     //Carreguem els dies en els que hi ha alguna activitat.
     $this->ACTIVITATS_CALENDARI = ActivitatsPeer::getDiesAmbActivitatsMes($this->DATACAL, $this->IDS);
     switch ($this->accio) {
         //Contingut manual
         case 'mc':
             $this->NODE = NodesPeer::selectPagina($idN);
             $this->ACCIO = 'web';
             break;
             //Contingut automàtic de cicles
         //Contingut automàtic de cicles
         case 'ac':
             $this->NODE = NodesPeer::selectPagina($idN);
             if (!$this->NODE->isNew()) {
                 $cat = $this->NODE->getCategories();
                 $this->LLISTAT_CICLES = ActivitatsPeer::getCiclesCategoria($this->IDS, $cat);
                 $this->ACCIO = 'llistatCiclesCategoria';
                 $ACT = ActivitatsPeer::selectCategories($this->IDS, true);
                 $this->TITOL = "Cicles i activitats a \"" . $ACT[$cat] . '"';
                 $this->CAT = $cat;
             }
             $this->NODE = $idN;
             break;
             //Contingut automàtic d'activitats d'un cicle
         //Contingut automàtic d'activitats d'un cicle
         case 'aca':
             $this->CAT = $request->getParameter('cat', '');
             $this->IDC = $request->getParameter('idc', 1);
             $this->PAGINA = $request->getParameter('p', 1);
             $this->NODE = $request->getParameter('NODE', 0);
             $OC = CiclesPeer::retrieveByPK($this->IDC);
             $this->TITOL = 'Llistat d\'activitats del cicle ' . $OC->getNom();
             $this->LLISTAT_ACTIVITATS = ActivitatsPeer::getActivitatsCicles($this->IDC, $this->IDS, true, $this->PAGINA);
             $this->ACCIO = 'llistatActivitatsCicleCategoria';
             break;
             //Consulta un cicle
         //Consulta un cicle
         case 'cc':
             $this->CICLE = CiclesPeer::retrieveByPK($request->getParameter('idC'));
             $this->ACCIO = 'mostra_cicle';
             $this->TITOL = $this->CICLE->getNom();
             break;
             //Llistat activitats de cicle
         //Llistat activitats de cicle
         case 'ccact':
             $this->IDC = $request->getParameter('idC');
             $this->CICLE = CiclesPeer::retrieveByPK($this->IDC);
             $this->LLISTAT_ACTIVITATS = CiclesPeer::getActivitatsCicleList($this->IDC, $this->IDS, true);
             $this->ACCIO = 'mostra_activitats_cicle';
             $this->TITOL = "Activitats || " . $this->CICLE->getNom();
             break;
             //Cerca
         //Cerca
         case 'c':
             if ($this->CERCA == 'mensual') {
                 $this->CERCA = '';
                 $this->TITOL = 'ACTIVITATS DEL MES';
             } else {
                 $this->TITOL = 'ACTIVITATS TROBADES AMB LA CERCA "' . $this->CERCA . '"';
             }
             $this->LLISTAT_ACTIVITATS = ActivitatsPeer::getActivitatsCerca($this->CERCA, $this->DATACAL, $this->PAGINA, $this->IDS);
             $this->ACCIO = 'llistat_activitats_cerca';
             $this->MODE = 'CERCA';
             break;
             //Cerca un dia
         //Cerca un dia
         case 'ca':
             $this->LLISTAT_ACTIVITATS = ActivitatsPeer::getActivitatsDia($this->IDS, date('Y-m-d', $this->DATACAL), $this->PAGINA);
             $this->ACCIO = 'llistat_activitats';
             $this->TITOL = 'ACTIVITATS EL DIA ' . date('d/m/Y', $this->DATACAL);
             $this->MODE = 'DIA';
             break;
             //Mostra una sola activitat
         //Mostra una sola activitat
         case 'caa':
             $this->LLISTAT_ACTIVITATS = array(ActivitatsPeer::retrieveByPK($request->getParameter('idA')));
             $this->NODE = $request->getParameter('node', 0);
             $this->ACCIO = 'mostra_activitat';
             $this->TITOL = 'Informació de l\'activitat';
             $OA = $this->LLISTAT_ACTIVITATS[0];
             $this->getResponse()->addMeta('facebook', myUser::getFacebookHeaders($OA->getTmig(), sfConfig::get('sf_webdomain') . $this->getController()->genUrl('@web_activitat?idA=' . $OA->getActivitatId() . '&titol=' . $OA->getNomForUrl()), OptionsPeer::getString('SF_WEBROOT', 1) . 'images/activitats/' . $OA->getActivitatId() . '.jpg', 'Casa de Cultura de Girona', '1763108168308'));
             break;
             //Canvi data del calendari
         //Canvi data del calendari
         case 'cdc':
             $this->redirect('web/index?accio=c&CERCA=mensual&DATACAL=' . $this->DATACAL);
             break;
             //Mostrem notícies
         //Mostrem notícies
         default:
             $this->IDN = $request->getParameter('idN', 0);
             $this->PAGINA = $request->getParameter('p', 1);
             if ($this->IDN > 0) {
                 $this->NOTICIA = NoticiesPeer::getNoticia($this->IDN, $this->IDS);
                 $this->getResponse()->addMeta('facebook', myUser::getFacebookHeaders($this->NOTICIA->getTitolnoticia(), sfConfig::get('sf_webdomain') . $this->getController()->genUrl('@web_noticia?idN=' . $this->NOTICIA->getIdnoticia() . '&p=' . $this->PAGINA . '&titol=' . $this->NOTICIA->getNomForUrl()), OptionsPeer::getString('SF_WEBROOT', 1) . 'images/noticies/' . $this->NOTICIA->getIdnoticia() . '.jpg', 'Casa de Cultura de Girona', '1763108168308'));
                 $this->NOTICIES = null;
             } else {
                 $this->NOTICIA = null;
                 $this->NOTICIES = NoticiesPeer::getNoticies('%', $this->PAGINA, true, FALSE, $this->IDS);
             }
             $this->ACCIO = 'noticies';
             $this->getUser()->setSessionPar('NODES', array());
             break;
             break;
     }
 }
Exemplo n.º 8
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(NodesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(NodesPeer::DATABASE_NAME);
         $criteria->add(NodesPeer::IDNODES, $pks, Criteria::IN);
         $objs = NodesPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemplo n.º 9
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = NodesPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdnodes($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setIdpare($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setTitolmenu($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setHtml($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setIscategoria($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setIsphp($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setIsactiva($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setOrdre($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setNivell($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setUrl($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setCategories($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setSiteId($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setActiu($arr[$keys[12]]);
     }
 }
Exemplo n.º 10
0
    <TD colspan="2" class="CONTINGUT">
    
     <div id="TEXT_WEB">
    <?php 
if (!$NODE->getIscategoria()) {
    $WEB = $NODE->getHtml();
    //	    	$WEB = sfConfig::get('sf_web_dir').$NODE->getHtml();
    //	    	$P = $NODE->getHtml();
    //	    	if(!empty($P) && file_exists($WEB)) include($WEB);
    //	    	else echo "Encara no hi ha continguts...";
    echo $WEB;
} else {
    //Carregar els nodes que depenen de mi
    //I dibuixar estructura d'arbre
    //Miro el nivell del node i trec els que tenen després per ordre de nivell superior.
    $NODES = NodesPeer::getFills($NODE);
    $NIVELL_ACT = $NODE->getNivell();
    $NIVELL_IN = $NIVELL_ACT;
    echo '<h2>Taula de continguts</h2>';
    echo '<h3>Dins aquest apartat trobarà els següents continguts: </h3>';
    echo '<ul>';
    echo '<li>' . $NODE->getTitolmenu();
    foreach ($NODES as $N) {
        if ($NODE->getIsactiva()) {
            if ($NIVELL_IN >= $N->getNivell()) {
                break;
            }
            if ($NIVELL_ACT < $N->getNivell()) {
                echo "<ul>";
            } elseif ($NIVELL_ACT > $N->getNivell()) {
                echo '</li></ul>';