Minor - Format code + remove forumfunction.inc.php

Lib added already in legacy.php
pull/3432/head
Julio Montoya 5 years ago
parent 33f5100d74
commit 60dfcfe06e
  1. 1
      public/main/gradebook/gradebook_add_link.php
  2. 5
      public/main/group/group_space.php
  3. 1
      public/main/inc/ajax/forum.ajax.php
  4. 1
      public/main/inc/ajax/lp.ajax.php
  5. 2
      public/main/inc/ajax/social.ajax.php
  6. 2
      public/main/inc/lib/MoodleImport.php
  7. 5
      public/main/inc/lib/add_course.lib.inc.php
  8. 2
      public/main/inc/lib/groupmanager.lib.php
  9. 1
      public/main/inc/lib/sessionmanager.lib.php
  10. 2
      public/main/inc/lib/social.lib.php
  11. 10
      public/main/inc/lib/webservices/Rest.php
  12. 6
      public/main/lp/learnpath.class.php
  13. 2
      public/main/lp/learnpathItem.class.php
  14. 2
      public/main/lp/lp_controller.php
  15. 1
      public/main/webservices/cm_webservice_forum.php
  16. 9
      public/main/work/work.lib.php

@ -3,7 +3,6 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
require_once '../forum/forumfunction.inc.php';
$current_course_tool = TOOL_GRADEBOOK; $current_course_tool = TOOL_GRADEBOOK;
api_protect_course_script(true); api_protect_course_script(true);

@ -17,8 +17,6 @@ $current_course_tool = TOOL_GROUP;
// Notice for unauthorized people. // Notice for unauthorized people.
api_protect_course_script(true, false, 'group'); api_protect_course_script(true, false, 'group');
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$group_id = api_get_group_id(); $group_id = api_get_group_id();
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$groupEntity = null; $groupEntity = null;
@ -26,8 +24,7 @@ if (!empty($group_id)) {
$groupEntity = api_get_group_entity($group_id); $groupEntity = api_get_group_entity($group_id);
} }
$group_id = $groupEntity->getIid(); if (null === $groupEntity) {
if (empty($groupEntity)) {
api_not_allowed(true); api_not_allowed(true);
} }

@ -9,7 +9,6 @@ use Chamilo\CourseBundle\Entity\CForumPost;
* @author Daniel Barreto Alva <daniel.barreto@beeznest.com> * @author Daniel Barreto Alva <daniel.barreto@beeznest.com>
*/ */
require_once __DIR__.'/../global.inc.php'; require_once __DIR__.'/../global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
// First, protect this script // First, protect this script
api_protect_course_script(false); api_protect_course_script(false);

