Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent 9dce3be971
commit c1bb3d85db
  1. 1
      main/inc/ajax/model.ajax.php
  2. 59
      main/work/work.lib.php

@ -81,7 +81,6 @@ function getWhereClause($col, $oper, $val)
'nc' => 'NOT LIKE' //doesn't contain 'nc' => 'NOT LIKE' //doesn't contain
); );
if (empty($col)) { if (empty($col)) {
return ''; return '';
} }

@ -213,7 +213,8 @@ function get_work_data_by_path($path, $courseId = null)
/** /**
* @param int $id * @param int $id
* * @param int $courseId
* @param int $sessionId
* @return array * @return array
*/ */
function get_work_data_by_id($id, $courseId = null, $sessionId = null) function get_work_data_by_id($id, $courseId = null, $sessionId = null)
@ -289,6 +290,7 @@ function get_work_count_by_student($user_id, $work_id)
$return = Database::fetch_row($result,'ASSOC'); $return = Database::fetch_row($result,'ASSOC');
$return = intval($return[0]); $return = intval($return[0]);
} }
return $return; return $return;
} }
@ -313,7 +315,7 @@ function get_work_assignment_by_id($id, $courseId = null)
$result = Database::query($sql); $result = Database::query($sql);
$return = array(); $return = array();
if (Database::num_rows($result)) { if (Database::num_rows($result)) {
$return = Database::fetch_array($result,'ASSOC'); $return = Database::fetch_array($result, 'ASSOC');
} }
return $return; return $return;
@ -635,19 +637,22 @@ function display_student_publications_list(
qualification, qualification,
weight, weight,
allow_text_assignment allow_text_assignment
FROM ".$iprop_table." prop INNER JOIN ".$work_table." work ON (prop.ref=work.id AND prop.c_id = $course_id) FROM ".$iprop_table." prop
INNER JOIN ".$work_table." work
ON (prop.ref=work.id AND prop.c_id = $course_id)
WHERE active IN (0, 1) AND "; WHERE active IN (0, 1) AND ";
if (!empty($group_id)) { if (!empty($group_id)) {
$sql_select_directory .= " work.post_group_id = '".$group_id."' "; // set to select only messages posted by the user's group // set to select only messages posted by the user's group
$sql_select_directory .= " work.post_group_id = '".$group_id."' ";
} else { } else {
$sql_select_directory .= " work.post_group_id = '0' "; $sql_select_directory .= " work.post_group_id = '0' ";
} }
$sql_select_directory .= " AND ". $sql_select_directory .= " AND
" work.c_id = $course_id AND ". work.c_id = $course_id AND
" work.id = ".$work_parent->id." AND ". work.id = ".$work_parent->id." AND
" work.filetype = 'folder' AND ". work.filetype = 'folder' AND
" prop.tool='work' $condition_session"; prop.tool='work' $condition_session";
$result = Database::query($sql_select_directory); $result = Database::query($sql_select_directory);
$row = Database::fetch_array($result, 'ASSOC'); $row = Database::fetch_array($result, 'ASSOC');
@ -657,16 +662,15 @@ function display_student_publications_list(
} }
// form edit directory // form edit directory
$homework = array();
if (!empty($row['has_properties'])) { if (!empty($row['has_properties'])) {
$sql = Database::query('SELECT * FROM '.$work_assigment.' $sql = Database::query('SELECT * FROM '.$work_assigment.'
WHERE c_id = '.$course_id.' AND id = "'.$row['has_properties'].'" LIMIT 1'); WHERE c_id = '.$course_id.' AND id = "'.$row['has_properties'].'" LIMIT 1');
$homework = Database::fetch_array($sql); $homework = Database::fetch_array($sql);
} }
// save original value for later // save original value for later
$utc_expiry_time = $homework['expires_on']; $utc_expiry_time = isset($homework['expires_on']) ? $homework['expires_on'] : null;
$work_data = get_work_data_by_id($work_parent->id); $work_data = get_work_data_by_id($work_parent->id);
$workId = $row['id']; $workId = $row['id'];
$action = ''; $action = '';
@ -820,7 +824,16 @@ function display_student_publications_list(
$my_params = array ('edit_dir' => intval($_GET['edit_dir'])); $my_params = array ('edit_dir' => intval($_GET['edit_dir']));
} }
$my_params['origin'] = $origin; $my_params['origin'] = $origin;
Display::display_sortable_config_table('work', $table_header, $table_data, $sorting_options, $paging_options, $my_params, $column_show, $column_order); Display::display_sortable_config_table(
'work',
$table_header,
$table_data,
$sorting_options,
$paging_options,
$my_params,
$column_show,
$column_order
);
} }
/** /**
@ -1111,8 +1124,7 @@ function create_unexisting_work_directory($base_work_dir, $desired_dir_name)
/** /**
* Delete a work-tool directory * Delete a work-tool directory
* @param string Base "work" directory for this course as /var/www/chamilo/courses/ABCD/work/ * @param int $id work id to delete
* @param string The directory name as the bit after "work/", without trailing slash
* @return integer -1 on error * @return integer -1 on error
*/ */
function deleteDirWork($id) function deleteDirWork($id)
@ -1197,7 +1209,7 @@ function deleteDirWork($id)
/** /**
* Get the path of a document in the student_publication table (path relative to the course directory) * Get the path of a document in the student_publication table (path relative to the course directory)
* @param integer Element ID * @param integer $id
* @return string Path (or -1 on error) * @return string Path (or -1 on error)
*/ */
function get_work_path($id) function get_work_path($id)
@ -1216,8 +1228,9 @@ function get_work_path($id)
/** /**
* Update the url of a work in the student_publication table * Update the url of a work in the student_publication table
* @param integer ID of the work to update * @param integer $id of the work to update
* @param string Destination directory where the work has been moved (must end with a '/') * @param string $new_path Destination directory where the work has been moved (must end with a '/')
* @param int $parent_id
* @return -1 on error, sql query result on success * @return -1 on error, sql query result on success
*/ */
function updateWorkUrl($id, $new_path, $parent_id) function updateWorkUrl($id, $new_path, $parent_id)
@ -5050,7 +5063,7 @@ function exportAllStudentWorkFromPublication(
// getWorkComments need c_id // getWorkComments need c_id
$work['c_id'] = $courseInfo['real_id']; $work['c_id'] = $courseInfo['real_id'];
$content .= '<h3>'.strip_tags($work['title']).'<h3 />'; $content .= '<h3>'.strip_tags($work['title']).'</h3>';
$content .= get_lang('Date').': '.api_get_local_time($work['sent_date_from_db']).'<br />'; $content .= get_lang('Date').': '.api_get_local_time($work['sent_date_from_db']).'<br />';
if (!empty($work['qualification_only'])) { if (!empty($work['qualification_only'])) {
$content .= get_lang('Score').': '.$work['qualification_only'] . '<br />'; $content .= get_lang('Score').': '.$work['qualification_only'] . '<br />';
@ -5072,13 +5085,6 @@ function exportAllStudentWorkFromPublication(
} }
if (!empty($content)) { if (!empty($content)) {
/*$pdf->content_to_pdf(
$content,
null,
replace_dangerous_char($workData['title']),
$courseInfo['code']
);*/
$params = array( $params = array(
'filename' => $workData['title'] . '_' . api_get_local_time(), 'filename' => $workData['title'] . '_' . api_get_local_time(),
'pdf_title' => replace_dangerous_char($workData['title']), 'pdf_title' => replace_dangerous_char($workData['title']),
@ -5095,6 +5101,7 @@ function exportAllStudentWorkFromPublication(
} }
/** /**
* Downloads all user files per user
* @param int $userId * @param int $userId
* @param array $courseInfo * @param array $courseInfo
* @return bool * @return bool

Loading…
Cancel
Save