function ajouterPara()
{
    $newParag = new Paragraphe();
    $newParag->titrePara = $_POST['textTitrePara'];
    $newParag->contenuPara = $_POST['textCont'];
    $numpara = $newParag->creerParagraphe();
    $laPage = new Page();
    $laPage->numpage = $_GET['numpage'];
    $laPage->id_m = $_GET['id'];
    $laPage->numpara = $numpara;
    $laPage->ordre = $_POST['selectOrdre'];
    $laPage->colonne = $_POST['selectType'];
    $laPage->liste = $_POST['radioListe'];
    $laPage->typeTitre = $_POST['radioTypeTitre'];
    $laPage->ajouterParagraphe();
    // On l'ajoute à la page
    for ($i = 1; $i <= $_POST['nbLiens']; $i++) {
        // On traite l'ajout de liens
        $valUrl = "textUrlLien" . $i . "_";
        $valPage = "selectPage" . $i . "_";
        if (${$valUrl} || ${$valPage}) {
            $valLib = "textLibLien" . $i . "_";
            $valTexte = "textTexteLien" . $i . "_";
            $valOrdre = "selectOrdreLien" . $i . "_";
            $valFen = "radioFen" . $i . "_";
            $newLien = new Lien();
            $newLien->numpara = $numpara;
            $newLien->libLien = ${$valLib};
            $newLien->texteLien = ${$valTexte};
            if (${$valPage}) {
                $pageLien = new Page();
                $pageLien->numpage = ${$valPage};
                $pageLien->infosPage();
                $newLien->numpage = ${$valPage};
                $newLien->urlLien = $pageLien->aliasPage;
            } else {
                $newLien->urlLien = ${$valUrl};
            }
            $newLien->fenLien = ${$valFen};
            $newLien->ordreLien = ${$valOrdre};
            $newLien->creerLien();
        }
        //fin if ($$valUrl)
    }
    //fin du for
    for ($i = 1; $i <= $nbPhotos; $i++) {
        // On traite l'association de photos
        $valSelect = "selectPhoto" . $i . "_";
        $valFile = "filePhoto" . $i . "_";
        if (${$valSelect} || isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") {
            $valLeg = "textLegPh" . $i . "_";
            $valOrdre = "selectOrdrePhoto" . $i . "_";
            $valTaille = "radioTaille" . $i . "_";
            if (${$valSelect}) {
                // on associe une photo existante
                $newParag->numphoto = ${$valSelect};
                $newParag->ordrePhoto = ${$valOrdre};
                $newParag->legPhoto = ${$valLeg};
                $newParag->associerPhoto();
            } else {
                if (isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") {
                    // on cr�e une photo
                    $newPhoto = new Photo();
                    $newPhoto->nomPhoto = normaliza(basename($_FILES[$valFile]['name']));
                    $newPhoto->tmp_name = $_FILES[$valFile]['tmp_name'];
                    $newPhoto->taille = ${$valTaille};
                    $numphoto = $newPhoto->creerPhoto();
                    // On associe ensuite la photo au paragraphe
                    $newParag->numphoto = $numphoto;
                    $newParag->ordrePhoto = ${$valOrdre};
                    $newParag->legPhoto = ${$valLeg};
                    $newParag->associerPhoto();
                }
            }
        }
        //fin if ($$valSelect || $$valFile)
    }
    //fin du for
    for ($i = 1; $i <= $nbVideos; $i++) {
        // On traite l'association de vidéos
        $valSelect = "selectVideo" . $i . "_";
        $valFile = "fileVideo" . $i . "_";
        if (${$valSelect} || isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") {
            $valLeg = "textLegVi" . $i . "_";
            $valOrdre = "selectOrdreVideo" . $i . "_";
            if (${$valSelect}) {
                // on associe une vidéo existante
                $newParag->numvideo = ${$valSelect};
                $newParag->ordreVideo = ${$valOrdre};
                $newParag->legVideo = ${$valLeg};
                $newParag->associerVideo();
            } else {
                if (isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") {
                    // on cree une video
                    $newVideo = new Video();
                    $newVideo->nomVideo = normaliza(basename($_FILES[$valFile]['name']));
                    $newVideo->tmp_name = $_FILES[$valFile]['tmp_name'];
                    $numvideo = $newVideo->creerVideo();
                    // On associe ensuite la vidéo au paragraphe
                    $newParag->numvideo = $numvideo;
                    $newParag->ordreVideo = ${$valOrdre};
                    $newParag->legVideo = ${$valLeg};
                    $newParag->associerVideo();
                }
            }
        }
        //fin if ($$valSelect || $$valFile)
    }
    //fin du for
    for ($i = 1; $i <= $nbFichiers; $i++) {
        // On traite l'association de fichiers
        //$valSelect="selectFich".$i."_";
        $valFile = "fileFich" . $i . "_";
        if (isset($_FILES[$valFile]['tmp_name']) && $_FILES[$valFile]['tmp_name'] != "") {
            $valOrdre = "selectOrdreFich" . $i . "_";
            $valLib = "textLibFich" . $i . "_";
            $newFichier = new Fichier();
            $newFichier->nomFichier = normaliza(basename($_FILES[$valFile]['name']));
            $newFichier->tmp_name = $_FILES[$valFile]['tmp_name'];
            $numfichier = $newFichier->creerFichier();
            // On associe ensuite le fichier au paragraphe
            $newParag->numfichier = $numfichier;
            $newParag->ordreFichier = ${$valOrdre};
            $newParag->libFichier = ${$valLib};
            $newParag->associerFichier();
        }
        //fin if ($$valSelect || $$valFile)
    }
    //fin du for
    if (!$action) {
        //on est en création de page
        if (!$paragraphe) {
            $pg_admin = "lister-page";
        } else {
            $creer_page = 1;
        }
    } else {
        //on est en modification de page
        if (!$paragraphe) {
            $onglet = "mod_para";
        } else {
            $onglet = "aj_para";
        }
    }
}
                 $newPhoto->infosPhoto();
                 $nom_photo = $newPhoto->nomPhoto;
                 $modifParag->ordrePhoto = $selectOrdrePhoto;
                 $modifParag->legPhoto = $textLegPh;
                 $modifParag->modifierPhoto();
             }
         }
     }
     //fin if ($selectPhoto || ...)
     $mes = "La photo est modifiée!";
     $fermer = 1;
 } else {
     if ($numvideo) {
         // modification de vidéo
         $sauv_numvideo = $numvideo;
         $modifParag = new Paragraphe();
         $modifParag->numparavideo = $numparavideo;
         if ($selectVideo || isset($_FILES["fileVideo"]['tmp_name']) && $_FILES["fileVideo"]['tmp_name'] != "") {
             if ($selectVideo) {
                 // on associe une vidéo existante
                 $modifParag->numvideo = $selectVideo;
                 $newVideo = new Video();
                 $newVideo->numvideo = $selectVideo;
                 $newVideo->infosVideo();
                 $nom_video = $newVideo->nomVideo;
                 $modifParag->ordreVideo = $selectOrdreVideo;
                 $modifParag->legVideo = $textLegVi;
                 $modifParag->modifierVideo();
             } else {
                 if (isset($_FILES["fileVideo"]['tmp_name']) && $_FILES["fileVideo"]['tmp_name'] != "") {
                     // on crée une vidéo
 /**
  * affiche la liste des paragraphes 
  * @return si on voit les docs on retourne le nombre de doc, sinon on retourne le nombre de paragraphes
  */
 function afficherListeParas()
 {
     //requete sql
     if ($this->numpage) {
         // Liste des paragraphes li&eacute;s &agrave; la page
         if (isset($this->colonne)) {
             $fin_req = "AND colonne='{$this->colonne}'";
         }
         $result = mysql_query("SELECT numpara FROM if_page_para WHERE numpage='{$this->numpage}' {$fin_req} ORDER BY ordre");
         //echo "SELECT numpara FROM if_page_para WHERE numpage='$this->numpage' $fin_req ORDER BY ordre<br/>";
         while ($row = mysql_fetch_row($result)) {
             $unPara = new Paragraphe();
             $unPara->numpara = $row[0];
             $unPara->numpage = $this->numpage;
             $unPara->infosPara();
             $this->paras[] = $unPara;
         }
         //fin du while
     } else {
         if ($this->formation) {
             // Liste des formations IFIP
             $result = mysql_query("SELECT numpara FROM if_v_form {$this->tri_date}");
             while ($row = mysql_fetch_row($result)) {
                 $unPara = new Formation();
                 $unPara->numpara = $row[0];
                 $unPara->infosFormation();
                 $this->paras[] = $unPara;
             }
             //fin du while
         } else {
             if ($this->doc) {
                 // Liste des docs IFIP
                 $result = mysql_query("SELECT numpara FROM if_v_doc {$this->req_doc}");
                 while ($row = mysql_fetch_row($result)) {
                     $unPara = new Documentation();
                     $unPara->numpara = $row[0];
                     if ($this->docvcourte) {
                         $unPara->infosDocVersionCourte();
                     } else {
                         $unPara->infosDoc();
                     }
                     $this->paras[] = $unPara;
                     //mise en commentaire HC sept. 2009 - on refait un tri sur le champ date
                     //usort($this->paras, 'trierDocs');//tri sur le tableau d'ojets Documentation (sur anneeDoc cr&eacute;&eacute;e dans InfosDoc)
                 }
                 //fin du while
                 if ($this->docvcourte) {
                     $this->nbdocs = count($this->paras);
                     $this->paras = array_slice($this->paras, $this->borneinf, $this->bornesup);
                     // troncage du tableau
                     //print_r($this->paras);
                 }
             } else {
                 if ($this->breve) {
                     // Liste des br&egrave;ves internationales IFIP
                     $result = mysql_query("SELECT numpara FROM if_v_breve {$this->req_breve}");
                     while ($row = mysql_fetch_row($result)) {
                         $unPara = new Breve();
                         $unPara->numpara = $row[0];
                         $unPara->infosBreve();
                         $this->paras[] = $unPara;
                     }
                     //fin du while
                 } else {
                     if ($this->actu) {
                         // Liste des br&egrave;ves d'actualit&eacute;s IFIP
                         $result = mysql_query("SELECT numpara FROM if_v_actu {$this->req_actu}");
                         while ($row = mysql_fetch_row($result)) {
                             $unPara = new Actualite();
                             $unPara->numpara = $row[0];
                             $unPara->infosActu();
                             $this->paras[] = $unPara;
                         }
                         //fin du while
                     } else {
                         // Liste de tous les paragraphes (pour choisir un paragraphe &agrave; associer lors de la cr&eacute;ation ou modification de la page sauf les paragraphes de type Formation et de type Doc
                         $result = mysql_query("SELECT numpara FROM if_paragraphe WHERE numpara NOT IN (SELECT numpara FROM if_v_form) AND NOT IN (SELECT numpara FROM if_v_doc)");
                         while ($row = mysql_fetch_row($result)) {
                             $unPara = new Paragraphe();
                             $unPara->numpara = $row[0];
                             $unPara->numpage = $this->numpage;
                             $unPara->infosPara();
                             $this->paras[] = $unPara;
                         }
                         //fin du while
                     }
                 }
             }
         }
     }
     if ($this->docvcourte) {
         return $this->nbdocs;
     } else {
         return count($this->paras);
     }
 }
Esempio n. 4
0
    $supLien->numlien = $numlien;
    $supLien->supprimerLien();
} else {
    if ($div == "li_fichiers" . $numfichier) {
        $supPara = new Paragraphe();
        $supPara->numparafichier = $numparafichier;
        $supPara->enleverFichier();
    } else {
        if ($div == "li_photos" . $numphoto) {
            $supPara = new Paragraphe();
            $supPara->numphoto = $numphoto;
            $supPara->numparaphoto = $numparaphoto;
            $supPara->enleverPhoto();
        } else {
            if ($div == "li_videos" . $numvideo) {
                $supPara = new Paragraphe();
                $supPara->numparavideo = $numparavideo;
                $supPara->enleverVideo();
            } else {
                if ($div == "li_photo_page") {
                    $modPage = new Page();
                    $modPage->numpage = $numpage;
                    $modPage->enleverPhoto();
                }
            }
        }
    }
}
?>
<html>	
<head>
Esempio n. 5
0
             if ($radioPubliee == "o") {
                 $newPage->creerAlias();
             }
             $creer_page = 1;
             $pg_admin = "ajouter-parag";
         } else {
             $mes = "Attention, le nom du fichier existe déjà. Vous devez choisir un autre nom pour cette page.";
         }
     }
     /* ************* On ajoute un paragraphe lors de la création de la page (pg="ajouter-parag") ou 
      ************* en modification de page (action="ajouter_parag") ****************
      **************************************************************** */
 } else {
     if ($pg_admin == "ajouter-parag" || $action == "ajouter_parag") {
         //if ($textCont || is_array($checkPara)) {
         $newParag = new Paragraphe();
         //if ($textTitrePara) { //on cree un nouveau paragraphe
         $newParag->titrePara = $textTitrePara;
         $newParag->contenuPara = $textCont;
         $numpara = $newParag->creerParagraphe();
         // On crée le paragraphe
         $laPage = new Page();
         $laPage->numpage = $numpage;
         $laPage->id_m = $id;
         $laPage->numpara = $numpara;
         $laPage->ordre = $selectOrdre;
         $laPage->colonne = $selectType;
         $laPage->liste = $radioListe;
         $laPage->typeTitre = $radioTypeTitre;
         $laPage->ajouterParagraphe();
         // On l'ajoute à la page