PageRenderTime 36ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/DEV/DISPLAY/modules/get_xiti_click.php

https://github.com/chrisbst35/LI_LEMONDE
PHP | 158 lines | 114 code | 21 blank | 23 comment | 53 complexity | 042ea86179656c0b3f2bf429bc2d982d MD5 | raw file
  1. <?php if ($_global['dev'] == 1 && isset($_GET['cmt']) && $_GET['cmt'] == 'on') { ?>
  2. <!-- begin : <?php echo __FILE__; ?> -->
  3. <?php } ?>
  4. <?php
  5. require_once dirname(__FILE__) . './../tools/XitiClickManager/cache_xiti_clicks.php';
  6. // Function qui va génère du code correspondant pour le tag xiti (Document Xiti de AT internet page:26)
  7. // Cette fonction va chercher les informations dans le fichier cache_xiti_click en fonction de $id de click
  8. function getXitiClick($id,$tab_indicateurs_globaux =array(), $params = array()) {
  9. global $refXitiClicks;
  10. $s2 = $refXitiClicks[$id]['s2'];
  11. $libelleComplet = $refXitiClicks[$id]['libelleComplet'];
  12. $type = $refXitiClicks[$id]['type'];
  13. $nouvelleDes = $refXitiClicks[$id]['nouvelleDes'];
  14. $targetBlank = $refXitiClicks[$id]['targetBlank'];
  15. if(is_array($params) && count($params) > 0) {
  16. foreach ($params as $key => $val) {
  17. $libelleComplet = str_replace('{'.$key.'}', $val, $libelleComplet);
  18. }
  19. }
  20. $str_indicateurs_globaux = "";
  21. if(is_array($tab_indicateurs_globaux)){
  22. foreach($tab_indicateurs_globaux as $key=>$value){
  23. $str_indicateurs_globaux.= "&".$key."=".$value;
  24. }
  25. }
  26. if ($type == 'Flash') {
  27. //$codeJavascript = "return xt_click(this, 'F', '$s2', '$libelleComplet');";
  28. $codeJavascript = "xt_med('F', '$s2', '".$libelleComplet.$str_indicateurs_globaux."');";
  29. } else if($s2 == '19') {
  30. $codeJavascript = "xt_med('F', '$s2', '".$libelleComplet.$str_indicateurs_globaux."');";
  31. } else {
  32. //$codeJavascript = "return xt_click(this, 'C', '$s2', '$libelleComplet', '$type');";
  33. $codeJavascript = "xt_med('C', '$s2', '".$libelleComplet.$str_indicateurs_globaux."', '$type');";
  34. }
  35. return $codeJavascript;
  36. }
  37. /**
  38. * Function getXitiIndicGlobaux : retourne la chaine des indicateurs globaux xiti
  39. * @author : Melissa Hoarau
  40. * @Param $sLibelleXiti :
  41. * @Param $iUnivers
  42. * @Param $ad
  43. * @Param $ag
  44. * @return
  45. */
  46. function getXitiIndicGlobaux($sLibelleXiti, $iUnivers, $ad, $ag) {
  47. global $_LI_PRICERANGE_UNIVERS;
  48. global $_LI_ADSURFACE;
  49. $sXitiIndicGlobaux = array();
  50. // echo 'test get_xiti_click<pre>'; print_r($ag); echo '</pre><hr/>';
  51. // echo '<pre>'; print_r($ad); echo '</pre>';
  52. //Type page = Liste resultats, id 1
  53. if($sLibelleXiti == "Contact_Agence_Fiche_Agence"){
  54. $sXitiIndicGlobaux = "&x1=3";
  55. }elseif($sLibelleXiti == 'Multi_Agences_selection_Fiche_Annonce'){
  56. $sXitiIndicGlobaux = "&x1=5";
  57. }elseif($sLibelleXiti == 'Contact_Agence_Fiche_Annonce_LeMonde' || $sLibelleXiti == 'Contact_Agence_Liste_Annonces_LeMonde'){
  58. $sXitiIndicGlobaux = "&x1=3";
  59. }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'){
  60. $sXitiIndicGlobaux = "&x1=4";
  61. }else{
  62. $sXitiIndicGlobaux = "&x1=1";
  63. }
  64. $sXitiIndicGlobaux .= "&x2=";
  65. $sXitiIndicGlobaux .= (isset($ad['features']) && (!empty($ad['features'])) ) ? addslashes(clean_xiti(xiti_string(str_replace("²", "2", $ad['features'])))) : '';
  66. $sXitiIndicGlobaux .= "&x3=";
  67. $sXitiIndicGlobaux .= (isset($ad['id']) && (!empty($ad['id'])) ) ? clean_xiti($ad['id']) : '';
  68. $sXitiIndicGlobaux .= "&x4=";
  69. $sXitiIndicGlobaux .= (isset($ad['id_bien']) && (!empty($ad['id_bien'])) ) ? clean_xiti($ad['id_bien']) : '';
  70. $sXitiIndicGlobaux .= "&x5=";
  71. $sXitiIndicGlobaux .= (isset($iUnivers) && (!empty($iUnivers)) ) ? $iUnivers : '';
  72. $sXitiIndicGlobaux .= "&x6=";
  73. $sXitiIndicGlobaux .= (isset($ad['hierarchy'][0]['lct_id']) && (!empty($ad['hierarchy'][0]['lct_id'])) ) ? $ad['hierarchy'][0]['lct_id'] : '';
  74. $sXitiIndicGlobaux .= "&x7=";
  75. $sXitiIndicGlobaux .= (isset($ad['hierarchy'][1]['lct_id']) && (!empty($ad['hierarchy'][1]['lct_id'])) ) ? $ad['hierarchy'][1]['lct_id'] : '';
  76. $sXitiIndicGlobaux .= "&x8=";
  77. $sXitiIndicGlobaux .= (isset($ad['lzip']) && (!empty($ad['lzip'])) ) ? $ad['lzip'] : '';
  78. $sXitiIndicGlobaux .= "&x9=";
  79. $sXitiIndicGlobaux .= (isset($ad['property_type']) && (!empty($ad['property_type'])) ) ? clean_xiti($ad['property_type']) : '';
  80. // Fourchette de prix
  81. $iPrice = $ad['real_price'];
  82. if ($iPrice > 0) {
  83. foreach ($_LI_PRICERANGE_UNIVERS[$ad['type_transaction']] as $k => $v) {
  84. if ($iPrice >= str_replace(' ', '', $v['from']) && $iPrice <= str_replace(' ', '', $v['to'])) {
  85. $sXitiIndicGlobaux .= "&x10=$k";
  86. break;
  87. }
  88. }
  89. } else {
  90. $sXitiIndicGlobaux .= "&x10=";
  91. }
  92. // Fourchette de surface
  93. $iArea = $ad['area'];
  94. if ($iArea > 0) {
  95. foreach ($_LI_ADSURFACE as $k => $v) {
  96. if ($iArea >= $v['from'] && $iArea <= $v['to']) {
  97. $sXitiIndicGlobaux .= "&x11=$k";
  98. break;
  99. }
  100. }
  101. }else {
  102. $sXitiIndicGlobaux .= "&x11=";
  103. }
  104. // Nombre de chambres
  105. $sXitiIndicGlobaux .= "&x12=";
  106. $sXitiIndicGlobaux .= (isset($ad['nb_rooms']) && (!empty($ad['nb_rooms'])) ) ? $ad['nb_rooms'] : '';
  107. // Parametres avancés : dependances, chauffage, amenagement, confort
  108. $aAdvancedParams = explode(',', $ad['advanced_set']);
  109. $aFormatedAdvancedParams = getAdvancedParams($aAdvancedParams);
  110. $sXitiIndicGlobaux .= "&x13=" . clean_xiti(implode(',',$aFormatedAdvancedParams['dependances']));
  111. $sXitiIndicGlobaux .= "&x14=" . clean_xiti(implode(',',$aFormatedAdvancedParams['chauffage']));
  112. $sXitiIndicGlobaux .= "&x15=" . clean_xiti(implode(',',$aFormatedAdvancedParams['amenagementInterieur']));
  113. $sXitiIndicGlobaux .= "&x16=" . clean_xiti(implode(',',$aFormatedAdvancedParams['confortSecurite']));
  114. // Lieu de diffusion : Le Monde
  115. $sXitiIndicGlobaux .= "&x17=8";
  116. $sXitiIndicGlobaux .= "&x18=";
  117. $sXitiIndicGlobaux .= (isset($ag['name']) && (!empty($ag['name'])) ) ? clean_xiti(xiti_string($ag['name'])) : '';
  118. //Date de mise en ligne
  119. $sXitiIndicGlobaux .= "&x19=";
  120. $dateX19 = '';
  121. if (!empty($ad["first_online_date"])) {
  122. $dateX19 = date('Ymd',strtotime($ad["first_online_date"]));
  123. }
  124. else if (!empty($ad["modified_on"])) {
  125. $dateX19 = str_replace('/','-',$ad["modified_on"]);
  126. $dateX19 = date('Ymd', strtotime($dateX19));
  127. }
  128. $sXitiIndicGlobaux .= $dateX19;
  129. $sXitiIndicGlobaux .= "&x20=";
  130. $sXitiIndicGlobaux .= (isset($ag['franchising_agency']) && (!empty($ag['franchising_agency'])) ) ? clean_xiti(xiti_string($ag['franchising_agency'])) : '';
  131. //echo $sXitiIndicGlobaux;die;
  132. return $sXitiIndicGlobaux;
  133. }
  134. ?>
  135. <?php if ($_global['dev'] == 1 && isset($_GET['cmt']) && $_GET['cmt'] == 'on') { ?>
  136. <!-- //end : <?php echo __FILE__; ?> -->
  137. <?php } ?>