* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ include_once("../lib/input_helpers.php"); if(isset($_POST['id'])) $id=$_POST['id']; if(isset($_GET['id'])) $id=$_GET['id']; if(isset($_POST['com_id'])) $com_id=$_POST['com_id']; if(isset($_GET['com_id'])) $com_id=$_GET['com_id']; //////////// Check Inclusion de pages //////////// if (!class_exists('auth')){ include_once("../lib/lib_common.php"); ReloadIndex('admin'); } //////////// //////////// Check Droits utilisateur //////////// if (!$l21auth->isWorkgroupOrganiser($l21auth->GetSessionElement('id'), $sql_object, $id) && !$l21auth->isSuperAdmin()) ReloadIndex('admin'); //////////// // TextboxList CSS/JS inclusion addDynamicCSS(THEME_ADMIN_PATH.'css/TextboxList.css'); addDynamicCSS(THEME_ADMIN_PATH.'css/TextboxList.Autocomplete.css'); footerAddJS('../lib/js/TextboxList-jQuery/Source/GrowingInput.js'); footerAddJS('../lib/js/TextboxList-jQuery/Source/TextboxList.js'); footerAddJS('../lib/js/TextboxList-jQuery/Source/TextboxList.Autocomplete.js'); $user_id=$l21auth->GetSessionElement('id'); $form_subject=''; $form_owner=''; $form_body=''; $mask_owner=''; $mask_notify=''; $link_det=$rub_link."&todo=det&id="; $link_add_com=$rub_link."&todo=add_com&id=".$id."&com_id="; if($com_id <> 0) $link_cancel=$rub_link."&todo=det_com&id=".$id."&com_id=".$com_id; else $link_cancel=$rub_link."&todo=list_com&id=".$id; $req_det_workshop= SQL_getoneCompleteWorkshop($id); $result_workshop=$sql_object->DBSelect($req_det_workshop); $workshop_denomination=formatText($result_workshop[0]['workshop_denomination'], '2HTML'); // we get root message if any $req_com_root = SQL_getOnetopicWorkcom($id, $com_id, $com_id); $result_com_root = $sql_object -> DBSelect($req_com_root); if(is_array($result_com_root)) { $com_root_subject=formatText($result_com_root[0]['workcom_subject'], '2HTML'); if(!empty($com_root_subject)) $form_subject=$com_root_subject; } $workshop_com_object= new workshop_com; if(isset($_POST['enregistrer'])) { $data_table=unserialize(urldecode($_POST['data_table'])); //faire l'ajout de user avec AddUserWorkshop $result=$workshop_com_object->AddCom($data_table , $sql_object); if($com_id == 0) $com_id=$result; $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&id=".$id."&com_id=".$com_id."&mes_id=".$result; if(is_numeric($result)) { // we notify users if needed if($data_table[5]===true) { // new topic if($data_table[2] == 0) { notifyUsersMsg(array('id' => $id,'user' => $_SESSION['userlogin'],'owner' => $data_table[6], 'action' => 'topic_alert', 'topic_subject' => formatText($data_table[0], '2FIELD'), 'topic_body' => $data_table[1])); // new post in existing topic } else { notifyUsersMsg(array('id' => $result,'user' => $_SESSION['userlogin'],'owner' => $data_table[6], 'action' => 'post_alert', 'topic_subject' => formatText($data_table[0], '2FIELD'), 'topic_body' => $data_table[1], 'tid' => $data_table[2], 'parentid' => $id)); } } header("Location: ".safe_redirect($link_confirm)); exit; } else system_error(); } if(isset($_POST['valider'])) { $table = array(); $table[0] = $_POST['subject']; $table[1] = $_POST['body']; $table[2] = $_POST['com_id']; if(isset($_POST['change-owner'])) { $r=$sql_object -> DBSelect(SQL_get_UserInfo($_POST['owner'])); $table[3] = $r[0]['user_id']; $mask_owner =' checked="checked"'; $table[6] = $_POST['owner']; } else { $table[3] = $user_id; $mask_owner = ''; $table[6] = $_SESSION['userlogin']; } $table[4] = $_POST['id']; if(isset($_POST['notify-users'])) { $mask_notify=' checked="checked"'; $table[5] = true; $notifyusers_display = _t('divers', 'yes'); } else { $mask_notify=''; $table[5] = false; $notifyusers_display = _t('divers', 'no'); } $integrity=$workshop_com_object->CheckDataIntegrity($table, $sql_object); if(is_string($integrity)) { $text_format='2FIELD'; } else { $text_format='2HTML'; } $form_subject=formatText($_POST['subject'], $text_format); if(isset($_POST['change-owner'])) { $form_owner=formatText($_POST['owner'], $text_format); } else { $form_owner=formatText($_SESSION['userlogin']); } $form_body=formatText($_POST['body'], $text_format); $table=urlencode(serialize($table)); } if ($com_id==0) { $navtitle=_t('workshop','add_com')." (".$workshop_denomination.")"; $titleh2=_t('workshop','add_com'); } else { $navtitle=_t('workshop','add_com_mes')." (".$com_root_subject.")"; $titleh2=_t('workshop','add_com_mes')." (".$com_root_subject.")"; }?>