linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file display.php

Documentation is available at display.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage yellowpages
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. include_once(override('../yellowpages/'.SQL.'.inc.php'));
  12.  
  13. /**
  14.  * DisplayUrlAddYellowpages()
  15.  * @return 
  16.  *  affichage d'ajout d'un organisation
  17.  ***/
  18. if(!function_exists('DisplayUrlAddYellowpages')) {
  19.  
  20.   function DisplayUrlAddYellowpages({
  21.  
  22.     $link_tablearray('rub'=> $GLOBALS['links'][U_L]['directory-add']['linkvalue']);
  23.     $content='<a class="button buttonmargin" href="'.HrefMaker($link_table).'" title="'._t('yp','add_public').'"><span class="plus icon"></span>'._t('yp','add_public').'</a>'.END_LINE;
  24.     echo $content;
  25.   }
  26. }
  27.  
  28. /**
  29.  * DisplayListYellowPages()
  30.  * affichage de l'annuaire
  31.  * @param $debut 
  32.  * @param unknown $limite 
  33.  * @param integer $filter 
  34.  * @param integer $search 
  35.  * @return 
  36.  ***/
  37. if(!function_exists('DisplayListYellowPages')) {
  38.  
  39.   function DisplayListYellowPages($debut$limite SELECT_LIMIT$filter= -1$search= -1){
  40.  
  41.     $result_yp $GLOBALS['sql_object'-> DBSelect(SQL_get_Display_ypList($debut$limite$filter$search));
  42.     $result_nb_yp $GLOBALS['sql_object'-> DBSelect(SQL_get_Display_CountypList($filter$search));
  43.  
  44.     $bdd_nb_yp=$result_nb_yp[0]['num_rows'];
  45.  
  46.  
  47.     if ($filter==-1$table_link=array('rub' => $GLOBALS['links'][U_L]['directory']['linkvalue']);
  48.     else $table_link=array('rub' => $GLOBALS['links'][U_L]['directory']['linkvalue'],'id' => $search'filter' => $filter);
  49.  
  50.     $bdd_nb_yp_display $bdd_nb_yp;
  51.  
  52.     if($bdd_nb_yp!=0DisplayAlphaBeta($filter,$search);
  53.     echo Display_linkin_page($table_link$bdd_nb_yp$debut);
  54.  
  55.     $content='<hr />'.END_LINE;
  56.     if($result_yp!=0)
  57.     {
  58.  
  59.       for($i=0$i<count($result_yp)$i++{
  60.         $link_tablearray('rub'=> $GLOBALS['links'][U_L]['directory-detail']['linkvalue'],'id'=>$result_yp[$i]['yellowp_id']'name'=>$result_yp[$i]['yellowp_name']);
  61.         $link_table2array('rub'=> $GLOBALS['links'][U_L]['directory']['linkvalue'],'filter'=> $GLOBALS['filters'][U_L]['theme']['linkvalue'],'id'=>$result_yp[$i]['sdtheme_id']'name'=>$result_yp[$i]['sdtheme_name']);
  62.         $yp_name=formatText($result_yp[$i]['yellowp_name']'2HTML');
  63.         $yp_activity=formatText(cutText($result_yp[$i]['yellowp_activity'],150)'2HTML');
  64.         $yp_sdtheme=formatText($result_yp[$i]['sdtheme_name']'2HTML');
  65.         $yp_theme=formatText($result_yp[$i]['theme_name']'2HTML');
  66.         $content.='<h2>'.END_LINE;
  67.         $content.='<a href="'.HrefMaker($link_table).'" title="'.formatText($yp_name'2ATT').'">'.$yp_name.'</a>'.END_LINE;
  68.         $content.='</h2>'.END_LINE;
  69.         $content.='<p> '._t('yp','activity').' : '.$yp_activity.'</p>'.END_LINE;
  70.          
  71.         if ($yp_sdtheme<>""){
  72.           $content.='<p class="filter_info"> '._t('divers','themeref').' : <a href="'.HrefMaker($link_table2).'" title="'.formatText($yp_sdtheme'2ATT').'" class="filter_info_theme">'.$yp_sdtheme.'</a>
  73.             '._t('divers','sousthemeref').': <span class="filter_info_scale">'.$yp_theme.'</span>
  74.             </p>'.END_LINE;
  75.         }
  76.         else {
  77.           $content.='<p class="filter_info"> '._t('divers','themeref').' : '.empty_nc($yp_sdtheme).' <span>'._t('divers','sousthemeref').': '.empty_nc($yp_sdtheme).'</span> </p>'.END_LINE;
  78.         }
  79.         $content.='<hr />'.END_LINE;
  80.       }
  81.     }
  82.     else
  83.     {
  84.       $content.='<p class="info"> '._t('yp','noresult').'</p>';
  85.     }
  86.     echo $content;
  87.     echo Display_linkin_page($table_link$bdd_nb_yp$debut)."<br />";
  88.   }
  89.  
  90. }
  91.  
  92. /**
  93.  * DisplayAlphaBeta()
  94.  * affichage de la liste alphabétique
  95.  * @param $filter 
  96.  * @param $filter_id 
  97.  * @return 
  98.  ***/
  99. if(!function_exists('DisplayAlphaBeta')) {
  100.  
  101.   function DisplayAlphaBeta($filter,$filter_id){
  102.  
  103.     $result_alphabetical $GLOBALS['sql_object'-> DBSelect(SQL_get_req_alphabetical());
  104.  
  105.     $content='<div id="directory-alpha" class="pagination">'.END_LINE;
  106.     $content.=_t('divers','trialpha').' :';
  107.     for($i=0$i<count($result_alphabetical)$i++)  {
  108.       $link_aff_classicHrefMaker(array('rub'=>$GLOBALS['links'][U_L]['directory']['linkvalue']'filter'=>"alpha"'id'=>$result_alphabetical[$i]['first_letter']));
  109.       if ($i==0$separator="";
  110.       else $separator="-";
  111.       if ($result_alphabetical[$i]['first_letter']==strtoupper($filter_id))
  112.       $content.=$separator.' <span>'.$result_alphabetical[$i]['first_letter'].'</span> '.END_LINE;
  113.       else $content.=$separator.' <a href="'.$link_aff_classic.'" title="'.$result_alphabetical[$i]['first_letter'].'" >'.$result_alphabetical[$i]['first_letter'].'</a> '.END_LINE;
  114.     }
  115.     $content.='</div>'.END_LINE;
  116.     echo  $content;
  117.   }
  118.  
  119. }
  120.  
  121. /**
  122.  * DisplayOneYellowPages()
  123.  * affichage d'une organisation
  124.  * @param $yp_id 
  125.  * @return 
  126.  ***/
  127. if(!function_exists('DisplayOneYellowPages')) {
  128.  
  129.   function DisplayOneYellowPages($yp_id){
  130.  
  131.     $data$GLOBALS['sql_object'-> DBSelect(SQL_getdetyp($yp_idarray('P')));
  132.     
  133.     if($data == 0error_redirect();
  134.     
  135.     if (count($data!= 1exit;
  136.     else {
  137.       $content'';
  138.       $link_table2array('rub'=> $GLOBALS['links'][U_L]['directory']['linkvalue'],'filter'=> $GLOBALS['filters'][U_L]['theme']['linkvalue'],'id'=>$data[0]['sdtheme_id']'name'=>$data[0]['sdtheme_name']);
  139.       $link_selfarray('rub'=> $GLOBALS['links'][U_L]['directory']['linkvalue'],'id'=> $yp_id);
  140.  
  141.       $yp_name=formatText($data[0]['yellowp_name']'2HTML');
  142.       $yp_activity=formatText(cutText($data[0]['yellowp_activity'],150)'2HTML');
  143.       $yp_sdtheme=formatText($data[0]['sdtheme_name']'2HTML');
  144.       $yp_theme=formatText($data[0]['theme_name']'2HTML');
  145.       $yp_street=formatText($data[0]['yellowp_street']'2HTML');
  146.       $yp_postal_code=formatText($data[0]['yellowp_postal_code']'2HTML');
  147.       $yp_city=formatText($data[0]['yellowp_city']'2HTML');
  148.       $yp_phone=formatText($data[0]['yellowp_phone']'2HTML');
  149.       $yp_fax=formatText($data[0]['yellowp_fax']'2HTML');
  150.       $yp_email=formatText($data[0]['yellowp_email']'2HTML');
  151.       $yp_website=formatText($data[0]['yellowp_website']'2HTML');
  152.       $yp_lat=$data[0]['yellowp_latitude'];
  153.       $yp_long=$data[0]['yellowp_longitude'];
  154.        
  155.       $content.='<h2>'.$yp_name.'</h2>'.END_LINE;
  156.       $content.='<p class="permalink">'.END_LINE;
  157.       $content.= formatted_permalink($link_self);
  158.       $content.='</p>'.END_LINE;
  159.       $content.='<dl id="det_yp"><dt> '.mb_ucfirst(_t('yp','adresse')).' : </dt><dd>'.$yp_street.' '.$yp_postal_code.' '.$yp_city.'</dd>'.END_LINE;
  160.       $content.='<dt> '.mb_ucfirst(_t('yp','phone')).' : </dt><dd>'.empty_nc($yp_phone).'</dd>'.END_LINE;
  161.       $content.='<dt> '.mb_ucfirst(_t('yp','fax')).': </dt><dd>'.empty_nc($yp_fax).'</dd>'.END_LINE;
  162.       $content.='<dt> '.mb_ucfirst(_t('yp','email')).' : </dt><dd><a href="mailto:'.$yp_email.'" title="'.formatText($yp_email'2ATT').'">'.$yp_email.'</a></dd>'.END_LINE;
  163.       if ($data[0]['yellowp_website']<>""$content.='<dt> '.mb_ucfirst(_t('yp','website'))     .' : </dt><dd><a href="'.$data[0]['yellowp_website'].'" title="'.formatText($yp_website'2ATT').'">'.$yp_website.'</a></dd>'.END_LINE;
  164.       else $content.='<dt> '.mb_ucfirst(_t('yp','website')).' : </dt><dd>'.empty_nc($yp_website).'</dd>'.END_LINE;
  165.       $content.='<dt> '.mb_ucfirst(_t('yp','activity')).' : </dt><dd>'.$yp_activity.'</dd>'.END_LINE;
  166.       if ($yp_sdtheme<>""{
  167.         $content.='<dt> '.mb_ucfirst(_t('divers','themeref')).' : </dt><dd><a href="'.HrefMaker($link_table2).'" title="'.formatText($yp_sdtheme'2ATT').'">'.$yp_sdtheme.'</a>
  168.             </dd><dt> '._t('divers','sousthemeref').': </dt><dd>'.$yp_theme.'
  169.             </dd>'.END_LINE;
  170.       }
  171.       else {
  172.         $content.='<dt> '.mb_ucfirst(_t('divers','themeref')).' : </dt><dd>'.empty_nc($yp_sdtheme).' </dd><dt>'._t('divers','sousthemeref').': </dt><dd>'.empty_nc($yp_sdtheme).'</span> </dd>'.END_LINE;
  173.       }
  174.       
  175.       $content.='</dl>'.END_LINE;
  176.  
  177.     }
  178.     
  179.     echo $content;
  180.  
  181.     echo generateMap('map'$data16;
  182.  
  183.   }
  184.  
  185. }
  186.  
  187. /**
  188.  * generateMap()
  189.  * generate a Map with Gmaps
  190.  * @return 
  191.  ***/
  192. if(!function_exists('generateMap')) {
  193.  
  194.   function generateMap($id$data$zoom{
  195.     
  196.     $lat     $data[0]['yellowp_latitude'];
  197.     $long    $data[0]['yellowp_longitude'];
  198.     $name    formatText($data[0]['yellowp_name']'2HTML');
  199.     $address formatText($data[0]['yellowp_street']'2HTML').'<br />'.formatText($data[0]['yellowp_postal_code']'2HTML')' - '.formatText($data[0]['yellowp_city']'2HTML');
  200.     
  201.     if($lat==|| $long==0return false;
  202.  
  203.     footerAddJS('http://maps.googleapis.com/maps/api/js?v=3&sensor=false');
  204.     
  205.     $map  ='<div id="'.$id.'" class="map"></div>';
  206.     $map .= '<script type="text/javascript">
  207.          $(document).ready(function() {
  208.           var markerPosition = new google.maps.LatLng('.$lat.', '.$long.');
  209.     
  210.           var latlng = new google.maps.LatLng('.($lat+0.0015).', '.($long-0.004).');
  211.           var myOptions = {
  212.                  zoom: ' $zoom ',
  213.                  center: latlng,
  214.                  mapTypeId: google.maps.MapTypeId.ROADMAP
  215.                  };
  216.            var map = new google.maps.Map(document.getElementById("'.$id.'"), myOptions);
  217.              
  218.  
  219.               myInfoWindowOptions = {
  220.                   content: "<div class=\"info-window-content\"><b>'.$name.'<\/b><br />'.$address.'<\/div>",
  221.                   maxWidth: 275
  222.               };
  223.               
  224.               infoWindow = new google.maps.InfoWindow(myInfoWindowOptions);
  225.               
  226.               marker = new google.maps.Marker({
  227.                 draggable: false,
  228.                 raiseOnDrag: false,
  229.                 map: map,
  230.                 position: markerPosition
  231.               });
  232.  
  233.                     
  234.  
  235.             google.maps.event.addListener(marker, "click", function() {
  236.                 infoWindow.open(map,marker);
  237.             });
  238.         
  239.             infoWindow.open(map,marker);
  240.          });
  241.          </script>';
  242.  
  243.     return $map;
  244.   }
  245.  
  246. }
  247.  
  248.  
  249. /**
  250.  * DisplayConfirmAdd()
  251.  * affichage confirmation de l'ajout
  252.  * @return 
  253.  ***/
  254. if(!function_exists('DisplayConfirmAdd')) {
  255.  
  256.   function DisplayConfirmAdd({
  257.     $link_tablearray('rub'=> $GLOBALS['links'][U_L]['directory']['linkvalue']);
  258.     $content='<p class="confirm">'._t('yp','confirm_pub').' <a href="'.HrefMaker($link_table).'" title="'.formatText(_t('yp','confirm_pub2')'2ATT').'" >'._t('yp','confirm_pub2').'</a>'.END_LINE;
  259.     $content.='</p>'.END_LINE;
  260.     echo $content;
  261.   }
  262.  
  263. }
  264.  
  265. /**
  266.  * DisplayAddYellowPages()
  267.  * affichage formulaire d'ajout
  268.  * @param integer $btn 
  269.  * @param $table 
  270.  * @return 
  271.  ***/
  272. if(!function_exists('DisplayAddYellowPages')) {
  273.  
  274.   function DisplayAddYellowPages({
  275.     include_once('../lib/input_helpers.php');
  276.     include_once('../class/class.yellowpages.php');
  277.     $form_name='';
  278.     $form_activity='';
  279.     $form_theme='';
  280.     $form_street='';
  281.     $form_postal_code='';
  282.     $form_city='';
  283.     $form_phone='';
  284.     $form_fax='';
  285.     $form_email='';
  286.     $form_website='http://';
  287.     $data$GLOBALS['sql_object'-> DBSelect(SQL_get_req_list_theme());
  288.     $select_theme=ThemeSelectBox($data"yp_theme"$form_theme);
  289.     //  testing $_POST['yp_name'] and not $_POST['valider'] because of OPERA bug
  290.     if(isset($_POST['yp_name'])) {
  291.       $table[0]=$_POST['yp_name'];
  292.       $table[1]=$_POST['yp_activity'];
  293.       $table[2]=$_POST['yp_theme'];
  294.       $table[3]=$_POST['yp_street'];
  295.       $table[4]=$_POST['yp_postal_code'];
  296.       $table[5]=$_POST['yp_city'];
  297.       $table[6]='';
  298.       $table[7]=$_POST['yp_phone'];
  299.       $table[8]=$_POST['yp_fax'];
  300.       $table[9]=$_POST['yp_email'];
  301.       ($_POST['yp_website'!= 'http://'$table[10]=$_POST['yp_website'$table[10]='';
  302.       $table[11]="D";
  303.       $yp_objectnew yellowpages;
  304.  
  305.       // prevent spam
  306.       if($_SESSION['securityaction']!=md5($_POST['securitycode'])) {
  307.         $integrity=_t('security','message');
  308.       }
  309.       if(!isset($integrity)) $integrity=$yp_object->CheckDataIntegrity($table);
  310.  
  311.       if (is_string($integrity)) {
  312.         echo "<p class=\"error\">".$integrity."</p>";
  313.         $form_name=formatText($_POST['yp_name']'2FIELD');
  314.         $form_activity=formatText($_POST['yp_activity']'2FIELD');
  315.         $form_theme=$_POST['yp_theme'];
  316.         $form_street=formatText($_POST['yp_street']'2FIELD');
  317.         $form_postal_code=$_POST['yp_postal_code'];
  318.         $form_city=formatText($_POST['yp_city']'2FIELD');
  319.         $form_phone=$_POST['yp_phone'];
  320.         $form_fax=$_POST['yp_fax'];
  321.         $form_email=formatText($_POST['yp_email']'2FIELD');
  322.         $form_website=formatText($_POST['yp_website']'2FIELD');
  323.       else {
  324.         $result=$yp_object->AddYellowPages($table$GLOBALS['sql_object']);
  325.         $link_confirm=HrefMaker(array('rub'=> $GLOBALS['links'][U_L]['directory']['linkvalue']));
  326.         if(is_numeric($result)) DisplayConfirmAdd();
  327.         else  echo "<p class=\"error\">".system_error()."</p>";
  328.       }
  329.     }
  330.     if (!isset($integrity|| is_string($integrity)) {
  331.       $form ='<div class="sub-title">'._t('yp','h1_public_add').'</div>';
  332.       $form.='<form action="index.php" method="post">'.END_LINE;
  333.       $form.='<div>'.END_LINE;
  334.       $form.='<p><label for="yp_name" class="labelised">'.mb_ucfirst(_t('yp','name2')).' * : </label>'.END_LINE;
  335.       $form.='<input type="text" maxlength="150"  name="yp_name" id="yp_name" value="'.$form_name.'" class="textfield" /></p>'.END_LINE;
  336.       $form.='<p><label for="yp_activity" class="labelised">'.mb_ucfirst(_t('yp','activity')).' * : </label>'.END_LINE;
  337.       $form.='<input type="text" maxlength="255"  name="yp_activity" id="yp_activity" value="'.$form_activity.'" class="textfield" /></p>'.END_LINE;
  338.       $form.='<p><label for="yp_theme" class="labelised">'.mb_ucfirst(_t('yp','theme')).' : </label>'.END_LINE;
  339.       $form.=$select_theme.'</p>'.END_LINE;
  340.       $form.='<p><label for="yp_street" class="labelised">'.mb_ucfirst(_t('yp','street')).' * : </label>'.END_LINE;
  341.       $form.='<input type="text" maxlength="200" class="textfield" name="yp_street" id="yp_street"  value="'.$form_street.'" /></p>'.END_LINE;
  342.       $form.='<p><label for="yp_postal_code" class="labelised">'.mb_ucfirst(_t('yp','postal_code')).' * : </label>'.END_LINE;
  343.       $form.='<input type="text" maxlength="6" class="textfield" name="yp_postal_code" id="yp_postal_code" value="'.$form_postal_code.'" /></p>'.END_LINE;
  344.       $form.='<p><label for="yp_city" class="labelised">'.mb_ucfirst(_t('yp','city')).' * : </label>'.END_LINE;
  345.       $form.='<input type="text" maxlength="100" class="textfield" name="yp_city" id="yp_city" value="'.$form_city.'" /></p>'.END_LINE;
  346.       $form.='<p><label for="yp_phone" class="labelised">'.mb_ucfirst(_t('yp','phone')).' : </label>'.END_LINE;
  347.       $form.='<input type="text" maxlength="12" class="textfield" name="yp_phone" id="yp_phone" value="'.$form_phone.'" /></p>'.END_LINE;
  348.       $form.='<p><label for="yp_fax" class="labelised">'.mb_ucfirst(_t('yp','fax')).' : </label>'.END_LINE;
  349.       $form.='<input type="text" maxlength="12" class="textfield" name="yp_fax" id="yp_fax" value="'.$form_fax.'" /></p>'.END_LINE;
  350.       $form.='<p><label for="yp_email" class="labelised">'.mb_ucfirst(_t('yp','email')).' * : </label>'.END_LINE;
  351.       $form.='<input type="text" maxlength="150" class="textfield" name="yp_email" id="yp_email" value="'.$form_email.'" /></p>'.END_LINE;
  352.       $form.='<p><label for="yp_website" class="labelised">'.mb_ucfirst(_t('yp','website')).' : </label>'.END_LINE;
  353.       $form.='<input type="text" maxlength="150" class="textfield" name="yp_website" id="yp_website" value="'.$form_website.'" /></p>'.END_LINE;
  354.       $form.='<p class="yp_antispam">'.END_LINE;
  355.       $form.='<span class="labelmargin labelised">' mb_ucfirst(_t('security','info2')) ' : </span>'.END_LINE;
  356.       $form.='<img src="../lib/securitycode.php" alt="' .mb_ucfirst_t('security','info2')) .'" id="securityimg"  />';
  357.       $form.='</p>'.END_LINE;
  358.       $form.='<p><label for="securitycode" class="labelised">' mb_ucfirst(_t('antispam','info')) ' * : </label>'.END_LINE;
  359.       $form.='<input type="text" class="textfield" id="securitycode" maxlength="5" name="securitycode" /></p> ';
  360.       $form.='<input type="hidden" id="rub_yp" value="'.$GLOBALS['links'][U_L]['directory-add']['linkvalue'].'" name="rub" /> ';
  361.       $form.='<input type="submit" class="submitbut"  value="'._t('btn','valid').'" name="valider" id="valider" />'.END_LINE;
  362.       $form.='</div>'.END_LINE;
  363.       $form.='</form>'.END_LINE;
  364.  
  365.       echo $form;
  366.     }
  367.   }
  368.  
  369. }
  370. ?>

Documentation generated on Mon, 08 Apr 2013 18:14:15 +0200 by phpDocumentor 1.4.1