function ttChpLink($valb0,$reqsup="",$valc=""){
	//echo $reqsup;
	global $DBHost,$DBUser,$DBName,$DBPass,$carsepldef,$TBDname,$maxrepld;
	$valbrut=explode(';',$valb0);
	/// en cas de modif de la syntaxe, checker aussi PYAObj
	/// methode echoFilt, case LDLLV qui se sert de la chaine valb0 pour une requete imbriquée  
	if (count($valbrut)>1) { // connection �une base diff�ente
		$lntable=$valbrut[1];
		$defdb=explode(',',$valbrut[0]);
		$newbase=true;
		// si user et/ou hote d'acc� �la Bdd est diff�ent, on etablit une nvlle connexion
		// on fait une nouvelle connection syst�atiquement pourt etre compatioble avec pg_sql
		//if (($defdb[1]!="" && $defdb[1]!=$DBHost)||($defdb[2]!="" && $defdb[2]!=$DBUser)) {
		$lnc=db_connect($defdb[1],$defdb[2],$defdb[3],$defdb[0]) or die ("Impossible de se connecter au serveur $defdb[1], user: $defdb[2], passwd: $defdb[3]");
		$newconnect=true;
		//}
	} else { //commme avant
		$lntable=$valbrut[0];
		$newbase=false;
		$newconnect=false;
	}
	// gestion condition AND depuis PYA
	$valb2 = explode("[[",$lntable);
	if (count($valb2)>1) {
		$lntable=$valb2[0];
		if ($reqsup!="") {
			$reqsup= "(".$this->Val2." AND ".$valb2[1].")";
		} else $reqsup = $valb2[1];
	}
	// si une seule valeur a chercher, on ignore $reqsup sinon ça met la merde
	if ($valc != "") $reqsup = "";

	// 0: table, 1: champ lié(clé(s)); 2: ET SUIVANTS champs affiches
	$defl = explode(',',$lntable);
	$nbca = 0; // on regarde les suivants pour construire la requete
	$rcaf = "";
	$tbmultk = explode(":",$defl[1]); // on gère les clé multiples: le nom du champ clé est dans ce cas clé1:clé2:clé3
	// on boucle sur les champs à afficher
	while ($defl[$nbca+2]!="") {
		$nmchp=$defl[$nbca+2];
		$c2aff=true; // champ a afficher effectivement
		if (strstr($nmchp,"!")) { // caractere separateur defini
			$nmchp=explode("!",$nmchp);
			$tbcs[$nbca+1]=$nmchp[0]; // separateur avant le "!"
			$nmchp=$nmchp[1];
		}
		/* si le chp a afficher champ comporte un & au debut, il faut aller cherche les valeurs dans une
		table; les parametres sont  indiques dans les caracteristiques d'édition de CE champ dans la table  de définition*/
       	if (strstr($nmchp,"&")) { // si chainage
			$nmchp=substr ($nmchp,1); // enl�e le &
			if (strstr($nmchp,"~@")) { // si classement inverse en plus sur ce champ
				$nmchp=substr ($nmchp,2); // enl�e le @
				$orderby=" order by $nmchp DESC "; 
			} elseif (strstr($nmchp,"@")) { // si classement en plus sur ce champ
				$nmchp=substr ($nmchp,1); // enl�e le @
				$orderby=" order by $nmchp "; 
			}
     	 	$rqvc=db_query("select VALEURS from $TBDname where NM_CHAMP='$nmchp' AND NM_TABLE='$defl[0]'");
      	 	$resvc=db_fetch_row($rqvc);
     	 	$valbchain[$nbca+1]=$resvc[0]; /// TODO la syntaxe de Valeurs a évolué !!
    	}
       	if (strstr($nmchp,"@@")) { // si ce champ indique un champ de structure hierarchique avec la clé de type pid= parent id
			$cppid = substr ($nmchp,2); // enleve le @@
			$c2aff=false;
	 	} elseif (strstr($nmchp,"~@")) { // si classement inverse sur ce champ
			$nmchp=substr ($nmchp,2); // enleve le ~@
			$orderby=" order by $nmchp DESC";
		} elseif (strstr($nmchp,"@")) { // si classement sur ce champ
			$nmchp=substr ($nmchp,1); // enleve le @
			$orderby=" order by $nmchp ";
		}
		if ($c2aff) { // si champ à afficher
			$rcaf=$rcaf.",".$nmchp;
			$tbc2a[]=$nmchp; // tableau des champs où chercher
		}
		$nbca++;
	} // fin boucle
	if ($cppid) $nbca=$nbca-1; 

	
	if  ($valc!="") { // soit on cherche 1 et 1 seule valeur, ou plusieurs si $valc est un tableau, ou une chaine de caractères
		if (is_array($valc)) { // on a un tableau, donc plusieurs enregistrements recherchés
			if (count($tbmultk) > 1) { // si FK clé multiple
				foreach ($valc as $val1c) {
					$whsmk = "";
					$uval = explode(":",$val1c);
					$ik = 0;
					foreach($tbmultk as $ck) {
						$whsmk.=" $ck='".$uval[$ik]."' AND ";
						$ik++;
					}
					$whsl.="(".vdc($whsmk,5).") OR ";
				}
			} else { // pas clé multiple
				foreach($valc as $uval) {
					$whsl.=" $defl[1]='$uval' OR ";
				}
			} // fin si pas clémltiple
			$whsl=" where ".vdc($whsl,3);
		} elseif (strstr($valc,'__str2f__')) { // on cherche une chaine parmi les champs à afficher (utilisé par la popup de sel générique)
			$val2s=str_replace('__str2f__','',$valc);
			foreach($tbc2a as $chp) {
				$whsl.=" $chp LIKE '%$val2s%' OR ";
			}
			$whsl=" where ".vdc($whsl,3);
		} else { // on cherche une valeur
			if (count($tbmultk) > 1) { // clé multiple
				$whsmk = "";
				$uval = explode(":",$valc);
				$ik = 0;
				foreach($tbmultk as $ck) {
					$whsmk.=" $ck='".$uval[$ik]."' AND ";
					$ik++;
				}
				$whsl.= ' where ('.vdc($whsmk,5).')';
			} else $whsl=" where $defl[1]='$valc'"; // normal
		}
		if ($reqsup!="") { // rajoute req suppl eventuelle
			$whsl="(".$whsl.") AND ".$reqsup;
		}
	} else { 	// soit la liste est simplement limité par une clause where supplémentaire
			$whsl= ($reqsup != "" ? "WHERE ".$reqsup : "");
	}


	if ($cppid && $valc=="") { //on a une structure hierarchique et plus d'une valeur à chercher
		// on cherche les parents initiaux, ie ceux dont le pid est null ou egal a la cle du meme enregistrement
		if ($reqsup!="") $whreqsup=" AND $reqsup ";
		$rql=db_query("SELECT $defl[1], $cppid $rcaf from $defl[0] WHERE ($cppid IS NULL OR $cppid=$defl[1] OR $cppid=0) $whreqsup $orderby");
		while ($rw=db_fetch_row($rql)) {
			if($rw[0] !="") { // si cle valide
				$resaf=tradLib($rw[2]);
				for ($k=2;$k<=$nbca;$k++) {
					$cs=($tbcs[$k]!="" ? $tbcs[$k] : $carsepldef);
					if ($valbchain[$k]!="") {
						$resaf=$resaf.$cs.ttChpLink($valbchain[$k],"",$rw[$k + 1]);
					} else $resaf=$resaf.$cs.tradLib($rw[$k +1]);
				} // boucle sur chps �entuels en plus
				$tabCorlb[$rw[0]]=$resaf;
				rettarbo($tabCorlb,$rw[0],$defl,$cppid,$rcaf,$orderby,$nbca,$tbcs,0,$whreqsup); 
				//print_r($tabCorlb);				
			} // fin si cl�valide
		} // fin boucle reponses
		if (!is_array($tabCorlb)) { // pas de reponses
			$tabCorlb[err]="Error ! impossible construire l'arbre ";
		}
	} else { // pas hierarchique => normal
		$defl[1] = str_replace(":",",",$defl[1]); // au cas ou clé multiple
		$sqln =  addwherefORlimit("SELECT $defl[1] $rcaf from $defl[0] $whsl $orderby",$maxrepld);
		
		$rql=db_query($sqln);
		// constitution du tableau associatif a2 dim de corresp code ->lib
		//echo "<!--debug2 rql=SELECT $defl[1] $rcaf from $defl[0] $whsl $orderby <br/>-->";
		$tabCorlb=array();
		$nbkm = count($tbmultk)>1 ? count($tbmultk) : 1; // nbre clé
		while ($resl=db_fetch_row($rql)) {
			$cle = $resaf = "";
			if ($nbkm > 1) { // clé multiple
				for ($k=0;$k<$nbkm;$k++) $cle .= $resl[$k].":";
				$cle = vdc($cle,1);
			} else { // clé simple
				$nbkm = 1;
				$cle=$resl[0];
			}
			for ($k=$nbkm;$k < ($nbca + $nbkm);$k++) {
				$cs=($tbcs[$k]!="" ? $tbcs[$k] : ($k!=$nbkm ? $carsepldef : ""));
				if ($valbchain[$k]!="") {
					$resaf=$resaf.$cs.ttChpLink($valbchain[$k],"",$resl[$k]);
				} else $resaf = $resaf.$cs.tradLib($resl[$k]);
			}
			$tabCorlb[$cle]=stripslashes($resaf); // tableau associatif de correspondance code -> libell�
			//echo "<!--debug2 cle: $cle; val: $resaf ; valverif:   ".$tabCorlb[$cle]."-->\n";
		}
		// fin boucle sur les r�ultats
	} // fin si pas hierarchique=normal

	// retablit les param�res normaux si n��saire
	if ($newconnect || $newbase) {
		db_close($lnc);
		db_connect($DBHost,$DBUser,$DBPass,$DBName);// r�uvre la session normale
		}
	//if ($newbase) mysql_select_db($DBName) or die ("Impossible d'ouvrir la base de donn�s $DBName.");
	if ($valc!="" && !strstr($valc,'__str2f__')) {
		if ($resaf=="") $resaf="N.C.";
		return ($resaf);
	} else {
		return($tabCorlb); // retourne le tableau associatif
	}
}
 function main($content, $conf)
 {
     $this->conf = $conf;
     //debug ($conf);
     $this->pi_loadLL();
     //debug($this->piVars);
     $WhereSTH = " WHERE (starttime=0 OR starttime <" . time() . ") AND (endtime=0 OR endtime>" . time() . ") AND deleted=0 AND hidden=0";
     $req = "SELECT * from tx_vm19watsniou" . $WhereSTH . " order by tstamp DESC LIMIT " . $this->conf['NiousNumber'];
     $rep = mysql(TYPO3_db, $req);
     //$content='<H2>'.$this->pi_getLL("WhatsNew").'</H2>'; // le titre est affich�au niveau du plugin
     $content .= '<table border="0">';
     while ($rw = mysql_fetch_array($rep)) {
         if ($this->pi_getPageLink($rw[pid] || $rw[typcontent] == "vm19_hnlinks")) {
             // gestion des droits  ... simple non ?
             // les images sont nomm�s comme les types de contenus
             $content .= '<tr><td><img src="' . $this->imgPath . $rw[typcontent] . '.gif"></td><td>';
             // debug $content.= "| getPageLink". $this->pi_getPageLink($rw[pid])."|";
             if ($rw[typcontent] == "vm19_hnlinks") {
                 $tabisa = explode("|", $rw[title]);
                 $href = strstr($tabisa[1], "http://") ? $tabisa[1] : "http://" . $tabisa[1];
                 $title = $tabisa[0];
                 $content .= '<H3><a href="' . $href . '" target="_blank">' . $title . '</a></H3>';
             } else {
                 $content .= '<H3>' . $this->pi_linkToPage($rw[title], $rw[pid]) . '</H3>';
             }
             // ne fonctionne pas quand l'id ne correspond pas au titre
             //	  $content.='<H2>'.VmlinkToPage($rw[title],$rw[pid]).'</H2>';
             $content .= '<DIV style="margin:2px">';
             $content .= "<b>" . $this->pi_getLL("tc_" . $rw[typcontent]) . "</b>";
             if ($rw[tstamp] <= $rw[crdate]) {
                 $content .= $this->pi_getLL("crdate");
             } else {
                 $content .= $this->pi_getLL("modifdate");
             }
             $femtctrad = $this->pi_getLL("tcf_" . $rw[typcontent]);
             // pour g�er le f�inin de cr�(e) ou modifi�e)
             $content .= $femtctrad . $this->pi_getLL("on");
             $content .= getDateF($rw[tstamp]);
             //      $tabidarbo=unserialize($rw[tabidarbo]);
             $content .= "<br/>" . $this->pi_getLL("path");
             $tabstrarbo = unserialize(stripslashes($rw[tabstrarbo]));
             foreach ($tabstrarbo as $key => $value) {
                 $content .= $this->pi_linkToPage($value, substr($key, 2)) . " > ";
             }
             $content = vdc($content, 3);
             // enl�e le dernier " > "
             $content .= '</DIV></td></tr>';
         }
         // fin si droit OK
     }
     // fin boucle sur nouveaut�
     $content .= "</table>";
     /*$content='
           <strong>This is a few paragraphs:</strong><BR>
           <P>This is line 1</P>
           <P>This is line 2</P>
     
           <h3>This is a form:</h3>
           <form action="'.$this->pi_getPageLink($GLOBALS["TSFE"]->id).'" method="POST">
             <input type="hidden" name="no_cache" value="1">
             <input type="text" name="'.$this->prefixId.'[input_field]" value="'.htmlspecialchars($this->piVars["input_field"]).'">
             <input type="submit" name="'.$this->prefixId.'[submit_button]" value="'.htmlspecialchars($this->pi_getLL("submit_button_label")).'">
           </form>
           <BR>
           <P>You can click here to '.$this->pi_linkToPage("get to this page again",$GLOBALS["TSFE"]->id).'</P>
         ';
         */
     return $this->pi_wrapInBaseClass($content);
 }
