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

Documentation generated on Thu, 20 Mar 2014 16:47:51 +0100 by phpDocumentor 1.4.1