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

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