示例#3
0
    }
    // fin si echelle suffisante pour afficher les pictos..
}
// fin si il y des parcours ? afficher
// couches de labels/pictos des objets LEI
$where_lei_f = "";
$where_lei_f = '';
foreach ($_REQUEST as $cle => $val) {
    // passe en revue tte les var get
    // la clé est de la forme "c3kGnnnnnnnCnnnnnnnnTnnnnnnnn"
    if (substr($cle, 0, 3) == "c3k" && $val != "" && strstr($cle, "T")) {
        $where_lei_f .= " lei_f_idcat=" . substr(strrchr($cle, "T"), 1) . " OR ";
    }
}
if ($where_lei_f != '') {
    $where_lei_f = vdc($where_lei_f, 4);
}
// enleve les 4 derniers car cad le dernier " OR "
//print_r($where_lei_f);
if ($bool_disp_lay_LEI && $where_lei_f != "") {
    $lei_lay = ms_newLayerObj($e_map);
    $lei_lay->set('name', 'lei_fiche');
    $lei_lay->set('status', MS_ON);
    $lei_lay->set('labelcache', MS_ON);
    // par d?faut
    $lei_lay->set('connectiontype', MS_POSTGIS);
    $lei_lay->set('connection', $db->connstr);
    $query = "lei_f_pos from lei_fiches";
    if ($where_lei_f != "") {
        $lei_lay->setFilter($where_lei_f);
    }
    /**
    	/**
    * le plugin a ��modifi�de fa�n �permettre d'�re ins��plusieurs fois dans une m�e page et que le passage en singleview de l'un n'influence pas les autres
    */
    function main($content, $conf)
    {
        $this->uid = substr(strstr($GLOBALS[GLOBALS][TSFE]->currentRecord, ":"), 1);
        if (strstr($this->cObj->currentRecord, "tt_content")) {
            $conf["pidList"] = $this->cObj->data["pages"];
            $conf["recursive"] = $this->cObj->data["recursive"];
        }
        $this->conf = $conf;
        // Setting the TypoScript passed to this function in $this->conf
        $this->pi_setPiVarDefaults();
        $this->pi_loadLL();
        // Loading the LOCAL_LANG values
        //$this->pi_moreParams="&pointeruid[".$this->uid."]=".$this->uid;
        /* !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-
        		  modif: on ne se met et en mode singleView que si showUid!=" ET SURTOUT que si l'uid tt_content pass�correspond
        		// au courant
        		// voir aussi utilisation du dernier argument optionel de la la fonction
        		pi_list_linkSingle qui permet de passer un tableau de hachage contenant autant d'arguments suppl�entaires que l'on veut
         		!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-
        		*/
        /*		if ($this->piVars["showUid"] && $this->piVars["ttc_uid"]==$this->uid)	{	// If a single element should be displayed:
        Maintenant la loupe se fait directement dans la liste */
        // Affichage Titre verrue Elodie : si nom du dossier syst�e contenant les actus contient "_noinfo", pas de Logo actu ni titre, ni auteur en mode normal
        if (!strstr(txRecupLib("pages", "uid", "title", $this->conf['pidList']), "_noinfo")) {
            $content .= '<H2>' . $this->pi_getLL("titre_fe", "[titre_fe]") . '</H2>';
            // <img src="'.$this->conf["extCurDir"].'picto_actu.gif" class="picto">&nbsp;&nbsp; cette bourrique de Diane veut plus du picto
        }
        // si changement de page, on efface le contexte
        if ($_SESSION['datafvmnews']['pidcour'] != $this->cObj->data['pid']) {
            unset($_SESSION['datafvmnews']);
        }
        // gestion mode archive
        if (isset($this->piVars['arch_mode'])) {
            $_SESSION['vmnews_arch_mode'] = $this->piVars['arch_mode'];
        }
        $this->arch_mode = $this->cObj->data['layout'] >= 1 || $_SESSION['vmnews_arch_mode'] == 1;
        /*		debug($this->cObj->data['layout'],"this->cObj->data['layout']");
        		debug($this->piVars,"this->piVars:");*/
        //debug ($_SESSION,"sessione");
        if ($this->arch_mode) {
            // mode archive
            //$GLOBALS["TSFE"]->set_no_cache(); // desactive la cache en mode archive sinon formulairee merde...
            $content .= '<a name="debform"></a>';
            $content .= "<H3>" . $this->pi_getLL("rech_arch", "Rech arhives") . "</H3>";
            $content .= $this->buttdisphiddarch();
            $content .= "<H4>" . $this->pi_getLL("crit_arch", "Crit arhives") . "</H4>";
            //debug($this->conf);
            //debug($_SESSION['datafvmnews'],"_SESSION['datafvmnews']");
            // si formulaire envoyé, on met en session sa valeur; sinon quand on suit un lien vers le détail d'une actu, comme il n'y a pas de submit, on perd les critères courant
            if (isset($this->piVars['DATA']['test_f_sent'])) {
                if ($this->piVars['DATA']['datedebp'] != "") {
                    $this->piVars['DATA']['datedebp'] = rmfDateF($this->piVars['DATA']['datedebp']);
                }
                if ($this->piVars['DATA']['datefinp'] != "") {
                    $this->piVars['DATA']['datefinp'] = rmfDateF($this->piVars['DATA']['datefinp']);
                }
                $tsdtdebp = DateF2tstamp($this->piVars['DATA']['datedebp']);
                $tsdtfinp = DateF2tstamp($this->piVars['DATA']['datefinp']);
                if ($tsdtdebp > 0 && $tsdtfinp > 0 && $tsdtdebp > $tsdtfinp) {
                    $errorcd = $this->pi_getLL("err_coher_dates", "erreur de cohérences sur les dates");
                    $this->piVars['DATA']['datefinp'] = "";
                    unset($_SESSION['datafvmnews']['datefinp']);
                }
                $_SESSION['datafvmnews'] = $this->piVars['DATA'];
            }
            if (!isset($_SESSION['datafvmnews']['emplact'])) {
                $this->piVars['DATA']['emplact'][0] = "'" . $this->cObj->data['pid'] . "'";
                // si pas de sélection precedente, prend l'uid de la page courante
                $_SESSION['datafvmnews']['emplact'][0] = "'" . $this->cObj->data['pid'] . "'";
            }
            $_SESSION['datafvmnews']['pidcour'] = $this->cObj->data['pid'];
            //debug(in_array($this->cObj->data['pid'],$_SESSION['datafvmnews']['emplact']));
            //debug($this->piVars['DATA'],"this->piVars['DATA']:");
            //debug($_SESSION['datafvmnews'],"_SESSION['datafvmnews']");
            $reqroot = "SELECT pid FROM sys_template WHERE hidden = 0 AND root = 1 AND deleted = 0";
            $resroot = mysql(TYPO3_db, $reqroot);
            if (mysql_num_rows($resroot) == 0) {
                die("This site seems to contain no root page");
            }
            while ($rep = mysql_fetch_row($resroot)) {
                $tbpidroot[] = $rep[0];
            }
            // debug root pid tables
            foreach ($tbpidroot as $pidroot) {
                $this->retTLDarbo($pidroot);
            }
            $this->tbemplact = array("%" => $this->pi_getLL("Indifferent", "Indifferent")) + $this->tbemplact;
            $LDEmplact = DispLD($this->tbemplact, $this->prefixId . '[DATA][emplact]', "yes", "", false);
            // liste d�oulante multi
            // avant DispLD n'etait pas compatible XHTML
            //$LDEmplact=str_replace("SELECTED",' selected="selected" ',$LDEmplact);
            $comment_fdate = " <small> ex. : 15/10/2005 </small>";
            $cHash = md5(serialize($this->piVars['DATA']));
            $content .= '<FORM action="' . $this->pi_getPageLink($GLOBALS["TSFE"]->id) . '?cHash=' . $cHash . '#debform" name="' . $this->prefixId . 'fname" method="POST">';
            $content .= '
				<INPUT TYPE="hidden" value="coucou" name="' . $this->prefixId . '[DATA][test_f_sent]" />
                                <TABLE><TR><TD width="120><label for="keywords">' . $this->pi_getLL("keywords", "Mots clés") . '</label></TD><TD><INPUT id="keywords" type="text" size="60" value="' . $_SESSION['datafvmnews']['keywords'] . '" name="' . $this->prefixId . '[DATA][keywords]" />
                               </TD></TR><TR><TD>
                                <label for="and_or">' . $this->pi_getLL("and_or", "Et/ou") . '</label></TD><TD><INPUT type="radio" id="and_or"  ' . ($_SESSION['datafvmnews']["and_or"] != "OR" ? ' checked="checked" ' : '') . ' name="' . $this->prefixId . '[DATA][and_or]" value="AND">' . $this->pi_getLL("AND", "ET") . '&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="' . $this->prefixId . '[DATA][and_or]" value="OR" ' . ($_SESSION['datafvmnews']["and_or"] == "OR" ? ' checked="checked" ' : '') . '>' . $this->pi_getLL("OR", "OU") . '</TD></TR><TR>
                                <TD>
                                <label for="datedebp">' . $this->pi_getLL("datedebp", "Datedebp") . '</label></TD><TD><INPUT id="datedebp" type="text" size="12" value="' . $_SESSION['datafvmnews']['datedebp'] . '" name="' . $this->prefixId . '[DATA][datedebp]" />' . $comment_fdate . '
                                </TD</TR><TR><TD>
                                <label for="datefinp">' . $this->pi_getLL("datefinp", "Datefinp") . '</label></TD><TD><INPUT id="datefinp" type="text" size="12" value="' . $_SESSION['datafvmnews']['datefinp'] . '" name="' . $this->prefixId . '[DATA][datefinp]" /> ' . $comment_fdate . ($errorcd ? '<BR><span style="color:red">' . $errorcd . '<span>' : "") . '</TD></TR><TR><TD>
                                <label for="emplact">' . $this->pi_getLL("Emplact", "emplact") . '</label></TD><TD>' . $LDEmplact . '
                                </TD></TR><TR><TD>
                                <INPUT ' . $this->pi_classParam("submit-button") . ' type="button" name="' . $this->prefixId . '[reset_button]" value="' . $this->pi_getLL("Reset", "Annuler") . '" onclick="getElementById(\'keywords\').value=\'\'; getElementById(\'datedebp\').value=\'\'; getElementById(\'datefinp\').value=\'\';">
                                </TD><TD>
                                <INPUT ' . $this->pi_classParam("submit-button") . ' type="submit" name="' . $this->prefixId . '[submit_button]" value="' . $this->pi_getLL("rechercher", "Rechercher") . '">

                                </TD></TR></TABLE>
                                <HR/>';
            $content .= '</FORM>';
        }
        //debug($this->cObj->data['pid']); uidd e la page courante
        //debug($this->uid);
        //debug($this->piVars);
        if (!isset($this->piVars["pointer"])) {
            $this->piVars["pointer"] = 0;
        }
        if (!isset($this->piVars["mode"])) {
            $this->piVars["mode"] = 1;
        }
        // Initializing the query parameters:
        list($this->internal["orderBy"], $this->internal["descFlag"]) = explode(":", $this->piVars["sort"]);
        //debug($this->piVars);
        $this->internal["results_at_a_time"] = t3lib_div::intInRange($conf["results_at_a_time"], 0, 1000, 3);
        // Number of results to show in a listing.
        $this->internal["maxPages"] = t3lib_div::intInRange($conf["maxPages"], 0, 1000, 2);
        // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc.
        $this->internal["searchFieldList"] = "title,abstract,bodytext";
        $this->internal["orderByList"] = "tstamp,uid,title";
        if ($this->arch_mode) {
            // envoie la requete spéciale
            if (isset($_SESSION['datafvmnews']['keywords'])) {
                $_SESSION['datafvmnews']['keywords'] = addslashes($_SESSION['datafvmnews']['keywords']);
                $tbkeyw = explode(" ", $_SESSION['datafvmnews']['keywords']);
                foreach ($tbkeyw as $keyw) {
                    $whk .= " __nom_chp__ LIKE '%{$keyw}%' __op__ ";
                }
                $whk = vdc($whk, 7);
                $whk = "(" . str_replace("__op__", $_SESSION['datafvmnews']["and_or"], $whk) . ")";
                $whk = "(" . str_replace("__nom_chp__", "title", $whk) . " OR " . str_replace("__nom_chp__", "abstract", $whk) . " OR " . str_replace("__nom_chp__", "bodytext", $whk) . ")";
            }
            if ($_SESSION['datafvmnews']['datedebp'] != "") {
                $whdp = "( (starttime> " . DateF2tstamp($_SESSION['datafvmnews']['datedebp']) . ") OR ( starttime=0 AND tstamp > " . DateF2tstamp($_SESSION['datafvmnews']['datedebp']) . ") )";
            }
            if ($_SESSION['datafvmnews']['datefinp'] != "") {
                $whfp = "( (endtime>0 AND endtime < " . DateF2tstamp($_SESSION['datafvmnews']['datefinp']) . ") OR ( endtime=0 AND tstamp < " . DateF2tstamp($_SESSION['datafvmnews']['datefinp']) . ") )";
            }
            $whg = "from tx_vm19news_news WHERE deleted=0 AND hidden=0 ";
            $whg .= ($whk ? " AND " : "") . $whk;
            $whg .= ($whdp ? " AND " : "") . $whdp;
            $whg .= ($whfp ? " AND " : "") . $whfp;
            if ($_SESSION['datafvmnews']['emplact'][0] != "%") {
                $whg .= " AND pid IN (" . implode(",", $_SESSION['datafvmnews']['emplact']) . ")";
            }
            //debug ($whg,"where avant :");
            $query = $this->pi_list_query("tx_vm19news_news", 1, '', '', '', '', $whg);
            // le 1 sert a compter seulement
            //debug ($query,"query apres :");
            //pi_list_query($table,$count=0,$addWhere='',$mm_cat='',$groupBy='',$orderBy='',$query='',$returnQueryArray=FALSE)
        } else {
            // anciennee methode "normale", ... mais on a rajouté l'affichage sur d'autres pages pr 1 meme actu...
            //$query = $this->pi_list_query("tx_vm19news_news",1);
            $whg = "from tx_vm19news_news WHERE deleted=0 AND hidden=0 ";
            $whg .= "AND ( starttime< " . time() . ' OR  starttime=0  )';
            $whg .= " AND ( endtime> " . time() . ' OR  endtime=0  )';
            $pidc = $this->cObj->data['pid'];
            $whg .= " AND (pid={$pidc} OR otherpages LIKE '{$pidc},%' OR otherpages LIKE '%,{$pidc},%' OR otherpages LIKE '%,{$pidc}')";
            $query = $this->pi_list_query("tx_vm19news_news", 1, '', '', '', '', $whg);
            // le 1 sert a compter seulement
            //debug($query);
        }
        $res = mysql(TYPO3_db, $query);
        //debug($query);
        if (mysql_error()) {
            debug(array(mysql_error(), $query));
        }
        list($this->internal["res_count"]) = mysql_fetch_row($res);
        #	$content.=t3lib_div::view_array($this->piVars);	// DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line!
        if ($this->internal["res_count"] > 0) {
            // Make listing query, pass query to MySQL:
            //pi_list_query($table, $count=0, $addWhere="", $mm_cat="", $groupBy="", $orderBy="", $query="")
            if ($this->arch_mode) {
                $content .= '<div class="nbrep_r">' . $this->pi_getLL("nb_news_r", "[nb_news]") . " : <b>" . $this->internal["res_count"] . "</b></div>";
                //$query="SELECT * ".$whg." ORDER BY sorting,tstamp DESC";
                // le fait de passer par pi_list_query permet d'utiliser la pagination native
                $query = $this->pi_list_query("tx_vm19news_news", 0, '', '', '', "ORDER BY sorting,tstamp DESC", $whg);
            } else {
                // anciennee methode "normale", ... mais on a rajouté l'affichage sur d'autres pages pr 1 meme actu...
                //$query = $this->pi_list_query("tx_vm19news_news",0,"","","","ORDER BY sorting,tstamp DESC");
                $query = $this->pi_list_query("tx_vm19news_news", 0, '', '', '', "ORDER BY sorting,tstamp DESC", $whg);
            }
            $res = mysql(TYPO3_db, $query);
            if (mysql_error()) {
                debug(array(mysql_error(), $query));
            }
            $this->internal["currentTable"] = "tx_vm19news_news";
            // Adds the mode selector.
            //$content.=$this->pi_list_modeSelector($items);
            // Adds the whole list table
            $content .= $this->makelist($res);
            // Adds the search box:
            //$content.=$this->pi_list_searchBox();
            // Adds the result browser:
            // Adds the result browser, seulement s'il y a assez de r�ultats
            if ($this->internal["res_count"] > $this->internal["results_at_a_time"]) {
                $content .= $this->pi_list_browseresults();
            }
        } else {
            $content .= $this->pi_getLL("no_news" . ($this->arch_mode ? "1" : ""), "[no_news]");
        }
        $content .= "<BR/>" . $this->buttdisphiddarch();
        //$content.=$this->pi_list_browseresults();
        // Returns the content from the plugin.
        return $this->pi_wrapInBaseClass($content);
    }
	EchoLig("GEO_PORPOSIT");
	EchoLig("GEO_LCABREGE");
	EchoLig("GEO_MAILUNITE");
	echo "<tr><td align=\"top\">Coordonnées postales</td><td>";
	$CIL[GEO_LLADRES]->EchoEditAll();
	if ($CIL[UFO_LLADRES2]->ValChp!="" || $TypEdit!="C") {
		echo "<BR>";
		$CIL[GEO_LLADRES2]->EchoEditAll();}
	echo "<BR>";
	$CIL[GEO_COPOSTAL]->EchoEditAll();
	echo " ";
	$CIL[GEO_LLCOMMU]->EchoEditAll();
	echo "</td></tr>\n"; // fin adresse
	EchoLig("GEO_COPAYS");
	if ($TypEdit!="N") {
		$wh1="where (DRH_LLACTIVITE LIKE '".str_replace(":","' OR DRH_LLACTIVITE LIKE  '",vdc(Ctbicepa(),1))."') ";
		$wh2="AND DRH_NUGEOPOS=".$NUUNITE;
		echo "<tr><td>effectif</td><td>";
		$rqsqlcnt="select COUNT(*) from INFOS_DRH ".$wh1.$wh2;
		if ($debug) echo "requête SQL de comptage: ";
		$rescnt=msq($rqsqlcnt);
		$rwcnt=mysql_fetch_row($rescnt);
		echo $rwcnt[0];
		echo "</td></tr>";
	}
	EchoLig("GEO_PLANACC");

  ?>
<tr><td colspan="2" align="center">
<a name="bas">
<br>
示例#6
0
function Ctbica() { 
	$rqca=msq("select TAC_COTACT from TYPE_ACTIVITE where TAC_AFFANN='O'");
	while ($rwca=mysql_fetch_row($rqca)) $tbica.=$rwca[0].":";
	return(vdc($tbica,1));
}
function hash_implode($array,$sep1=":",$sep2=",") {
	if (is_array($array) && count($array)>0) {
		foreach($array as $k=>$v) {
			if ($k!="") $res.=$k.$sep1.$v.$sep2;
		}
		$res = vdc($res,1);
		return($res);
	}
}
		echo "<BR>";
		$CIL[UFO_LLADRES2]->EchoEditAll();}
	echo "<BR>";
	$CIL[UFO_COPOSTAL]->EchoEditAll();
	echo " ";
	$CIL[UFO_LLCOMMU]->EchoEditAll();
	echo "</td></tr>\n"; // fin adresse
	EchoLig("UFO_COPAYS");
	$CIL[UFO_COHIERA]->TypEdit=$TypEditRP; 	  
	if ($TypEdit!="C") EchoLig("UFO_COHIERA");
	$wh1="where (DRH_LLACTIVITE LIKE '".str_replace(":","' OR DRH_LLACTIVITE LIKE  '",vdc(Ctbicepa(),1))."') ";
	$wh2="AND (DRH_NUUNITE LIKE '";
	foreach (TbUFdep($NUUNITE) as $NUU) {
		$wh2.=$NUU."' OR DRH_NUUNITE LIKE '";
		}
	$wh2=vdc($wh2,22).")"; // elnlève le dernier  OR DRH_NUUNITE LIKE '
	echo "<tr><td>effectif</td><td>";
	$rqsqlcnt="select COUNT(*) from INFOS_DRH ".$wh1.$wh2;
	if ($debug) echo "requête SQL de comptage: ";
	$rescnt=msq($rqsqlcnt);
	$rwcnt=mysql_fetch_row($rescnt);
	echo $rwcnt[0];
	echo "</td></tr>";
	//EchoLig("UFO_NBEFFEC");
  	$CIL[UFO_COTYUNITE]->TypEdit=$TypEditRP; 	  
	EchoLig("UFO_COTYUNITE");
	EchoLig("UFO_PLANACC");

  ?>
<tr><td colspan="2" align="center">
<a name="bas">