Fixing breadcrumb, fixing bug when moving files, removing delete all and make invisible to all see #3374

skala
Julio Montoya 14 years ago
parent a36c472148
commit eb631fdcca
  1. 119
      main/work/work.lib.php
  2. 107
      main/work/work.php

@ -28,31 +28,28 @@ function display_action_links($cur_dir_path, $always_show_tool_options, $always_
$origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : ''; $origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '';
$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : empty($curdirpath); $curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : empty($curdirpath);
///why is that here?
//$origin = api_get_tools_lists($origin);
echo '<div class="actions">';
if (strlen($cur_dir_path) > 0 && $cur_dir_path != '/') { if (strlen($cur_dir_path) > 0 && $cur_dir_path != '/') {
$parent_dir = dirname($cur_dir_path); $parent_dir = dirname($cur_dir_path);
$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'&curdirpath='.$parent_dir.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'','32').'</a>'; $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'&curdirpath='.$parent_dir.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'','32').'</a>';
} else { } else {
if ($_GET['display_tool_options'] == 'true' OR $_GET['display_upload_form'] == 'true') { if ($_GET['display_tool_options'] == 'true' OR $_GET['display_upload_form'] == 'true') {
if ($origin != 'learnpath') { if ($origin != 'learnpath') {
echo '<a href="work.php?gradebook='.$gradebook.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'','32').'</a>'; //$display_output .= '<a href="work.php?gradebook='.$gradebook.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'','32').'</a>';
} }
} }
} }
if (!$always_show_tool_options && api_is_allowed_to_edit(null, true) && $origin != 'learnpath') { if (!$always_show_tool_options && api_is_allowed_to_edit(null, true) && $origin != 'learnpath') {
if (empty($curdirpath)) { if (empty($curdirpath)) {
$display_output .= '<a href="work.php?">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'','32').'</a>'; //$display_output .= '<a href="work.php?">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'','32').'</a>';
} }
// Create dir // Create dir
if ($cur_dir_path == '/') { if ($cur_dir_path == '/') {
$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;toolgroup='.Security::remove_XSS($_GET['toolgroup']).'&amp;createdir=1&origin='.$origin.'&gradebook='.$gradebook.'">'.Display::return_icon('new_work.png', get_lang('CreateAssignment'),'','32').'</a>'; $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;toolgroup='.Security::remove_XSS($_GET['toolgroup']).'&amp;createdir=1&origin='.$origin.'&gradebook='.$gradebook.'">'.Display::return_icon('new_work.png', get_lang('CreateAssignment'),'','32').'</a>';
} }
// Options if (empty($curdirpath) || $curdirpath == '.') {
$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;display_tool_options=true&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'">'.Display::return_icon('settings.png', get_lang('EditToolOptions'),'','32').'</a>'; // Options
$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;display_tool_options=true&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'">'.Display::return_icon('settings.png', get_lang('EditToolOptions'),'','32').'</a>';
}
} }
if (!$always_show_upload_form && api_is_allowed_to_session_edit(false, true) && (isset($_GET['curdirpath']) && (!empty($_GET['curdirpath']) && $_GET['curdirpath'] != '.') )) { if (!$always_show_upload_form && api_is_allowed_to_session_edit(false, true) && (isset($_GET['curdirpath']) && (!empty($_GET['curdirpath']) && $_GET['curdirpath'] != '.') )) {
@ -68,10 +65,10 @@ function display_action_links($cur_dir_path, $always_show_tool_options, $always_
} }
if (empty($curdirpath) or $curdirpath != '.') { if (empty($curdirpath) or $curdirpath != '.') {
$display_output .= '<a href="#">'.Display::return_icon('delete_na.png', get_lang('Delete'),'','32').'</a>'; //$display_output .= '<a href="#">'.Display::return_icon('delete_na.png', get_lang('Delete'),'','32').'</a>';
} else { } else {
$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$cur_dir_path.'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'&amp;delete=all" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities($message, ENT_QUOTES)).'\')) return false;">'. /*$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$cur_dir_path.'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'&amp;delete=all" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities($message, ENT_QUOTES)).'\')) return false;">'.
Display::return_icon('delete.png', get_lang('Delete'),'','32').'</a>'; Display::return_icon('delete.png', get_lang('Delete'),'','32').'</a>';*/
} }
// make all files visible or invisible // make all files visible or invisible
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
@ -80,16 +77,19 @@ function display_action_links($cur_dir_path, $always_show_tool_options, $always_
if ($sql_result) { if ($sql_result) {
$columnStatus = Database::fetch_array($sql_result); $columnStatus = Database::fetch_array($sql_result);
/*
if ($columnStatus['Default'] == 1) { if (empty($curdirpath) || $curdirpath == '.') {
$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'&amp;make_invisible=all&amp;curdirpath='.$cur_dir_path.'">'. if ($columnStatus['Default'] == 1) {
Display::return_icon('visible.png', get_lang('MakeAllPapersInvisible'),'','32')."</a>\n"; $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'&amp;make_invisible=all&amp;curdirpath='.$cur_dir_path.'">'.
} else { Display::return_icon('visible.png', get_lang('MakeAllPapersInvisible'),'','32')."</a>\n";
$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'&amp;make_visible=all&amp;curdirpath='.$cur_dir_path.'">'. } else {
Display::return_icon('invisible.png', get_lang('MakeAllPapersVisible'),'','32')."</a>\n"; $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'&amp;make_visible=all&amp;curdirpath='.$cur_dir_path.'">'.
} Display::return_icon('invisible.png', get_lang('MakeAllPapersVisible'),'','32')."</a>\n";
}
}*/
} }
} }
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
global $publication; global $publication;
if (empty($curdirpath) or $curdirpath != '.' or $cur_dir_path != '/') { if (empty($curdirpath) or $curdirpath != '.' or $cur_dir_path != '/') {
@ -106,10 +106,12 @@ function display_action_links($cur_dir_path, $always_show_tool_options, $always_
} }
} }
} }
if ($display_output != '') { if ($display_output != '') {
echo '<div class="actions">';
echo $display_output; echo $display_output;
echo '</div>';
} }
echo '</div>';
} }
/** /**
@ -341,19 +343,16 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
//Get list from database //Get list from database
if ($is_allowed_to_edit) { if ($is_allowed_to_edit) {
$sql_get_publications_list = "SELECT * " . $sql_get_publications_list = "SELECT * FROM ".$work_table." " .
"FROM ".$work_table." " . "WHERE url LIKE BINARY '$sub_course_dir%' " .
"WHERE url LIKE BINARY '$sub_course_dir%' " . "AND url NOT LIKE BINARY '$sub_course_dir%/%' " .$add_in_where_query.$condition_session.
"AND url NOT LIKE BINARY '$sub_course_dir%/%' " .$add_in_where_query. " ORDER BY sent_date DESC";
$condition_session.
" ORDER BY sent_date DESC"; $sql_get_publications_num = "SELECT count(*) FROM ".$work_table." " .
"WHERE url LIKE BINARY '$sub_course_dir%' " .
$sql_get_publications_num = "SELECT count(*) " . "AND url NOT LIKE BINARY '$sub_course_dir%/%' " .$add_in_where_query.
"FROM ".$work_table." " . $condition_session.
"WHERE url LIKE BINARY '$sub_course_dir%' " . " ORDER BY id";
"AND url NOT LIKE BINARY '$sub_course_dir%/%' " .$add_in_where_query.
$condition_session.
" ORDER BY id";
} else { } else {
if (!empty($_SESSION['toolgroup'])) { if (!empty($_SESSION['toolgroup'])) {
@ -365,15 +364,13 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
} }
$sql_get_publications_list = "SELECT * FROM $work_table $group_query $subdirs_query ".$add_in_where_query." $condition_session ORDER BY id"; $sql_get_publications_list = "SELECT * FROM $work_table $group_query $subdirs_query ".$add_in_where_query." $condition_session ORDER BY id";
$sql_get_publications_num = "SELECT count(url) " . $sql_get_publications_num = "SELECT count(url) FROM ".$work_table." " .
"FROM ".$work_table." " . "WHERE url LIKE BINARY '$sub_course_dir%' AND url NOT LIKE BINARY '$sub_course_dir%/%' " .$add_in_where_query.
"WHERE url LIKE BINARY '$sub_course_dir%' " . $condition_session.
"AND url NOT LIKE BINARY '$sub_course_dir%/%' " .$add_in_where_query. " ORDER BY id";
$condition_session.
" ORDER BY id";
} }
// echo $sql_get_publications_list; //echo $sql_get_publications_list;
$sql_result = Database::query($sql_get_publications_list); $sql_result = Database::query($sql_get_publications_list);
$sql_result_num = Database::query($sql_get_publications_num); $sql_result_num = Database::query($sql_get_publications_num);
@ -389,10 +386,10 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$table_header[] = array(get_lang('Qualification'), true); $table_header[] = array(get_lang('Qualification'), true);
} }
$table_header[] = array(get_lang('Date'), true, 'style="width:70px"'); $table_header[] = array(get_lang('Date'), true, 'style="width:160px"');
if ($origin != 'learnpath') { if ($origin != 'learnpath') {
$table_header[] = array(get_lang('Actions'), false, 'style="width:80px"'); $table_header[] = array(get_lang('Actions'), false, 'style="width:90px"');
$table_header[] = array('RealDate', true); $table_header[] = array('RealDate', true);
} }
@ -420,7 +417,6 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$i++; $i++;
} }
if ($count_files != 0) { if ($count_files != 0) {
if ($sub_course_dir == '/work') { if ($sub_course_dir == '/work') {
$column_order[2] = 2; $column_order[2] = 2;
@ -722,18 +718,12 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$icon = Display::return_icon('work.png', get_lang('Assignment'),array(), 22); $icon = Display::return_icon('work.png', get_lang('Assignment'),array(), 22);
if (!empty($display_edit_form) && isset($clean_edit_dir) && $clean_edit_dir == $mydir) { if (!empty($display_edit_form) && isset($clean_edit_dir) && $clean_edit_dir == $mydir) {
$row[] = $icon; $row[] = $icon;
$row[] = '<span class="invisible" style="display:none">'.$dir.'</span>'.$form_folder->toHtml(); // form to edit the directory's name $row[] = '<span class="invisible" style="display:none">'.$dir.'</span>'.$form_folder->toHtml(); // form to edit the directory's name
} else { } else {
$row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'&curdirpath='.$mydir.'">'.$icon.'</a>'; $row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'&curdirpath='.$mydir.'">'.$icon.'</a>';
$add_to_name = ''; $add_to_name = '';
/*
$tbl_gradebook_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = "SELECT weight FROM ". $tbl_gradebook_link ." WHERE type='3' AND ref_id= '".$id2."'";
$result = Database::query($sql);
$count = Database::num_rows($result);
*/
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
$link_id = is_resource_in_course_gradebook(api_get_course_id(), 3 , $id2 , api_get_session_id()); $link_id = is_resource_in_course_gradebook(api_get_course_id(), 3 , $id2 , api_get_session_id());
$count = 0; $count = 0;
@ -837,15 +827,15 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
if ($is_allowed_to_edit) { if ($is_allowed_to_edit) {
$action = ''; $action = '';
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;edit='.$work->id.'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;parent_id='.$work->parent_id.'" title="'.get_lang('Modify').'" >'.Display::return_icon('rate_work.png', get_lang('CorrectAndRate'),array(), 22).'</a>'; $action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;edit='.$work->id.'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;parent_id='.$work->parent_id.'" title="'.get_lang('Modify').'" >'.Display::return_icon('rate_work.png', get_lang('CorrectAndRate'),array(), 22).'</a>';
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;delete='.$work->id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('WorkDelete').'" >'.Display::return_icon('delete.png', get_lang('WorkDelete'),'',22).'</a>';
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;move='.$work->id.'" title="'.get_lang('Move').'">'.Display::return_icon('move.png', get_lang('Move'),array(), 22).'</a>'; $action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;move='.$work->id.'" title="'.get_lang('Move').'">'.Display::return_icon('move.png', get_lang('Move'),array(), 22).'</a>';
if ($work->accepted == '1') { if ($work->accepted == '1') {
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;make_invisible='.$work->id.'&amp;'.$sort_params.'" title="'.get_lang('Invisible').'" >'.Display::return_icon('visible.png', get_lang('Invisible'),array(), 22).'</a>'; $action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;make_invisible='.$work->id.'&amp;'.$sort_params.'" title="'.get_lang('Invisible').'" >'.Display::return_icon('visible.png', get_lang('Invisible'),array(), 22).'</a>';
} else { } else {
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;make_visible='.$work->id.'&amp;'.$sort_params.'" title="'.get_lang('Visible').'" >'.Display::return_icon('invisible.png', get_lang('Visible'),array(), 22).'</a>'; $action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;make_visible='.$work->id.'&amp;'.$sort_params.'" title="'.get_lang('Visible').'" >'.Display::return_icon('invisible.png', get_lang('Visible'),array(), 22).'</a> ';
} }
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;delete='.$work->id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('WorkDelete').'" >'.Display::return_icon('delete.png', get_lang('WorkDelete'),'',22).'</a>';
$row[] = $action; $row[] = $action;
// the user that is not course admin can only edit/delete own document // the user that is not course admin can only edit/delete own document
} elseif ($row2['insert_user_id'] == $_user['user_id']) { } elseif ($row2['insert_user_id'] == $_user['user_id']) {
$action = ''; $action = '';
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;edit='.$work->id.'" title="'.get_lang('Modify').'" >'.Display::return_icon('edit.png', get_lang('Modify'),array(), 22).'</a>'; $action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;edit='.$work->id.'" title="'.get_lang('Modify').'" >'.Display::return_icon('edit.png', get_lang('Modify'),array(), 22).'</a>';
@ -962,7 +952,6 @@ function build_work_directory_selector($folders, $curdirpath, $group_dir = '') {
* @return string html form * @return string html form
*/ */
function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_dir = '') { function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_dir = '') {
//gets file title
$move_file = intval($move_file); $move_file = intval($move_file);
$tbl_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION); $tbl_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
@ -971,20 +960,20 @@ function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_d
$title = Database::fetch_row($result); $title = Database::fetch_row($result);
global $gradebook; global $gradebook;
$form = '<form name="move_to" action="'.api_get_self().'?gradebook='.$gradebook.'" method="POST">'."\n"; $form = '<form name="move_to" action="'.api_get_self().'?gradebook='.$gradebook.'&curdirpath='.Security::remove_XSS($curdirpath).'" method="POST">';
$form .= '<div class="row"><div class="form_header">'.get_lang('MoveFile').'</div></div>'; $form .= '<div class="row"><div class="form_header">'.get_lang('MoveFile').' - '.Security::remove_XSS($title[0]).'</div></div>';
$form .= '<input type="hidden" name="move_file" value="'.$move_file.'" />'."\n"; $form .= '<input type="hidden" name="move_file" value="'.$move_file.'" />';
$form .= '<div class="row"> $form .= '<div class="row">
<div class="label"> <div class="label">
<span class="form_required">*</span>'.sprintf(get_lang('MoveXTo'), $title[0]).' <span class="form_required">*</span>'.get_lang('Select').'
</div> </div>
<div class="formw">'; <div class="formw">';
$form .= ' <select name="move_to">'."\n"; $form .= ' <select name="move_to">';
//group documents cannot be uploaded in the root //group documents cannot be uploaded in the root
if ($group_dir == '') { if ($group_dir == '') {
if ($curdirpath != '/') { if ($curdirpath != '/') {
$form .= '<option value="0">/ ('.get_lang('Root').')</option>'; //$form .= '<option value="0">/ ('.get_lang('Root').')</option>';
} }
if (is_array($folders)) { if (is_array($folders)) {
foreach ($folders as $fid => $folder) { foreach ($folders as $fid => $folder) {
@ -993,7 +982,7 @@ function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_d
//2. inside the folder you want to move //2. inside the folder you want to move
//3. inside a subfolder of the folder you want to move //3. inside a subfolder of the folder you want to move
if (($curdirpath != $folder) && ($folder != $move_file) && (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')) { if (($curdirpath != $folder) && ($folder != $move_file) && (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')) {
$form .= '<option value="'.$fid.'">'.$folder.'</option>'."\n"; $form .= '<option value="'.$fid.'">'.$folder.'</option>';
} }
} }
} }
@ -1011,19 +1000,17 @@ function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_d
} }
} }
$form .= '</select>'."\n"; $form .= '</select>';
$form .= ' </div> $form .= ' </div>
</div>'; </div>';
$form .= '<div class="row"> $form .= '<div class="row">
<div class="label"> <div class="label"></div>
</div>
<div class="formw"> <div class="formw">
<button type="submit" class="save" name="move_file_submit">'.get_lang('MoveFile').'</button> <button type="submit" class="save" name="move_file_submit">'.get_lang('MoveFile').'</button>
</div> </div>
</div>'; </div>';
$form .= '</form>'; $form .= '</form>';
$form .= '<div style="clear: both; margin-bottom: 10px;"></div>'; $form .= '<div style="clear: both; margin-bottom: 10px;"></div>';
return $form; return $form;
} }

