Source for file display.php
Documentation is available at display.php
* @package linea21.modules
* @author linea21 <info@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
include_once(themePath('../workshop/'. SQL. '.inc.php'));
echo '<h3>'. _t('workshop', 'files'). ' : </h3>'. END_LINE;
$path = '../library/userfiles/workgroups/'. $work_id. '/';
if(!file_exists($path)) echo '<ul><li>'. _t('divers', 'no_files'). '</li></ul>';
$handle = @opendir($path) or die("Unable to open $path");
echo '<h3>'. _t('workshop', 'common_files'). ' : </h3>'. END_LINE;
$path = '../library/userfiles/workgroups/shared/';
if(!file_exists($path)) echo '<ul><li>'. _t('divers', 'no_files'). '</li></ul>';
$handle = @opendir($path) or die("Unable to open $path");
echo '<script type="text/javascript">
jQuery(".comment_actions a").colorbox({width:"60%", height:"80%"});
$data= $GLOBALS['sql_object'] -> DBSelect(SQL_getCommentsNumber(array('module' => 'files', 'module_id' => $id)));
if($a['action'] == 'post_alert') {
if(ALERT_NEWPOST == 0) return true;
if(ALERT_NEWPOST == 1) $m = array('O');
if(ALERT_NEWPOST == 2) $m = array('O', 'U');
if(count($data)== 1) $wname = $data[0]['workshop_denomination'];
$wlinkforum= array('rub'=> $GLOBALS['links'][U_L]['topic']['linkvalue'],'id'=> $a['tid'], 'parentid' => $a['parentid'], 'name' => $wname, '#' => 'msg-'. $a['id']);
if($a['action'] == 'topic_alert') {
if(ALERT_NEWTOPIC == 0) return true;
if(ALERT_NEWTOPIC == 1) $m = array('O');
if(ALERT_NEWTOPIC == 2) $m = array('O', 'U');
if(count($data)== 1) $wname = $data[0]['workshop_denomination'];
$wlinkfiles = array('rub'=> $GLOBALS['links'][U_L]['files']['linkvalue'],'id'=> $a['id'], 'name' => $wname);
$wlinkforum= array('rub'=> $GLOBALS['links'][U_L]['topic-list']['linkvalue'],'id'=> $a['id'], 'name' => $wname);
if($a['action'] == 'file_alert') {
if(ALERT_NEWFILE == 0) return true;
if(ALERT_NEWFILE == 1) $m = array('O');
if(ALERT_NEWFILE == 2) $m = array('O', 'U');
if(count($data)== 1) $wname = $data[0]['workshop_denomination'];
$wlinkfiles = array('rub'=> $GLOBALS['links'][U_L]['files']['linkvalue'],'id'=> $a['id'], 'name' => $wname);
$wlinkforum= array('rub'=> $GLOBALS['links'][U_L]['topic-list']['linkvalue'],'id'=> $a['id'], 'name' => $wname);
foreach($users as $user) {
if(isset ($_COOKIE['linea21']['login']) && $user->user_login != $_COOKIE['linea21']['login']) {
if(in_array($user->jwu_user_right, $m)) {
include(themePath('../workshop/mail_actions.php'));
include('../mail/template.php');
include_once('../class/system/class.upload.php');
include_once('../class/system/class.form.php');
if(isset ($_FILES['file'])) {
$ext= $upload->GetExtension($_FILES['file']['name']);
$dest = '../library/userfiles/workgroups/';
if(isset ($_POST['shared_file'])) $dest .= 'shared/';
if($upload->CheckMaxFile(filesize($_FILES['file']['tmp_name']), MEDIA_ALLOWED_SIZE) === true) {
$filename_parts = pathinfo($_FILES['file']['name']);
$final_name = cleanString($filename_parts['filename']). '.'. $filename_parts['extension'];
$r = $upload->UploadFile($_FILES['file'], $final_name, $dest);
notifyUsersMsg(array('id' => $id, 'action' => 'file_alert', 'files' => array($final_name)));
$confirmation = $final_name . ' : ' . _t('upload', 'confirmed');
$err_msg = $upload->CheckMaxFile(filesize($_FILES['file']['tmp_name']), MEDIA_ALLOWED_SIZE);
// $form->startForm('../library/upload.php', '#uploadform');
// $form->insertHTML('<p id="loader"></p>');
// $form->hiddenInput('id', $id);
// $form->hiddenInput('rub', $GLOBALS['links'][U_L]['files']['linkvalue']);
// $form->fileInput('file',_t('divers', 'up_file'));
// $form->insertHTML('<input type="file" name="fileinput" id="fileinput" multiple>');
// $form->checkboxInput('checkbox','shared_file',true,'<i>'._t('workshop', 'share_files').'</i>', false);
// $form->submitButton(false, _t('divers', 'up'), true, 'submitbut');
// $form->insertHTML('<button>'._t('divers', 'up_file').'</button>');
// $form->insertHTML('<div>'._t('divers', 'up_file').'</div>');
// if(!$output = $form->getForm()) { die("error: " . $form->error); }
// else { echo $output; }
echo '<form id="uploadform" action="index.php" method="post" enctype="multipart/form-data">
<div id="file_upload_container">
<input type="hidden" name="id" id="id" value='. $id. ' />
<input type="hidden" name="rub" id="rub" value='. $GLOBALS['links'][U_L]['files']['linkvalue']. ' />
<input type="file" name="file" multiple />
<button>'. _t('divers', 'up_file'). '</button>
<input type="checkbox" value="1" id="shared_file" name="shared_file" />
<label for="shared_file" class="autowidth"><em>'. _t('workshop', 'share_files'). '</em></label>
if(isset ($err_msg)) echo '<div class="error">'. $err_msg. '</div>'. END_LINE;
if(isset ($confirmation)) echo '<div class="info">'. $confirmation. '</div>'. END_LINE;
echo '<table id="files"></table>'. END_LINE;
$link = array('rub'=> $GLOBALS['links'][U_L]['files']['linkvalue'],'id'=> $work_id, 'name' => $work_name);
$content= '<a href="'. HrefMaker($link). '" title="'. formatText(_t('workshop','shared_files'), '2ATT'). '" id="nav-files">'. _t('workshop','shared_files'). '</a>'. END_LINE;
* DisplayUrlAllCalendar()
* affichage de l'URL de détails d'un calendrier
$link_table= array('rub'=> $GLOBALS['links'][U_L]['calendar']['linkvalue'],'id'=> $workshop_id);
* DisplayUrlInscription()
* affichage de l'URL d'inscription au groupe de travail
$link_table= array('rub'=> $GLOBALS['links'][U_L]['workgroup-subscription']['linkvalue'],'id'=> $workshop_id);
$link_table2= array('rub'=> $GLOBALS['links'][U_L]['user-prefs']['linkvalue']);
if (!isset ($_COOKIE['linea21'])) {
$content= '<div class="info">'. _t('divers','noauth'). ''. END_LINE;
$content.= '<br />'. _t('divers','creaauth'). ' : '. END_LINE;
$content= '<div class="info">'. _t('workshop','noinscription'). ''. END_LINE;
$content.= '<br />'. _t('workshop','creainscription2'). ' : '. END_LINE;
$content.= '<a href="'. HrefMaker($link_table). '" title="'. formatText(_t('workshop','creainscription'), '2ATT'). '" onclick="return window.confirm(\''. _t('workshop','creainscription3'). '\')" >'. _t('workshop','creainscription'). '</a></div>'. END_LINE;
* affichage URL pour accéder aux discussions
$link_table= array('rub'=> $GLOBALS['links'][U_L]['topic-list']['linkvalue'],'id'=> $work_id, 'name' => $work_name);
$content= '<a href="'. HrefMaker($link_table). '" title="'. formatText(_t('workshop','com_public'), '2ATT'). '" id="nav-discussion" >'. _t('workshop','com_public'). '</a>'. END_LINE;
* affichage URL pour accéder aux calendrier
$link_table= array('rub'=> $GLOBALS['links'][U_L]['calendar']['linkvalue'],'id'=> $work_id, 'name' => $work_name);
$content= '<a href="'. HrefMaker($link_table). '" title="'. formatText(_t('workshop','cal_all'), '2ATT'). '" id="nav-calendar">'. _t('workshop','cal_all'). '</a>'. END_LINE;
* DisplayUrlListerapport()
* affichage URL pour accéder aux rapports
$link_table= array('rub'=> $GLOBALS['links'][U_L]['report-all']['linkvalue'],'id'=> $work_id, 'name' => $work_name);
$content= '<a href="'. HrefMaker($link_table). '" title="'. formatText(_t('workshop','barre_report'), '2ATT'). '" id="nav-report" >'. _t('workshop','barre_report'). '</a>'. END_LINE;
* DisplayUrlListeutilisateurs()
* affichage URL pour accéder aux utilisatuers
$link_table= array('rub'=> $GLOBALS['links'][U_L]['user-all']['linkvalue'],'id'=> $work_id, 'name' => $work_name);
$content= '<a href="'. HrefMaker($link_table). '" title="'. formatText(_t('workshop','participant'), '2ATT'). '" id="nav-user" >'. _t('workshop','participant'). '</a>'. END_LINE;
$link_table= array('rub'=> $GLOBALS['links'][U_L]['topic-add']['linkvalue'],'id'=> $work_id);
$content= '<a href="'. HrefMaker($link_table). '" title="'. formatText(_t('workshop','add_com'), '2ATT'). '" class="add_topic button"><span class="plus icon"></span>'. _t('workshop','add_com'). '</a>'. END_LINE;
* affichage de la liste de groupe de travail
* @param integer $id_filter
if ($filter== "") $filter= 'public';
$data= $GLOBALS['sql_object'] -> DBSelect(SQL_getWorkshopList($debut=- 1, $limite=- 1, $filter , $id_filter));
for($i= 0; $i< count($data); $i++ ) {
$link_table= array('rub'=> $GLOBALS['links'][U_L]['workgroup']['linkvalue'],'id'=> $data[$i]['workshop_id'],'name'=> $data[$i]['workshop_denomination']);
$link_table2= array('rub'=> $GLOBALS['links'][U_L]['workgroup']['linkvalue'],'filter'=> $GLOBALS['filters'][U_L]['theme']['linkvalue'],'id'=> $data[$i]['sdtheme_id'], 'name'=> $data[$i]['sdtheme_name']);
$link_table3= array('rub'=> $GLOBALS['links'][U_L]['workgroup']['linkvalue'],'filter'=> $GLOBALS['filters'][U_L]['level']['linkvalue'],'id'=> $data[$i]['workshop_level'], 'name'=> $data[$i]['level_name']);
$workshop_title= formatText($data[$i]['workshop_denomination'], '2HTML');
$workshop_resume= formatText($data[$i]['workshop_resume'], '2HTML');
$workshop_sdtheme= formatText($data[$i]['sdtheme_name'], '2HTML');
$workshop_level= formatText($data[$i]['level_name'], '2HTML');
$content.= '<div class="chapo">'. $workshop_resume. '</div>'. END_LINE;
$content.= '<p class="filter_info">'. _t('divers','level'). ' : <a href="'. HrefMaker($link_table3). '" title="'. formatText($workshop_level, '2ATT'). '" class="filter_info_level" >'. $workshop_level. '</a> '. END_LINE;
$content.= ' '. _t('divers','themeref'). ': <a href="'. HrefMaker($link_table2). '" title="'. formatText($workshop_sdtheme, '2ATT'). '" class="filter_info_theme">'. $workshop_sdtheme. '</a></p>'. END_LINE;
$content.= '<a class="readmore" href="'. HrefMaker($link_table). '">'. _t('workshop', 'access_to'). '</a>';
$content= '<p class="info">'. _t('divers','nodata'). '</p>';
* affichage du calendrier
for($i= 0; $i< count($data); $i++ ) {
$workcal_id= $data[$i]['workcal_id'];
$workcal_title= formatText($data[$i]['workcal_task'], '2HTML');
$workcal_resume= formatText($data[$i]['workcal_task_details'], '2HTML');
$workcal_author= formatText($data[$i]['user_login'], '2HTML');
$workcal_date_publi= formatText($data[$i]['workcal_task_date_display'], '2HTML');
$link_table= array('rub'=> $GLOBALS['links'][U_L]['user-profile']['linkvalue'],'id'=> $data[$i]['workcal_posted_by'], 'name'=> $data[$i]['workcal_task']);
if($data[$i]['workcal_workshop_id'] == 999999999) {
$common_task = '<span class="task_common">' . _t('workshop', 'task_common') . '</span>';
$datetask= $data[$i]['workcal_task_date_display'];
$datetask2 = mktime (0, 0, 0, $mois, $jour, $annee);
if (($datetask2+ $inter)> $datenow) $class= 'in'; else $class= 'out';
$content.= '<div id="cal-'. $workcal_id. '" class="task_'. $class. '">'. END_LINE;
$content.= '<div class="task_meta"><p>'. $workcal_date_publi. '</p>';
$content.= '<p><a href="'. HrefMaker($link_table). '" title="'. formatText($workcal_author, '2ATT'). '">'. $workcal_author. '</a></p></div>';
$content.= '<div class="task_content"><h3>'. $workcal_title. '</h3>'. END_LINE;
$content.= '<div class="chapo">'. $workcal_resume. '</div></div>'. END_LINE;
$content.= '<br style="clear:both" />'. END_LINE;
$content.= '<p class="info">'. _t('divers','nodata'). '</p>';
* affichage du détail d'un groupe de travail
for($i= 0; $i< count($data); $i++ ) {
$link_self= array('rub'=> $GLOBALS['links'][U_L]['workgroup']['linkvalue'],'id'=> $workshop_id);
$link_table2= array('rub'=> $GLOBALS['links'][U_L]['workgroup']['linkvalue'],'filter'=> $GLOBALS['filters'][U_L]['theme']['linkvalue'],'id'=> $data[$i]['sdtheme_id'], 'name'=> $data[$i]['sdtheme_name']);
$link_table3= array('rub'=> $GLOBALS['links'][U_L]['workgroup']['linkvalue'],'filter'=> $GLOBALS['filters'][U_L]['level']['linkvalue'],'id'=> $data[$i]['workshop_level'], 'name'=> $data[$i]['level_name']);
$workshop_title= formatText($data[$i]['workshop_denomination'], '2HTML');
$workshop_resume= formatText($data[$i]['workshop_resume'], '2HTML');
//$workshop_comment=formatText(cutText($data[$i]['workshop_comment'],150), '2HTML');
$workshop_sdtheme= formatText($data[$i]['sdtheme_name'], '2HTML');
$workshop_level= formatText($data[$i]['level_name'], '2HTML');
$content.= '<h1>'. $workshop_title. '</h1>'. END_LINE;
$content.= '<p class="permalink">'. END_LINE;
//$content.='<h2>'._t('workshop','det').'</h2>'.END_LINE;
$content.= '<div class="chapo">'. $workshop_resume. '</div>'. END_LINE;
//$content.='<p>'.$workshop_comment.'</p>'.END_LINE;
$content.= '<p class="filter_info">'. _t('divers','level'). ' : <a href="'. HrefMaker($link_table3). '" title="'. formatText($workshop_level, '2ATT'). '" class="filter_info_level" >'. $workshop_level. '</a> '. END_LINE;
$content.= ' '. _t('divers','themeref'). ' : <a href="'. HrefMaker($link_table2). '" title="'. formatText($workshop_sdtheme, '2ATT'). '" class="filter_info_theme" >'. $workshop_sdtheme. '</a></p> '. END_LINE;
//._t('divers','sousthemeref').':'.$workshop_theme.'</p>'.END_LINE;
$content.= '<p class="info">'. _t('divers','nodata'). '</p>';
* affichage des utilisateurs/organisateurs d'un groupe de travail
$content1= '<p>'. _t('workshop','organizer2'). ' : ';
$content2= '<p>'. _t('workshop','user'). ' : ';
for($i= 0; $i< count($data); $i++ ) {
$workcal_author= formatText($data[$i]['user_login'], '2HTML');
$link_table= array('rub'=> $GLOBALS['links'][U_L]['user-profile']['linkvalue'],'id'=> $data[$i]['jwu_user_id'], 'name'=> $data[$i]['user_login']);
if($data[$i]['jwu_user_right']<> "U") {
$content1.= $sep_u. '<a href="'. HrefMaker($link_table). '" title="'. formatText($workcal_author, '2ATT'). '">'. $workcal_author. '</a>';
$content2.= $sep_a. '<a href="'. HrefMaker($link_table). '" title="'. formatText($workcal_author, '2ATT'). '">'. $workcal_author. '</a>';
$content= $content1. $content2;
$content.= '<p class="info">'. _t('workshop','no_user'). '</p>';
* affichage de la liste des rapports d'un groupe de travail
for($i= 0; $i< count($data); $i++ ) {
$link_table= array('rub'=> $GLOBALS['links'][U_L]['report']['linkvalue'],'id'=> $data[$i]['workrep_id'], 'name'=> $data[$i]['workrep_title']);
$workrep_title= formatText($data[$i]['workrep_title'], '2HTML');
$workrep_resume= formatText($data[$i]['workrep_resume'], '2HTML');
$workrep_date_publi= formatText($data[$i]['workrep_published_date_display'], '2HTML');
$content.= '<h3><a href="'. HrefMaker($link_table). '" title="'. formatText($workrep_title, '2ATT'). '">'. $workrep_title. '</a></h3>'. END_LINE;
$content.= '<div class="chapo">'. $workrep_resume. '</div>'. END_LINE;
$content.= '<p class="filter_info">'. _t('workshop','date_report'). ' : <span>'. $workrep_date_publi. '</span></p>'. END_LINE;
$content.= '<p class="info">'. _t('workshop','no_report'). '</p>';
* affichage de la liste des discussions
$result_workcom_list= $GLOBALS['sql_object'] -> DBSelect(SQL_getWorkcomList($debut, SELECT_LIMIT, $workshop_id));
$bdd_nb_com= $result_nb_com[0]['num_rows'];
$table_link= array('rub' => $GLOBALS['links'][U_L]['topic-list']['linkvalue'],'id' => $workshop_id);
echo $bdd_nb_com_display = "<p class=\"nb_sujet\">". $bdd_nb_com. " ". _t('workshop','nb_total_com'). "</p>\n";
if($result_workcom_list!= 0) {
$content= "<table cellspacing=\"1\" cellpadding=\"3\" class=\"table_discussion\" summary=\"". _t('workshop','com'). "\">". END_LINE;
$content.= "<td>". _t('divers','statut'). "</td>". END_LINE;
$content.= "<td>". _t('workshop','com_subject'). "</td>". END_LINE;
$content.= "<td>". _t('workshop','com_author'). "</td>". END_LINE;
$content.= "<td>". _t('workshop','com_nb_rep'). "</td>". END_LINE;
$content.= "<td>". _t('workshop','com_date_last'). "</td>". END_LINE;
for($i= 0; $i< count($result_workcom_list); $i++ ) {
$result_workcom_det= $GLOBALS['sql_object'] -> DBSelect(SQL_getWorkcom_detList($result_workcom_list[$i]['workcom_id']));
$link_user= array('rub'=> $GLOBALS['links'][U_L]['user-profile']['linkvalue'],'id'=> $result_workcom_list[$i]['workcom_user_id'], 'name' => $result_workcom_list[$i]['user_login']);
$link_det_com= array('rub'=> $GLOBALS['links'][U_L]['topic']['linkvalue'],'id'=> $result_workcom_list[$i]['workcom_id'], 'parentid' => $workshop_id, 'name' => $result_workcom_list[$i]['workcom_subject']);
$workcom_title= formatText(cutText($result_workcom_list[$i]['workcom_subject'], 70, 1), '2HTML');
$workcom_user= formatText(cutText($result_workcom_list[$i]['user_login'], 10, 1), '2HTML');
if ($result_workcom_list[$i]['workcom_statut']== 'C') {
else $content.= "<td> </td>\n";
$content.= "<td style=\"width:50%\"><a href=\"". HrefMaker($link_det_com). "\" title=\"". formatText($workcom_title, '2ATT'). "\" class=\"table_title\">". $workcom_title. "</a></td>". END_LINE;
$content.= "<td><a href=\"". HrefMaker($link_user). "\" title=\"". formatText($workcom_user, '2ATT'). "\" class=\"table_auth\">". $workcom_user. "</a></td>". END_LINE;
if ($result_workcom_det[0]['nb_rep']== "") {
else $content.= "<td style=\"width:11%\">". $result_workcom_det[0]['nb_rep']. "</td>". END_LINE;
if ($result_workcom_det[0]['workcom_date_crea_display']== "") {
$content.= "<td>". $result_workcom_list[$i]['workcom_date_crea_display']. "</td>". END_LINE;
$content.= "<td>". $result_workcom_list[$i]['workcom_date_crea_display']. "</td>". END_LINE;
$content= '<p class="info">'. _t('workshop','no_com'). '</p>'. END_LINE;
* affichage d'une discussion
$topic_state= $dataroot[0]['workcom_statut'];
$data= $GLOBALS['sql_object'] -> DBSelect(SQL_getOnetopicWorkcom2($workshop_id, $topic_id, $root= - 1, $debut, SELECT_LIMIT));
$bdd_nb_com= $result_nb_com[0]['nb_rep'];
$table_link= array('rub' => $GLOBALS['links'][U_L]['topic']['linkvalue'],'id' => $topic_id, 'parentid' => $workshop_id, 'name' => $dataroot[0]['workcom_subject'] );
$post_title= formatText($dataroot[0]['workcom_subject'], '2HTML');
$post_body= formatText($dataroot[0]['workcom_body'], '2HTML');
echo "<p class=\"nb_sujet\">". $bdd_nb_com_display = $bdd_nb_com. " ". _t('workshop','nb_total_com_mes'). "</p>". END_LINE;
echo '<h1>'. _t('workshop','com_name'). ' : '. $post_title. '</h1>'. END_LINE;
$complete_uri= '../'. $dataroot[0]['profile_avatar'];
if($dataroot[0]['profile_avatar'] == "") $user_profile_avatar= '<img src="'. THEME_PUBLIC_PATH. '/images/no_avatar.png" alt="'. formatText($dataroot[0]['user_login'], '2HTML'). '" class="user_profile"/>';
else $user_profile_avatar= '<img src="'. $complete_uri. '" alt="'. formatText($dataroot[0]['user_login'], '2HTML'). '" class="user_profile"/>';
$link_user= array('rub'=> $GLOBALS['links'][U_L]['user-profile']['linkvalue'],'id'=> $dataroot[0]['workcom_user_id'], 'name' => $dataroot[0]['user_login']);
$content.= '<div class="blocksujet" id="msg-'. $topic_id. '">'. END_LINE;
$content.= '<p class="workshop_auth_sujet">'. $user_profile_avatar. '<a href="'. HrefMaker($link_user). '" title="'. formatText($post_user, '2ATT'). '">'. $post_user. '</a><br />'. END_LINE;
$content.= '<span class="workshop_date_sujet">'. _t('statut', 'published_on'). ' '. $dataroot[0]['workcom_date_crea_display']. '</span>'. END_LINE;
$content.= '<div class="post-content">'. END_LINE;
$content.= '<h3>'. $post_title. '</h3>'. END_LINE;
$content.= '<div class="body">'. $post_body. '</div>'. END_LINE;
for($i= 0; $i< count($data); $i++ ) {
$class = ($i & 1) ? '' : ' odd';
$post_title= formatText($data[$i]['workcom_subject'], '2HTML');
$post_body= formatText($data[$i]['workcom_body'], '2HTML');
$post_id= $data[$i]['workcom_id'];
$link_user= array('rub'=> $GLOBALS['links'][U_L]['user-profile']['linkvalue'],'id'=> $data[$i]['workcom_user_id'], 'name'=> $data[$i]['user_login']);
$link_edit= array('rub'=> $GLOBALS['links'][U_L]['post-update']['linkvalue'],'parentid'=> $workshop_id, 'id'=> $data[$i]['workcom_id'], 'parentparentid'=> $topic_id, 'name'=> $data[$i]['workcom_subject']);
$complete_uri= '../'. $data[$i]['profile_avatar'];
if($data[$i]['profile_avatar'] == "") $user_profile_avatar= '<img src="'. THEME_PUBLIC_PATH. '/images/no_avatar.png" alt="'. formatText($data[$i]['user_login'], '2HTML'). '" class="user_profile"/>';
else $user_profile_avatar= '<img src="'. $complete_uri. '" alt="'. formatText($data[$i]['user_login'], '2HTML'). '" class="user_profile"/>';
if(isset ($_COOKIE['linea21']['id'])) {
if ($data[$i]['workcom_user_id']== $_COOKIE['linea21']['id'] && $topic_state == 'P') {
$edit= '<span><a class="edit_topic" href="'. HrefMaker($link_edit). '" title="'. formatText(_t('workshop','mod_com_mes'), '2ATT'). '"><span>'. _t('divers','modify'). '</span></a></span>'. END_LINE;
$content.= '<div class="blocksujet'. $class. '" id="msg-'. $post_id. '">'. END_LINE;
$content.= '<p class="workshop_auth_sujet">'. $user_profile_avatar. '<a href="'. HrefMaker($link_user). '" title="'. formatText($post_user, '2ATT'). '">'. $post_user. '</a><br />'. END_LINE;
$content.= '<span class="workshop_date_sujet">'. _t('statut', 'published_on'). ' '. $data[$i]['workcom_date_crea_display']. '</span>'. END_LINE;
$content.= '<div class="post-content">'. END_LINE;
$content.= '<h3>'. $post_title. '</h3>'. END_LINE;
$content.= '<div class="body">'. $post_body. '</div>'. END_LINE;
$content.= '<p class="info">'. _t('workshop','no_com_rep'). '</p>';
if ($topic_state== "P") echo GetFormAddPost($workshop_id, $topic_id, '', $last_title);
else echo $content= '<p class="info">'. _t('workshop','com_p_lock'). '</p>';
function AddTopic($workshop_id, $debut, $body, $title, $confirm_update)
//test new value for this post in form
notifyUsersMsg(array('id' => $workshop_id, 'action' => 'topic_alert', 'topic_subject' => $title, 'topic_body' => $body));
echo '<p class="confirm">'. _t('workshop','confirm_add_com'). '</p>'. END_LINE;
echo "<p class=\"error\">". $integrity. "</p>";
function AddPost($workshop_id, $topic_id, $debut, $body, $title)
$topic_state= $dataroot[0]['workcom_statut'];
if ($topic_state<> "P") DisplayTopic($workshop_id, $topic_id, $debut);
notifyUsersMsg(array('action' => 'post_alert', 'topic_subject' => $title, 'topic_body' => $body, 'tid' => $topic_id, 'parentid' => $workshop_id, 'id' => $post_id));
echo '<p class="confirm">'. _t('workshop','confirm_add_com'). '</p>'. END_LINE;
echo '<script type="text/javascript">
setTimeout(\'jQuery.smoothScroll({scrollTarget: "#msg-'. $post_id. '"});\', '. SCROLL_DELAY. ');
echo "<p class=\"error\">". $integrity. "</p>";
* Mise à jour d'un message
function UpdatePost($workshop_id, $topic_id, $debut, $new_body, $new_title, $post_id, $confirm_update)
$old_title= formatText($data[0]['workcom_subject'], '2FIELD');
$old_body= formatText($data[0]['workcom_body'], '2FIELD');
$topic_state= $data[0]['workcom_statut'];
if ($topic_state<> "P") DisplayTopic($workshop_id, $topic_id, $debut);
//display old value for this post in form
if(!$confirm_update) echo GetFormModPost($workshop_id, $topic_id, $post_id, $old_body, $old_title);
//test new value for this post in form
$post_id= ModPersistentPost($new_title, $new_body, $post_id, $workshop_id, $topic_id);
echo '<p class="confirm">'. _t('workshop','confirm_mod_com'). '</p>'. END_LINE;
echo "<p class=\"error\">". $integrity. "</p>";
echo GetFormModPost($workshop_id, $topic_id, $post_id, $old_body, $old_title);
* formulaire d'ajout d'un Topic
$form= '<h2>'. _t('workshop','add_com'). '</h2>'. END_LINE;
$form.= '<form action="index.php" method="post">'. END_LINE;
$form.= '<label for="title" class="labelised">'. ucfirst(_t('workshop','com_subject')). ' : </label>'. END_LINE;
$form.= '<input type="text" maxlength="100" size="40" name="title" id="title" value="'. $title. '" class="shorttextfield" /><br />'. END_LINE;
$form.= '<label for="body" class="labelised">'. _t('workshop','com_body'). ' : </label>'. END_LINE;
$form.= '<textarea id="body" name="body" rows="10" cols="50" class="textfield">'. $body. '</textarea><br />'. END_LINE;
$form.= '<input type="hidden" value="'. $GLOBALS['links'][U_L]['topic-add']['linkvalue']. '" name="rub" id="rub" />'. END_LINE;
$form.= '<input type="hidden" value="'. $workshop_id. '" name="id" id="id" />'. END_LINE;
$form.= '<input type="hidden" value="true" name="confirm" id="confirm" />'. END_LINE;
$form.= '<input type="submit" value="'. _t('btn','valid'). '" name="valider" id="valider" class="submitbut" />'. END_LINE;
* formulaire de modification d'un Post
* @param integer $post_id
function GetFormModPost($workshop_id, $topic_id, $post_id, $body, $title) {
$form= '<h2>'. _t('workshop','mod_com_mes'). '</h2>'. END_LINE;
$form.= '<form action="index.php" method="post">'. END_LINE;
$form.= '<label for="title" class="labelised">'. _t('workshop','com_subject'). ' : </label>'. END_LINE;
$form.= '<input type="text" maxlength="50" name="title" id="title" value="'. $title. '" class="textfield" /><br />'. END_LINE;
$form.= '<label for="body" class="labelised">'. _t('workshop','com_body'). ' : </label>'. END_LINE;
$form.= '<textarea id="body" name="body" rows="10" cols="50" class="textfield">'. $body. '</textarea>'. END_LINE;
$form.= '<input type="hidden" value="'. $GLOBALS['links'][U_L]['post-update']['linkvalue']. '" name="rub" id="rub" />'. END_LINE;
$form.= '<input type="hidden" value="'. $workshop_id. '" name="parentid" id="parentid" />'. END_LINE;
$form.= '<input type="hidden" value="'. $post_id. '" name="id" id="id" />'. END_LINE;
$form.= '<input type="hidden" value="true" name="confirm" id="confirm" />'. END_LINE;
$form.= '<input type="hidden" value="'. $topic_id. '" name="parentparentid" id="parentparentid" />'. END_LINE;
$form.= '<input type="submit" value="'. _t('btn','valid'). '" name="valider" id="valider" class="submitbut" />'. END_LINE;
* formulaire d'ajout d'un Post
function GetFormAddPost($workshop_id, $topic_id, $body= '', $title= ''){
$form= '<h2>'. _t('workshop','add_com_mes'). '</h2>'. END_LINE;
$form.= '<form action="index.php" method="post">'. END_LINE;
$form.= '<label for="title" class="labelised">'. _t('workshop','com_subject'). ' : </label>'. END_LINE;
$form.= '<input type="text" maxlength="100" size="40" name="title" id="title" value="'. $title. '" class="shorttextfield" /><br />'. END_LINE;
$form.= '<label for="body" class="labelised">'. _t('workshop','com_body'). ' : </label>'. END_LINE;
$form.= '<textarea id="body" name="body" rows="10" cols="50" class="textfield">'. $body. '</textarea><br />'. END_LINE;
$form.= '<input type="hidden" value="'. $GLOBALS['links'][U_L]['post-add']['linkvalue']. '" name="rub" id="rub" />'. END_LINE;
$form.= '<input type="hidden" value="'. $topic_id. '" name="id" id="id" />'. END_LINE;
$form.= '<input type="hidden" value="'. $workshop_id. '" name="parentid" id="parentid" />'. END_LINE;
$form.= '<input type="submit" alt="'. _t('btn','valid'). '" value="'. _t('btn','valid'). '" name="valider" id="valider" class="submitbut" />'. END_LINE;
* Vérification de l'intégrité des données
* @param $workshop_com_object
if (strlen($title) < 3) $integrity= _t('workshop','com_no_subject');
if (strlen($body) < 10) $integrity= _t('workshop','com_no_body');
* Ajout dans la base d'un nouveau Post
if(isset ($_COOKIE['linea21']['id'])) {
$user_id= $_COOKIE['linea21']['id'];
include_once('../class/class.workshop_com.php');
$table[4] = $workshop_id;
$result= $workshop_com_object->AddCom($table , $GLOBALS['sql_object']);
} else return "<p class=\"error\">". _t('divers','errorauth'). "</p>";
* Modification dans la base d'un Post
if(isset ($_COOKIE['linea21']['id'])) {
$user_id= $_COOKIE['linea21']['id'];
include_once('../class/class.workshop_com.php');
$result= $workshop_com_object->ModifyComUser($mes_id, $table , $user_id, $GLOBALS['sql_object']);
} else return "<p class=\"error\">". _t('divers','errorauth'). "</p>";
|