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

Documentation generated on Fri, 01 Apr 2011 09:27:25 +0200 by phpDocumentor 1.4.1