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

Documentation generated on Thu, 20 Mar 2014 16:45:54 +0100 by phpDocumentor 1.4.1