Minor - format code.

pull/2487/head
jmontoyaa 8 years ago
parent 4c5ebe3ce5
commit a43e0c9698
  1. 40
      main/course_progress/thematic.php
  2. 32
      main/course_progress/thematic_controller.php
  3. 10
      main/course_progress/thematic_plan.php
  4. 15
      main/create_course/add_course.php
  5. 84
      main/dropbox/dropbox_functions.inc.php
  6. 4
      main/dropbox/dropbox_init.inc.php
  7. 1
      main/dropbox/update.php
  8. 46
      main/forum/forumfunction.inc.php
  9. 4
      main/forum/iframe_thread.php
  10. 1
      main/forum/index.php
  11. 1
      main/forum/newthread.php
  12. 8
      main/forum/viewthread_flat.inc.php
  13. 30
      main/gradebook/certificate_report.php
  14. 51
      main/gradebook/gradebook.php
  15. 2
      main/gradebook/gradebook_add_cat.php

@ -20,7 +20,6 @@ $tpl = new Template(get_lang('ThematicControl'));
$toolbar = null;
if (api_is_allowed_to_edit(null, true)) {
switch ($action) {
case 'thematic_add':
case 'thematic_import_select':
@ -47,13 +46,17 @@ if (api_is_allowed_to_edit(null, true)) {
break;
default:
$actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'.
Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon(
'new_course_progress.png',
get_lang('NewThematicSection'),
'',
ICON_SIZE_MEDIUM
).'</a>';
}
$toolbar = Display::toolbarAction('thematic-bar', array($actionLeft));
}
if ($action == 'thematic_list') {
$table = new SortableTable(
'thematic_list',
@ -77,8 +80,16 @@ if ($action == 'thematic_list') {
$table->display();
} elseif ($action == 'thematic_details') {
if (isset($_GET['thematic_plan_save_message']) && $_GET['thematic_plan_save_message'] == 'ok') {
Display::addFlash(Display::return_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull'), 'confirmation', false));
if (isset($_GET['thematic_plan_save_message']) &&
$_GET['thematic_plan_save_message'] == 'ok'
) {
Display::addFlash(
Display::return_message(
get_lang('ThematicSectionHasBeenCreatedSuccessfull'),
'confirmation',
false
)
);
}
if (isset($last_id) && $last_id) {
@ -99,12 +110,11 @@ if ($action == 'thematic_list') {
$message = Display::return_message($text, 'info', false);
}
$list = [];
// Display thematic data
// Display thematic data
if (!empty($thematic_data)) {
// display progress
foreach ($thematic_data as $thematic) {
$list['id'] = $thematic['id'];
$list['id_course'] = $thematic['c_id'];
$list['id_session'] = $thematic['session_id'];
@ -129,7 +139,12 @@ if ($action == 'thematic_list') {
if (api_is_allowed_to_edit(null, true)) {
// Thematic title
$toolbarThematic = Display::url(
Display::return_icon('cd.png', get_lang('Copy'), null, ICON_SIZE_TINY),
Display::return_icon(
'cd.png',
get_lang('Copy'),
null,
ICON_SIZE_TINY
),
'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$my_thematic_id.$params.$url_token,
array('class'=> 'btn btn-default')
);
@ -211,7 +226,13 @@ if ($action == 'thematic_list') {
} else {
$form->addText('title', get_lang('Title'), true, array('size' => '50'));
}
$form->addHtmlEditor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Height' => '150'));
$form->addHtmlEditor(
'content',
get_lang('Content'),
false,
false,
array('ToolbarSet' => 'TrainingDescription', 'Height' => '150')
);
$form->addButtonSave(get_lang('Save'));
$show_form = true;
@ -235,7 +256,6 @@ if ($action == 'thematic_list') {
}
if ($show_form) {
$html = $form->returnForm();
}
} elseif ($action == 'thematic_import_select') {
// Create form to upload csv file.

@ -202,7 +202,6 @@ class ThematicController
case 'export_documents':
//no break
case 'thematic_export_pdf':
$pdfOrientation = api_get_configuration_value('thematic_pdf_orientation');
$list = $thematic->get_thematic_list();
@ -272,9 +271,12 @@ class ThematicController
case 'export_single_thematic':
$theme = $thematic->get_thematic_list($thematic_id);
$plans = $thematic->get_thematic_plan_data($theme['id']);
$plans = array_filter($plans, function($plan) {
$plans = array_filter(
$plans,
function ($plan) {
return !empty($plan['description']);
});
}
);
$advances = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
$view = new Template('', false, false, false, true, false, false);
@ -301,7 +303,11 @@ class ThematicController
'add_signatures' => $signatures
]
);
$pdf->exportFromHtmlToDocumentsArea($view->fetch($template), $fileName, $courseId);
$pdf->exportFromHtmlToDocumentsArea(
$view->fetch($template),
$fileName,
$courseId
);
header('Location: '.api_get_self().'?'.api_get_cidreq());
exit;
@ -388,7 +394,9 @@ class ThematicController
$thematic = new Thematic();
$data = array();
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (isset($_POST['action']) && ($_POST['action'] == 'thematic_plan_add' || $_POST['action'] == 'thematic_plan_edit')) {
if (isset($_POST['action']) &&
($_POST['action'] == 'thematic_plan_add' || $_POST['action'] == 'thematic_plan_edit')
) {
if (isset($_POST['title'])) {
if ($_POST['thematic_plan_token'] == $_SESSION['thematic_plan_token']) {
if (api_is_allowed_to_edit(null, true)) {
@ -437,7 +445,10 @@ class ThematicController
$error = true;
$action = $_POST['action'];
$data['error'] = $error;
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($_POST['thematic_id'], $_POST['description_type']);
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data(
$_POST['thematic_id'],
$_POST['description_type']
);
$data['thematic_id'] = $_POST['thematic_id'];
$data['description_type'] = $_POST['description_type'];
$data['action'] = $action;
@ -463,11 +474,13 @@ class ThematicController
}
$description_type = isset($_GET['description_type']) ? intval($_GET['description_type']) : null;
if (!empty($thematic_id) && !empty($description_type)) {
if ($action === 'thematic_plan_delete') {
if (api_is_allowed_to_edit(null, true)) {
$thematic->thematic_plan_destroy($thematic_id, $description_type);
$thematic->thematic_plan_destroy(
$thematic_id,
$description_type
);
}
$data['thematic_plan_data'] = $thematic->get_thematic_plan_data($thematic_id);
$action = 'thematic_plan_list';
@ -489,8 +502,7 @@ class ThematicController
$data['default_thematic_plan_question'] = $thematic->get_default_question();
$data['thematic_data'] = $thematic->get_thematic_list($thematic_id);
//render to the view
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('thematic_plan');

@ -26,8 +26,6 @@ if (!empty($thematic_simple_list)) {
}
}
//$i = 1;
echo Display::tag('h2', $thematic_data['title']);
echo $thematic_data['content'];
@ -161,7 +159,13 @@ if ($action === 'thematic_plan_list') {
// error messages
if ($error) {
Display::addFlash(Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'error', false));
Display::addFlash(
Display::return_message(
get_lang('FormHasErrorsPleaseComplete'),
'error',
false
)
);
}
$form->display();
}

@ -1,6 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Repository\CourseCategoryRepository;
use Chamilo\CoreBundle\Entity\CourseCategory;
/**
* This script allows professors and administrative staff to create course sites.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
@ -12,9 +15,6 @@
* @author Ivan Tcholakov <ivantcholakov@gmail.com>
*/
use Chamilo\CoreBundle\Entity\Repository\CourseCategoryRepository;
use Chamilo\CoreBundle\Entity\CourseCategory;
// Flag forcing the "current course" reset.
$cidReset = true;
@ -39,7 +39,9 @@ $accessUrlId = api_get_current_access_url_id();
// true - the new course is requested only and it is created after approval;
// false - the new course is created immediately, after filling this form.
$course_validation_feature = false;
if (api_get_setting('course_validation') === 'true' && !api_is_platform_admin()) {
if (api_get_setting('course_validation') === 'true' &&
!api_is_platform_admin()
) {
$course_validation_feature = true;
}
@ -191,7 +193,6 @@ $form->addElement(
);
if ($course_validation_feature) {
// A special URL to terms and conditions that is set
// in the platform settings page.
$terms_and_conditions_url = trim(
@ -291,7 +292,9 @@ if ($form->validate()) {
}
if ($wanted_code == '') {
$wanted_code = CourseManager::generate_course_code(api_substr($title, 0, CourseManager::MAX_COURSE_LENGTH_CODE));
$wanted_code = CourseManager::generate_course_code(
api_substr($title, 0, CourseManager::MAX_COURSE_LENGTH_CODE)
);
}
// Check whether the requested course code has already been occupied.

@ -309,20 +309,20 @@ function get_dropbox_category($id)
}
/**
* This functions stores a new dropboxcategory
*
* @var it might not seem very elegant if you create a category in sent
* This functions stores a new dropboxcategory
*
* @var it might not seem very elegant if you create a category in sent
* and in received with the same name that you get two entries in the
* dropbox_category table but it is the easiest solution. You get
* cat_name | received | sent | user_id
* test | 1 | 0 | 237
* test | 0 | 1 | 237
* more elegant would be
* test | 1 | 1 | 237
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
* dropbox_category table but it is the easiest solution. You get
* cat_name | received | sent | user_id
* test | 1 | 0 | 237
* test | 0 | 1 | 237
* more elegant would be
* test | 1 | 1 | 237
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function store_addcategory()
{
$course_id = api_get_course_int_id();
@ -1087,20 +1087,20 @@ function store_add_dropbox($file = [], $work = null)
Security::clear_token();
Display::addFlash(Display::return_message(get_lang('FileUploadSucces')));
return $result;
return $result;
}
/**
* Transforms the array containing all the feedback into something visually attractive.
*
* @param an array containing all the feedback about the given message.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function feedback($array) {
* Transforms the array containing all the feedback into something visually attractive.
*
* @param an array containing all the feedback about the given message.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function feedback($array)
{
$output = null;
foreach ($array as $value) {
$output .= format_feedback($value);
@ -1156,12 +1156,14 @@ function user_can_download_file($id, $user_id)
$id = intval($id);
$user_id = intval($user_id);
$sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
$sql = "SELECT file_id
FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
WHERE c_id = $course_id AND user_id = $user_id AND file_id = ".$id;
$result = Database::query($sql);
$number_users_who_see_file = Database::num_rows($result);
$sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
$sql = "SELECT file_id
FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
WHERE c_id = $course_id AND dest_user_id = $user_id AND file_id = ".$id;
$result = Database::query($sql);
$count = Database::num_rows($result);
@ -1175,12 +1177,14 @@ function check_if_file_exist($id)
{
$id = intval($id);
$course_id = api_get_course_int_id();
$sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
$sql = "SELECT file_id
FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
WHERE c_id = $course_id AND file_id = ".$id;
$result = Database::query($sql);
$number_users_who_see_file = Database::num_rows($result);
$sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
$sql = "SELECT file_id
FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
WHERE c_id = $course_id AND file_id = ".$id;
$result = Database::query($sql);
$count = Database::num_rows($result);
@ -1212,7 +1216,8 @@ function store_feedback()
$id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FEEDBACK), $params);
if ($id) {
$sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FEEDBACK)." SET feedback_id = iid WHERE iid = $id";
$sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FEEDBACK)."
SET feedback_id = iid WHERE iid = $id";
Database::query($sql);
}
@ -1286,13 +1291,14 @@ function zip_download($fileList)
}
/**
* This is a callback function to decrypt the files in the zip file to their normal filename (as stored in the database)
* @param array $p_event a variable of PCLZip
* @param array $p_header a variable of PCLZip
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
* This is a callback function to decrypt the files in the zip file
* to their normal filename (as stored in the database)
* @param array $p_event a variable of PCLZip
* @param array $p_header a variable of PCLZip
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function my_pre_add_callback($p_event, &$p_header)
{
$files = Session::read('dropbox_files_to_download');
@ -1321,7 +1327,6 @@ function generate_html_overview($files, $dont_show_columns = array(), $make_link
$counter = 0;
foreach ($files as $value) {
// Adding the header.
if ($counter == 0) {
$columns_array = array_keys($value);
@ -1358,7 +1363,8 @@ function generate_html_overview($files, $dont_show_columns = array(), $make_link
}
/**
* @desc This function retrieves the number of feedback messages on every document. This function might become obsolete when
* @desc This function retrieves the number of feedback messages on every
* document. This function might become obsolete when
* the feedback becomes user individual.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
@ -1377,9 +1383,9 @@ function get_total_number_feedback($file_id = '')
return $return;
}
/**
* @desc this function checks if the key exists. If this is the case it returns the value, if not it returns 0
* @desc this function checks if the key exists. If this is the case
* it returns the value, if not it returns 0
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/

@ -311,7 +311,9 @@ if (($postAction == 'download_received' || $postAction == 'download_sent') and !
* Prevents access of all users that are not course members
*/
if ((!$is_allowed_in_course || !$is_course_member) && !api_is_allowed_to_edit(null, true)) {
if ((!$is_allowed_in_course || !$is_course_member) &&
!api_is_allowed_to_edit(null, true)
) {
if ($origin != 'learnpath') {
api_not_allowed(true); //print headers/footers
} else {

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
require_once 'dropbox_init.inc.php';
api_protect_course_script();

@ -4216,7 +4216,11 @@ function move_post_form()
{
$gradebook = Security::remove_XSS($_GET['gradebook']);
// initiate the object
$form = new FormValidator('movepost', 'post', api_get_self().'?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&thread='.Security::remove_XSS($_GET['thread']).'&gradebook='.$gradebook.'&post='.Security::remove_XSS($_GET['post']).'&action='.Security::remove_XSS($_GET['action']).'&post='.Security::remove_XSS($_GET['post']));
$form = new FormValidator(
'movepost',
'post',
api_get_self().'?'.api_get_cidreq().'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']).'&gradebook='.$gradebook.'&post='.Security::remove_XSS($_GET['post']).'&action='.Security::remove_XSS($_GET['action']).'&post='.Security::remove_XSS($_GET['post'])
);
// The header for the form
$form->addElement('header', '', get_lang('MovePost'));
@ -4402,7 +4406,13 @@ function store_move_thread($values)
// Fix group id, if forum is moved to a different group
if (!empty($forumInfo['to_group_id'])) {
$groupId = $forumInfo['to_group_id'];
$item = api_get_item_property_info($courseId, TABLE_FORUM_THREAD, $threadId, $sessionId, $groupId);
$item = api_get_item_property_info(
$courseId,
TABLE_FORUM_THREAD,
$threadId,
$sessionId,
$groupId
);
$table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sessionCondition = api_get_session_condition($sessionId);
@ -4484,7 +4494,11 @@ function prepare4display($input)
*/
function forum_search()
{
$form = new FormValidator('forumsearch', 'post', 'forumsearch.php?'.api_get_cidreq());
$form = new FormValidator(
'forumsearch',
'post',
'forumsearch.php?'.api_get_cidreq()
);
// Setting the form elements.
$form->addElement('header', '', get_lang('ForumSearch'));
@ -4709,7 +4723,12 @@ function add_forum_attachment_file($file_comment, $last_id)
$file_name = $attachment['name'];
if (!filter_extension($new_file_name)) {
Display::addFlash(Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'error'));
Display::addFlash(
Display::return_message(
get_lang('UplUnableToSaveFileFilteredExtension'),
'error'
)
);
return;
}
@ -4797,7 +4816,12 @@ function edit_forum_attachment_file($file_comment, $post_id, $id_attach)
$file_name = $attachment['name'];
if (!filter_extension($new_file_name)) {
Display::addFlash(Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'error'));
Display::addFlash(
Display::return_message(
get_lang('UplUnableToSaveFileFilteredExtension'),
'error'
)
);
} else {
$new_file_name = uniqid('');
$new_path = $updir.'/'.$new_file_name;
@ -4912,7 +4936,8 @@ function delete_attachment($post_id, $id_attach = 0, $display = true)
}
// Delete from forum_attachment table.
$sql = "DELETE FROM $forum_table_attachment WHERE c_id = $course_id AND $cond ";
$sql = "DELETE FROM $forum_table_attachment
WHERE c_id = $course_id AND $cond ";
$result = Database::query($sql);
if ($result !== false) {
$affectedRows = Database::affected_rows($result);
@ -4940,7 +4965,7 @@ function delete_attachment($post_id, $id_attach = 0, $display = true)
/**
* This function gets all the forum information of the all the forum of the group
*
* @param integer $groupId the id of the group we need the fora of (see forum.forum_of_group)
* @param array $groupInfo the id of the group we need the fora of (see forum.forum_of_group)
* @return array
*
* @todo this is basically the same code as the get_forums function. Consider merging the two.
@ -5153,7 +5178,6 @@ function get_notifications($content, $id)
// Database table definition
$table_users = Database::get_main_table(TABLE_MAIN_USER);
$table_notification = Database::get_course_table(TABLE_FORUM_NOTIFICATION);
$course_id = api_get_course_int_id();
// Which database field contains the notification?
@ -5165,7 +5189,8 @@ function get_notifications($content, $id)
$sql = "SELECT user.user_id, user.firstname, user.lastname, user.email, user.user_id user
FROM $table_users user, $table_notification notification
WHERE notification.c_id = $course_id AND user.active = 1 AND
WHERE
notification.c_id = $course_id AND user.active = 1 AND
user.user_id = notification.user_id AND
notification.$database_field= '".Database::escape_string($id)."'";
@ -5673,7 +5698,8 @@ function editAttachedFile($array, $id, $courseId = null) {
// Delete last comma
$setString = substr($setString, 0, strlen($setString) - 2);
$forumAttachmentTable = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
$sql = "UPDATE $forumAttachmentTable SET $setString WHERE c_id = $courseId AND id = $id";
$sql = "UPDATE $forumAttachmentTable
SET $setString WHERE c_id = $courseId AND id = $id";
$result = Database::query($sql);
if ($result !== false) {
$affectedRows = Database::affected_rows($result);

@ -51,7 +51,9 @@ $current_forum_category = get_forumcategory_information(
// if the user is not a course administrator and the forum is hidden
// then the user is not allowed here.
if (!api_is_allowed_to_edit(false, true) && ($current_forum['visibility'] == 0 || $current_thread['visibility'] == 0)) {
if (!api_is_allowed_to_edit(false, true) &&
($current_forum['visibility'] == 0 || $current_thread['visibility'] == 0)
) {
api_not_allowed(false);
}

@ -520,7 +520,6 @@ if (is_array($forumCategories)) {
}
}
$tpl = new Template($nameTools);
$tpl->assign('introduction_section', $introduction);
$tpl->assign('actions', $actions);

@ -41,7 +41,6 @@ require_once 'forumfunction.inc.php';
// Are we in a lp ?
$origin = api_get_origin();
/* MAIN DISPLAY SECTION */
$current_forum = get_forum_information($_GET['forum']);
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);

@ -52,8 +52,12 @@ if (isset($current_thread['thread_id'])) {
$current_thread['locked'] == 0 ||
api_is_allowed_to_edit(false, true)
) {
if ($_user['user_id'] || ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])) {
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
if ($_user['user_id'] ||
($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])
) {
if (!api_is_anonymous() &&
api_is_allowed_to_session_edit(false, true)
) {
$buttonReply = Display::toolbarButton(
get_lang('ReplyToMessage'),
'reply.php?'.api_get_cidreq().'&'.http_build_query([

@ -36,7 +36,11 @@ if (api_is_student_boss()) {
$userList = $userGroup->getGroupUsersByUser($userId);
$sessionsList = SessionManager::getSessionsFollowedForGroupAdmin($userId);
} else {
$sessionsList = SessionManager::getSessionsCoachedByUser($userId, false, api_is_platform_admin());
$sessionsList = SessionManager::getSessionsCoachedByUser(
$userId,
false,
api_is_platform_admin()
);
}
foreach ($sessionsList as $session) {
@ -62,7 +66,11 @@ if ($selectedSession > 0) {
if (api_is_student_boss()) {
$coursesList = CourseManager::getCoursesFollowedByGroupAdmin($userId);
} else {
$coursesList = CourseManager::get_courses_list_by_user_id($userId, false, true);
$coursesList = CourseManager::get_courses_list_by_user_id(
$userId,
false,
true
);
if (is_array($coursesList)) {
foreach ($coursesList as &$course) {
@ -102,7 +110,14 @@ if ($searchSessionAndCourse || $searchCourseOnly) {
exit;
}
$gradebookCategories = Category::load(null, null, $selectedCourseInfo['code'], null, false, $selectedSession);
$gradebookCategories = Category::load(
null,
null,
$selectedCourseInfo['code'],
null,
false,
$selectedSession
);
$gradebook = null;
@ -197,7 +212,14 @@ if ($searchSessionAndCourse || $searchCourseOnly) {
$sessionCourseList = SessionManager::get_course_list_by_session_id($session['id']);
foreach ($sessionCourseList as $sessionCourse) {
$gradebookCategories = Category::load(null, null, $sessionCourse['code'], null, false, $session['id']);
$gradebookCategories = Category::load(
null,
null,
$sessionCourse['code'],
null,
false,
$session['id']
);
$gradebook = null;

@ -229,7 +229,7 @@ if (isset($_GET['deleteeval'])) {
//parameters for links
if (isset($_GET['visiblelink'])) {
GradebookUtils::block_students();
if (isset ($_GET['set_visible'])) {
if (isset($_GET['set_visible'])) {
$visibility_command = 1;
} else {
$visibility_command = 0;
@ -246,7 +246,7 @@ if (isset($_GET['visiblelink'])) {
$filter_confirm_msg = false;
}
}
if (isset ($_GET['deletelink'])) {
if (isset($_GET['deletelink'])) {
GradebookUtils::block_students();
//fixing #5229
if (!empty($_GET['deletelink'])) {
@ -319,7 +319,7 @@ if (isset($_POST['action'])) {
$confirmation_message = get_lang('DeletedCategories').' : <b>'.$number_of_deleted_categories.'</b><br />'.get_lang('DeletedEvaluations').' : <b>'.$number_of_deleted_evaluations.'</b><br />'.get_lang('DeletedLinks').' : <b>'.$number_of_deleted_links.'</b><br /><br />'.get_lang('TotalItems').' : <b>'.$number_of_selected_items.'</b>';
$filter_confirm_msg = false;
break;
case 'setvisible' :
case 'setvisible':
foreach ($_POST['id'] as $indexstr) {
if (api_substr($indexstr, 0, 4) == 'CATE') {
$cats = Category:: load(api_substr($indexstr, 4));
@ -341,7 +341,7 @@ if (isset($_POST['action'])) {
$confirmation_message = get_lang('ItemsVisible');
$filter_confirm_msg = false;
break;
case 'setinvisible' :
case 'setinvisible':
foreach ($_POST['id'] as $indexstr) {
if (api_substr($indexstr, 0, 4) == 'CATE') {
$cats = Category:: load(api_substr($indexstr, 4));
@ -367,7 +367,7 @@ if (isset($_POST['action'])) {
}
}
if (isset ($_POST['submit']) && isset ($_POST['keyword'])) {
if (isset($_POST['submit']) && isset($_POST['keyword'])) {
header('Location: '.api_get_self().'?selectcat='.$selectcat
. '&search='.Security::remove_XSS($_POST['keyword']));
exit;
@ -382,43 +382,43 @@ if (isset($_GET['evaluationmoved'])) {
if (isset($_GET['linkmoved'])) {
Display::addFlash(Display::return_message(get_lang('LinkMoved'), 'confirmation', false));
}
if (isset ($_GET['addcat'])) {
if (isset($_GET['addcat'])) {
Display::addFlash(Display::return_message(get_lang('CategoryAdded'), 'confirmation', false));
}
if (isset ($_GET['linkadded'])) {
if (isset($_GET['linkadded'])) {
Display::addFlash(Display::return_message(get_lang('LinkAdded'), 'confirmation', false));
}
if (isset ($_GET['addresult'])) {
if (isset($_GET['addresult'])) {
Display::addFlash(Display::return_message(get_lang('ResultAdded'), 'confirmation', false));
}
if (isset ($_GET['editcat'])) {
if (isset($_GET['editcat'])) {
Display::addFlash(Display::return_message(get_lang('CategoryEdited'), 'confirmation', false));
}
if (isset ($_GET['editeval'])) {
if (isset($_GET['editeval'])) {
Display::addFlash(Display::return_message(get_lang('EvaluationEdited'), 'confirmation', false));
}
if (isset ($_GET['linkedited'])) {
if (isset($_GET['linkedited'])) {
Display::addFlash(Display::return_message(get_lang('LinkEdited'), 'confirmation', false));
}
if (isset ($_GET['nolinkitems'])) {
if (isset($_GET['nolinkitems'])) {
Display::addFlash(Display::return_message(get_lang('NoLinkItems'), 'warning', false));
}
if (isset ($_GET['addallcat'])) {
if (isset($_GET['addallcat'])) {
Display::addFlash(Display::return_message(get_lang('AddAllCat'), 'normal', false));
}
if (isset ($confirmation_message)) {
if (isset($confirmation_message)) {
Display::addFlash(Display::return_message($confirmation_message, 'confirmation', $filter_confirm_msg));
}
if (isset ($warning_message)) {
if (isset($warning_message)) {
Display::addFlash(Display::return_message($warning_message, 'warning', $filter_warning_msg));
}
if (isset ($move_form)) {
if (isset($move_form)) {
Display::addFlash(Display::return_message($move_form->toHtml(), 'normal', false));
}
// DISPLAY HEADERS AND MESSAGES -
if (!isset($_GET['exportpdf']) && !isset($_GET['export_certificate'])) {
if (isset ($_GET['studentoverview'])) {
if (isset($_GET['studentoverview'])) {
$interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat.'&'.api_get_cidreq(),
'name' => get_lang('ToolGradebook')
@ -486,15 +486,14 @@ if (!empty($keyword)) {
$alleval = Evaluation::find_evaluations($keyword, $cats[0]->get_id());
$alllink = LinkFactory::find_links($keyword, $cats[0]->get_id());
}
} elseif (isset ($_GET['studentoverview'])) {
} elseif (isset($_GET['studentoverview'])) {
//@todo this code seems to be deprecated because the gradebook tab is off
$cats = Category :: load($category);
$stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id());
$allcat = array();
$alleval = $cats[0]->get_evaluations($stud_id, true);
$alllink = $cats[0]->get_links($stud_id, true);
if (isset ($_GET['exportpdf'])) {
if (isset($_GET['exportpdf'])) {
$datagen = new GradebookDataGenerator($allcat, $alleval, $alllink);
$header_names = array(
get_lang('Name'),
@ -587,10 +586,13 @@ $addparams = array('selectcat' => $cats[0]->get_id());
if (isset($_GET['search'])) {
$addparams['search'] = $keyword;
}
if (isset ($_GET['studentoverview'])) {
if (isset($_GET['studentoverview'])) {
$addparams['studentoverview'] = '';
}
if (isset($allcat_info) && count($allcat_info) >= 0 && (isset($_GET['selectcat']) && $_GET['selectcat'] == 0) && isset($_GET['search']) && strlen(trim($_GET['search'])) > 0) {
if (isset($allcat_info) && count($allcat_info) >= 0 &&
(isset($_GET['selectcat']) && $_GET['selectcat'] == 0) &&
isset($_GET['search']) && strlen(trim($_GET['search'])) > 0
) {
$allcat = $allcat_info;
} else {
$allcat = $allcat;
@ -602,7 +604,10 @@ $gradebooktable = new GradebookTable(
$alllink,
$addparams
);
if (((empty($allcat)) && (empty ($alleval)) && (empty ($alllink)) && (!$is_platform_admin) && ($is_course_admin) && (!isset($_GET['selectcat']))) &&
if (((empty($allcat)) && (empty($alleval)) && (empty ($alllink)) && (!$is_platform_admin) &&
($is_course_admin) &&
(!isset($_GET['selectcat']))
) &&
api_is_course_tutor()
) {
echo Display::return_message(

@ -82,7 +82,7 @@ if ($form->validate()) {
$cat->setIsRequirement(false);
}
if (empty ($values['visible'])) {
if (empty($values['visible'])) {
$visible = 0;
} else {
$visible = 1;

Loading…
Cancel
Save