linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file add_com.php

Documentation is available at add_com.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage workshop
  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. include_once("../lib/input_helpers.php");
  12. if(isset($_POST['id']))    $id=$_POST['id'];
  13. if(isset($_GET['id']))    $id=$_GET['id'];
  14.  
  15. if(isset($_POST['com_id']))    $com_id=$_POST['com_id'];
  16. if(isset($_GET['com_id']))    $com_id=$_GET['com_id'];
  17.  
  18. //////////// Check Inclusion de pages ////////////
  19. if (!function_exists('AuthenthificationProcess')){
  20.   include_once("../lib/lib_common.php");
  21.   ReloadIndex('admin');
  22. }
  23. ////////////
  24.  
  25. //////////// Check Droits utilisateur ////////////
  26. if (isWorkgroupOrganiser(GetSessionElement('id')$sql_object$id)<>true && !IsSuperAdmin())
  27. ReloadIndex('admin');
  28. ////////////
  29.  
  30.  
  31. $user_id=GetSessionElement('id');
  32.  
  33. $form_subject='';
  34. $form_body='';
  35. $link_det=$rub_link."&amp;todo=det&amp;id=";
  36. $link_add_com=$rub_link."&amp;todo=add_com&amp;id=".$id."&amp;com_id=";
  37. if($com_id <> 0$link_cancel=$rub_link."&amp;todo=det_com&amp;id=".$id."&amp;com_id=".$com_id;
  38. else $link_cancel=$rub_link."&amp;todo=list_com&amp;id=".$id;
  39.  
  40.  
  41. $req_det_workshopSQL_getoneCompleteWorkshop($id);
  42. $result_workshop=$sql_object->DBSelect($req_det_workshop);
  43. $workshop_denomination=formatText($result_workshop[0]['workshop_denomination']'2HTML');
  44.  
  45. $req_com_root SQL_getOnetopicWorkcom($id$com_id$com_id);
  46. $result_com_root $sql_object -> DBSelect($req_com_root);
  47. $com_root_subject=formatText($result_com_root[0]['workcom_subject']'2HTML');
  48. $workshop_com_objectnew workshop_com;
  49.  
  50.  
  51. if(isset($_POST['enregistrer'])) {
  52.   $data_table=unserialize(urldecode($_POST['data_table']));
  53.   //faire l'ajout de user avec AddUserWorkshop
  54.   $result=$workshop_com_object->AddCom($data_table $sql_object);
  55.   if($com_id == 0$com_id=$result;
  56.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&id=".$id."&com_id=".$com_id."&mes_id=".$result;
  57.   if(is_numeric($result)) header("Location: ".$link_confirm);
  58.   else  system_error();
  59. }
  60.  
  61. if(isset($_POST['valider'])) {
  62.  
  63.   $table[0$_POST['subject'];
  64.   $table[1$_POST['body'];
  65.   $table[2$_POST['com_id'];
  66.   $table[3$user_id;
  67.   $table[4$_POST['id'];
  68.  
  69.   $integrity=$workshop_com_object->CheckDataIntegrity($table$sql_object);
  70.  
  71.   if(is_string($integrity)) {
  72.     $text_format='2FIELD';
  73.   else {
  74.     $text_format='2HTML';
  75.   }
  76.  
  77.   $form_subject=formatText($_POST['subject']$text_format);
  78.   $form_body=formatText($_POST['body']$text_format);
  79.   $table=urlencode(serialize($table));
  80. }
  81. include_once(THEME_ADMIN_PATH."quickicons.php");
  82. if ($com_id==0{
  83.   $navtitle=_t('workshop','add_com')." : ".$workshop_denomination;
  84.   $titleh2=_t('workshop','name')." : ".$workshop_denomination;
  85. }
  86. else {
  87.   $navtitle=_t('workshop','add_com_mes')." : ".$com_root_subject." (".$workshop_denomination.")";
  88.   $titleh2=_t('workshop','com_name')." : ".$com_root_subject." ("._t('workshop','name')." :".$workshop_denomination.")";
  89. }?>
  90. <div id="chemin">
  91. <ul>
  92.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home'?></a>
  93.     </li>
  94.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>"
  95.         class="chemin_rub"><?php echo _t('menu','workshop')?></a></li>
  96.     <li><span><?php  echo formatnavTitle($navtitle);
  97.     ?></span></li>
  98. </ul>
  99. </div>
  100. <!--end barre haute -->
  101.     <?php
  102.     if(!isset($integrity|| is_string($integrity)) {
  103.       ?>
  104. <div class="contentcontainer"><?php
  105. include_once($dir."/menurub.php");
  106. ?>
  107. <div id="content"><?php
  108. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  109. ?> <?php afflinkbar($todo,$id$lang)?>
  110. <h2><?php 
  111. echo formatTitleh2($titleh2)?></h2>
  112. <form id="addcom" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  113.     method="post">
  114. <p><label for="subject"><?php echo _t('workshop','com_subject')?> * :
  115. </label> <input name="subject" type="text" class="textfield"
  116.     id="subject" maxlength="150" value="<?php echo $form_subject?>" /></p>
  117. <p><label for="body"><?php echo _t('workshop','com_body')?> * : </label>
  118. <textarea id="body" name="body" <?php echo AREA_SETTINGS?>
  119.     class="largetextfield"><?php echo $form_body?></textarea></p>
  120. <div><input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  121. <input name="com_id" type="hidden" value="<?php echo $com_id?>"
  122.     id="com_id" /> <input name="rub" type="hidden"
  123.     value="<?php echo $rub?>" id="rub" /> <?php echo cancel_button($link_cancel)?>
  124. <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  125. <input name="valider" type="submit"
  126.     value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  127. </div>
  128. </form>
  129. </div>
  130. <?php include_once($dir."/help.php")?></div>
  131. <?php
  132. // Récapitulatif
  133.     else    {
  134.       ?>
  135. <div class="contentcontainer"><?php
  136. include_once($dir."/menurub.php");
  137. ?>
  138. <div id="content"><?php afflinkbar($todo,$id$lang)?>
  139. <h2><?php echo _t('recap','title'?></h2>
  140. <?php
  141. echo "<dl class=\"dl3\">\n";
  142. echo "<dt>"._t('workshop','com_subject')." :</dt>\n";
  143. echo "<dd>".$form_subject."</dd>\n";
  144. echo "<dt>"._t('workshop','com_body'."</dt>\n";
  145. echo "<dd>".$form_body."</dd>\n";
  146. echo "</dl>\n";
  147. ?>
  148. <form id="addworkshop" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  149.     method="post">
  150. <div><input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  151. <input name="com_id" type="hidden" value="<?php echo $com_id?>"
  152.     id="com_id" /> <input name="data_table" type="hidden"
  153.     value="<?php echo $table?>" id="data_table" /> <input name="rub"
  154.     type="hidden" value="<?php echo $rub?>" id="rub" /> <?php echo cancel_button($link_cancel)?>
  155. <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  156. <input name="retour" type="button"
  157.     value="<?php echo _t('btn','preview'?>" class="button" id="retour"
  158.     onclick="history.go(-1);" /> <input name="enregistrer" type="submit"
  159.     value="<?php echo _t('btn','save'?>" class="button" id="valider" /></div>
  160. </form>
  161. </div>
  162. <?php include_once($dir."/help.php")?></div>
  163. <?php
  164.     }
  165.     ?>

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