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(themePath('../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_id));
  132.     if($data!=0{
  133.  
  134.       $content'';
  135.       $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']);
  136.       $link_selfarray('rub'=> $GLOBALS['links'][U_L]['directory']['linkvalue'],'id'=> $yp_id);
  137.  
  138.       $yp_name=formatText($data[0]['yellowp_name']'2HTML');
  139.       $yp_activity=formatText(cutText($data[0]['yellowp_activity'],150)'2HTML');
  140.       $yp_sdtheme=formatText($data[0]['sdtheme_name']'2HTML');
  141.       $yp_theme=formatText($data[0]['theme_name']'2HTML');
  142.       $yp_street=formatText($data[0]['yellowp_street']'2HTML');
  143.       $yp_postal_code=formatText($data[0]['yellowp_postal_code']'2HTML');
  144.       $yp_city=formatText($data[0]['yellowp_city']'2HTML');
  145.       $yp_phone=formatText($data[0]['yellowp_phone']'2HTML');
  146.       $yp_fax=formatText($data[0]['yellowp_fax']'2HTML');
  147.       $yp_email=formatText($data[0]['yellowp_email']'2HTML');
  148.       $yp_website=formatText($data[0]['yellowp_website']'2HTML');
  149.       $yp_lat=$data[0]['yellowp_latitude'];
  150.       $yp_long=$data[0]['yellowp_longitude'];
  151.        
  152.       $content.='<h2>'.$yp_name.'</h2>'.END_LINE;
  153.       $content.='<p class="permalink">'.END_LINE;
  154.       $content.= formatted_permalink($link_self);
  155.       $content.='</p>'.END_LINE;
  156.       $content.='<dl id="det_yp"><dt> '._t('yp','adresse').' : </dt><dd>'.$yp_street.' '.$yp_postal_code.' '.$yp_city.'</dd>'.END_LINE;
  157.       $content.='<dt> '._t('yp','phone').' : </dt><dd>'.empty_nc($yp_phone).'</dd>'.END_LINE;
  158.       $content.='<dt> '._t('yp','fax').': </dt><dd>'.empty_nc($yp_fax).'</dd>'.END_LINE;
  159.       $content.='<dt> '._t('yp','email').' : </dt><dd><a href="mailto:'.$yp_email.'" title="'.formatText($yp_email'2ATT').'">'.$yp_email.'</a></dd>'.END_LINE;
  160.       if ($data[0]['yellowp_website']<>""$content.='<dt> '._t('yp','website').' : </dt><dd><a href="'.$data[0]['yellowp_website'].'" title="'.formatText($yp_website'2ATT').'">'.$yp_website.'</a></dd>'.END_LINE;
  161.       else $content.='<dt> '._t('yp','website').' : </dt><dd>'.empty_nc($yp_website).'</dd>'.END_LINE;
  162.       $content.='<dt> '._t('yp','activity').' : </dt><dd>'.$yp_activity.'</dd>'.END_LINE;
  163.       if ($yp_sdtheme<>""{
  164.         $content.='<dt> '._t('divers','themeref').' : </dt><dd><a href="'.HrefMaker($link_table2).'" title="'.formatText($yp_sdtheme'2ATT').'">'.$yp_sdtheme.'</a>
  165.             </dd><dt> '._t('divers','sousthemeref').': </dt><dd>'.$yp_theme.'
  166.             </dd>'.END_LINE;
  167.       }
  168.       else {
  169.         $content.='<dt> '._t('divers','themeref').' : </dt><dd>'.empty_nc($yp_sdtheme).' </dd><dt>'._t('divers','sousthemeref').': </dt><dd>'.empty_nc($yp_sdtheme).'</span> </dd>'.END_LINE;
  170.       }
  171.       
  172.       $content.='</dl>'.END_LINE;
  173.  
  174.     }
  175.  
  176.     else {
  177.       $content.='<p class="info">'._t('yp','noresult').'</p>';
  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?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: 16,
  213.                  center: latlng,
  214.                  mapTypeId: google.maps.MapTypeId.ROADMAP
  215.                  };
  216.            var map = new google.maps.Map(document.getElementById("'.$id.'"), myOptions);
  217.              
  218.            marker = new google.maps.Marker({
  219.                 draggable: false,
  220.                 raiseOnDrag: false,
  221.                 map: map,
  222.                 position: markerPosition
  223.               });
  224.  
  225.               myInfoWindowOptions = {
  226.                   content: "<div class=\"info-window-content\"><b>'.$name.'</b><br />'.$address.'</div>",
  227.                   maxWidth: 275
  228.               };
  229.  
  230.             infoWindow = new google.maps.InfoWindow(myInfoWindowOptions);
  231.  
  232.             google.maps.event.addListener(marker, "click", function() {
  233.                 infoWindow.open(map,marker);
  234.             });
  235.         
  236.             infoWindow.open(map,marker);
  237.          });
  238.          </script>';
  239.  
  240.     return $map;
  241.   }
  242.  
  243. }
  244.  
  245.  
  246. /**
  247.  * DisplayConfirmAdd()
  248.  * affichage confirmation de l'ajout
  249.  * @return 
  250.  ***/
  251. if(!function_exists('DisplayConfirmAdd')) {
  252.  
  253.   function DisplayConfirmAdd({
  254.     $link_tablearray('rub'=> $GLOBALS['links'][U_L]['directory']['linkvalue']);
  255.     $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;
  256.     $content.='</p>'.END_LINE;
  257.     echo $content;
  258.   }
  259.  
  260. }
  261.  
  262. /**
  263.  * DisplayAddYellowPages()
  264.  * affichage formulaire d'ajout
  265.  * @param integer $btn 
  266.  * @param $table 
  267.  * @return 
  268.  ***/
  269. if(!function_exists('DisplayAddYellowPages')) {
  270.  
  271.   function DisplayAddYellowPages({
  272.     include_once('../lib/input_helpers.php');
  273.     include_once('../class/class.yellowpages.php');
  274.     $form_name='';
  275.     $form_activity='';
  276.     $form_theme='';
  277.     $form_street='';
  278.     $form_postal_code='';
  279.     $form_city='';
  280.     $form_phone='';
  281.     $form_fax='';
  282.     $form_email='';
  283.     $form_website='http://';
  284.     $data$GLOBALS['sql_object'-> DBSelect(SQL_get_req_list_theme());
  285.     $select_theme=ThemeSelectBox($data"yp_theme"$form_theme);
  286.     //  testing $_POST['yp_name'] and not $_POST['valider'] because of OPERA bug
  287.     if(isset($_POST['yp_name'])) {
  288.       $table[0]=$_POST['yp_name'];
  289.       $table[1]=$_POST['yp_activity'];
  290.       $table[2]=$_POST['yp_theme'];
  291.       $table[3]=$_POST['yp_street'];
  292.       $table[4]=$_POST['yp_postal_code'];
  293.       $table[5]=$_POST['yp_city'];
  294.       $table[6]='';
  295.       $table[7]=$_POST['yp_phone'];
  296.       $table[8]=$_POST['yp_fax'];
  297.       $table[9]=$_POST['yp_email'];
  298.       ($_POST['yp_website'!= 'http://'$table[10]=$_POST['yp_website'$table[10]='';
  299.       $table[11]="D";
  300.       $yp_objectnew yellowpages;
  301.  
  302.       // prevent spam
  303.       if($_SESSION['securityaction']!=md5($_POST['securitycode'])) {
  304.         $integrity=_t('security','message');
  305.       }
  306.       if(!isset($integrity)) $integrity=$yp_object->CheckDataIntegrity($table);
  307.  
  308.       if (is_string($integrity)) {
  309.         echo "<p class=\"error\">".$integrity."</p>";
  310.         $form_name=formatText($_POST['yp_name']'2FIELD');
  311.         $form_activity=formatText($_POST['yp_activity']'2FIELD');
  312.         $form_theme=$_POST['yp_theme'];
  313.         $form_street=formatText($_POST['yp_street']'2FIELD');
  314.         $form_postal_code=$_POST['yp_postal_code'];
  315.         $form_city=formatText($_POST['yp_city']'2FIELD');
  316.         $form_phone=$_POST['yp_phone'];
  317.         $form_fax=$_POST['yp_fax'];
  318.         $form_email=formatText($_POST['yp_email']'2FIELD');
  319.         $form_website=formatText($_POST['yp_website']'2FIELD');
  320.       else {
  321.         $result=$yp_object->AddYellowPages($table$GLOBALS['sql_object']);
  322.         $link_confirm=HrefMaker(array('rub'=> $GLOBALS['links'][U_L]['directory']['linkvalue']));
  323.         if(is_numeric($result)) DisplayConfirmAdd();
  324.         else  echo "<p class=\"error\">".system_error()."</p>";
  325.       }
  326.     }
  327.     if (!isset($integrity|| is_string($integrity)) {
  328.       $form ='<div class="sub-title">'._t('yp','h1_public_add').'</div>';
  329.       $form.='<form action="index.php" method="post">'.END_LINE;
  330.       $form.='<div>'.END_LINE;
  331.       $form.='<p><label for="yp_name" class="labelised">'._t('yp','name2').' * : </label>'.END_LINE;
  332.       $form.='<input type="text" maxlength="150"  name="yp_name" id="yp_name" value="'.$form_name.'" class="textfield" /></p>'.END_LINE;
  333.       $form.='<p><label for="yp_activity" class="labelised">'._t('yp','activity').' * : </label>'.END_LINE;
  334.       $form.='<input type="text" maxlength="255"  name="yp_activity" id="yp_activity" value="'.$form_activity.'" class="textfield" /></p>'.END_LINE;
  335.       $form.='<p><label for="yp_theme" class="labelised">'._t('yp','theme').' : </label>'.END_LINE;
  336.       $form.=$select_theme.'</p>'.END_LINE;
  337.       $form.='<p><label for="yp_street" class="labelised">'._t('yp','street').' * : </label>'.END_LINE;
  338.       $form.='<input type="text" maxlength="200" class="textfield" name="yp_street" id="yp_street"  value="'.$form_street.'" /></p>'.END_LINE;
  339.       $form.='<p><label for="yp_postal_code" class="labelised">'._t('yp','postal_code').' * : </label>'.END_LINE;
  340.       $form.='<input type="text" maxlength="6" class="textfield" name="yp_postal_code" id="yp_postal_code" value="'.$form_postal_code.'" /></p>'.END_LINE;
  341.       $form.='<p><label for="yp_city" class="labelised">'._t('yp','city').' * : </label>'.END_LINE;
  342.       $form.='<input type="text" maxlength="100" class="textfield" name="yp_city" id="yp_city" value="'.$form_city.'" /></p>'.END_LINE;
  343.       $form.='<p><label for="yp_phone" class="labelised">'._t('yp','phone').' : </label>'.END_LINE;
  344.       $form.='<input type="text" maxlength="12" class="textfield" name="yp_phone" id="yp_phone" value="'.$form_phone.'" /></p>'.END_LINE;
  345.       $form.='<p><label for="yp_fax" class="labelised">'._t('yp','fax').' : </label>'.END_LINE;
  346.       $form.='<input type="text" maxlength="12" class="textfield" name="yp_fax" id="yp_fax" value="'.$form_fax.'" /></p>'.END_LINE;
  347.       $form.='<p><label for="yp_email" class="labelised">'._t('yp','email').' * : </label>'.END_LINE;
  348.       $form.='<input type="text" maxlength="150" class="textfield" name="yp_email" id="yp_email" value="'.$form_email.'" /></p>'.END_LINE;
  349.       $form.='<p><label for="yp_website" class="labelised">'._t('yp','website').' : </label>'.END_LINE;
  350.       $form.='<input type="text" maxlength="150" class="textfield" name="yp_website" id="yp_website" value="'.$form_website.'" /></p>'.END_LINE;
  351.       $form.='<p class="yp_antispam">'.END_LINE;
  352.       $form.='<span class="labelmargin labelised">' _t('security','info2'' : </span>'.END_LINE;
  353.       $form.='<img src="../lib/securitycode.php" alt="' _t('security','info2'.'" id="securityimg"  />';
  354.       $form.='</p">'.END_LINE;
  355.       $form.='<p><label for="securitycode" class="labelised">' _t('antispam','info'' * : </label>'.END_LINE;
  356.       $form.='<input type="text" class="shorttextfield" id="securitycode" maxlength="5" name="securitycode" /></p> ';
  357.       $form.='<input type="hidden" id="rub_yp" value="'.$GLOBALS['links'][U_L]['directory-add']['linkvalue'].'" name="rub" /> ';
  358.       $form.='<input type="submit" class="submitbut"  value="'._t('btn','valid').'" size="15" name="valider" id="valider" />'.END_LINE;
  359.       $form.='</div>'.END_LINE;
  360.       $form.='</form>'.END_LINE;
  361.  
  362.       echo $form;
  363.     }
  364.   }
  365.  
  366. }
  367. ?>

Documentation generated on Thu, 03 May 2012 15:03:58 +0200 by phpDocumentor 1.4.1