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

Source for file add.php

Documentation is available at add.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage user
  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. //////////// Check Droits utilisateur ////////////
  19. if (!IsSuperAdmin()) ReloadIndex('admin');
  20. ////////////
  21. ?>
  22.  
  23. <div id="chemin">
  24. <ul>
  25.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a>
  26.     </li>
  27.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>"
  28.         class="chemin_rub"><?php echo _t('menu','user')?></a></li>
  29.     <li><span><?php echo formatNavTitle(_t('user','add'))?></span></li>
  30. </ul>
  31. </div>
  32. <!--end barre haute -->
  33. <?php
  34. $form_pseudo='';
  35. $form_email='';
  36. $layer_rights"style=\"display:none;\"";
  37. $mask_type_S='';
  38. $mask_type_P='';
  39. $mask_type_A='';
  40.  
  41. $mask_dashboard_1="checked=\"checked\"";
  42. $mask_dashboard_2='';
  43. $mask_publication_1="checked=\"checked\"";
  44. $mask_publication_2='';
  45. $mask_news_1="checked=\"checked\"";
  46. $mask_news_2='';
  47. $mask_workshop_1="checked=\"checked\"";
  48. $mask_workshop_2='';
  49.  
  50. $workgroups=$sql_object->DBSelect($q);
  51. $default_wg array();
  52.  
  53.  
  54. if(isset($_POST['enregistrer'])) {
  55.   $data_table_user=unserialize(urldecode($_POST['data_table_user']));
  56.   $data_table_right=unserialize(urldecode($_POST['data_table_right']));
  57.   $data_table_workgroups=unserialize(urldecode($_POST['data_table_workgroups']));
  58.   $user_objectnew user;
  59.   $data_table_user[3$user_object -> GetNewPassword();
  60.  
  61.   /** include envoi de mail */
  62.   $todo_mail='add_user';
  63.   include_once(themePath('../user/mail_actions.php'));
  64.   include_once('../mail/template.php');
  65.   /** end mail */
  66.  
  67.   $result=$user_object->AddUser($data_table_user$data_table_right$sql_object);
  68.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  69.   if(is_numeric($result)) {
  70.     $r $user_object -> AddWorkshops($result$data_table_workgroups'U' $sql_object);
  71.     header("Location: ".$link_confirm);
  72.   }
  73.   else  system_error();
  74. }
  75.  
  76.  
  77. if(isset($_POST['valider'])) {
  78.   $table_user[0]=$_POST['pseudo'];
  79.   $table_user[1]=$_POST['email'];
  80.   $table_user[2]='N';
  81.   $user_objectnew user;
  82.   $integrity=$user_object->CheckDataIntegrity($table_user$sql_object);
  83.  
  84.   if($_POST['user_type']=='simple_user'{
  85.     $table_right=$user_object->InitUserRight('SIMPLE_USER');
  86.     $mask_type_S="checked=\"checked\"";
  87.   }
  88.   if($_POST['user_type']=='admin_user'{
  89.     $table_right=$user_object->InitUserRight('ADMIN_USER');
  90.     $mask_type_A="checked=\"checked\"";
  91.   }
  92.   if($_POST['user_type']=='privilege_user'{
  93.     $table_right['dashboard']=$_POST['dashboard'];
  94.     $table_right['workshop']=$_POST['workshop'];
  95.     $table_right['publication']=$_POST['publication'];
  96.     $table_right['news']=$_POST['news'];
  97.     $table_right['yellowpages']='U';
  98.     $table_right['project']='U';
  99.     $table_right['theme']='U';
  100.     $table_right['scale']='U';
  101.     $table_right['level']='U';
  102.     $table_right['category_user']='U';
  103.     $layer_rights"style=\"display:block;\"";
  104.     $mask_type_P="checked=\"checked\"";
  105.   }
  106.  
  107.   if(isset($_POST['workgroups'])) {
  108.     $table_workgroups=$_POST['workgroups'];
  109.     $default_wg=$table_workgroups;
  110.   }
  111.   else $table_workgroups=array();
  112.  
  113.   $form_pseudo=$_POST['pseudo'];
  114.   $form_email=$_POST['email'];
  115.   $table_user=urlencode(serialize($table_user));
  116.   $table_right=urlencode(serialize($table_right));
  117.   $table_workgroups=urlencode(serialize($table_workgroups));
  118.  
  119.   if($_POST['dashboard']=='O'{
  120.     $mask_dashboard_1='';
  121.     $mask_dashboard_2="checked=\"checked\"";
  122.   }
  123.   if($_POST['publication']=='O'{
  124.     $mask_publication_1='';
  125.     $mask_publication_2="checked=\"checked\"";
  126.   }
  127.   if($_POST['news']=='O'{
  128.     $mask_news_1='';
  129.     $mask_news_2="checked=\"checked\"";
  130.   }
  131.   if($_POST['workshop']=='O'{
  132.     $mask_workshop_1='';
  133.     $mask_workshop_2="checked=\"checked\"";
  134.   }
  135. }
  136.  
  137. // preparation affichage detaillé
  138. $rights_display='';
  139. if(defined('MOD_SDI')) {
  140.   $rights_display.= "<label for=\"dashboard_1\" class=\"rights\">>> "._t('menu','dashboard')." : </label><br />\n";
  141.   $rights_display.= "<div class=\"radiomargin\">\n";
  142.   $rights_display.= "<input type=\"radio\" id=\"dashboard_1\" class=\"radio\" name=\"dashboard\" value=\"U\" ".$mask_dashboard_1." /><span class=\"radio\">"_t('user','norights')."</span>\n";
  143.   $rights_display.= "<input type=\"radio\" id=\"dashboard_2\" class=\"radio\" name=\"dashboard\" value=\"O\" ".$mask_dashboard_2."/><span class=\"radio\">"_t('user','redactorrights')."</span>\n";
  144.   $rights_display.= "</div>\n";
  145. else $rights_display.="<input type=\"hidden\" id=\"dashboard\" name=\"dashboard\" value=\"U\" />\n";
  146. if(defined('MOD_PUBLICATION')) {
  147.   $rights_display.= "<label for=\"publication_1\" class=\"rights\">>> "._t('menu','publication')." : </label><br />\n";
  148.   $rights_display.= "<div class=\"radiomargin\">\n";
  149.   $rights_display.= "<input type=\"radio\" id=\"publication_1\" class=\"radio\" name=\"publication\" value=\"U\" ".$mask_publication_1." /><span class=\"radio\">"_t('user','norights')."</span>\n";
  150.   $rights_display.= "<input type=\"radio\" id=\"publication_2\" class=\"radio\" name=\"publication\" value=\"O\" ".$mask_publication_2." /><span class=\"radio\">"_t('user','redactorrights')."</span>\n";
  151.   $rights_display.= "</div>\n";
  152. else $rights_display.="<input type=\"hidden\" id=\"publication\" name=\"publication\" value=\"U\" />\n";
  153. if(defined('MOD_NEWS')) {
  154.   $rights_display.= "<label for=\"news_1\" class=\"rights\">>> "._t('menu','news')." : </label><br />\n";
  155.   $rights_display.= "<div class=\"radiomargin\">\n";
  156.   $rights_display.= "<input type=\"radio\" id=\"news_1\" class=\"radio\" name=\"news\" value=\"U\" ".$mask_news_1." /><span class=\"radio\">"_t('user','norights')."</span>\n";
  157.   $rights_display.= "<input type=\"radio\" id=\"news_2\" class=\"radio\" name=\"news\" value=\"O\" ".$mask_news_2."/><span class=\"radio\">"_t('user','redactorrights')."</span>\n";
  158.   $rights_display.= "</div>\n";
  159. else $rights_display.="<input type=\"hidden\" id=\"news\" name=\"news\" value=\"U\" />\n";
  160. if(defined('MOD_WORKSHOP')) {
  161.   $rights_display.= "<label for=\"workshop_1\" class=\"rights\">>> "._t('menu','workshop')." : </label><br />\n";
  162.   $rights_display.= "<div class=\"radiomargin\">\n";
  163.   $rights_display.= "<input type=\"radio\" id=\"workshop_1\" class=\"radio\" name=\"workshop\" value=\"U\" ".$mask_workshop_1." /><span class=\"radio\">"_t('user','norights')."</span>\n";
  164.   $rights_display.= "<input type=\"radio\" id=\"workshop_2\" class=\"radio\" name=\"workshop\" value=\"O\" ".$mask_workshop_2." /><span class=\"radio\">"_t('user','animatorrights')."</span>\n";
  165.   $rights_display.= "</div>\n";
  166. else $rights_display.="<input type=\"hidden\" id=\"wokshop\" name=\"workshop\" value=\"U\" />\n";
  167.  
  168. include_once(THEME_ADMIN_PATH."quickicons.php");
  169.  
  170. if(!isset($_POST['valider'])) $mask_type_S='checked="checked"';
  171. ?>
  172.  
  173. <?php
  174. if(!isset($integrity|| is_string($integrity)) {
  175.   ?>
  176. <div class="contentcontainer"><?php
  177. include_once($dir."/menurub.php");
  178. ?>
  179. <div id="content"><?php
  180. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  181. ?>
  182. <h2><?php echo formatTitleh2(_t('user','add_title'))?></h2>
  183. <form id="adduser" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  184.     method="post">
  185. <p><label for="simple_user"><?php echo _t('user','type')?> : *</label>
  186. <input name="user_type" type="radio" id="simple_user" maxlength="150"
  187.     value="simple_user" class="radio" onclick="ShowthemeTableRights('')"
  188. <?php echo $mask_type_S?> /><span class="radio"><?php echo _t('user','type_simple')?></span>
  189. <input name="user_type" type="radio" id="privilege_user" maxlength="150"
  190.     value="privilege_user" class="radio"
  191.     onclick="ShowthemeTableRights('rights')" <?php echo $mask_type_P;  ?> /><span
  192.     class="radio"><?php echo _t('user','type_privilege')?></span> <input
  193.     name="user_type" type="radio" id="admin_user" maxlength="150"
  194.     value="admin_user" class="radio" onclick="ShowthemeTableRights('')"
  195. <?php echo $mask_type_A;  ?> /><span class="radio"><?php echo _t('user','type_admin')?></span>
  196. </p>
  197. <div id="rights" <?php echo $layer_rights?>>
  198. <h3><?php echo _t('user','set_rights')?> : <br />
  199. </h3>
  200. <?php echo $rights_display?></div>
  201. <p><label for="pseudo"><?php echo ucfirst(_t('user','pseudo'))?> : *</label>
  202. <input name="pseudo" type="text" class="textfield" id="pseudo"
  203.     maxlength="150" value="<?php echo $form_pseudo?>" /></p>
  204. <p><label for="email"><?php echo ucfirst(_t('user','email'))?> : *</label>
  205. <input name="email" type="text" class="textfield" id="email"
  206.     maxlength="200" value="<?php echo $form_email?>" /></p>
  207. <div><input name="rub" type="hidden" value="<?php echo $rub?>"
  208.     id="rub" /> <input name="todo" type="hidden"
  209.     value="<?php echo $todo?>" id="todo" />
  210. <div class="label"><?php echo ucfirst(_t('user','workgroups'))?> :</div>
  211. <div class="rightpanel"><?php echo workgroupsCheckbox($workgroups'workgroups[]'$default_wg)?>
  212. </div>
  213. <?php
  214. if(isset($table_user&& isset($table_right&& isset($table_workgroups)) {
  215.   echo "<input name=\"data_table_user\" type=\"hidden\" value=\"".$table_user."\" id=\"data_table_user\" />\n";
  216.   echo "<input name=\"data_table_right\" type=\"hidden\" value=\"".$table_right."\" id=\"data_table_right\" />\n";
  217.   echo "<input name=\"data_table_workgroups\" type=\"hidden\" value=\"".$table_workgroups."\" id=\"data_table_workgroups\" />\n";
  218. }
  219. ?> <?php echo cancel_button('javascript:history.go(-1);')?> <input
  220.     name="valider" type="submit" value="<?php echo _t('btn','valid')?>"
  221.     class="button" id="valider" /></div>
  222. </form>
  223. </div>
  224. <?php include_once($dir."/help.php")?></div>
  225. <?php
  226. // Récapitulatif
  227. else    {
  228.  
  229.   $wg_display '';
  230.   if(isset($_POST['workgroups'])) {
  231.     $q=SQL_Get_WorkshopsDenomination($_POST['workgroups']);
  232.     $workgroups=$sql_object->DBSelect($q);
  233.     foreach($workgroups as $wg{
  234.       $wg_display .= '- '.$wg['workshop_denomination'].'<br />'.END_LINE;
  235.     }
  236.   else $wg_display .= _t('divers''none');
  237.  
  238.  
  239.   $reca_droits='';
  240.   if($_POST['user_type']=='simple_user'{
  241.     $display_type=_t('user','type_simple');
  242.   }
  243.   if($_POST['user_type']=='admin_user'{
  244.     $display_type=_t('user','type_admin');
  245.   }
  246.   if($_POST['user_type']=='privilege_user')  {
  247.     $display_type=_t('user','type_privilege');
  248.  
  249.     $reca_droits.="<dt>"._t('user','set_rights')." : </dt>";
  250.     $reca_droits.="<dd>&nbsp;<br /></dd>";
  251.     if(defined('MOD_SDI'))  {
  252.       $reca_droits.="<dt> . "._t('menu','sdi')." : </dt>";
  253.       $reca_droits.="<dd>".GetDisplayUserRight($_POST['dashboard']'dashboard')."<br /></dd>";
  254.     }
  255.     if(defined('MOD_PUBLICATION'))  {
  256.       $reca_droits.="<dt>  . "._t('menu','publication')." : </dt>";
  257.       $reca_droits.="<dd>".GetDisplayUserRight($_POST['publication'])."<br /></dd>";
  258.     }
  259.     if(defined('MOD_WORKSHOP'))  {
  260.       $reca_droits.="<dt>  . "._t('menu','workshop')." : </dt>";
  261.       $reca_droits.="<dd>".GetDisplayUserRight($_POST['workshop']'workshop')."<br /></dd>";
  262.     }
  263.     if(defined('MOD_NEWS'))  {
  264.       $reca_droits.="<dt>  . "._t('menu','news')." : </dt>";
  265.       $reca_droits.="<dd>".GetDisplayUserRight($_POST['news'])."<br /></dd>";
  266.     }
  267.   }
  268.  
  269.   ?>
  270. <div class="contentcontainer"><?php
  271. include_once($dir."/menurub.php");
  272. ?>
  273. <div id="content">
  274. <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  275. <dl class="dl3">
  276.     <dt><?php echo _t('user','type'?> :</dt>
  277.     <dd><?php echo $display_type?><br />
  278.     </dd>
  279.     <dt><?php echo ucfirst(_t('user','pseudo')) ?> :</dt>
  280.     <dd><?php echo $form_pseudo?><br />
  281.     </dd>
  282.     <dt><?php echo ucfirst(_t('user','email')) ?> :</dt>
  283.     <dd><?php echo $form_email?><br />
  284.     </dd>
  285.     <?php echo $reca_droits?>
  286.     <dt><?php echo ucfirst(_t('user','workgroups')) ?> :</dt>
  287.     <dd><?php echo stripslashes($wg_display)?></dd>
  288. </dl>
  289. <form id="adduser" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  290.     method="post">
  291. <div><input name="rub" type="hidden" value="<?php echo $rub?>"
  292.     id="rub" /> <input name="todo" type="hidden"
  293.     value="<?php echo $todo?>" id="todo" /> <input name="data_table_user"
  294.     type="hidden" value="<?php echo $table_user?>" id="data_table_user" />
  295. <input name="data_table_right" type="hidden"
  296.     value="<?php echo $table_right?>" id="data_table_right" /> <input
  297.     name="data_table_workgroups" type="hidden"
  298.     value="<?php echo $table_workgroups?>" id="data_table_workgroups" />
  299.     <?php echo cancel_button('?rub=user&todo=list')?> <input
  300.     name="retour" type="button" value="<?php echo _t('btn','preview'?>"
  301.     class="button" id="retour" onclick="history.go(-1);" /> <input
  302.     name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>"
  303.     class="button" id="valider" /></div>
  304. </form>
  305. </div>
  306.     <?php include_once($dir."/help.php")?></div>
  307.     <?php
  308. }
  309. ?>

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