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

Source for file add.php

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

Documentation generated on Mon, 08 Apr 2013 18:11:55 +0200 by phpDocumentor 1.4.1