/DEV/DISPLAY/modules/get_xiti_click.php
PHP | 158 lines | 114 code | 21 blank | 23 comment | 53 complexity | 042ea86179656c0b3f2bf429bc2d982d MD5 | raw file
- <?php if ($_global['dev'] == 1 && isset($_GET['cmt']) && $_GET['cmt'] == 'on') { ?>
- <!-- begin : <?php echo __FILE__; ?> -->
- <?php } ?>
- <?php
- require_once dirname(__FILE__) . './../tools/XitiClickManager/cache_xiti_clicks.php';
- // Function qui va génère du code correspondant pour le tag xiti (Document Xiti de AT internet page:26)
- // Cette fonction va chercher les informations dans le fichier cache_xiti_click en fonction de $id de click
- function getXitiClick($id,$tab_indicateurs_globaux =array(), $params = array()) {
- global $refXitiClicks;
-
- $s2 = $refXitiClicks[$id]['s2'];
- $libelleComplet = $refXitiClicks[$id]['libelleComplet'];
- $type = $refXitiClicks[$id]['type'];
- $nouvelleDes = $refXitiClicks[$id]['nouvelleDes'];
- $targetBlank = $refXitiClicks[$id]['targetBlank'];
-
- if(is_array($params) && count($params) > 0) {
- foreach ($params as $key => $val) {
- $libelleComplet = str_replace('{'.$key.'}', $val, $libelleComplet);
- }
- }
- $str_indicateurs_globaux = "";
-
- if(is_array($tab_indicateurs_globaux)){
- foreach($tab_indicateurs_globaux as $key=>$value){
- $str_indicateurs_globaux.= "&".$key."=".$value;
- }
- }
-
- if ($type == 'Flash') {
- //$codeJavascript = "return xt_click(this, 'F', '$s2', '$libelleComplet');";
- $codeJavascript = "xt_med('F', '$s2', '".$libelleComplet.$str_indicateurs_globaux."');";
- } else if($s2 == '19') {
- $codeJavascript = "xt_med('F', '$s2', '".$libelleComplet.$str_indicateurs_globaux."');";
- } else {
- //$codeJavascript = "return xt_click(this, 'C', '$s2', '$libelleComplet', '$type');";
- $codeJavascript = "xt_med('C', '$s2', '".$libelleComplet.$str_indicateurs_globaux."', '$type');";
- }
-
- return $codeJavascript;
- }
-
-
- /**
- * Function getXitiIndicGlobaux : retourne la chaine des indicateurs globaux xiti
- * @author : Melissa Hoarau
- * @Param $sLibelleXiti :
- * @Param $iUnivers
- * @Param $ad
- * @Param $ag
- * @return
- */
- function getXitiIndicGlobaux($sLibelleXiti, $iUnivers, $ad, $ag) {
- global $_LI_PRICERANGE_UNIVERS;
- global $_LI_ADSURFACE;
-
- $sXitiIndicGlobaux = array();
- // echo 'test get_xiti_click<pre>'; print_r($ag); echo '</pre><hr/>';
- // echo '<pre>'; print_r($ad); echo '</pre>';
-
- //Type page = Liste resultats, id 1
- if($sLibelleXiti == "Contact_Agence_Fiche_Agence"){
- $sXitiIndicGlobaux = "&x1=3";
- }elseif($sLibelleXiti == 'Multi_Agences_selection_Fiche_Annonce'){
- $sXitiIndicGlobaux = "&x1=5";
- }elseif($sLibelleXiti == 'Contact_Agence_Fiche_Annonce_LeMonde' || $sLibelleXiti == 'Contact_Agence_Liste_Annonces_LeMonde'){
- $sXitiIndicGlobaux = "&x1=3";
- }elseif($sLibelleXiti == 'Affichage_telephone_Liste_Annonces_LeMonde' || $sLibelleXiti == 'Affichage_telephone_Fiche_Annonce_LeMonde' || $sLibelleXiti == 'Affichage_telephone_Fiche_Annonce_bas_LeMonde' || $sLibelleXiti == 'Affichage_telephone_Fiche_Agence_LeMonde'){
- $sXitiIndicGlobaux = "&x1=4";
- }else{
- $sXitiIndicGlobaux = "&x1=1";
- }
- $sXitiIndicGlobaux .= "&x2=";
- $sXitiIndicGlobaux .= (isset($ad['features']) && (!empty($ad['features'])) ) ? addslashes(clean_xiti(xiti_string(str_replace("²", "2", $ad['features'])))) : '';
- $sXitiIndicGlobaux .= "&x3=";
- $sXitiIndicGlobaux .= (isset($ad['id']) && (!empty($ad['id'])) ) ? clean_xiti($ad['id']) : '';
- $sXitiIndicGlobaux .= "&x4=";
- $sXitiIndicGlobaux .= (isset($ad['id_bien']) && (!empty($ad['id_bien'])) ) ? clean_xiti($ad['id_bien']) : '';
- $sXitiIndicGlobaux .= "&x5=";
- $sXitiIndicGlobaux .= (isset($iUnivers) && (!empty($iUnivers)) ) ? $iUnivers : '';
- $sXitiIndicGlobaux .= "&x6=";
- $sXitiIndicGlobaux .= (isset($ad['hierarchy'][0]['lct_id']) && (!empty($ad['hierarchy'][0]['lct_id'])) ) ? $ad['hierarchy'][0]['lct_id'] : '';
- $sXitiIndicGlobaux .= "&x7=";
- $sXitiIndicGlobaux .= (isset($ad['hierarchy'][1]['lct_id']) && (!empty($ad['hierarchy'][1]['lct_id'])) ) ? $ad['hierarchy'][1]['lct_id'] : '';
- $sXitiIndicGlobaux .= "&x8=";
- $sXitiIndicGlobaux .= (isset($ad['lzip']) && (!empty($ad['lzip'])) ) ? $ad['lzip'] : '';
- $sXitiIndicGlobaux .= "&x9=";
- $sXitiIndicGlobaux .= (isset($ad['property_type']) && (!empty($ad['property_type'])) ) ? clean_xiti($ad['property_type']) : '';
-
- // Fourchette de prix
- $iPrice = $ad['real_price'];
- if ($iPrice > 0) {
- foreach ($_LI_PRICERANGE_UNIVERS[$ad['type_transaction']] as $k => $v) {
- if ($iPrice >= str_replace(' ', '', $v['from']) && $iPrice <= str_replace(' ', '', $v['to'])) {
- $sXitiIndicGlobaux .= "&x10=$k";
- break;
- }
- }
- } else {
- $sXitiIndicGlobaux .= "&x10=";
- }
- // Fourchette de surface
- $iArea = $ad['area'];
- if ($iArea > 0) {
- foreach ($_LI_ADSURFACE as $k => $v) {
- if ($iArea >= $v['from'] && $iArea <= $v['to']) {
- $sXitiIndicGlobaux .= "&x11=$k";
- break;
- }
- }
- }else {
- $sXitiIndicGlobaux .= "&x11=";
- }
- // Nombre de chambres
- $sXitiIndicGlobaux .= "&x12=";
- $sXitiIndicGlobaux .= (isset($ad['nb_rooms']) && (!empty($ad['nb_rooms'])) ) ? $ad['nb_rooms'] : '';
- // Parametres avancés : dependances, chauffage, amenagement, confort
- $aAdvancedParams = explode(',', $ad['advanced_set']);
- $aFormatedAdvancedParams = getAdvancedParams($aAdvancedParams);
- $sXitiIndicGlobaux .= "&x13=" . clean_xiti(implode(',',$aFormatedAdvancedParams['dependances']));
- $sXitiIndicGlobaux .= "&x14=" . clean_xiti(implode(',',$aFormatedAdvancedParams['chauffage']));
- $sXitiIndicGlobaux .= "&x15=" . clean_xiti(implode(',',$aFormatedAdvancedParams['amenagementInterieur']));
- $sXitiIndicGlobaux .= "&x16=" . clean_xiti(implode(',',$aFormatedAdvancedParams['confortSecurite']));
- // Lieu de diffusion : Le Monde
- $sXitiIndicGlobaux .= "&x17=8";
- $sXitiIndicGlobaux .= "&x18=";
- $sXitiIndicGlobaux .= (isset($ag['name']) && (!empty($ag['name'])) ) ? clean_xiti(xiti_string($ag['name'])) : '';
- //Date de mise en ligne
- $sXitiIndicGlobaux .= "&x19=";
- $dateX19 = '';
- if (!empty($ad["first_online_date"])) {
- $dateX19 = date('Ymd',strtotime($ad["first_online_date"]));
- }
- else if (!empty($ad["modified_on"])) {
- $dateX19 = str_replace('/','-',$ad["modified_on"]);
- $dateX19 = date('Ymd', strtotime($dateX19));
- }
- $sXitiIndicGlobaux .= $dateX19;
- $sXitiIndicGlobaux .= "&x20=";
- $sXitiIndicGlobaux .= (isset($ag['franchising_agency']) && (!empty($ag['franchising_agency'])) ) ? clean_xiti(xiti_string($ag['franchising_agency'])) : '';
-
- //echo $sXitiIndicGlobaux;die;
-
- return $sXitiIndicGlobaux;
- }
- ?>
- <?php if ($_global['dev'] == 1 && isset($_GET['cmt']) && $_GET['cmt'] == 'on') { ?>
- <!-- //end : <?php echo __FILE__; ?> -->
- <?php } ?>