Minor - format code

pull/3064/head
Julio 5 years ago
parent 3328690fcd
commit 25c512807a
  1. 21
      public/main/create_course/add_course.php
  2. 5
      public/main/glossary/glossary.js.php
  3. 7
      public/main/glossary/glossary_ajax_request.php
  4. 22
      public/main/glossary/index.php
  5. 40
      public/main/link/link.php
  6. 11
      public/main/link/link_goto.php
  7. 7
      public/main/messages/download.php
  8. 12
      public/main/messages/inbox.php
  9. 9
      public/main/messages/index.php
  10. 34
      public/main/messages/new_message.php
  11. 12
      public/main/messages/outbox.php
  12. 1
      public/main/messages/record_audio.php
  13. 14
      public/main/messages/view_message.php
  14. 7
      public/main/work/work.lib.php

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\CourseCategory;
@ -10,10 +11,6 @@ use Chamilo\CoreBundle\Repository\CourseCategoryRepository;
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @author Roan Embrechts, refactoring
*
* @package chamilo.create_course
* "Course validation" feature:
*
* @author Jose Manuel Abuin Mosquera <chema@cesga.es>, Centro de Supercomputacion de Galicia
* "Course validation" feature, technical adaptation for Chamilo 1.8.8:
* @author Ivan Tcholakov <ivantcholakov@gmail.com>
@ -43,7 +40,7 @@ $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' &&
if ('true' === api_get_setting('course_validation') &&
!api_is_platform_admin()
) {
$course_validation_feature = true;
@ -169,7 +166,7 @@ $form->addRule(
);
// The teacher
$titular = &$form->addElement('hidden', 'tutor_name', '');
$form->addElement('hidden', 'tutor_name', '');
if ($course_validation_feature) {
// Description of the requested course.
$form->addElement(
@ -198,7 +195,7 @@ if ($course_validation_feature) {
// Course language.
$languages = api_get_languages();
if (count($languages) === 1) {
if (1 === count($languages)) {
// If there's only one language available, there's no point in asking
$form->addElement('hidden', 'course_language', $languages['folder'][0]);
} else {
@ -229,7 +226,7 @@ if ($course_validation_feature) {
// then we may get the URL from Chamilo's module "Terms and conditions",
// if it is activated.
if (empty($terms_and_conditions_url)) {
if (api_get_setting('allow_terms_conditions') === 'true') {
if ('true' === api_get_setting('allow_terms_conditions')) {
$terms_and_conditions_url = api_get_path(WEB_CODE_PATH).'auth/inscription.php?legal';
}
}
@ -269,7 +266,7 @@ if ($course_validation_feature) {
$obj = new GradeModel();
$obj->fill_grade_model_select_in_form($form);
if (api_get_setting('teacher_can_select_course_template') === 'true') {
if ('true' === api_get_setting('teacher_can_select_course_template')) {
$form->addElement(
'select_ajax',
'course_template',
@ -291,7 +288,7 @@ $form->addButtonCreate($course_validation_feature ? get_lang('Create this course
$form->addProgress();
// Set default values.
if (isset($_user['language']) && $_user['language'] != '') {
if (isset($_user['language']) && '' != $_user['language']) {
$values['course_language'] = $_user['language'];
} else {
$values['course_language'] = api_get_setting('platformLanguage');
@ -317,7 +314,7 @@ if ($form->validate()) {
$target_audience = $course_values['target_audience'];
}
if ($wanted_code == '') {
if ('' == $wanted_code) {
$wanted_code = CourseManager::generate_course_code(
api_substr($title, 0, CourseManager::MAX_COURSE_LENGTH_CODE)
);
@ -363,7 +360,7 @@ if ($form->validate()) {
}
$splash = api_get_setting('course_creation_splash_screen');
if ($splash === 'true') {
if ('true' === $splash) {
$url = Container::getRouter()->generate(
'chamilo_core_course_welcome',
['cid' => $course_info['real_id']]

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php';
@ -11,7 +12,7 @@ $tpl = new Template('', false, false, false, true, false, false);
$glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
if ($origin == 'learnpath') {
if ('learnpath' == $origin) {
$showGlossary = in_array($glossaryExtraTools, ['lp', 'exercise_and_lp']);
} else {
$showGlossary = in_array($glossaryExtraTools, ['true', 'lp', 'exercise_and_lp']);
@ -19,7 +20,7 @@ if ($origin == 'learnpath') {
if ($showGlossary) {
$templateName = 'glossary/glossary_auto.js.tpl';
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
if ('ismanual' == api_get_setting('show_glossary_in_documents')) {
$templateName = 'glossary/glossary_manual.js.tpl';
}

@ -1,11 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/* @todo move this file in the inc/ajax/ folder */
/**
* Glossary ajax request code.
*
* @package chamilo.glossary
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -25,7 +24,7 @@ $description = get_lang('No results found');
if (!empty($glossaryId)) {
$description = GlossaryManager::get_glossary_term_by_glossary_id($glossaryId);
$description = str_replace($path_image_search, $path_image, $description);
} elseif (isset($_POST['glossary_data']) && $_POST['glossary_data'] == 'true') {
} elseif (isset($_POST['glossary_data']) && 'true' == $_POST['glossary_data']) {
// get_glossary_terms
$glossary_data = GlossaryManager::get_glossary_terms();
$glossary_all_data = [];
@ -53,7 +52,7 @@ if (!empty($glossaryId)) {
$glossaryInfo['description']
);
if (is_null($description) || strlen(trim($description)) == 0) {
if (null === $description || 0 == strlen(trim($description))) {
$description = get_lang('No results found');
} else {
$description = str_replace('class="glossary"', '', $description);

@ -1,11 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* @package chamilo.glossary
*
* @author Christian Fasanando, initial version
* @author Bas Wijnen import/export to CSV
*/
@ -13,9 +12,6 @@ require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_GLOSSARY;
// The section (tabs).
$this_section = SECTION_COURSES;
// Notification for unauthorized people.
api_protect_course_script(true);
@ -37,7 +33,7 @@ $(function() {
modal: true
});
$("#export_opener").click(function() {
var targetUrl = $(this).attr("href");
var targetUrl = $(this).attr("href");
$( "#dialog-confirm" ).dialog({
width:400,
height:300,
@ -134,6 +130,7 @@ switch ($action) {
);
$content .= $form->returnForm();
}
break;
case 'edit_glossary':
if (!api_is_allowed_to_edit(null, true)) {
@ -222,6 +219,7 @@ switch ($action) {
$content .= $form->returnForm();
}
}
break;
case 'delete_glossary':
if (!api_is_allowed_to_edit(null, true)) {
@ -231,14 +229,17 @@ switch ($action) {
Security::clear_token();
header('Location: '.$currentUrl);
exit;
break;
case 'moveup':
//GlossaryManager::move_glossary('up',$_GET['glossary_id']); //actions not available
GlossaryManager::display_glossary();
break;
case 'movedown':
//GlossaryManager::move_glossary('down',$_GET['glossary_id']); //actions not available
GlossaryManager::display_glossary();
break;
case 'import':
if (!api_is_allowed_to_edit(null, true)) {
@ -304,18 +305,18 @@ switch ($action) {
switch ($format) {
case 'csv':
$data = Import::csvToArray($_FILES['file']['tmp_name']);
break;
case 'xls':
$data = Import::xlsToArray($_FILES['file']['tmp_name']);
break;
}
$goodList = [];
$updatedList = [];
$addedList = [];
$badList = [];
$doubles = [];
$added = [];
$termsPerKey = [];
if ($data) {
@ -417,6 +418,7 @@ switch ($action) {
header('Location: '.$currentUrl);
exit;
}
break;
case 'export':
if (!api_is_allowed_to_edit(null, true)) {
@ -424,6 +426,7 @@ switch ($action) {
}
$format = isset($_GET['export_format']) ? $_GET['export_format'] : 'csv';
GlossaryManager::exportToFormat($format);
break;
case 'changeview':
if (in_array($_GET['view'], ['list', 'table'])) {
@ -440,17 +443,20 @@ switch ($action) {
}
header('Location: '.$currentUrl);
exit;
break;
case 'export_documents':
GlossaryManager::movePdfToDocuments();
header('Location: '.$currentUrl);
exit;
break;
default:
$tool_name = get_lang('List');
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php?add_ready=1&'.api_get_cidreq().'"></script>';
$htmlHeadXtra[] = api_get_js('jquery.highlight.js');
$content = GlossaryManager::display_glossary();
break;
}

@ -16,8 +16,6 @@
* @author Julio Montoya code rewritten
* @author Patrick Cool
* @author René Haentjens, added CSV file import (October 2004)
*
* @package chamilo.link
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_LINK;
@ -41,47 +39,30 @@ $htmlHeadXtra[] = '<script>
}
</script>';
// @todo change the $_REQUEST into $_POST or $_GET
// @todo remove this code
$link_submitted = isset($_POST['submitLink']);
$category_submitted = isset($_POST['submitCategory']);
$urlview = !empty($_GET['urlview']) ? $_GET['urlview'] : '';
$submit_import = !empty($_POST['submitImport']) ? $_POST['submitImport'] : '';
$down = !empty($_GET['down']) ? $_GET['down'] : '';
$up = !empty($_GET['up']) ? $_GET['up'] : '';
$catmove = !empty($_GET['catmove']) ? $_GET['catmove'] : '';
$editlink = !empty($_REQUEST['editlink']) ? $_REQUEST['editlink'] : '';
$id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : '';
$urllink = !empty($_REQUEST['urllink']) ? $_REQUEST['urllink'] : '';
$title = !empty($_REQUEST['title']) ? $_REQUEST['title'] : '';
$description = !empty($_REQUEST['description']) ? $_REQUEST['description'] : '';
$selectcategory = !empty($_REQUEST['selectcategory']) ? $_REQUEST['selectcategory'] : '';
$submit_link = isset($_REQUEST['submitLink']);
$action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : '';
$category_title = !empty($_REQUEST['category_title']) ? $_REQUEST['category_title'] : '';
$submit_category = isset($_POST['submitCategory']);
$target_link = !empty($_REQUEST['target_link']) ? $_REQUEST['target_link'] : '_self';
$nameTools = get_lang('Links');
$course_id = api_get_course_int_id();
// Condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id, true, true);
if ($action === 'addlink') {
if ('addlink' === $action) {
$nameTools = '';
$interbreadcrumb[] = ['url' => 'link.php', 'name' => get_lang('Links')];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add a link')];
}
if ($action === 'addcategory') {
if ('addcategory' === $action) {
$nameTools = '';
$interbreadcrumb[] = ['url' => 'link.php', 'name' => get_lang('Links')];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add category')];
}
if ($action === 'editlink') {
if ('editlink' === $action) {
$nameTools = get_lang('Edit link');
$interbreadcrumb[] = ['url' => 'link.php', 'name' => get_lang('Links')];
}
@ -133,6 +114,7 @@ switch ($action) {
exit;
}
$content = $form->returnForm();
break;
case 'editlink':
$form = Link::getLinkForm($id, 'editlink');
@ -143,6 +125,7 @@ switch ($action) {
exit;
}
$content = $form->returnForm();
break;
case 'addcategory':
$form = Link::getCategoryForm(null, 'addcategory');
@ -154,6 +137,7 @@ switch ($action) {
exit;
}
$content = $form->returnForm();
break;
case 'editcategory':
$form = Link::getCategoryForm($id, 'editcategory');
@ -173,51 +157,59 @@ switch ($action) {
Link::deletelinkcategory($id, 'link');
header('Location: '.$linkListUrl);
exit;
break;
case 'deletecategory':
// Here we delete a category
Link::deletelinkcategory($id, 'category');
header('Location: '.$linkListUrl);
exit;
break;
case 'visible':
// Here we edit a category
Link::change_visibility_link($id, $scope);
header('Location: '.$linkListUrl);
exit;
break;
case 'invisible':
// Here we edit a category
Link::change_visibility_link($id, $scope);
header('Location: '.$linkListUrl);
exit;
break;
case 'up':
Link::movecatlink('up', $up);
header('Location: '.$linkListUrl);
exit;
break;
case 'down':
Link::movecatlink('down', $down);
header('Location: '.$linkListUrl);
exit;
break;
case 'move_link_up':
Link::moveLinkUp($id);
header('Location: '.$linkListUrl);
exit;
break;
case 'move_link_down':
Link::moveLinkDown($id);
header('Location: '.$linkListUrl);
exit;
break;
case 'export':
$content = Link::listLinksAndCategories($course_id, $session_id, $categoryId, $show, null, false, true);
$courseInfo = api_get_course_info_by_id($course_id);
if (!empty($session_id)) {
$sessionInfo = api_get_session_info($session_id);
$courseInfo['title'] = $courseInfo['title'].' '.$sessionInfo['name'];
$courseInfo['title'] .= ' '.$sessionInfo['name'];
}
$pdf = new PDF();
$pdf->content_to_pdf(
@ -231,10 +223,12 @@ switch ($action) {
false,
true
);
break;
case 'list':
default:
$content = Link::listLinksAndCategories($course_id, $session_id, $categoryId, $show);
break;
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -13,12 +14,8 @@
* url is given to avoid a new select
*
* @author Thomas Depraetere, Hugues Peeters, Christophe Gesch<EFBFBD> - original versions
*
* @package chamilo.link
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
$linkId = isset($_GET['link_id']) ? $_GET['link_id'] : 0;
$linkInfo = Link::getLinkInfo($linkId);
@ -27,9 +24,9 @@ if ($linkInfo) {
// Launch event
Event::event_link($linkId);
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); // HTTP/1.0
header("Location: $linkUrl");
exit;
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -6,8 +7,6 @@
* Html files are parsed to fix a few problems with URLs,
* but this code will hopefully be replaced soon by an Apache URL
* rewrite mechanism.
*
* @package chamilo.messages
*/
session_cache_limiter('public');
@ -56,9 +55,11 @@ $message_uid = '';
switch ($type) {
case MessageManager::MESSAGE_TYPE_INBOX:
$message_uid = $row_users['user_receiver_id'];
break;
case MessageManager::MESSAGE_TYPE_OUTBOX:
$message_uid = $row_users['user_sender_id'];
break;
}
@ -103,7 +104,7 @@ if (Security::check_abs_path($full_file_name, $path_user_info['dir'].'message_at
true,
$title
);
if ($result === false) {
if (false === $result) {
api_not_allowed(true);
}
}

@ -1,16 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.messages
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
if (api_get_setting('allow_message_tool') != 'true') {
if ('true' != api_get_setting('allow_message_tool')) {
api_not_allowed(true);
}
@ -20,8 +18,8 @@ $logInfo = [
];
Event::registerLog($logInfo);
$allowSocial = api_get_setting('allow_social_tool') == 'true';
$allowMessage = api_get_setting('allow_message_tool') == 'true';
$allowSocial = 'true' == api_get_setting('allow_social_tool');
$allowMessage = 'true' == api_get_setting('allow_message_tool');
if ($allowSocial) {
$this_section = SECTION_SOCIAL;
@ -45,7 +43,7 @@ $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Inbox')];
$actions = '';
// Comes from normal profile
if ($allowSocial === false && $allowMessage) {
if (false === $allowSocial && $allowMessage) {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('message_new.png', get_lang('Compose message')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.messages
*/
require_once __DIR__.'/../inc/global.inc.php';
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
if ('true' == api_get_setting('allow_social_tool') && 'true' == api_get_setting('allow_message_tool')) {
header('Location:inbox.php?f=social');
} elseif (api_get_setting('allow_message_tool') == 'true') {
} elseif ('true' == api_get_setting('allow_message_tool')) {
header('Location:inbox.php');
}
exit;

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.messages
*/
/* For licensing terms, see /license.txt */
/**
* This script shows a compose area (wysiwyg editor if supported, otherwise
@ -18,7 +15,7 @@ require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
if (api_get_setting('allow_message_tool') !== 'true') {
if ('true' !== api_get_setting('allow_message_tool')) {
api_not_allowed(true);
}
@ -29,7 +26,7 @@ $logInfo = [
];
Event::registerLog($logInfo);
$allowSocial = api_get_setting('allow_social_tool') === 'true';
$allowSocial = 'true' === api_get_setting('allow_social_tool');
$nameTools = api_xml_http_response_encode(get_lang('Messages'));
$htmlHeadXtra[] = '<script>
@ -65,9 +62,8 @@ $tpl = new Template(get_lang('Compose message'));
function show_compose_to_any($tpl)
{
$default['user_list'] = 0;
$html = manageForm($default, null, null, $tpl);
return $html;
return manageForm($default, null, null, $tpl);
}
function show_compose_reply_to_message($message_id, $receiver_id, $tpl)
@ -78,20 +74,17 @@ function show_compose_reply_to_message($message_id, $receiver_id, $tpl)
$query = "SELECT user_sender_id
FROM $table
WHERE user_receiver_id = ".$receiver_id." AND id = ".$message_id;
WHERE user_receiver_id = ".$receiver_id.' AND id = '.$message_id;
$result = Database::query($query);
$row = Database::fetch_array($result, 'ASSOC');
$userInfo = api_get_user_info($row['user_sender_id']);
if (empty($row['user_sender_id']) || empty($userInfo)) {
$html = get_lang('The id of the message to reply to is not valid.');
return $html;
return get_lang('The id of the message to reply to is not valid.');
}
$default['users'] = [$row['user_sender_id']];
$html = manageForm($default, null, $userInfo['complete_name_with_username'], $tpl);
return $html;
return manageForm($default, null, $userInfo['complete_name_with_username'], $tpl);
}
function show_compose_to_user($receiver_id, $tpl)
@ -100,9 +93,8 @@ function show_compose_to_user($receiver_id, $tpl)
$html = get_lang('To').':&nbsp;<strong>'.$userInfo['complete_name'].'</strong>';
$default['title'] = api_xml_http_response_encode(get_lang('Please enter a title'));
$default['users'] = [$receiver_id];
$html .= manageForm($default, null, '', $tpl);
return $html;
return $html.manageForm($default, null, '', $tpl);
}
/**
@ -202,7 +194,7 @@ function manageForm($default, $select_from_user_list = null, $sent_to = '', $tpl
$fileListToString = !empty($attachments) ? implode('<br />', $attachments) : '';
$form->addLabel('', $fileListToString);
}
$default['title'] = '['.get_lang('Fwd').": ".Security::remove_XSS($message_reply_info['title']).']';
$default['title'] = '['.get_lang('Fwd').': '.Security::remove_XSS($message_reply_info['title']).']';
$form->addHidden('forward_id', $forwardId);
$form->addHidden('save_form', 'save_form');
$receiverInfo = api_get_user_info($message_reply_info['user_receiver_id']);
@ -257,7 +249,7 @@ function manageForm($default, $select_from_user_list = null, $sent_to = '', $tpl
if (!empty($group_id) && !empty($message_id)) {
$message_info = MessageManager::get_message_by_id($message_id);
$default['title'] = get_lang('RE:')." ".$message_info['title'];
$default['title'] = get_lang('RE:').' '.$message_info['title'];
}
$form->setDefaults($default);
$html = '';
@ -300,7 +292,7 @@ function manageForm($default, $select_from_user_list = null, $sent_to = '', $tpl
if ($res) {
$userInfo = api_get_user_info($userId);
Display::addFlash(Display::return_message(
get_lang('The message has been sent to')."&nbsp;<b>".$userInfo['complete_name_with_username']."</b>",
get_lang('The message has been sent to').'&nbsp;<b>'.$userInfo['complete_name_with_username'].'</b>',
'confirmation',
false
));
@ -345,7 +337,7 @@ $interbreadcrumb[] = [
$group_id = isset($_REQUEST['group_id']) ? (int) $_REQUEST['group_id'] : 0;
$social_right_content = null;
if ($group_id != 0) {
if (0 != $group_id) {
$social_right_content .= '<div class=actions>';
$social_right_content .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/group_view.php?id='.$group_id.'">'.
Display::return_icon('back.png', api_xml_http_response_encode(get_lang('Compose message'))).'</a>';
@ -356,7 +348,7 @@ if ($group_id != 0) {
if ($allowSocial) {
} else {
$social_right_content .= '<div class=actions>';
if (api_get_setting('allow_message_tool') === 'true') {
if ('true' === api_get_setting('allow_message_tool')) {
$social_right_content .= '<a href="'.api_get_path(WEB_CODE_PATH).'messages/new_message.php">'.
Display::return_icon('message_new.png', get_lang('Compose message')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">'.

@ -1,15 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.messages
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
if (api_get_setting('allow_message_tool') != 'true') {
if ('true' != api_get_setting('allow_message_tool')) {
api_not_allowed(true);
}
@ -19,12 +17,12 @@ $logInfo = [
];
Event::registerLog($logInfo);
$allowSocial = api_get_setting('allow_social_tool') == 'true';
$allowMessage = api_get_setting('allow_message_tool') == 'true';
$allowSocial = 'true' == api_get_setting('allow_social_tool');
$allowMessage = 'true' == api_get_setting('allow_message_tool');
if (isset($_GET['messages_page_nr'])) {
if ($allowSocial && $allowMessage) {
header('Location:outbox.php?pager='.intval($_GET['messages_page_nr']));
header('Location:outbox.php?pager='.(int) ($_GET['messages_page_nr']));
exit;
}
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php';

@ -1,15 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.messages
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
$allowSocial = api_get_setting('allow_social_tool') === 'true';
$allowMessage = api_get_setting('allow_message_tool') === 'true';
$allowSocial = 'true' === api_get_setting('allow_social_tool');
$allowMessage = 'true' === api_get_setting('allow_message_tool');
if (!$allowMessage) {
api_not_allowed(true);
@ -43,7 +41,7 @@ $social_right_content .= '</div>';
$type = isset($_GET['type']) ? (int) $_GET['type'] : MessageManager::MESSAGE_TYPE_INBOX;
$show_menu = 'messages_inbox';
if ($type === MessageManager::MESSAGE_TYPE_OUTBOX) {
if (MessageManager::MESSAGE_TYPE_OUTBOX === $type) {
$show_menu = 'messages_outbox';
}
@ -57,7 +55,7 @@ $logInfo = [
Event::registerLog($logInfo);
// LEFT COLUMN
if (api_get_setting('allow_social_tool') === 'true') {
if ('true' === api_get_setting('allow_social_tool')) {
// Block Social Menu
$social_menu_block = SocialManager::show_social_menu($show_menu);
}
@ -73,7 +71,7 @@ $tpl = new Template(get_lang('View'));
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), $show_menu);
if (api_get_setting('allow_social_tool') === 'true') {
if ('true' === api_get_setting('allow_social_tool')) {
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');

@ -153,7 +153,7 @@ function get_work_data_by_id($id, $courseId = 0, $sessionId = 0)
[
'id' => $studentPublication->getResourceNode()->getId(),
'tool' => 'student_publication',
'type' => 'student_publications'
'type' => 'student_publications',
]
).'?'.api_get_cidreq();
@ -5189,11 +5189,11 @@ function downloadFile($id, $course_info, $isCorrection)
function getFile($id, $course_info, $download = true, $isCorrection = false, $forceAccessForCourseAdmins = false)
{
$file = getFileContents($id, $course_info, 0, $isCorrection, $forceAccessForCourseAdmins);
var_dump($file);exit;
var_dump($file);
exit;
if (!empty($file) && isset($file['entity'])) {
/** @var CStudentPublication $studentPublication */
$studentPublication = $file['entity'];
}
return false;
@ -5327,7 +5327,6 @@ function getFileContents($id, $courseInfo, $sessionId = 0, $correction = false,
'title_correction' => $studentPublication->getTitleCorrection(),
'entity' => $studentPublication,
];
}
return false;

Loading…
Cancel
Save