@ -141,7 +141,7 @@ $id = isset($_REQUEST['id']) ? strval(intval($_REQUEST['id'])) : '';
// get data for publication assignment // get data for publication assignment
$has_expired = false; $has_expired = false;
$has_ended = false; $has_ended = false;
$curdirpath = isset($_GET['curdirpath']) ? Database::escape_string($_GET['curdirpath']) : ''; $curdirpath = isset($_REQUEST['curdirpath']) ? Database::escape_string($_REQUEST['curdirpath']) : '';
//This means that we are in a folder assignment //This means that we are in a folder assignment
$sql_select ='SELECT id, description FROM '.Database :: get_course_table(TABLE_STUDENT_PUBLICATION).' WHERE filetype = '."'folder'".' and has_properties != '."''".' and url = '."'/".$curdirpath."'".' LIMIT 1'; $sql_select ='SELECT id, description FROM '.Database :: get_course_table(TABLE_STUDENT_PUBLICATION).' WHERE filetype = '."'folder'".' and has_properties != '."''".' and url = '."'/".$curdirpath."'".' LIMIT 1';
@ -170,6 +170,7 @@ if (isset ($_GET['curdirpath']) && $_GET['curdirpath'] != '') {
//$cur_dir_path = preg_replace('#[\.]+/#','/',$_POST['curdirpath']); //escape '..' hack attempts //$cur_dir_path = preg_replace('#[\.]+/#','/',$_POST['curdirpath']); //escape '..' hack attempts
//now using common security approach with security lib //now using common security approach with security lib
$in_course = Security :: check_abs_path($base_work_dir . '/' . $_POST['curdirpath'], $base_work_dir); $in_course = Security :: check_abs_path($base_work_dir . '/' . $_POST['curdirpath'], $base_work_dir);
echo '2';
if (!$in_course) { if (!$in_course) {
$cur_dir_path = "/"; $cur_dir_path = "/";
} else { } else {
@ -265,10 +266,7 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') {
} }
if (!empty($gradebook) && $gradebook == 'view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array ('url' => '../gradebook/' . $_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook'));
'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
} }
if (!empty($_SESSION['toolgroup'])) { if (!empty($_SESSION['toolgroup'])) {
@ -278,36 +276,22 @@ if (!empty($_SESSION['toolgroup'])) {
$interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$_SESSION['toolgroup'], 'name' => get_lang('GroupSpace').' '.$group_properties['name']); $interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$_SESSION['toolgroup'], 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
$url_dir =''; $url_dir ='';
$interbreadcrumb[] = array ('url' => $url_dir,'name' => get_lang('StudentPublications')); $interbreadcrumb[] = array ('url' =>'#','name' => get_lang('StudentPublications'));
//if (!$display_tool_options && !$display_upload_form)
//{
// interbreadcrumb for the current directory root path
$dir_array = explode('/', $cur_dir_path);
$array_len = count($dir_array);
/*
if ($array_len > 0) {
$url_dir = 'work.php?&curdirpath=/';
$interbreadcrumb[] = array (
'url' => $url_dir,
'name' => get_lang('HomeDirectory'));
}*/
$dir_acum = ''; $dir_array = explode('/', $cur_dir_path);
for ($i = 0; $i < $array_len; $i++) { $array_len = count($dir_array);
$url_dir = 'work.php?&curdirpath=' . $dir_acum . $dir_array[$i];
$interbreadcrumb[] = array ( $dir_acum = '';
'url' => $url_dir, for ($i = 0; $i < $array_len; $i++) {
'name' => $dir_array[$i] $url_dir = 'work.php?&curdirpath=' . $dir_acum . $dir_array[$i];
); $interbreadcrumb[] = array ('url' => $url_dir,'name' => $dir_array[$i]);
$dir_acum .= $dir_array[$i] . '/'; $dir_acum .= $dir_array[$i] . '/';
} }
//}
if ($display_upload_form) { if ($display_upload_form) {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array ('url' => 'work.php','name' => get_lang('UploadADocument'));
'url' => 'work.php',
'name' => get_lang('UploadADocument'));
} }
if ($display_tool_options) { if ($display_tool_options) {
@ -317,57 +301,42 @@ if (!empty($_SESSION['toolgroup'])) {
} }
if ($_GET['createdir'] == 1) { if ($_GET['createdir'] == 1) {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array ('url' => 'work.php','name' => get_lang('CreateFolder'));
'url' => 'work.php',
'name' => get_lang('CreateFolder'));
} }
Display :: display_header(null); Display :: display_header(null);
} else { } else {
if (isset($origin) && $origin != 'learnpath') { if (isset($origin) && $origin != 'learnpath') {
$url_dir = ''; $url_dir = '';
$interbreadcrumb[] = array ('url' => $url_dir.'?gradebook='.$gradebook, 'name' => get_lang('StudentPublications'));
//if (!$display_tool_options && !$display_upload_form) if (isset($_GET['curdirpath']) && $_GET['curdirpath'] != '.' || $display_upload_form || $display_tool_options || $_GET['createdir'] == 1) {
//{ $interbreadcrumb[] = array ('url' => 'work.php', 'name' => get_lang('StudentPublications'));
//------interbreadcrumb for the current directory root path } else {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('StudentPublications'));
}
$dir_array = explode('/', $cur_dir_path); $dir_array = explode('/', $cur_dir_path);
$array_len = count($dir_array); $array_len = count($dir_array);
/*if ($array_len > 0) {
$url_dir = 'work.php?gradebook='.$gradebook.'&curdirpath=/';
$interbreadcrumb[] = array (
'url' => $url_dir,
'name' => get_lang('HomeDirectory'));
}*/
$dir_acum = ''; $dir_acum = '';
for ($i = 0; $i < $array_len; $i++) { for ($i = 0; $i < $array_len; $i++) {
$url_dir = 'work.php?gradebook='.$gradebook.'&amp;curdirpath=' . $dir_acum . $dir_array[$i]; $url_dir = 'work.php?gradebook='.$gradebook.'&amp;curdirpath=' . $dir_acum . $dir_array[$i];
$interbreadcrumb[] = array ( if (isset($_REQUEST['curdirpath']) && $_REQUEST['curdirpath'] != '.' || $display_upload_form || $display_tool_options || $_GET['createdir'] == 1) {
'url' => $url_dir, $interbreadcrumb[] = array ('url' => $url_dir ,'name' => $dir_array[$i]);
'name' => $dir_array[$i] } else {
); $interbreadcrumb[] = array ('url' => '#','name' => $dir_array[$i]);
}
$dir_acum .= $dir_array[$i] . '/'; $dir_acum .= $dir_array[$i] . '/';
} }
// }
if ($display_upload_form) { if ($display_upload_form) {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('UploadADocument'));
'url' => 'work.php?gradebook='.$gradebook,
'name' => get_lang('UploadADocument'));
} }
if ($display_tool_options) { if ($display_tool_options) {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditToolOptions'));
'url' => 'work.php?gradebook='.$gradebook,
'name' => get_lang('EditToolOptions'));
} }
if ($_GET['createdir'] == 1) { if ($_GET['createdir'] == 1) {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array ('url' => '#','name' => get_lang('CreateDir'));
'url' => 'work.php?gradebook='.$gradebook,
'name' => get_lang('CreateDir'));
} }
Display :: display_header(null); Display :: display_header(null);
@ -716,11 +685,11 @@ if (isset ($_POST['move_to']) && isset ($_POST['move_file'])) {
update_work_url($move_file_id, 'work' . $move_to_path, $move_to); update_work_url($move_file_id, 'work' . $move_to_path, $move_to);
//set the current path //set the current path
$cur_dir_path = $move_to_path; //$cur_dir_path = $move_to_path;
$cur_dir_path_url = urlencode($move_to_path); //$cur_dir_path_url = urlencode($move_to_path);
// update all the parents in the table item propery // update all the parents in the table item propery
$list_id = get_parent_directories($cur_dir_path); $list_id = get_parent_directories($move_to_path);
for ($i = 0; $i < count($list_id); $i++) { for ($i = 0; $i < count($list_id); $i++) {
api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id); api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);
} }
@ -1312,7 +1281,7 @@ if ($is_course_member) {
$row = Database::fetch_array($result); $row = Database::fetch_array($result);
$qualification_over = $row['qualification']; $qualification_over = $row['qualification'];
$form->addElement('text', 'qualification', get_lang('Qualification'), 'size="10"'); $form->addElement('text', 'qualification', get_lang('Qualification'), 'size="10"');
$form->addElement('html', '<div style="margin-left:20%">'.get_lang('QualificationNumeric').'&nbsp;:&nbsp;'.$qualification_over.'</div>'); $form->addElement('html', '<div class="row"><div class="formw">'.get_lang('QualificationNumeric').'&nbsp;:&nbsp;'.$qualification_over.'</div></div>');
$form->addElement('hidden', 'qualification_over', $qualification_over); $form->addElement('hidden', 'qualification_over', $qualification_over);
} }
@ -1457,7 +1426,6 @@ if ($display_tool_options) {
} }
/* Display list of student publications */ /* Display list of student publications */
if ($cur_dir_path == '/') { if ($cur_dir_path == '/') {
$my_cur_dir_path = ''; $my_cur_dir_path = '';
} else { } else {
@ -1500,7 +1468,7 @@ if (!$display_upload_form && !$display_tool_options) {
} }
} }
$cidreq = isset($_GET['cidreq']) ? Security::remove_XSS($_GET['cidreq']) : ''; $cidreq = isset($_GET['cidreq']) ? Security::remove_XSS($_GET['cidreq']) : '';
$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : ''; $curdirpath = isset($_REQUEST['curdirpath']) ? Security::remove_XSS($_REQUEST['curdirpath']) : '';
$filter = isset($_REQUEST['filter']) ? (int)$_REQUEST['filter'] : ''; $filter = isset($_REQUEST['filter']) ? (int)$_REQUEST['filter'] : '';
if ($origin != 'learnpath') { if ($origin != 'learnpath') {
@ -1518,13 +1486,10 @@ if (!$display_upload_form && !$display_tool_options) {
if ($display_list_users_without_publication) { if ($display_list_users_without_publication) {
display_list_users_without_publication($publication['id']); display_list_users_without_publication($publication['id']);
} else { } else {
//var_dump($add_query);
display_student_publications_list($base_work_dir . '/' . $my_cur_dir_path, 'work/' . $my_cur_dir_path, $currentCourseRepositoryWeb, $link_target_parameter, $dateFormatLong, $origin,$add_query); display_student_publications_list($base_work_dir . '/' . $my_cur_dir_path, 'work/' . $my_cur_dir_path, $currentCourseRepositoryWeb, $link_target_parameter, $dateFormatLong, $origin,$add_query);
} }
} }
/* Footer */
if ($origin != 'learnpath') { if ($origin != 'learnpath') {
//we are not in the learning path tool //we are not in the learning path tool
Display :: display_footer(); Display :: display_footer();

Loading…
Cancel
Save