Format code, add api_get_cidReq, remove unused function.

1.10.x
Julio Montoya 11 years ago
parent 5d3b825c16
commit 783f3e312b
  1. 28
      main/work/work.lib.php
  2. 46
      main/work/work.php

@ -747,29 +747,6 @@ function build_work_move_to_selector($folders, $curdirpath, $move_file, $group_d
return $form;
}
/**
* Checks if the first given directory exists as a subdir of the second given directory
* This function should now be deprecated by Security::check_abs_path()
* @param string Subdir
* @param string Base dir
* @return integer -1 on error, 0 if not subdir, 1 if subdir
*/
// TODO: This function is a candidate for removal, it is not used anywhere.
function is_subdir_of($subdir, $basedir)
{
if (empty($subdir) or empty($basedir)) {
return -1;
}
if (substr($basedir, -1, 1) != '/') {
$basedir = $basedir.'/';
}
if (substr($subdir, 0, 1) == '/') {
$subdir = substr($subdir, 1);
}
return is_dir($basedir.$subdir) ? 1 : 0;
}
/**
* creates a new directory trying to find a directory name
* that doesn't already exist
@ -1037,8 +1014,9 @@ function insert_all_directory_in_course_table($base_work_dir)
$course_id = api_get_course_int_id();
$group_id = api_get_group_id();
$work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
for($i = 0; $i < count($only_dir); $i++) {
global $work_table;
$url = Database::escape_string($only_dir[$i]);
$sql = "INSERT INTO " . $work_table . " SET
c_id = '$course_id',
@ -2129,7 +2107,7 @@ function get_work_user_list(
*/
function send_reminder_users_without_publication($task_data)
{
global $_course;
$_course = api_get_course_info();
$task_id = $task_data['id'];
$task_title = !empty($task_data['title']) ? $task_data['title'] : basename($task_data['url']);
$subject = '[' . api_get_setting('siteName') . '] ';

@ -33,23 +33,15 @@ $_course = api_get_course_info();
/* Constants and variables */
$tool_name = get_lang('StudentPublications');
$course_code = $_course['code'];
$session_id = api_get_session_id();
$group_id = api_get_group_id();
$item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
$parent_id = isset($_REQUEST['parent_id']) ? intval($_REQUEST['parent_id']) : '';
$origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : '';
$submitGroupWorkUrl = isset($_REQUEST['submitGroupWorkUrl']) ? Security::remove_XSS($_REQUEST['submitGroupWorkUrl']) : '';
$title = isset($_REQUEST['title']) ? $_REQUEST['title'] : '';
$description = isset($_REQUEST['description']) ? $_REQUEST['description'] : '';
$uploadvisibledisabled = isset($_REQUEST['uploadvisibledisabled']) ? Database::escape_string($_REQUEST['uploadvisibledisabled']) : $course_info['show_score'];
$course_dir = api_get_path(SYS_COURSE_PATH).$_course['path'];
$base_work_dir = $course_dir . '/work';
$link_target_parameter = ""; // e.g. "target=\"_blank\"";
$display_list_users_without_publication = isset($_GET['list']) && Security::remove_XSS($_GET['list']) == 'without' ? true : false;
$item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
$origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : '';
$course_dir = api_get_path(SYS_COURSE_PATH).$_course['path'];
$base_work_dir = $course_dir . '/work';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'list';
//Download folder
if ($action == 'downloadfolder') {
require 'downloadfolder.inc.php';
@ -76,43 +68,43 @@ if (!empty($gradebook) && $gradebook == 'view') {
if (!empty($group_id)) {
api_protect_course_group(GroupManager::GROUP_TOOL_WORK);
$group_properties = GroupManager::get_group_properties($group_id);
$group_properties = GroupManager::get_group_properties($group_id);
$interbreadcrumb[] = array ('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
$interbreadcrumb[] = array ('url' =>'work.php?gidReq='.$group_id,'name' => get_lang('StudentPublications'));
$url_dir = 'work.php?&id=' . $work_id;
$interbreadcrumb[] = array('url' => '../group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
$interbreadcrumb[] = array('url' =>'work.php?'.api_get_cidreq(),'name' => get_lang('StudentPublications'));
$url_dir = 'work.php?&id=' . $work_id.'&'.api_get_cidreq();
if (!empty($my_folder_data)) {
$interbreadcrumb[] = array ('url' => $url_dir, 'name' => $my_folder_data['title']);
$interbreadcrumb[] = array('url' => $url_dir, 'name' => $my_folder_data['title']);
}
if ($action == 'upload_form') {
$interbreadcrumb[] = array ('url' => 'work.php','name' => get_lang('UploadADocument'));
$interbreadcrumb[] = array('url' => 'work.php','name' => get_lang('UploadADocument'));
}
if ($action == 'create_dir') {
$interbreadcrumb[] = array ('url' => 'work.php','name' => get_lang('CreateAssignment'));
$interbreadcrumb[] = array('url' => 'work.php','name' => get_lang('CreateAssignment'));
}
} else {
if ($origin != 'learnpath') {
if (isset($_GET['id']) && !empty($_GET['id']) || $display_upload_form || $action == 'settings' || $action == 'create_dir') {
$interbreadcrumb[] = array ('url' => 'work.php', 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array('url' => 'work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
} else {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('StudentPublications'));
}
if (!empty($my_folder_data)) {
$interbreadcrumb[] = array ('url' => 'work.php?id=' . $work_id, 'name' => $my_folder_data['title']);
$interbreadcrumb[] = array('url' => 'work.php?id=' . $work_id.'&'.api_get_cidreq(), 'name' => $my_folder_data['title']);
}
if ($action == 'upload_form') {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('UploadADocument'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('UploadADocument'));
}
if ($action == 'settings') {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditToolOptions'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditToolOptions'));
}
if ($action == 'create_dir') {
$interbreadcrumb[] = array ('url' => '#','name' => get_lang('CreateAssignment'));
$interbreadcrumb[] = array('url' => '#','name' => get_lang('CreateAssignment'));
}
}
}

Loading…
Cancel
Save