[svn r10808] bugfix: error when editing student publication

http://www.dokeos.com/forum/viewtopic.php?t=8294
skala
Patrick Cool 19 years ago
parent 04643425ca
commit 4dd142640c
  1. 200
      main/work/work.php

@ -10,7 +10,7 @@
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
See "documentation/licence.html" more details. See "documentation/licence.html" more details.
Contact: Contact:
Dokeos Dokeos
Rue des Palais 44 Paleizenstraat Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium B-1030 Brussels - Belgium
@ -23,8 +23,8 @@
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University - ability for course admins to specify wether uploaded documents are visible or invisible by default. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University - ability for course admins to specify wether uploaded documents are visible or invisible by default.
* @author Roan Embrechts, code refactoring and virtual course support * @author Roan Embrechts, code refactoring and virtual course support
* @author Frederic Vauthier, directories management * @author Frederic Vauthier, directories management
* @version $Id: work.php 10570 2006-12-29 13:57:25Z fvauthier $ * @version $Id: work.php 10808 2007-01-20 19:59:25Z pcool $
* *
* @todo refactor more code into functions, use quickforms, coding standards, ... * @todo refactor more code into functions, use quickforms, coding standards, ...
*/ */
/** /**
@ -58,14 +58,14 @@
* usually /var/www/html * usually /var/www/html
* *
* Modified by Patrick Cool, february 2004: * Modified by Patrick Cool, february 2004:
* Allow course managers to specify wether newly uploaded documents should * Allow course managers to specify wether newly uploaded documents should
* be visible or unvisible by default * be visible or unvisible by default
* This is ideal for reviewing the uploaded documents before the document * This is ideal for reviewing the uploaded documents before the document
* is available for everyone. * is available for everyone.
* *
* note: maybe the form to change the behaviour should go into the course * note: maybe the form to change the behaviour should go into the course
* properties page? * properties page?
* note 2: maybe a new field should be created in the course table for * note 2: maybe a new field should be created in the course table for
* this behaviour. * this behaviour.
* *
* We now use the show_score field since this is not used. * We now use the show_score field since this is not used.
@ -79,38 +79,39 @@
============================================================================== ==============================================================================
*/ */
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file[] = "work"; $language_file[] = "work";
$language_file[] = "document"; $language_file[] = "document";
// Section (for the tabs) // Section (for the tabs)
$this_section=SECTION_COURSES; $this_section=SECTION_COURSES;
// @todo why is this needed? // @todo why is this needed?
//session //session
if(isset($_GET['id_session'])) if(isset($_GET['id_session']))
{ {
$_SESSION['id_session'] = $_GET['id_session']; $_SESSION['id_session'] = $_GET['id_session'];
} }
/* /*
----------------------------------------------------------- -----------------------------------------------------------
Including necessary files Including necessary files
----------------------------------------------------------- -----------------------------------------------------------
*/ */
include('../inc/global.inc.php'); include('../inc/global.inc.php');
include_once(api_get_path(LIBRARY_PATH) . "course.lib.php"); include_once(api_get_path(LIBRARY_PATH) . "course.lib.php");
include_once(api_get_path(LIBRARY_PATH) . "debug.lib.inc.php"); include_once(api_get_path(LIBRARY_PATH) . "debug.lib.inc.php");
include_once(api_get_path(LIBRARY_PATH) . "events.lib.inc.php"); include_once(api_get_path(LIBRARY_PATH) . "events.lib.inc.php");
include_once('work.lib.php'); include_once('work.lib.php');
/* /*
----------------------------------------------------------- -----------------------------------------------------------
Table definitions Table definitions
----------------------------------------------------------- -----------------------------------------------------------
*/ */
$tool_name = get_lang(TOOL_STUDENTPUBLICATION); $main_course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$main_course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY); $iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
@ -119,8 +120,7 @@ $iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
Constants and variables Constants and variables
----------------------------------------------------------- -----------------------------------------------------------
*/ */
$tool_name = get_lang('StudentPublication');
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$course_code = $_course['sysCode']; $course_code = $_course['sysCode'];
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $_SESSION['id_session']); $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $_SESSION['id_session']);
@ -139,7 +139,6 @@ $make_invisible = $_REQUEST['make_invisible'];
$make_visible = $_REQUEST['make_visible']; $make_visible = $_REQUEST['make_visible'];
$origin = $_REQUEST['origin']; $origin = $_REQUEST['origin'];
$submitGroupWorkUrl = $_REQUEST['submitGroupWorkUrl']; $submitGroupWorkUrl = $_REQUEST['submitGroupWorkUrl'];
$submitWork = $_REQUEST['submitWork'];
$title = $_REQUEST['title']; $title = $_REQUEST['title'];
$uploadvisibledisabled = $_REQUEST['uploadvisibledisabled']; $uploadvisibledisabled = $_REQUEST['uploadvisibledisabled'];
$id = (int) $_REQUEST['id']; $id = (int) $_REQUEST['id'];
@ -158,7 +157,7 @@ elseif (isset($_POST['curdirpath']) && $_POST['curdirpath']!='')
{ {
$cur_dir_path = preg_replace('#/\.\./#','/',$_POST['curdirpath']); //escape '..' hack attempts $cur_dir_path = preg_replace('#/\.\./#','/',$_POST['curdirpath']); //escape '..' hack attempts
} }
else else
{ {
$cur_dir_path = '/'; $cur_dir_path = '/';
} }
@ -171,9 +170,12 @@ $cur_dir_path_url = urlencode($cur_dir_path);
//prepare a form of path that can easily be added at the end of any url ending with "work/" //prepare a form of path that can easily be added at the end of any url ending with "work/"
$my_cur_dir_path = $cur_dir_path; $my_cur_dir_path = $cur_dir_path;
if($my_cur_dir_path == '/'){ if($my_cur_dir_path == '/')
{
$my_cur_dir_path = ''; $my_cur_dir_path = '';
}elseif(substr($my_cur_dir_path,-1,1)!='/'){ }
elseif(substr($my_cur_dir_path,-1,1)!='/')
{
$my_cur_dir_path = $my_cur_dir_path.'/'; $my_cur_dir_path = $my_cur_dir_path.'/';
} }
/* /*
@ -207,7 +209,7 @@ if(isset($_POST['cancelForm']) && !empty($_POST['cancelForm']))
exit(); exit();
} }
if ($submitWork || $submitGroupWorkUrl) if ($_POST['submitWork'] || $submitGroupWorkUrl)
{ {
// these libraries are only used for upload purpose // these libraries are only used for upload purpose
// so we only include them when necessary // so we only include them when necessary
@ -233,7 +235,8 @@ if($_SERVER['REQUEST_METHOD'] == 'POST' && !sizeof($_POST))
} }
//toolgroup comes from group. the but of tis variable is to limit post to the group of the student //toolgroup comes from group. the but of tis variable is to limit post to the group of the student
if (!api_is_course_admin()){ if (!api_is_course_admin()){
if (!empty($_GET['toolgroup'])){ if (!empty($_GET['toolgroup']))
{
$toolgroup=$_GET['toolgroup']; $toolgroup=$_GET['toolgroup'];
api_session_register('toolgroup'); api_session_register('toolgroup');
} }
@ -256,18 +259,14 @@ else
//stats //stats
event_access_tool(TOOL_STUDENTPUBLICATION); event_access_tool(TOOL_STUDENTPUBLICATION);
$is_allowed_to_edit = api_is_allowed_to_edit(); //has to come after display_tool_view_option(); $is_allowed_to_edit = api_is_allowed_to_edit(); //has to come after display_tool_view_option();
//api_display_tool_title($tool_name); //api_display_tool_title($tool_name);
/* /*
============================================================================== ==============================================================================
MAIN CODE MAIN CODE
============================================================================== ==============================================================================
*/ */
if (isset($_POST['changeProperties'])) if (isset($_POST['changeProperties']))
{ {
@ -296,14 +295,14 @@ Display::display_introduction_section(TOOL_STUDENTPUBLICATION);
----------------------------------------------------------- -----------------------------------------------------------
COMMANDS SECTION (reserved for course administrator) COMMANDS SECTION (reserved for course administrator)
----------------------------------------------------------- -----------------------------------------------------------
*/ */
if ($is_allowed_to_edit) if (api_is_allowed_to_edit())
{ {
/*------------------------------------------- /*-------------------------------------------
DELETE WORK COMMAND DELETE WORK COMMAND
-----------------------------------------*/ -----------------------------------------*/
if ($delete) if ($delete)
{ {
if ($delete == "all") if ($delete == "all")
{ {
$queryString1 = "SELECT url FROM ".$work_table.""; $queryString1 = "SELECT url FROM ".$work_table."";
@ -439,7 +438,8 @@ if ($is_allowed_to_edit)
/* ------------------- /* -------------------
* Delete dir command * Delete dir command
--------------------*/ --------------------*/
if(!empty($_REQUEST['delete_dir'])){ if(!empty($_REQUEST['delete_dir']))
{
//TODO implement //TODO implement
del_dir($base_work_dir.'/',$_REQUEST['delete_dir']); del_dir($base_work_dir.'/',$_REQUEST['delete_dir']);
Display::display_normal_message($_REQUEST['delete_dir'].' '.get_lang('DirDeleted')); Display::display_normal_message($_REQUEST['delete_dir'].' '.get_lang('DirDeleted'));
@ -447,12 +447,13 @@ if ($is_allowed_to_edit)
/* ---------------------- /* ----------------------
* Move file form request * Move file form request
----------------------- */ ----------------------- */
if(!empty($_REQUEST['move'])){ if(!empty($_REQUEST['move']))
{
$folders = get_subdirs_list($base_work_dir,1); $folders = get_subdirs_list($base_work_dir,1);
Display::display_normal_message(build_move_to_selector($folders,$cur_dir_path,$_REQUEST['move'])); Display::display_normal_message(build_move_to_selector($folders,$cur_dir_path,$_REQUEST['move']));
} }
/* ------------------ /* ------------------
* Move file command * Move file command
------------------- */ ------------------- */
if (isset($_POST['move_to']) && isset($_POST['move_file'])) if (isset($_POST['move_to']) && isset($_POST['move_file']))
{ {
@ -461,7 +462,8 @@ if ($is_allowed_to_edit)
if($move_to == '/' or empty($move_to)) if($move_to == '/' or empty($move_to))
{ {
$move_to = ''; $move_to = '';
}elseif(substr($move_to,-1,1)!='/') }
elseif(substr($move_to,-1,1)!='/')
{ {
$move_to = $move_to.'/'; $move_to = $move_to.'/';
} }
@ -496,15 +498,19 @@ if ($is_allowed_to_edit)
COMMANDS SECTION (reserved for others - check they're authors each time) COMMANDS SECTION (reserved for others - check they're authors each time)
----------------------------------------------------------- -----------------------------------------------------------
*/ */
else{ else
$iprop_table = Database::get_course_table(ITEM_PROPERTY_TABLE); {
$iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$user_id = api_get_user_id(); $user_id = api_get_user_id();
/*------------------------------------------- /*-------------------------------------------
DELETE WORK COMMAND DELETE WORK COMMAND
-----------------------------------------*/ -----------------------------------------*/
if ($delete) if ($delete)
{ {
if ($delete == "all"){/*not authorized to this user */} if ($delete == "all")
{
/*not authorized to this user */
}
else else
{ {
//Get the author ID for that document from the item_property table //Get the author ID for that document from the item_property table
@ -512,7 +518,7 @@ else{
$author_qry = api_sql_query($author_sql,__FILE__,__LINE__); $author_qry = api_sql_query($author_sql,__FILE__,__LINE__);
if(Database::num_rows($author_qry)==1) if(Database::num_rows($author_qry)==1)
{ {
//we found the current user is the author //we found the current user is the author
$queryString1 = "SELECT url FROM ".$work_table." WHERE id = '$delete'"; $queryString1 = "SELECT url FROM ".$work_table." WHERE id = '$delete'";
$queryString2 = "DELETE FROM ".$work_table." WHERE id='$delete'"; $queryString2 = "DELETE FROM ".$work_table." WHERE id='$delete'";
$result1 = api_sql_query($queryString1,__FILE__,__LINE__); $result1 = api_sql_query($queryString1,__FILE__,__LINE__);
@ -536,7 +542,6 @@ else{
/*------------------------------------------- /*-------------------------------------------
EDIT COMMAND WORK COMMAND EDIT COMMAND WORK COMMAND
-----------------------------------------*/ -----------------------------------------*/
if ($edit) if ($edit)
{ {
//Get the author ID for that document from the item_property table //Get the author ID for that document from the item_property table
@ -544,14 +549,14 @@ else{
$author_qry = api_sql_query($author_sql,__FILE__,__LINE__); $author_qry = api_sql_query($author_sql,__FILE__,__LINE__);
if(Database::num_rows($author_qry)==1) if(Database::num_rows($author_qry)==1)
{ {
//we found the current user is the author //we found the current user is the author
$sql = "SELECT * FROM ".$work_table." WHERE id='".$edit."'"; $sql = "SELECT * FROM ".$work_table." WHERE id='".$edit."'";
$result = api_sql_query($sql,__FILE__,__LINE__); $result = api_sql_query($sql,__FILE__,__LINE__);
if ($result) if ($result)
{ {
$row = mysql_fetch_array($result); $row = mysql_fetch_array($result);
$workTitle = $row ['title' ]; $workTitle = $row ['title' ];
$workAuthor = $row ['author' ]; $workAuthor = $row ['author' ];
$workDescription = $row ['description']; $workDescription = $row ['description'];
@ -565,11 +570,11 @@ else{
============================================================================== ==============================================================================
FORM SUBMIT PROCEDURE FORM SUBMIT PROCEDURE
============================================================================== ==============================================================================
*/ */
$error_message=""; $error_message="";
if($submitWork && $is_course_member) if($_POST['submitWork'] && $is_course_member)
{ {
if($_FILES['file']['size']) if($_FILES['file']['size'])
{ {
@ -597,12 +602,15 @@ if($submitWork && $is_course_member)
// compose a unique file name to avoid any conflict // compose a unique file name to avoid any conflict
$new_file_name = uniqid('').$new_file_name; $new_file_name = uniqid('').$new_file_name;
if (isset($_SESSION['toolgroup'])) if (isset($_SESSION['toolgroup']))
{ {
$post_group_id = $_SESSION['toolgroup']; $post_group_id = $_SESSION['toolgroup'];
} }
else{$post_group_id = '0';} else
{
$post_group_id = '0';
}
//if we come from the group tools the groupid will be saved in $work_table //if we come from the group tools the groupid will be saved in $work_table
move_uploaded_file($_FILES['file']['tmp_name'],$updir.$my_cur_dir_path.$new_file_name); move_uploaded_file($_FILES['file']['tmp_name'],$updir.$my_cur_dir_path.$new_file_name);
@ -628,7 +636,7 @@ if($submitWork && $is_course_member)
api_sql_query($sql_add_publication,__FILE__,__LINE__); api_sql_query($sql_add_publication,__FILE__,__LINE__);
$Id = mysql_insert_id(); $Id = mysql_insert_id();
api_item_property_update($_course,'work',$Id,get_lang('DocumentAdded'),$user_id); api_item_property_update($_course,'work',$Id,get_lang('DocumentAdded'),$user_id);
$succeed = true; $succeed = true;
} }
@ -682,20 +690,20 @@ if($submitWork && $is_course_member)
{ {
$is_author=true; $is_author=true;
} }
if ($id && ($is_allowed_to_edit or $is_author)) if ($id && ($is_allowed_to_edit or $is_author))
{ {
if( ! $title ) if( ! $title )
{ {
$title = basename($newWorkUrl); $title = basename($newWorkUrl);
} }
$sql = "UPDATE ".$work_table." $sql = "UPDATE ".$work_table."
SET title = '".$title."', SET title = '".$title."',
description = '".$description."', description = '".$description."',
author = '".$authors."' author = '".$authors."'
WHERE id = '".$id."'"; WHERE id = '".$id."'";
api_sql_query($sql,__FILE__,__LINE__); api_sql_query($sql,__FILE__,__LINE__);
$insertId = $id; $insertId = $id;
api_item_property_update($_course,'work',$insertId,get_lang('DocumentUpdated'),$user_id); api_item_property_update($_course,'work',$insertId,get_lang('DocumentUpdated'),$user_id);
@ -707,7 +715,7 @@ if($submitWork && $is_course_member)
} }
} }
} }
if ($submitWork && $succeed &&!$id) //last value is to check this is not "just" an edit if ($_POST['submitWork'] && $succeed &&!$id) //last value is to check this is not "just" an edit
{ {
//YW Tis part serve to send a e-mail to the tutors when a new file is send //YW Tis part serve to send a e-mail to the tutors when a new file is send
// Lets predefine some variables. Be sure to change the from address! // Lets predefine some variables. Be sure to change the from address!
@ -726,17 +734,17 @@ if ($submitWork && $succeed &&!$id) //last value is to check this is not "just"
$emailfromaddr = get_setting('emailAdministrator'); $emailfromaddr = get_setting('emailAdministrator');
$emailfromname = get_setting('siteName'); $emailfromname = get_setting('siteName');
$emailsubject = "[".get_setting('siteName')."] "; $emailsubject = "[".get_setting('siteName')."] ";
// The body can be as long as you wish, and any combination of text and variables // The body can be as long as you wish, and any combination of text and variables
//$emailbody=get_lang('SendMailBody').' '.api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()." ($title)\n\n".get_setting('administratorName')." ".get_setting('administratorSurname')."\n". get_lang('Manager'). " ".get_setting('siteName')."\nT. ".get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".get_setting('emailAdministrator'); //$emailbody=get_lang('SendMailBody').' '.api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()." ($title)\n\n".get_setting('administratorName')." ".get_setting('administratorSurname')."\n". get_lang('Manager'). " ".get_setting('siteName')."\nT. ".get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".get_setting('emailAdministrator');
$emailbody=get_lang('SendMailBody').' '.api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()." ($title)\n\n".get_setting('administratorName')." ".get_setting('administratorSurname')."\n". get_lang('Manager'). " ".get_setting('siteName')."\n" .get_lang('Email') ." : ".get_setting('emailAdministrator'); $emailbody=get_lang('SendMailBody').' '.api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()." ($title)\n\n".get_setting('administratorName')." ".get_setting('administratorSurname')."\n". get_lang('Manager'). " ".get_setting('siteName')."\n" .get_lang('Email') ." : ".get_setting('emailAdministrator');
// Here we are forming one large header line // Here we are forming one large header line
// Every header must be followed by a \n except the last // Every header must be followed by a \n except the last
$emailheaders = "From: ".get_setting('administratorSurname')." ".get_setting('administratorName')." <".get_setting('emailAdministrator').">\n"; $emailheaders = "From: ".get_setting('administratorSurname')." ".get_setting('administratorName')." <".get_setting('emailAdministrator').">\n";
$emailheaders .= "Reply-To: ".get_setting('emailAdministrator'); $emailheaders .= "Reply-To: ".get_setting('emailAdministrator');
// Because I predefined all of my variables, this api_send_mail() function looks nice and clean hmm? // Because I predefined all of my variables, this api_send_mail() function looks nice and clean hmm?
@api_send_mail( $emailto, $emailsubject, $emailbody, $emailheaders); @api_send_mail( $emailto, $emailsubject, $emailbody, $emailheaders);
} }
@ -757,13 +765,13 @@ if ($submitWork && $succeed &&!$id) //last value is to check this is not "just"
/*======================================= /*=======================================
Display links to upload form and tool options Display links to upload form and tool options
=======================================*/ =======================================*/
display_action_links($cur_dir_path,$always_show_tool_options, $always_show_upload_form); display_action_links($cur_dir_path,$always_show_tool_options, $always_show_upload_form);
/*======================================= /*=======================================
Display form to upload document Display form to upload document
=======================================*/ =======================================*/
if($is_course_member) if($is_course_member)
{ {
if ($display_upload_form || $edit) if ($display_upload_form || $edit)
@ -781,15 +789,15 @@ if ($submitWork && $succeed &&!$id) //last value is to check this is not "just"
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."?curdirpath=$cur_dir_path&origin=$origin\" enctype=\"multipart/form-data\" >\n", echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."?curdirpath=$cur_dir_path&origin=$origin\" enctype=\"multipart/form-data\" >\n",
"<table>\n"; "<table>\n";
if(!empty($error_message)) Display::display_error_message($error_message); if(!empty($error_message)) Display::display_error_message($error_message);
if ($submitGroupWorkUrl) // For user comming from group space to publish his work if ($submitGroupWorkUrl) // For user comming from group space to publish his work
{ {
$realUrl = str_replace ($_configuration['root_sys'], $_configuration['root_web'], str_replace("\\", "/", realpath($submitGroupWorkUrl) ) ) ; $realUrl = str_replace ($_configuration['root_sys'], $_configuration['root_web'], str_replace("\\", "/", realpath($submitGroupWorkUrl) ) ) ;
echo "<tr>\n", echo "<tr>\n",
"<td align=\"right\">", "<td align=\"right\">",
"<input type=\"hidden\" name=\"newWorkUrl\" value=\"",$submitGroupWorkUrl,"\">", "<input type=\"hidden\" name=\"newWorkUrl\" value=\"",$submitGroupWorkUrl,"\">",
get_lang("Document")," : ", get_lang("Document")," : ",
@ -797,76 +805,76 @@ if ($submitWork && $succeed &&!$id) //last value is to check this is not "just"
"<td align=\"right\">", "<td align=\"right\">",
"<a href=\"",format_url($submitGroupWorkUrl),"\">",$realUrl,"</a>", "<a href=\"",format_url($submitGroupWorkUrl),"\">",$realUrl,"</a>",
"</td>\n", "</td>\n",
"</tr>\n"; "</tr>\n";
} }
elseif ($edit && ($is_allowed_to_edit or $is_author)) elseif ($edit && ($is_allowed_to_edit or $is_author))
{ {
$workUrl = $currentCourseRepositoryWeb.$workUrl; $workUrl = $currentCourseRepositoryWeb.$workUrl;
echo "<tr>\n", echo "<tr>\n",
"<td>", "<td>",
"<input type=\"hidden\" name=\"id\" value=\"",$edit,"\">\n", "<input type=\"hidden\" name=\"id\" value=\"",$edit,"\">\n",
get_lang('Document')," : ", get_lang('Document')," : ",
"</td>\n", "</td>\n",
"<td>", "<td>",
"<a href=\"",$workUrl,"\">",$workUrl,"</a>", "<a href=\"",$workUrl,"\">",$workUrl,"</a>",
"</td>\n", "</td>\n",
"</tr>\n"; "</tr>\n";
} }
else // else standard upload option else // else standard upload option
{ {
echo "<tr>\n", echo "<tr>\n",
"<td align=\"right\"><strong>", "<td align=\"right\"><strong>",
get_lang("DownloadFile"),"</strong>&nbsp;&nbsp;", get_lang("DownloadFile"),"</strong>&nbsp;&nbsp;",
"</td>\n", "</td>\n",
"<td>", "<td>",
"<input type=\"file\" name=\"file\" size=\"20\">", "<input type=\"file\" name=\"file\" size=\"20\">",
"</td>\n", "</td>\n",
"</tr>\n"; "</tr>\n";
} }
if(empty($authors)) if(empty($authors))
{ {
$authors=$_user['lastName']." ".$_user['firstName']; $authors=$_user['lastName']." ".$_user['firstName'];
} }
echo "<tr>\n", echo "<tr>\n",
"<td align=\"right\"><strong>", "<td align=\"right\"><strong>",
get_lang("TitleWork"),"</strong>&nbsp;&nbsp;", get_lang("TitleWork"),"</strong>&nbsp;&nbsp;",
"</td>\n", "</td>\n",
"<td>", "<td>",
"<input type=\"text\" name=\"title\" value=\"",($edit?htmlentities(stripslashes($workTitle)):htmlentities(stripslashes($title))),"\" size=\"30\">", "<input type=\"text\" name=\"title\" value=\"",($edit?htmlentities(stripslashes($workTitle)):htmlentities(stripslashes($title))),"\" size=\"30\">",
"</td>\n", "</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
"<td valign=\"top\" align=\"right\"><strong>", "<td valign=\"top\" align=\"right\"><strong>",
get_lang("Authors")."</strong>&nbsp;&nbsp;", get_lang("Authors")."</strong>&nbsp;&nbsp;",
"</td>\n", "</td>\n",
"<td>", "<td>",
"<input type=\"text\" name=\"authors\" value=\"",($edit?htmlentities(stripslashes($workAuthor)):htmlentities(stripslashes($authors))),"\" size=\"30\">\n", "<input type=\"text\" name=\"authors\" value=\"",($edit?htmlentities(stripslashes($workAuthor)):htmlentities(stripslashes($authors))),"\" size=\"30\">\n",
"</td>\n", "</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
"<td valign=\"top\" align=\"right\">", "<td valign=\"top\" align=\"right\">",
get_lang("Description"),"&nbsp;&nbsp;", get_lang("Description"),"&nbsp;&nbsp;",
"</td>\n", "</td>\n",
"<td>", "<td>",
"<textarea name=\"description\" cols=\"30\" rows=\"3\">", "<textarea name=\"description\" cols=\"30\" rows=\"3\">",
($edit?htmlentities(stripslashes($workDescription)):htmlentities(stripslashes($description))), ($edit?htmlentities(stripslashes($workDescription)):htmlentities(stripslashes($description))),
@ -874,29 +882,29 @@ if ($submitWork && $succeed &&!$id) //last value is to check this is not "just"
"<input type=\"hidden\" name=\"active\" value=\"1\">", "<input type=\"hidden\" name=\"active\" value=\"1\">",
"<input type=\"hidden\" name=\"accepted\" value=\"1\">", "<input type=\"hidden\" name=\"accepted\" value=\"1\">",
"</td>\n", "</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
"<td></td>", "<td></td>",
"<td>", "<td>",
"<input type=\"submit\" name=\"submitWork\" value=\"".get_lang('Ok')."\">"; "<input type=\"submit\" name=\"submitWork\" value=\"".get_lang('Ok')."\">";
if($submitWork || $edit) if($_POST['submitWork'] || $edit)
{ {
echo "&nbsp;&nbsp;<input type=\"submit\" name=\"cancelForm\" value=\"".get_lang('Cancel')."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang('ConfirmYourChoice')))."')) return false;\">"; echo "&nbsp;&nbsp;<input type=\"submit\" name=\"cancelForm\" value=\"".get_lang('Cancel')."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang('ConfirmYourChoice')))."')) return false;\">";
} }
echo "</td>\n", echo "</td>\n",
"</tr>\n", "</tr>\n",
"</table>\n", "</table>\n",
"</form>\n", "</form>\n",
"<p>&nbsp;</p>"; "<p>&nbsp;</p>";
} }
//show them the form for the directory name //show them the form for the directory name
@ -935,15 +943,15 @@ if ($submitWork && $succeed &&!$id) //last value is to check this is not "just"
Display list of student publications Display list of student publications
============================================================================== ==============================================================================
*/ */
if($cur_dir_path =='/'){$my_cur_dir_path = '';}else{$my_cur_dir_path = $cur_dir_path;} if($cur_dir_path =='/'){$my_cur_dir_path = '';}else{$my_cur_dir_path = $cur_dir_path;}
display_student_publications_list($base_work_dir.'/'.$my_cur_dir_path,'work/'.$my_cur_dir_path,$currentCourseRepositoryWeb, $link_target_parameter, $dateFormatLong, $origin); display_student_publications_list($base_work_dir.'/'.$my_cur_dir_path,'work/'.$my_cur_dir_path,$currentCourseRepositoryWeb, $link_target_parameter, $dateFormatLong, $origin);
//} //}
/* /*
============================================================================== ==============================================================================
Footer Footer
============================================================================== ==============================================================================
*/ */
if ($origin != 'learnpath') if ($origin != 'learnpath')
{ {
//we are not in the learning path tool //we are not in the learning path tool

Loading…
Cancel
Save