From bc5f7c4faa233bf32d06ff038aba80f9bc29724e Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Wed, 10 Mar 2010 09:48:01 +0200 Subject: [PATCH] Feature #675 - Assignments tool: The icons have been made clickable + ome cosmetic changes. --- main/work/work.lib.php | 38 +++++++++++++++++++++++++------------- main/work/work.php | 23 ++++++++--------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/main/work/work.lib.php b/main/work/work.lib.php index 1e50069e25..029ececf30 100755 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -9,6 +9,7 @@ * @author Frederic Vauthier, directories management * @version $Id: work.lib.php 22357 2009-07-24 17:44:17Z juliomontoya $ */ + /** * Displays action links (for admins, authorized groups members and authorized students) * @param string Current dir @@ -568,7 +569,6 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC Database::query($sql_add_publication); } } - } //if($_POST['qualification']['qualification']!='') Database::query('UPDATE '.$work_table.' SET description = '."'".Database::escape_string(Security::remove_XSS($_POST['description']))."'".', qualification = '."'".Database::escape_string($_POST['qualification']['qualification'])."'".',weight = '."'".Database::escape_string($_POST['weight']['weight'])."'".' WHERE id = '."'".$row['id']."'"); @@ -608,14 +608,13 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC WHERE id='".$calendar_id[0]."'"; Database::query($sql); } - } } } $action = ''; $row = array(); $class = ''; - $row[] = ''.get_lang('Assignment').''; //image + //$a_count_directory = count_dir($work_dir.'/'.$dir, false); $cant_files = 0; @@ -631,7 +630,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC $res = Database::query($sql); $admin_course = ''; while($row_admin = Database::fetch_row($res)) { - $admin_course .='\''.$row_admin[0].'\','; + $admin_course .= '\''.$row_admin[0].'\','; } $sql_document = "SELECT count(*) FROM $work_table s, $iprop_table p WHERE s.id = p.ref AND p.tool='work' AND lastedit_user_id IN(".$admin_course.'\''.api_get_user_id().'\''.") AND s.accepted='1' AND url NOT LIKE '".$sub_course_dir.$dir."/%/%' AND url LIKE '".$sub_course_dir.$dir."/%'"; } @@ -662,9 +661,13 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC $dirtext = ''; } + $icon = ''.get_lang('Assignment').''; + if (!empty($display_edit_form) && isset($clean_edit_dir) && $clean_edit_dir == $mydir) { + $row[] = $icon; $row[] = ''.$form_folder->toHtml(); // form to edit the directory's name } else { + $row[] = ''.$icon.''; $tbl_gradebook_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $add_to_name = ''; $sql = "SELECT weight FROM ". $tbl_gradebook_link ." WHERE type='3' AND ref_id= '".$id2."'"; @@ -680,9 +683,9 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC if (is_allowed_to_edit()) { $zip=''.get_lang('Save').''; } - $row[] = $zip.''.$dir.''.$add_to_name.'
'.$cant_files.' '.$text_file.$dirtext; + $row[] = $zip.''.$dir.''.$add_to_name.'
'.$cant_files.' '.$text_file.$dirtext; } else { - $row[] = ''.$dir.''.$add_to_name.'
'.$cant_files.' '.$text_file.$dirtext; + $row[] = ''.$dir.''.$add_to_name.'
'.$cant_files.' '.$text_file.$dirtext; } } if ($count_files != 0) { @@ -690,9 +693,14 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC } if ($direc_date != '' && $direc_date != '0000-00-00 00:00:00') { + $direc_date = api_get_local_time($direc_date, null, null, date_default_timezone_get()); + /* $my_direc_date = api_ucfirst(format_locale_date($dateFormatShort, strtotime($direc_date))).'    '; $my_direc_date .= api_ucfirst(strftime($timeNoSecFormat, strtotime($direc_date))); + */ + $my_direc_date = $direc_date; + $row[] = date_to_str_ago($direc_date).'
'.$my_direc_date.''.''; } else { $row[] = ''; @@ -728,7 +736,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC //display info depending on the permissions if ($work->accepted == '1' || $is_allowed_to_edit) { $row = array(); - if($work->accepted == '0') { + if ($work->accepted == '0') { $class = 'class="invisible"'; } else { $class = ''; @@ -738,9 +746,9 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC $add_string = ''; if (defined('IS_ASSIGNMENT')) { if($work->qualification == '') { - $qualification_string = ' / '.get_lang('NotRevised').''; + $qualification_string = ' / '.get_lang('NotRevised').''; } else { - $qualification_string = ' / '.get_lang('Qualification').': '.$work->qualification.''; + $qualification_string = ' / '.get_lang('Qualification').': '.$work->qualification.''; } if (defined('ASSIGNMENT_EXPIRES') && (ASSIGNMENT_EXPIRES < convert_date_to_number($work->sent_date))) { $add_string = ' '.get_lang('Expired').''; @@ -749,14 +757,18 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC $url = implode('/', array_map('rawurlencode', explode('/', $work->url))); - //$full_file_name = 'download.php?file='.$realname; - $row[] = build_document_icon_tag('file', $work->url); + $row[] = ''.build_document_icon_tag('file', substr(basename($work->url), 13)).''; $row[] = ''.get_lang('Save').''.$work->title.'
'.$work->description; - $row[] = display_user_link_work($row2['insert_user_id'],$work->author).$qualification_string; // $work->author; + $row[] = display_user_link_work($row2['insert_user_id'], $work->author).$qualification_string; // $work->author; + $work_sent_date = api_get_local_time($work->sent_date, null, null, date_default_timezone_get()); + /* $sent_date = api_ucfirst(format_locale_date($dateFormatShort, strtotime($work_sent_date))).'    '; $sent_date .= api_ucfirst(strftime($timeNoSecFormat, strtotime($work_sent_date))); - $row[] = date_to_str_ago($work->sent_date).$add_string.'
'.$sent_date.''.''; + */ + $sent_date = $work_sent_date; + + $row[] = date_to_str_ago($work->sent_date).$add_string.'
'.$sent_date.''.''; if ($is_allowed_to_edit) { diff --git a/main/work/work.php b/main/work/work.php index fb12bd213f..5119bf03e4 100755 --- a/main/work/work.php +++ b/main/work/work.php @@ -140,7 +140,6 @@ $title = isset($_REQUEST['title']) ? Database::escape_string($_REQUEST['title']) $uploadvisibledisabled = isset($_REQUEST['uploadvisibledisabled']) ? Database::escape_string($_REQUEST['uploadvisibledisabled']) : ''; $id = isset($_REQUEST['id']) ? strval(intval($_REQUEST['id'])) : ''; - // get data for publication assignment $has_expired = false; $has_ended = false; @@ -190,11 +189,9 @@ if ($my_cur_dir_path == '/') { } elseif (substr($my_cur_dir_path, -1, 1) != '/') { $my_cur_dir_path = $my_cur_dir_path . '/'; } -/* ------------------------------------------------------------ - Configuration settings ------------------------------------------------------------ -*/ + +/* Configuration settings */ + $link_target_parameter = ""; //or e.g. "target=\"_blank\""; $always_show_tool_options = false; $always_show_upload_form = false; @@ -366,8 +363,7 @@ if (!empty($_SESSION['toolgroup'])) { 'url' => 'work.php?gradebook='.$gradebook, 'name' => get_lang('EditToolOptions')); } - if ($_GET['createdir'] == 1) - { + if ($_GET['createdir'] == 1) { $interbreadcrumb[] = array ( 'url' => 'work.php?gradebook='.$gradebook, 'name' => get_lang('CreateDir')); @@ -377,7 +373,7 @@ if (!empty($_SESSION['toolgroup'])) { } else { //we are in the learnpath tool - include api_get_path(INCLUDE_PATH).'reduced_header.inc.php'; + require api_get_path(INCLUDE_PATH).'reduced_header.inc.php'; } } @@ -389,8 +385,6 @@ $is_allowed_to_edit = api_is_allowed_to_edit(); //has to come after display_tool /* MAIN CODE */ - - if (!empty ($_POST['changeProperties'])) { // changing the tool setting: default visibility of an uploaded document $query = "UPDATE " . $main_course_table . " SET show_score='" . $uploadvisibledisabled . "' WHERE code='" . $_course['sysCode'] . "'"; @@ -1047,7 +1041,6 @@ if (!empty($_POST['submitWork']) && !empty($succeed) && !$id) { $emailto[$row_email['myemail']] = $row_email['myemail']; } } - } if (count($emailto) > 0) { @@ -1283,7 +1276,7 @@ if ($is_course_member) { //show them the form for the directory name - if (isset ($_REQUEST['createdir']) && $is_allowed_to_edit) { + if (isset($_REQUEST['createdir']) && $is_allowed_to_edit) { //create the form that asks for the directory name $new_folder_text = '
'; $new_folder_text .= '
'.get_lang('CreateAssignment').'
'; @@ -1326,7 +1319,7 @@ if ($is_course_member) { $addtext .= ''; $addtext .= ''; $addtext .= '
'; - $addtext .= ''.get_lang('DatesAvailables').'
'; + $addtext .= ''.get_lang('DatesAvailables').'
'; $addtext .= ''.get_lang('EnableExpiryDate').''; $addtext .= '   '; $addtext .= '   '; @@ -1337,7 +1330,7 @@ if ($is_course_member) { $addtext .= '   '; $addtext .= draw_date_picker('ends').'
'; $addtext .= ''; - $addtext .= '

'.get_lang('Agenda').'
'; + $addtext .= '

'.get_lang('Agenda').'
'; $addtext .= '  '.make_checkbox('add_to_calendar').get_lang('AddToCalendar').''; $addtext .= '';