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 newsletter
  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.  
  19. <div id="chemin">
  20.     <ul>
  21.         <li>
  22.             <a href="index.php" class="chemin_home"><? echo _t('way','home'); ?></a>
  23.         </li>
  24.         <li>
  25.                <a href="<?php echo $rub_link; ?>" id="chemin_<? echo $rub; ?>" class="chemin_rub"><? echo _t('menu','newsletter'); ?></a>
  26.         </li>
  27.         <li>
  28.             <span><? echo formatNavTitle(_t('newsletter','add')); ?></span>
  29.         </li>
  30.     </ul>
  31. </div>
  32. <!--end barre haute -->
  33. <?php
  34. $form_title='';
  35. $form_body='';
  36. $mask_statut_D='checked="checked"';
  37. $mask_statut_W='';
  38.  
  39.  
  40. $newsletter_object = new newsletter;
  41.  
  42. if(isset($_POST['enregistrer'])) {
  43.     $data_table=unserialize(urldecode($_POST['data_table']));
  44.     $result=$newsletter_object->AddNewsletter($data_table, $sql_object);
  45.     $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  46.     if(is_numeric($result)) header("Location: ".$link_confirm);
  47.     else  system_error();
  48. }
  49.  
  50. if(isset($_POST['valider'])) {
  51.     $table[0]=$_POST['newsletter_title'];
  52.     $table[1]=$_POST['newsletter_body'];
  53.     $table[2]=GetSessionElement('id'); // ID posteur
  54.     $table[3]=$_POST['newsletter_statut'];
  55.     
  56.     $newsletter_object= new newsletter;
  57.     $integrity=$newsletter_object->CheckDataIntegrity($table);
  58.     
  59.     if(is_string($integrity)) {
  60.         $text_format='2FIELD';
  61.     } else {
  62.         $text_format='2HTML';
  63.     }
  64.     $form_title=formatText($_POST['newsletter_title'], $text_format);
  65.     $form_body=formatText($_POST['newsletter_body'], $text_format);
  66.  
  67.  
  68.     if($_POST['newsletter_statut']=='D') $mask_statut_D="checked=\"checked\""; else $mask_statut_D='';
  69.     if($_POST['newsletter_statut']=='W') $mask_statut_W="checked=\"checked\""; else $mask_statut_P='';
  70.     $table=urlencode(serialize($table));
  71. }
  72.  
  73. include_once(THEME_ADMIN_PATH."quickicons.php");
  74.  
  75. ?>
  76.  
  77. <?php
  78. if(!isset($integrity) || is_string($integrity)) {
  79. ?>
  80. <div class="contentcontainer">
  81.         <?php
  82.         include_once($dir."/menurub.php");
  83.         ?>
  84.         <div id="content">
  85.             <?php
  86.             if(isset($integrity) && is_string($integrity)) display_errors($integrity);
  87.             ?>
  88.             <h2><? echo formatTitleh2(_t('newsletter','add_title')); ?></h2>
  89.             <form id="addnews" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  90.                 <p>
  91.                 <label for="newsletter_title"><? echo _t('newsletter','title'); ?> : *</label>
  92.                 <input name="newsletter_title" type="text" class="textfield" id="newsletter_title" maxlength="200" value="<?php echo $form_title; ?>" />
  93.                 </p>
  94.                 <p>
  95.                 <label for="newsletter_body"><? echo _t('newsletter','body'); ?> : *</label>
  96.                 <textarea id="newsletter_body" name="newsletter_body" class="largetextfield" <?php echo AREA_SETTINGS; ?>><?php echo $form_body; ?></textarea>
  97.                 </p>
  98.                 <p>
  99.                 <label for="statut_D"><? echo _t('newsletter','statut'); ?> : </label>
  100.                 <input name="newsletter_statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D; ?> /><span class="radio"><?php echo _t('statut','draft'); ?></span>
  101.                 <input name="newsletter_statut" type="radio" id="statut_W" value="W" <?php echo $mask_statut_W; ?> /><span class="radio"><?php echo _t('newsletter','nightsend'); ?></span>
  102.                 <br />
  103.                 </p>
  104.                 <div>
  105.                 <input name="rub" type="hidden" value="<?php echo $rub; ?>" id="rub" />
  106.                 <input name="todo" type="hidden" value="<?php echo $todo; ?>" id="todo" />
  107.                 <?php echo cancel_button('javascript:history.go(-1);'); ?>
  108.                 <input name="valider" type="submit" value="<? echo _t('btn','valid') ?>" class="button" id="valider" />
  109.                 </div>
  110.             </form>
  111.         </div>
  112. <?php include_once($dir."/help.php"); ?>
  113. </div>
  114. <?php
  115. // Récapitulatif
  116. } else    {
  117.  
  118. ?>
  119. <div class="contentcontainer">
  120. <?php
  121. include_once($dir."/menurub.php");
  122. ?>
  123. <div id="content">
  124.             <h2><? echo formatTitleh2(_t('recap','title')); ?></h2>
  125.             <?php
  126.             echo "<dl class=\"dl3\">\n";
  127.             echo "<dt>"._t('newsletter','title')."</dt>\n";
  128.             echo "<dd>". $form_title."</dd>\n";
  129.             echo "<dt>"._t('newsletter','body')." :</dt>\n";
  130.             echo "<dd>".linkin_content($form_body)."</dd>\n";
  131.             echo "<dt>"._t('divers','statut')."</dt>\n";
  132.             echo "<dd>". display_statut($_POST['newsletter_statut']). "</dd>\n";
  133.             echo "</dl>\n";
  134.             ?>
  135.             <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  136.                 <div>
  137.                 <input name="rub" type="hidden" value="<?php echo $rub; ?>" id="rub" />
  138.                 <input name="todo" type="hidden" value="<?php echo $todo; ?>" id="todo" />
  139.                 <input name="data_table" type="hidden" value="<?php echo $table; ?>" id="data_table" />
  140.                 <?php echo cancel_button('?rub=news&amp;todo=list'); ?>
  141.                 <input name="retour" type="button" value="<? echo _t('btn','preview'); ?>" class="button" id="retour" onclick="history.go(-1);" />
  142.                 <input name="enregistrer" type="submit" value="<? echo _t('btn','save'); ?>" class="button" id="valider" />
  143.                 </div>
  144.             </form>
  145.         </div>
  146.     <?php include_once($dir."/help.php"); ?>
  147. </div>
  148. <?php
  149. }
  150. ?>

Documentation generated on Fri, 16 Oct 2009 09:27:43 +0200 by phpDocumentor 1.4.1