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

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