@ -212,7 +212,6 @@ switch ($action) {
$forum = false; $forum = false;
if (empty($forum)) { if (empty($forum)) {
require_once '../../forum/forumfunction.inc.php';
$forumCategory = getForumCategoryByTitle( $forumCategory = getForumCategoryByTitle(
get_lang('Learning paths'), get_lang('Learning paths'),
$courseId, $courseId,

@ -126,8 +126,6 @@ switch ($action) {
echo ''; echo '';
break; break;
} }
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$user_id = Session::read('social_user_id'); $user_id = Session::read('social_user_id');
if ($_POST['action']) { if ($_POST['action']) {

@ -169,8 +169,6 @@ class MoodleImport
} }
$activities = $doc->getElementsByTagName('activity'); $activities = $doc->getElementsByTagName('activity');
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
if ($debug) { if ($debug) {
error_log('Loading activities: '.count($activities)); error_log('Loading activities: '.count($activities));
} }

@ -529,10 +529,7 @@ class AddCourse
$answer->createAnswer(get_lang('Compell one\'s interlocutor, by a series of questions and sub-questions, to admit he doesn\'t know what he claims to know.'), 1, get_lang('Indeed'), 5, 3); $answer->createAnswer(get_lang('Compell one\'s interlocutor, by a series of questions and sub-questions, to admit he doesn\'t know what he claims to know.'), 1, get_lang('Indeed'), 5, 3);
$answer->createAnswer(get_lang('Use the Principle of Non Contradiction to force one\'s interlocutor into a dead end.'), 1, get_lang('This answer is not false. It is true that the revelation of the interlocutor\'s ignorance means showing the contradictory conclusions where lead his premisses.'), 5, 4); $answer->createAnswer(get_lang('Use the Principle of Non Contradiction to force one\'s interlocutor into a dead end.'), 1, get_lang('This answer is not false. It is true that the revelation of the interlocutor\'s ignorance means showing the contradictory conclusions where lead his premisses.'), 5, 4);
$answer->save(); $answer->save();
// Forums.
/* Forum tool */
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$params = [ $params = [
'forum_category_title' => get_lang('Example Forum Category'), 'forum_category_title' => get_lang('Example Forum Category'),
'forum_category_comment' => '', 'forum_category_comment' => '',

@ -335,8 +335,6 @@ class GroupManager
// create a forum if needed // create a forum if needed
if ($forumState >= 0) { if ($forumState >= 0) {
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$forumName = get_lang('Group forums'); $forumName = get_lang('Group forums');
$repo = Container::getForumCategoryRepository(); $repo = Container::getForumCategoryRepository();
$criteria = ['cId' => $course_id, 'catTitle' => $forumName]; $criteria = ['cId' => $course_id, 'catTitle' => $forumName];

@ -2370,7 +2370,6 @@ class SessionManager
$subscribe = (int) api_get_course_setting('subscribe_users_to_forum_notifications', $courseInfo); $subscribe = (int) api_get_course_setting('subscribe_users_to_forum_notifications', $courseInfo);
$forums = []; $forums = [];
if (1 === $subscribe) { if (1 === $subscribe) {
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$forums = get_forums(0, $course_code, true, $session_id); $forums = get_forums(0, $course_code, true, $session_id);
} }

@ -2954,8 +2954,6 @@ class SocialManager extends UserManager
return []; return [];
$forumCourseId = api_get_configuration_value('global_forums_course_id'); $forumCourseId = api_get_configuration_value('global_forums_course_id');
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$threads = []; $threads = [];
if (!empty($forumCourseId)) { if (!empty($forumCourseId)) {
$courseInfo = api_get_course_info_by_id($forumCourseId); $courseInfo = api_get_course_info_by_id($forumCourseId);

@ -629,7 +629,7 @@ class Rest extends WebService
$sessionId = $this->session ? $this->session->getId() : 0; $sessionId = $this->session ? $this->session->getId() : 0;
$webCoursePath = api_get_path(WEB_COURSE_PATH).$this->course->getDirectory().'/upload/forum/images/'; $webCoursePath = api_get_path(WEB_COURSE_PATH).$this->course->getDirectory().'/upload/forum/images/';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$categoriesFullData = get_forum_categories('', $this->course->getId(), $sessionId); $categoriesFullData = get_forum_categories('', $this->course->getId(), $sessionId);
$categories = []; $categories = [];
@ -699,7 +699,7 @@ class Rest extends WebService
*/ */
public function getCourseForum($forumId) public function getCourseForum($forumId)
{ {
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$sessionId = $this->session ? $this->session->getId() : 0; $sessionId = $this->session ? $this->session->getId() : 0;
$forumInfo = get_forums($forumId, $this->course->getCode(), true, $sessionId); $forumInfo = get_forums($forumId, $this->course->getCode(), true, $sessionId);
@ -741,7 +741,7 @@ class Rest extends WebService
*/ */
public function getCourseForumThread($forumId, $threadId) public function getCourseForumThread($forumId, $threadId)
{ {
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$sessionId = $this->session ? $this->session->getId() : 0; $sessionId = $this->session ? $this->session->getId() : 0;
$threadInfo = get_thread_information($forumId, $threadId, $sessionId); $threadInfo = get_thread_information($forumId, $threadId, $sessionId);
@ -972,7 +972,7 @@ class Rest extends WebService
*/ */
public function saveForumPost(array $postValues, $forumId) public function saveForumPost(array $postValues, $forumId)
{ {
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$forum = get_forums($forumId, $this->course->getCode()); $forum = get_forums($forumId, $this->course->getCode());
store_reply($forum, $postValues, $this->course->getId(), $this->user->getId()); store_reply($forum, $postValues, $this->course->getId(), $this->user->getId());
@ -1114,7 +1114,7 @@ class Rest extends WebService
*/ */
public function saveForumThread(array $values, $forumId) public function saveForumThread(array $values, $forumId)
{ {
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$sessionId = $this->session ? $this->session->getId() : 0; $sessionId = $this->session ? $this->session->getId() : 0;
$forum = get_forums($forumId, $this->course->getCode(), true, $sessionId); $forum = get_forums($forumId, $this->course->getCode(), true, $sessionId);

@ -8283,8 +8283,6 @@ class learnpath
*/ */
public function get_forums() public function get_forums()
{ {
require_once '../forum/forumfunction.inc.php';
$forumCategories = get_forum_categories(); $forumCategories = get_forum_categories();
$forumsInNoCategory = get_forums_in_category(0); $forumsInNoCategory = get_forums_in_category(0);
if (!empty($forumsInNoCategory)) { if (!empty($forumsInNoCategory)) {
@ -10344,8 +10342,6 @@ EOD;
*/ */
public function createForum(CForumCategory $forumCategory) public function createForum(CForumCategory $forumCategory)
{ {
require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
return store_forum( return store_forum(
[ [
'lp_id' => $this->lp_id, 'lp_id' => $this->lp_id,
@ -10938,8 +10934,6 @@ EOD;
); );
} }
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
/*if (!empty($itemList['thread'])) { /*if (!empty($itemList['thread'])) {
$postList = []; $postList = [];
foreach ($itemList['thread'] as $postId) { foreach ($itemList['thread'] as $postId) {

@ -4346,8 +4346,6 @@ class learnpathItem
*/ */
public function createForumThread(CForumForum $forum) public function createForumThread(CForumForum $forum)
{ {
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$em = Database::getManager(); $em = Database::getManager();
$threadRepo = Container::getForumThreadRepository(); $threadRepo = Container::getForumThreadRepository();
$forumThread = $threadRepo->findOneBy([ $forumThread = $threadRepo->findOneBy([

@ -1305,8 +1305,6 @@ switch ($action) {
$forumThread = $selectedItem->getForumThread($oLP->course_int_id, $oLP->lp_session_id); $forumThread = $selectedItem->getForumThread($oLP->course_int_id, $oLP->lp_session_id);
if (empty($forumThread)) { if (empty($forumThread)) {
require_once '../forum/forumfunction.inc.php';
$forumCategory = getForumCategoryByTitle( $forumCategory = getForumCategoryByTitle(
get_lang('Learning paths'), get_lang('Learning paths'),
$oLP->course_int_id, $oLP->course_int_id,

@ -3,7 +3,6 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
require_once __DIR__.'/../forum/forumfunction.inc.php';
require_once __DIR__.'/cm_webservice.php'; require_once __DIR__.'/cm_webservice.php';
/** /**

@ -2765,14 +2765,13 @@ function getAllWork(
$qualification_string = ''; $qualification_string = '';
if ($qualification_exists) { if ($qualification_exists) {
if ($work['qualification'] == '') { if ('' == $work['qualification']) {
$qualification_string = Display::label('-'); $qualification_string = Display::label('-');
} else { } else {
$qualification_string = formatWorkScore($work['qualification'], $work['qualification']); $qualification_string = formatWorkScore($work['qualification'], $work['qualification']);
} }
} }
$work_assignment = get_work_assignment_by_id($work_id, $courseId); $work_assignment = get_work_assignment_by_id($work_id, $courseId);
$work['qualification_score'] = $work['qualification']; $work['qualification_score'] = $work['qualification'];
@ -2790,7 +2789,7 @@ function getAllWork(
$add_string = Display::label(get_lang('Expired'), 'important').' - '; $add_string = Display::label(get_lang('Expired'), 'important').' - ';
} }
if (($can_read && $work['accepted'] == '1') || if (($can_read && '1' == $work['accepted']) ||
($is_author && in_array($work['accepted'], ['1', '0'])) || ($is_author && in_array($work['accepted'], ['1', '0'])) ||
($is_allowed_to_edit || api_is_drh()) ($is_allowed_to_edit || api_is_drh())
) { ) {
@ -3001,11 +3000,11 @@ function getAllWork(
$action .= '<a href="'.$url.'work_list_all.php?'.$cidReq.'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'. $action .= '<a href="'.$url.'work_list_all.php?'.$cidReq.'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
}*/ }*/
} elseif ($is_author && (empty($work['qualificator_id']) || $work['qualificator_id'] == 0)) { } elseif ($is_author && (empty($work['qualificator_id']) || 0 == $work['qualificator_id'])) {
$action .= '<a href="'.$url.'view.php?'.$cidReq.'&id='.$item_id.'" title="'.get_lang('View').'">'. $action .= '<a href="'.$url.'view.php?'.$cidReq.'&id='.$item_id.'" title="'.get_lang('View').'">'.
Display::return_icon('default.png', get_lang('View'), [], ICON_SIZE_SMALL).'</a>'; Display::return_icon('default.png', get_lang('View'), [], ICON_SIZE_SMALL).'</a>';
if (api_get_course_setting('student_delete_own_publication') == 1) { if (1 == api_get_course_setting('student_delete_own_publication')) {
if (api_is_allowed_to_session_edit(false, true)) { if (api_is_allowed_to_session_edit(false, true)) {
$action .= '<a href="'.$url.'edit.php?'.$cidReq.'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'. $action .= '<a href="'.$url.'edit.php?'.$cidReq.'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
Display::return_icon('edit.png', get_lang('Comment'), [], ICON_SIZE_SMALL).'</a>'; Display::return_icon('edit.png', get_lang('Comment'), [], ICON_SIZE_SMALL).'</a>';

Loading…
Cancel
Save