Minor - format code.

1.9.x
Julio Montoya 10 years ago
parent 97fda734b5
commit 76a28b1c8d
  1. 50
      main/work/work.php

@ -88,7 +88,11 @@ if (!empty($group_id)) {
$show_work = true; $show_work = true;
} else { } else {
// you are not a teacher // you are not a teacher
$show_work = GroupManager::user_has_access($user_id, $group_id, GroupManager::GROUP_TOOL_WORK); $show_work = GroupManager::user_has_access(
$user_id,
$group_id,
GroupManager::GROUP_TOOL_WORK
);
} }
if (!$show_work) { if (!$show_work) {
@ -154,7 +158,11 @@ switch ($action) {
case 'settings': case 'settings':
//if posts //if posts
if ($is_allowed_to_edit && !empty($_POST['changeProperties'])) { if ($is_allowed_to_edit && !empty($_POST['changeProperties'])) {
updateSettings($course, $_POST['show_score'], $_POST['student_delete_own_publication']); updateSettings(
$course,
$_POST['show_score'],
$_POST['student_delete_own_publication']
);
Session::write('message', Display::return_message(get_lang('Saved'), 'success')); Session::write('message', Display::return_message(get_lang('Saved'), 'success'));
header('Location: '.$currentUrl); header('Location: '.$currentUrl);
exit; exit;
@ -173,7 +181,11 @@ switch ($action) {
if (!$is_allowed_to_edit) { if (!$is_allowed_to_edit) {
api_not_allowed(); api_not_allowed();
} }
$form = new FormValidator('form1', 'post', api_get_path(WEB_CODE_PATH).'work/work.php?action=create_dir&'. api_get_cidreq()); $form = new FormValidator(
'form1',
'post',
api_get_path(WEB_CODE_PATH) . 'work/work.php?action=create_dir&' . api_get_cidreq()
);
$form->addElement('header', get_lang('CreateAssignment')); $form->addElement('header', get_lang('CreateAssignment'));
$form->addElement('hidden', 'action', 'add'); $form->addElement('hidden', 'action', 'add');
$defaults = isset($_POST) ? $_POST : array(); $defaults = isset($_POST) ? $_POST : array();
@ -181,7 +193,13 @@ switch ($action) {
$form->addElement('style_submit_button', 'submit', get_lang('CreateDirectory')); $form->addElement('style_submit_button', 'submit', get_lang('CreateDirectory'));
if ($form->validate()) { if ($form->validate()) {
$result = addDir($_POST, $user_id, $_course, $group_id, $id_session); $result = addDir(
$_POST,
$user_id,
$_course,
$group_id,
$id_session
);
if ($result) { if ($result) {
$message = Display::return_message(get_lang('DirectoryCreated'), 'success'); $message = Display::return_message(get_lang('DirectoryCreated'), 'success');
} else { } else {
@ -214,7 +232,13 @@ switch ($action) {
/* Move file form request */ /* Move file form request */
if ($is_allowed_to_edit) { if ($is_allowed_to_edit) {
if (!empty($item_id)) { if (!empty($item_id)) {
$content = generateMoveForm($item_id, $curdirpath, $course_info, $group_id, $session_id); $content = generateMoveForm(
$item_id,
$curdirpath,
$course_info,
$group_id,
$session_id
);
} }
} }
break; break;
@ -233,8 +257,18 @@ switch ($action) {
if ($path = get_work_path($item_id)) { if ($path = get_work_path($item_id)) {
if (move($course_dir.'/'.$path, $base_work_dir . $move_to_path)) { if (move($course_dir.'/'.$path, $base_work_dir . $move_to_path)) {
// Update db // Update db
updateWorkUrl($item_id, 'work' . $move_to_path, $_REQUEST['move_to_id']); updateWorkUrl(
api_item_property_update($_course, 'work', $_REQUEST['move_to_id'], 'FolderUpdated', $user_id); $item_id,
'work' . $move_to_path,
$_REQUEST['move_to_id']
);
api_item_property_update(
$_course,
'work',
$_REQUEST['move_to_id'],
'FolderUpdated',
$user_id
);
$message = Display::return_message(get_lang('DirMv'), 'success'); $message = Display::return_message(get_lang('DirMv'), 'success');
} else { } else {
@ -267,7 +301,7 @@ switch ($action) {
} else { } else {
$content .= showStudentWorkGrid(); $content .= showStudentWorkGrid();
} }
break; break;
} }
Display :: display_header(null); Display :: display_header(null);

Loading…
Cancel
Save