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

Source for file mod.php

Documentation is available at mod.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. //////////// Check Inclusion de pages ////////////
  12. if (!class_exists('auth')){
  13.   include_once("../lib/lib_common.php");
  14.   ReloadIndex('admin');
  15. }
  16. ////////////
  17.  
  18. //////////// Check Droits utilisateur ////////////
  19. if (!$l21auth->isSuperAdmin()) ReloadIndex('admin');
  20. ////////////
  21.  
  22. include_once("../lib/input_helpers.php");
  23. if (isset($_GET['id']))    $yp_id=$_GET['id'];
  24. if (isset($_POST['id']))    $yp_id=$_POST['id'];
  25.  
  26. $requete=SQL_getdetyp($yp_id);
  27. $data_yp=$sql_object->DBSelect($requete'OBJECT');
  28. $display_title=formatTitleh2($data_yp[0]->yellowp_name);
  29. $navtitle=_t('yp','mod')." : ".$data_yp[0]->yellowp_name;
  30.  
  31. ?>
  32. <div id="chemin">
  33. <ul>
  34.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a></li>
  35.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu','yellowpages');?></a></li>
  36.     <li><span><?php echo formatnavTitle($navtitle)?></span></li>
  37. </ul>
  38. </div>
  39. <!--end barre haute -->
  40. <?php
  41. if(isset($_POST['enregistrer'])) {
  42.   $data_table=unserialize(urldecode($_POST['data_table']));
  43.   $yp_objectnew yellowpages;
  44.   $result=$yp_object->ModifyYellowPages($yp_id$data_table$sql_object);
  45.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&id=".$yp_id;
  46.  
  47.   if($resultheader("Location: ".$link_confirm);
  48.   else  system_error();
  49. }
  50.  
  51. $form_name=formatText($data_yp[0]->yellowp_name'2FIELD');
  52. $form_activity=formatText($data_yp[0]->yellowp_activity'2FIELD');
  53. $form_theme=$data_yp[0]->yellowp_theme;
  54. $form_street=formatText($data_yp[0]->yellowp_street'2FIELD');
  55. $form_postal_code=formatText($data_yp[0]->yellowp_postal_code'2FIELD');
  56. $form_city=formatText($data_yp[0]->yellowp_city'2FIELD');
  57. $form_phone=$data_yp[0]->yellowp_phone;
  58. $form_fax=$data_yp[0]->yellowp_fax;
  59. $form_email=formatText($data_yp[0]->yellowp_email'2FIELD');
  60. $form_website=formatText($data_yp[0]->yellowp_website'2FIELD');
  61. $form_statut=$data_yp[0]->yellowp_statut;
  62. if($form_statut=='AA'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  63. if($form_statut=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  64.  
  65.  
  66. if(isset($_POST['valider'])) {
  67.   $table[0]=$_POST['yp_name'];
  68.   $table[1]=$_POST['yp_activity'];
  69.   $table[2]=$_POST['yp_theme'];
  70.   $table[3]=$_POST['yp_street'];
  71.   $table[4]=$_POST['yp_postal_code'];
  72.   $table[5]=$_POST['yp_city'];
  73.   $table[6]='';
  74.   $table[7]=$_POST['yp_phone'];
  75.   $table[8]=$_POST['yp_fax'];
  76.   $table[9]=$_POST['yp_email'];
  77.   $table[10]=$_POST['yp_website'];
  78.   $table[11]=$_POST['yp_statut'];
  79.   $yp_objectnew yellowpages;
  80.   $integrity=$yp_object->CheckDataIntegrity($table);
  81.  
  82.   $form_name=formatText($_POST['yp_name']'2FIELD');
  83.   $form_activity=formatText($_POST['yp_activity']'2FIELD');
  84.   $form_theme=$_POST['yp_theme'];
  85.   $form_street=formatText($_POST['yp_street']'2FIELD');
  86.   $form_postal_code=formatText($_POST['yp_postal_code']'2FIELD');
  87.   $form_city=formatText($_POST['yp_city']'2FIELD');
  88.   $form_phone=$_POST['yp_phone'];
  89.   $form_fax=$_POST['yp_fax'];
  90.   $form_email=formatText($_POST['yp_email']'2FIELD');
  91.   $form_website=formatText($_POST['yp_website']'2FIELD');
  92.   $form_statut=$_POST['yp_statut'];
  93.   if($form_statut=='AA'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  94.   if($form_statut=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  95.  
  96.   $table=urlencode(serialize($table));
  97. }
  98. include_once(THEME_ADMIN_PATH."quickicons.php");
  99.  
  100. // select-box de thèmes
  101. $data=$sql_object->DBSelect($req_list_theme);
  102. $select_theme=ThemeSelectBox($data"yp_theme"$form_theme);
  103. ?>
  104.  
  105. <?php
  106. if(!isset($integrity|| is_string($integrity)) {
  107.   ?>
  108. <div class="contentcontainer">
  109. <?php
  110. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  111. ?>
  112. <div id="content">
  113. <?php 
  114. $link_det_state=$rub_link."&todo=det&state=".$form_statut."&amp;id=";
  115. if ($form_statut=='D'{  ?>
  116.   <div class="mod_link">
  117.       <a href="<?php echo $link_det_state.$yp_id ;?>"><?php echo _t('yp','confirmation');?></a>
  118.   </div>
  119.   <br class="brendstep" />
  120. <?php ?> 
  121. <?php
  122. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  123. ?>
  124. <h2><?php echo $display_title?></h2>
  125.  
  126. <form id="addyp" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  127. <p>
  128.     <label for="yp_name"><?php echo mb_ucfirst(_t('yp','name2'))?> : *</label>
  129.     <input name="yp_name" type="text" class="textfield" id="yp_name" maxlength="150" value="<?php echo $form_name?>" />
  130. </p>
  131. <p>
  132.     <label for="yp_activity"><?php echo mb_ucfirst(_t('yp','activity'))?> : *</label>
  133.     <input name="yp_activity" type="text" class="textfield" id="yp_activity" maxlength="255" value="<?php echo $form_activity?>" />
  134. </p>
  135. <p>
  136.     <label for="yp_theme"><?php echo mb_ucfirst(_t('yp','theme'))?> : </label>
  137.     <?php echo $select_theme?>
  138. </p>
  139. <?php if($form_statut=='P' || $form_statut=='AA'){?>
  140.     <div class="label"><?php echo mb_ucfirst(_t('divers','statut'))?> : *</div>
  141.     <div class="rightpanel">
  142.         <input name="yp_statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P?> />
  143.         <label for="statut_P"><?php echo mb_ucfirst(_t('statut','public'))?></label>
  144.         <input name="yp_statut" type="radio" id="statut_D" value="AA" <?php echo $mask_statut_D?> />
  145.         <label for="statut_D"><?php echo mb_ucfirst(_t('statut','AA'))?></label>
  146.     </div>
  147. <?php else {
  148.   echo "<input name=\"yp_statut\" type=\"hidden\" value=\"D\" id=\"yp_statut\" />" ;
  149. }
  150. ?>
  151. <h3 class="part"><?php echo _t('yp','infos_adresse'?></h3>
  152.  
  153. <p>
  154.     <label for="yp_street"><?php echo mb_ucfirst(_t('yp','street'))?> : *</label>
  155.     <input name="yp_street" type="text" class="textfield" id="yp_street" maxlength="200" value="<?php echo $form_street?>" />
  156. </p>
  157. <p>
  158.     <label for="yp_postal_code"><?php echo mb_ucfirst(_t('yp','postal_code'))?> : *</label>
  159.     <input name="yp_postal_code" type="text" class="textfield" id="yp_postal_code" maxlength="6" value="<?php echo $form_postal_code?>" />
  160. </p>
  161. <p>
  162.     <label for="yp_city"><?php echo mb_ucfirst(_t('yp','city'))?> : *</label>
  163.     <input name="yp_city" type="text" class="textfield" id="yp_city" maxlength="100" value="<?php echo $form_city?>" />
  164. </p>
  165. <p>
  166.     <label for="yp_phone"><?php echo mb_ucfirst(_t('yp','phone'))?> :</label>
  167.     <input name="yp_phone" type="text" class="textfield" id="yp_phone" maxlength="12" value="<?php echo $form_phone?>" />
  168. </p>
  169. <p>
  170.     <label for="yp_fax"><?php echo mb_ucfirst(_t('yp','fax'))?> :</label>
  171.     <input name="yp_fax" type="text" class="textfield" id="yp_fax" maxlength="12" value="<?php echo $form_fax?>" />
  172. </p>
  173. <p>
  174.     <label for="yp_email"><?php echo mb_ucfirst(_t('yp','email'))?> : *</label>
  175.     <input name="yp_email" type="text" class="textfield" id="yp_email" maxlength="150" value="<?php echo $form_email?>" />
  176. </p>
  177. <p>
  178.     <label for="yp_website"><?php echo mb_ucfirst(_t('yp','website'))?> :</label>
  179.     <input    name="yp_website" type="text" class="textfield" id="yp_website" maxlength="150" value="<?php echo $form_website?>" />
  180. </p>
  181. <div>
  182.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  183.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  184.     <?php echo cancel_button($rub_link."&amp;todo=det&amp;id=".$yp_id)?>
  185.     <input name="id" type="hidden" value="<?php echo $yp_id?>" id="id" />
  186.     <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  187. </div>
  188. </form>
  189. </div>
  190. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  191. <?php
  192. // Récapitulatif
  193. else    {
  194.   if($form_theme==-1$display_form_theme=_t('yp','notheme');
  195.   else {
  196.     $onethemeSQL_getOneyptheme($form_theme);
  197.     $onetheme=$sql_object->DBSelect($onetheme);
  198.     $display_form_theme=formatText($onetheme[0]['theme_name']'2HTML');
  199.   }
  200.   $display_form_name=formatText(empty_nc($form_name)'2HTML');
  201.   $display_form_activity=formatText(empty_nc($form_activity)'2HTML');
  202.   $display_form_street=formatText(empty_nc($form_street)'2HTML');
  203.   $display_form_postal_code=formatText(empty_nc($form_postal_code)'2HTML');
  204.   $display_form_city=formatText(empty_nc($form_city)'2HTML');
  205.   $display_form_phone=formatText(empty_nc($form_phone)'2HTML');
  206.   $display_form_fax=formatText(empty_nc($form_fax)'2HTML');
  207.   $display_form_email=formatText(empty_nc($form_email)'2HTML');
  208.   $display_form_website=formatText(empty_nc($form_website)'2HTML');
  209.   if ($form_statut=='D'$display_form_statut=_t('yp','draft');
  210.   else $display_form_statut=display_statut($form_statut);
  211.   ?>
  212. <div class="contentcontainer">
  213. <?php
  214. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  215. ?>
  216. <div id="content">
  217. <h2><?php echo _t('recap','title')?></h2>
  218. <dl class="summary">
  219.     <dt><?php echo mb_ucfirst(_t('yp','name2'))?> :</dt>
  220.     <dd><?php echo $display_form_name?></dd>
  221.     <dt><?php echo mb_ucfirst(_t('yp','activity')) ;?> :</dt>
  222.     <dd><?php echo $display_form_activity?></dd>
  223.     <dt><?php echo mb_ucfirst(_t('yp','theme'))?> :</dt>
  224.     <dd><?php echo $display_form_theme?></dd>
  225.     <dt><?php echo mb_ucfirst(_t('divers','statut'))?> :</dt>
  226.     <dd><?php echo $display_form_statut?></dd>
  227.     <dt><?php echo mb_ucfirst(_t('yp','street'))?> :</dt>
  228.     <dd><?php echo $display_form_street?></dd>
  229.     <dt><?php echo mb_ucfirst(_t('yp','postal_code'))?> :</dt>
  230.     <dd><?php echo $display_form_postal_code?></dd>
  231.     <dt><?php echo mb_ucfirst(_t('yp','city'))?> :</dt>
  232.     <dd><?php echo $display_form_city?></dd>
  233.     <dt><?php echo mb_ucfirst(_t('yp','phone'))?> :</dt>
  234.     <dd><?php echo $display_form_phone?></dd>
  235.     <dt><?php echo mb_ucfirst(_t('yp','fax'))?> :</dt>
  236.     <dd><?php echo $display_form_fax?></dd>
  237.     <dt><?php echo mb_ucfirst(_t('yp','email'))?> :</dt>
  238.     <dd><?php echo $display_form_email?></dd>
  239.     <dt><?php echo mb_ucfirst(_t('yp','website'))?> :</dt>
  240.     <dd><?php echo $display_form_website?></dd>
  241. </dl>
  242. <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  243.   <div>
  244.       <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  245.       <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  246.       <input name="id" type="hidden" value="<?php echo $yp_id?>" id="id" />
  247.       <?php echo cancel_button($rub_link."&amp;todo=det&amp;id=".$yp_id)?>
  248.       <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  249.       <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  250.       <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  251.   </div>
  252. </form>
  253. </div>
  254. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  255. <?php
  256. }
  257. ?>

Documentation generated on Thu, 20 Mar 2014 16:49:01 +0100 by phpDocumentor 1.4.1