Minor - format code

pull/2487/head
jmontoyaa 7 years ago
parent be61e5e11a
commit 1914b93948
  1. 4
      main/admin/user_import.php
  2. 4
      main/dashboard/dashboard_controller.php
  3. 72
      main/inc/lib/api.lib.php
  4. 2
      main/inc/lib/document.lib.php
  5. 2
      main/lp/aiccObjective.class.php
  6. 79
      main/lp/learnpath.class.php
  7. 144
      main/work/work.lib.php
  8. 13
      plugin/vchamilo/views/editinstance_form.php
  9. 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php
  10. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php
  11. 13
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php
  12. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Careers.php
  13. 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php
  14. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/FAQ.php
  15. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Forum.php
  16. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ForumStudent.php
  17. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Glossary.php
  18. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/LearningPathAuthor.php
  19. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Messages.php
  20. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Minimal.php
  21. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/NotebookStudent.php
  22. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/PortalNews.php
  23. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Profile.php
  24. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Project.php
  25. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectComment.php
  26. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectCommentStudent.php
  27. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ProjectStudent.php
  28. 4
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Register.php
  29. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php
  30. 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TermsAndConditions.php
  31. 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswerStrict.php
  32. 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php
  33. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/ToolbarStartExpanded.php
  34. 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Wiki.php
  35. 1
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiStudent.php
  36. 2
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/WikiTask.php
  37. 5
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Work.php
  38. 1
      src/Chamilo/CoreBundle/Component/Editor/Connector.php
  39. 1
      src/Chamilo/CoreBundle/Component/Editor/Driver/CourseUserDriver.php
  40. 8
      src/Chamilo/CoreBundle/Component/Editor/Toolbar.php
  41. 2
      src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php
  42. 14
      src/Chamilo/CoreBundle/EventListener/LegacyLoginListener.php
  43. 1
      src/Chamilo/CoreBundle/Menu/NavBuilder.php
  44. 3
      src/Chamilo/CoreBundle/Twig/Extension/ChamiloExtension.php
  45. 1
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Asset.php

@ -365,9 +365,7 @@ $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
$user_id_error = array();
$error_message = '';
if (isset($_POST['formSent']) && $_POST['formSent'] AND
$_FILES['import_file']['size'] !== 0
) {
if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['size'] !== 0) {
$file_type = $_POST['file_type'];
Security::clear_token();
$tok = Security::get_token();

@ -132,10 +132,6 @@ class DashboardController
$content .= '<div style="margin-top:20px;">'.get_lang('YouHaveNotEnabledBlocks').'</div>';
}
} else {
// block dashboard list
if (isset($success)) {
Display::addFlash(Display::return_message(get_lang('BlocksHaveBeenUpdatedSuccessfully'), 'confirm'));
}
$user_id = api_get_user_id();
$content .= DashboardManager::display_user_dashboard_list($user_id);
}

@ -1290,7 +1290,7 @@ function api_get_user_courses($userid, $fetch_session = true)
{
// Get out if not integer
if ($userid != strval(intval($userid))) {
return array();
return [];
}
$t_course = Database::get_main_table(TABLE_MAIN_COURSE);
@ -1305,10 +1305,10 @@ function api_get_user_courses($userid, $fetch_session = true)
cu.relation_type<>".COURSE_RELATION_TYPE_RRHH." ";
$result = Database::query($sql);
if ($result === false) {
return array();
return [];
}
$courses = array();
$courses = [];
while ($row = Database::fetch_array($result)) {
// we only need the database name of the course
$courses[] = $row;
@ -1329,7 +1329,7 @@ function api_get_user_courses($userid, $fetch_session = true)
*/
function _api_format_user($user, $add_password = false, $loadAvatars = true)
{
$result = array();
$result = [];
$result['firstname'] = null;
$result['lastname'] = null;
@ -1898,7 +1898,7 @@ function api_get_course_info($course_code = null, $strict = false)
$courseId = api_get_course_int_id($course_code);
if (empty($courseId)) {
return array();
return [];
}
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
@ -1912,7 +1912,7 @@ function api_get_course_info($course_code = null, $strict = false)
ON course.category_code = course_category.code
WHERE course.id = $courseId";
$result = Database::query($sql);
$courseInfo = array();
$courseInfo = [];
if (Database::num_rows($result) > 0) {
$data = Database::fetch_array($result);
$courseInfo = api_format_course_array($data);
@ -1923,7 +1923,7 @@ function api_get_course_info($course_code = null, $strict = false)
global $_course;
if ($_course == '-1') {
$_course = array();
$_course = [];
}
return $_course;
@ -1952,7 +1952,7 @@ function api_get_course_info_by_id($id = null)
ON course.category_code = course_category.code
WHERE course.id = $id";
$result = Database::query($sql);
$_course = array();
$_course = [];
if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result);
$_course = api_format_course_array($row);
@ -1962,7 +1962,7 @@ function api_get_course_info_by_id($id = null)
global $_course;
if ($_course == '-1') {
$_course = array();
$_course = [];
}
return $_course;
}
@ -1979,10 +1979,10 @@ function api_get_course_info_by_id($id = null)
function api_format_course_array($course_data)
{
if (empty($course_data)) {
return array();
return [];
}
$_course = array();
$_course = [];
$_course['id'] = $course_data['code'];
$_course['real_id'] = $course_data['id'];
@ -4075,7 +4075,7 @@ function api_get_item_property_by_tool($tool, $course_code, $session_id = null)
tool = '$tool'
$session_condition ";
$rs = Database::query($sql);
$list = array();
$list = [];
if (Database::num_rows($rs) > 0) {
while ($row = Database::fetch_array($rs, 'ASSOC')) {
$list[] = $row;
@ -4117,7 +4117,7 @@ function api_get_item_property_list_by_tool_by_user(
$session_condition ";
$rs = Database::query($sql);
$list = array();
$list = [];
if (Database::num_rows($rs) > 0) {
while ($row = Database::fetch_array($rs, 'ASSOC')) {
$list[] = $row;
@ -4214,7 +4214,7 @@ function api_get_track_item_property_history($tool, $ref)
ORDER BY lastedit_date DESC";
$result = Database::query($sql);
if ($result === false or $result === null) {
$result = array();
$result = [];
} else {
$result = Database::store_result($result, 'ASSOC');
}
@ -4266,7 +4266,7 @@ function api_get_item_property_info($course_id, $tool, $ref, $session_id = 0, $g
}
$rs = Database::query($sql);
$row = array();
$row = [];
if (Database::num_rows($rs) > 0) {
$row = Database::fetch_array($rs, 'ASSOC');
}
@ -4460,7 +4460,7 @@ function api_get_languages()
$sql = "SELECT * FROM $tbl_language WHERE available='1'
ORDER BY original_name ASC";
$result = Database::query($sql);
$language_list = array();
$language_list = [];
while ($row = Database::fetch_array($result)) {
$language_list['name'][] = $row['original_name'];
$language_list['folder'][] = $row['dokeos_folder'];
@ -4478,7 +4478,7 @@ function api_get_languages_to_array()
$tbl_language = Database::get_main_table(TABLE_MAIN_LANGUAGE);
$sql = "SELECT * FROM $tbl_language WHERE available='1' ORDER BY original_name ASC";
$result = Database::query($sql);
$languages = array();
$languages = [];
while ($row = Database::fetch_array($result)) {
$languages[$row['dokeos_folder']] = $row['original_name'];
}
@ -4899,7 +4899,7 @@ function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = fals
* @param string $source
* @param string $dest
*/
function copyr($source, $dest, $exclude = array(), $copied_files = array())
function copyr($source, $dest, $exclude = [], $copied_files = [])
{
if (empty($dest)) { return false; }
// Simple copy for a file
@ -5117,7 +5117,7 @@ function api_chmod_R($path, $filemode)
* The info array.
*/
function api_parse_info_file($filename) {
$info = array();
$info = [];
if (!file_exists($filename)) {
return $info;
@ -5157,7 +5157,7 @@ function api_parse_info_file($filename) {
$key = count($parent);
}
if (!isset($parent[$key]) || !is_array($parent[$key])) {
$parent[$key] = array();
$parent[$key] = [];
}
$parent = &$parent[$key];
}
@ -5254,7 +5254,7 @@ function api_get_settings_options($var)
WHERE variable = '$var'
ORDER BY id";
$result = Database::query($sql);
$settings_options_array = array();
$settings_options_array = [];
while ($row = Database::fetch_array($result, 'ASSOC')) {
$settings_options_array[] = $row;
}
@ -5414,7 +5414,7 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
* @param string $value
* @return bool
*/
function api_set_settings_category($category, $value = null, $access_url = 1, $fieldtype = array())
function api_set_settings_category($category, $value = null, $access_url = 1, $fieldtype = [])
{
if (empty($category)) {
return false;
@ -5932,7 +5932,7 @@ function api_get_access_url_from_user($user_id)
ON (url_rel_user.access_url_id = u.id)
WHERE user_id = ".intval($user_id);
$result = Database::query($sql);
$list = array();
$list = [];
while ($row = Database::fetch_array($result, 'ASSOC')) {
$list[] = $row['access_url_id'];
}
@ -6658,7 +6658,7 @@ function api_get_jquery_ui_css_web_path()
*/
function api_get_jquery_ui_js($include_jqgrid = false)
{
$libraries = array();
$libraries = [];
if ($include_jqgrid) {
$libraries[] = 'jqgrid';
}
@ -7076,7 +7076,7 @@ function api_set_default_visibility(
$item_id,
$tool_id,
$group_id = 0,
$courseInfo = array(),
$courseInfo = [],
$sessionId = 0,
$userId = 0
) {
@ -7177,7 +7177,7 @@ function api_get_security_key()
*/
function api_detect_user_roles($user_id, $courseId, $session_id = 0)
{
$user_roles = array();
$user_roles = [];
$courseInfo = api_get_course_info_by_id($courseId);
$course_code = $courseInfo['code'];
@ -7274,11 +7274,11 @@ function api_get_js_simple($file)
function api_set_settings_and_plugins()
{
global $_configuration;
$_setting = array();
$_plugins = array();
$_setting = [];
$_plugins = [];
// access_url == 1 is the default chamilo location
$settings_by_access_list = array();
$settings_by_access_list = [];
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != 1) {
$url_info = api_get_access_url($_configuration['access_url']);
@ -7341,11 +7341,11 @@ function api_set_settings_and_plugins()
}
$result = api_get_settings('Plugins', 'list', $access_url_id);
$_plugins = array();
$_plugins = [];
foreach ($result as & $row) {
$key = & $row['variable'];
if (is_string($_setting[$key])) {
$_setting[$key] = array();
$_setting[$key] = [];
}
$_setting[$key][] = $row['selected_value'];
$_plugins[$key][] = $row['selected_value'];
@ -7675,7 +7675,7 @@ function api_can_login_as($loginAsUserId, $userId = null)
'drh_all',
api_get_user_id()
);
$userList = array();
$userList = [];
if (is_array($users)) {
foreach ($users as $user) {
$userList[] = $user['user_id'];
@ -8083,10 +8083,10 @@ function api_mail_html(
$message,
$senderName = '',
$senderEmail = '',
$extra_headers = array(),
$data_file = array(),
$extra_headers = [],
$data_file = [],
$embedded_image = false,
$additionalParameters = array()
$additionalParameters = []
) {
global $platform_email;
@ -8165,7 +8165,7 @@ function api_mail_html(
// Get all images html inside content.
preg_match_all("/<img\s+.*?src=[\"\']?([^\"\' >]*)[\"\']?[^>]*>/i", $message, $m);
// Prepare new tag images.
$new_images_html = array();
$new_images_html = [];
$i = 1;
if (!empty($m[1])) {
foreach ($m[1] as $image_path) {

@ -2494,7 +2494,7 @@ class DocumentManager
$value = trim($regs[16][$i]);
}
if (!empty($name)) {
if (!$reduced OR in_array(strtolower($name), $wanted)) {
if (!$reduced || in_array(strtolower($name), $wanted)) {
if ($name == $check) {
$attributes[strtolower($name)][] = strtolower($name);
} else {

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
require_once 'learnpathItem.class.php';
/**
* Class aiccObjective
* Class defining the Block elements in an AICC Course Structure file.

@ -40,7 +40,7 @@ class learnpath
public $extra_information = ''; // This string can be used by proprietary SCORM contents to store data about the current learnpath.
public $force_commit = false; // For SCORM only - if set to true, will send a scorm LMSCommit() request on each LMSSetValue().
public $index; // The index of the active learnpath_item in $ordered_items array.
public $items = array();
public $items = [];
public $last; // item_id of last item viewed in the learning path.
public $last_item_seen = 0; // In case we have already come in this learnpath, reuse the last item seen if authorized.
public $license; // Which license this course has been given - not used yet on 20060522.
@ -50,7 +50,7 @@ class learnpath
public $message = '';
public $mode = 'embedded'; // Holds the video display mode (fullscreen or embedded).
public $name; // Learnpath name (they generally have one).
public $ordered_items = array(); // List of the learnpath items in the order they are to be read.
public $ordered_items = []; // List of the learnpath items in the order they are to be read.
public $path = ''; // Path inside the scorm directory (if scorm).
public $theme; // The current theme of the learning path.
public $preview_image; // The current image of the learning path.
@ -66,15 +66,15 @@ class learnpath
// Percentage progress as saved in the db.
public $progress_db = 0;
public $proximity; // Wether the content is distant or local or unknown.
public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match.
public $refs_list = []; //list of items by ref => db_id. Used only for prerequisites match.
// !!!This array (refs_list) is built differently depending on the nature of the LP.
// If SCORM, uses ref, if Chamilo, uses id to keep a unique value.
public $type; //type of learnpath. Could be 'chamilo', 'scorm', 'scorm2004', 'aicc', ...
// TODO: Check if this type variable is useful here (instead of just in the controller script).
public $user_id; //ID of the user that is viewing/using the course
public $update_queue = array();
public $update_queue = [];
public $scorm_debug = 0;
public $arrMenu = array(); // Array for the menu items.
public $arrMenu = []; // Array for the menu items.
public $debug = 0; // Logging level.
public $lp_session_id = 0;
public $lp_view_session_id = 0; // The specific view might be bound to a session.
@ -87,7 +87,7 @@ class learnpath
public $expired_on = '';
public $ref = null;
public $course_int_id;
public $course_info = array();
public $course_info = [];
public $categoryId;
/**
@ -246,7 +246,7 @@ class learnpath
error_log('-- Start while--');
}
$lp_item_id_list = array();
$lp_item_id_list = [];
while ($row = Database::fetch_array($res)) {
$lp_item_id_list[] = $row['iid'];
switch ($this->type) {
@ -355,7 +355,7 @@ class learnpath
);
}
$status_list = array();
$status_list = [];
$res = Database::query($sql);
while ($row = Database:: fetch_array($res)) {
$status_list[$row['lp_item_id']] = $row['status'];
@ -1035,7 +1035,7 @@ class learnpath
return false;
}
$this->current_time_stop = time();
$this->ordered_items = array();
$this->ordered_items = [];
$this->index = 0;
unset($this->lp_id);
//unset other stuff
@ -1295,7 +1295,7 @@ class learnpath
$title,
$description,
$prerequisites = '0',
$audio = array(),
$audio = [],
$max_time_allowed = 0,
$url = ''
) {
@ -1599,7 +1599,7 @@ class learnpath
}
if (empty($id) || $id != strval(intval($id))) {
return array();
return [];
}
$lp_item = Database::get_course_table(TABLE_LP_ITEM);
@ -1617,7 +1617,7 @@ class learnpath
ORDER BY display_order";
$res_bros = Database::query($sql);
$list = array();
$list = [];
while ($row_bro = Database::fetch_array($res_bros)) {
$list[] = $row_bro;
}
@ -1625,7 +1625,7 @@ class learnpath
return $list;
}
return array();
return [];
}
/**
@ -1642,7 +1642,7 @@ class learnpath
}
if (empty($id) || $id != strval(intval($id))) {
return array();
return [];
}
$lp_item = Database::get_course_table(TABLE_LP_ITEM);
@ -1679,7 +1679,7 @@ class learnpath
TOOL_LEARNPATH,
$this->lp_id
);
$prefix_terms = array();
$prefix_terms = [];
if (!empty($terms)) {
foreach ($terms as $term) {
$prefix_terms[] = $term['value'];
@ -2840,7 +2840,7 @@ class learnpath
if ($this->debug > 0) {
error_log('New LP - In learnpath::get_items_status_list()', 0);
}
$list = array();
$list = [];
foreach ($this->ordered_items as $item_id) {
$list[] = array(
$item_id => $this->items[$item_id]->get_status()
@ -4988,7 +4988,7 @@ class learnpath
/**
* Set index specified prefix terms for all items in this path
* @param string Comma-separated list of terms
* @param char Xapian term prefix
* @param string Xapian term prefix
* @return boolean False on error, true otherwise
*/
public function set_terms_by_prefix($terms_string, $prefix)
@ -5004,7 +5004,6 @@ class learnpath
$terms_string = trim($terms_string);
$terms = explode(',', $terms_string);
array_walk($terms, 'trim_value');
$stored_terms = $this->get_common_index_terms_by_prefix($prefix);
// Don't do anything if no change, verify only at DB, not the search engine.
@ -9377,7 +9376,7 @@ class learnpath
* @param array $data
* @return string
*/
public function display_item_small_form($item_type, $title = '', $data = array())
public function display_item_small_form($item_type, $title = '', $data = [])
{
$url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
$form = new FormValidator('small_form', 'post', $url);
@ -9436,10 +9435,10 @@ class learnpath
$sql = "SELECT * FROM $tbl_lp_item
WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
$result = Database::query($sql);
$arrLP = array();
$arrLP = [];
$selectedMinScore = array();
$selectedMaxScore = array();
$selectedMinScore = [];
$selectedMaxScore = [];
while ($row = Database::fetch_array($result)) {
if ($row['id'] == $item_id) {
$selectedMinScore[$row['prerequisite']] = $row['prerequisite_min_score'];
@ -9622,7 +9621,7 @@ class learnpath
DocumentManager::build_directory_selector(
$folders,
'',
array(),
[],
true,
$form,
'directory_parent_id'
@ -9732,7 +9731,7 @@ class learnpath
$return .= Display::return_icon(
'move_everywhere.png',
get_lang('Move'),
array(),
[],
ICON_SIZE_TINY
);
$return .= '</a> ';
@ -9758,14 +9757,14 @@ class learnpath
$return .= Display::return_icon(
'move_everywhere.png',
get_lang('Move'),
array(),
[],
ICON_SIZE_TINY
);
$return .= '</a> ';
$return .= Display::return_icon(
'quizz_small.gif',
'',
array(),
[],
ICON_SIZE_TINY
);
$sessionStar = api_get_session_image(
@ -9800,7 +9799,7 @@ class learnpath
$moveEverywhereIcon = Display::return_icon(
'move_everywhere.png',
get_lang('Move'),
array(),
[],
ICON_SIZE_TINY
);
@ -9824,8 +9823,8 @@ class learnpath
WHERE link.c_id = ".$course_id." $condition_session
ORDER BY link_category.category_title ASC, link.title ASC";
$result = Database::query($sql);
$categorizedLinks = array();
$categories = array();
$categorizedLinks = [];
$categories = [];
while ($link = Database::fetch_array($result)) {
if (!$link['category_id']) {
@ -9928,7 +9927,7 @@ class learnpath
$return .= Display::return_icon(
'move_everywhere.png',
get_lang('Move'),
array(),
[],
ICON_SIZE_TINY
);
$return .= '</a> ';
@ -10027,9 +10026,9 @@ class learnpath
$return .= '<li class="lp_resource_element" data_id="'.$forum['forum_id'].'" data_type="'.TOOL_FORUM.'" title="'.$forum['forum_title'].'" >';
$return .= '<a class="moved" href="#">';
$return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
$return .= Display::return_icon('move_everywhere.png', get_lang('Move'), [], ICON_SIZE_TINY);
$return .= ' </a>';
$return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
$return .= Display::return_icon('lp_forum.png', '', [], ICON_SIZE_TINY);
$return .= '<a onclick="javascript:toggle_forum('.$forum['forum_id'].');" style="cursor:hand; vertical-align:middle">
<img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
</a>
@ -10050,9 +10049,9 @@ class learnpath
$return .= '<li class="lp_resource_element" data_id="'.$thread['thread_id'].'" data_type="'.TOOL_THREAD.'" title="'.$thread['thread_title'].'" >';
$return .= '&nbsp;<a class="moved" href="#">';
$return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
$return .= Display::return_icon('move_everywhere.png', get_lang('Move'), [], ICON_SIZE_TINY);
$return .= ' </a>';
$return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
$return .= Display::return_icon('forumthread.png', get_lang('Thread'), [], ICON_SIZE_TINY);
$return .= '<a class="moved" href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_THREAD.'&thread_id='.$thread['thread_id'].'&lp_id='.$this->lp_id.'">'.
Security::remove_XSS($thread['thread_title']).' '.$link.'</a>';
$return .= '</li>';
@ -10103,7 +10102,7 @@ class learnpath
$zip_folder = new PclZip($temp_zip_file);
$current_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
$root_path = $main_path = api_get_path(SYS_PATH);
$files_cleanup = array();
$files_cleanup = [];
// Place to temporarily stash the zip file.
// create the temp dir if it doesn't exist
@ -10120,7 +10119,7 @@ class learnpath
}
closedir($handle);
}
$zip_files = $zip_files_abs = $zip_files_dist = array();
$zip_files = $zip_files_abs = $zip_files_dist = [];
if (is_dir($current_course_path.'/scorm/'.$this->path) &&
is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')
) {
@ -10195,8 +10194,8 @@ class learnpath
// For each element, add it to the imsmanifest structure, then add it to the zip.
// Always call the learnpathItem->scorm_export() method to change it to the SCORM format.
$link_updates = array();
$links_to_create = array();
$link_updates = [];
$links_to_create = [];
//foreach ($this->items as $index => $item) {
foreach ($this->ordered_items as $index => $itemId) {
$item = $this->items[$itemId];
@ -11014,7 +11013,7 @@ EOD;
public function scorm_export_to_pdf($lp_id)
{
$lp_id = intval($lp_id);
$files_to_export = array();
$files_to_export = [];
$course_data = api_get_course_info($this->cc);
if (!empty($course_data)) {
$scorm_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/scorm/'.$this->path;
@ -11545,7 +11544,7 @@ EOD;
public static function getCategoryFromCourseIntoSelect($courseId, $addSelectOption = false)
{
$items = self::getCategoryByCourse($courseId);
$cats = array();
$cats = [];
if ($addSelectOption) {
$cats = array(get_lang('SelectACategory'));
}

@ -143,17 +143,16 @@ function settingsForm($defaults)
function get_work_data_by_path($path, $courseId = 0)
{
$path = Database::escape_string($path);
$courseId = intval($courseId);
if (empty($courseId)) {
$courseId = api_get_course_int_id();
} else {
$courseId = intval($courseId);
}
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$sql = "SELECT * FROM ".$work_table."
WHERE url = '$path' AND c_id = $courseId ";
$result = Database::query($sql);
$return = array();
$return = [];
if (Database::num_rows($result)) {
$return = Database::fetch_array($result, 'ASSOC');
}
@ -170,13 +169,10 @@ function get_work_data_by_path($path, $courseId = 0)
function get_work_data_by_id($id, $courseId = 0, $sessionId = 0)
{
$id = intval($id);
if (!empty($courseId)) {
$courseId = intval($courseId);
} else {
$courseId = intval($courseId);
if (empty($courseId)) {
$courseId = api_get_course_int_id();
}
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$sessionCondition = null;
@ -189,7 +185,7 @@ function get_work_data_by_id($id, $courseId = 0, $sessionId = 0)
id = $id AND c_id = $courseId
$sessionCondition";
$result = Database::query($sql);
$work = array();
$work = [];
if (Database::num_rows($result)) {
$work = Database::fetch_array($result, 'ASSOC');
if (empty($work['title'])) {
@ -272,7 +268,7 @@ function get_work_assignment_by_id($id, $courseId = null)
$sql = "SELECT * FROM $table
WHERE c_id = $courseId AND publication_id = $id";
$result = Database::query($sql);
$return = array();
$return = [];
if (Database::num_rows($result)) {
$return = Database::fetch_array($result, 'ASSOC');
}
@ -362,7 +358,7 @@ function getWorkList($id, $my_folder_data, $add_in_where_query = null, $course_i
ORDER BY title";
}
$work_parents = array();
$work_parents = [];
$sql_result = Database::query($sql);
if (Database::num_rows($sql_result)) {
@ -385,7 +381,7 @@ function getWorkList($id, $my_folder_data, $add_in_where_query = null, $course_i
function getWorkPerUser($userId, $courseId = 0, $sessionId = 0)
{
$works = getWorkList(null, null, null, $courseId, $sessionId);
$result = array();
$result = [];
if (!empty($works)) {
foreach ($works as $workData) {
$workId = $workData->id;
@ -468,7 +464,7 @@ function getUniqueStudentAttempts(
$course_id,
$sessionId,
$userId = null,
$onlyUserList = array()
$onlyUserList = []
) {
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$user_table = Database::get_main_table(TABLE_MAIN_USER);
@ -577,7 +573,7 @@ function showStudentWorkGrid()
$html = '<script>
$(function() {
'.Display::grid_js('workList', $url, $columns, $columnModel, $params, array(), null, true).'
'.Display::grid_js('workList', $url, $columns, $columnModel, $params, [], null, true).'
});
</script>';
@ -622,7 +618,7 @@ function showTeacherWorkGrid()
$html = '<script>
$(function() {
'.Display::grid_js('workList', $url, $columns, $columnModel, $params, array(), null, true).'
'.Display::grid_js('workList', $url, $columns, $columnModel, $params, [], null, true).'
$("#workList").jqGrid(
"navGrid",
"#workList_pager",
@ -987,7 +983,6 @@ function updateWorkUrl($id, $new_path, $parent_id)
function updateDirName($work_data, $newPath)
{
$course_id = $work_data['c_id'];
$sessionId = intval($work_data['session_id']);
$work_id = intval($work_data['iid']);
$oldPath = $work_data['url'];
$originalNewPath = Database::escape_string($newPath);
@ -1029,8 +1024,7 @@ function get_parent_directories($id)
'parentId' => $id
]);
$list_id = array();
$list_id = [];
foreach ($directories as $directory) {
$list_id[] = $directory->getId();
}
@ -1047,7 +1041,7 @@ function get_parent_directories($id)
*/
function directory_to_array($directory)
{
$array_items = array();
$array_items = [];
if ($handle = @opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
@ -1076,7 +1070,7 @@ function directory_to_array($directory)
function insert_all_directory_in_course_table($base_work_dir)
{
$dir_to_array = directory_to_array($base_work_dir, true);
$only_dir = array();
$only_dir = [];
for ($i = 0; $i < count($dir_to_array); $i++) {
$only_dir[] = substr($dir_to_array[$i], strlen($base_work_dir), strlen($dir_to_array[$i]));
@ -1136,7 +1130,7 @@ function count_dir($path_dir, $recurse)
}
}
}
$return_array = array();
$return_array = [];
$return_array[] = $count;
$return_array[] = $count_dir;
return $return_array;
@ -1486,7 +1480,7 @@ function getWorkListStudent(
return $row['count'];
}
$works = array();
$works = [];
$url = api_get_path(WEB_CODE_PATH).'work/work_list.php?'.api_get_cidreq();
if ($isDrhOfCourse) {
$url = api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq();
@ -1598,7 +1592,7 @@ function getWorkListTeacher(
$column = !empty($column) ? Database::escape_string($column) : 'sent_date';
$start = intval($start);
$limit = intval($limit);
$works = array();
$works = [];
// Get list from database
if ($is_allowed_to_edit) {
@ -1672,7 +1666,7 @@ function getWorkListTeacher(
}
$visibilityLink = Display::url(
Display::return_icon($icon, $text, array(), ICON_SIZE_SMALL),
Display::return_icon($icon, $text, [], ICON_SIZE_SMALL),
api_get_path(WEB_CODE_PATH).'work/work.php?id='.$workId.'&action='.$action.'&'.api_get_cidreq()
);
@ -1684,7 +1678,7 @@ function getWorkListTeacher(
$work['sent_date'] = api_get_local_time($work['sent_date']);
$editLink = Display::url(
Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL),
api_get_path(WEB_CODE_PATH).'work/edit_work.php?id='.$workId.'&'.api_get_cidreq()
);
@ -1698,7 +1692,7 @@ function getWorkListTeacher(
Display::return_icon(
'save_pack.png',
get_lang('Save'),
array(),
[],
ICON_SIZE_SMALL
),
api_get_path(WEB_CODE_PATH).'work/downloadfolder.inc.php?id='.$workId.'&'.api_get_cidreq()
@ -1708,7 +1702,7 @@ function getWorkListTeacher(
Display::return_icon(
'save_pack_na.png',
get_lang('Save'),
array(),
[],
ICON_SIZE_SMALL
),
'#'
@ -1723,7 +1717,7 @@ function getWorkListTeacher(
// Display::return_icon(
// 'delete.png',
// get_lang('Delete'),
// array(),
// [],
// ICON_SIZE_SMALL
// ) . '</a>';
@ -1888,7 +1882,7 @@ function get_work_user_list_from_documents(
);
$allowEdition = api_get_course_setting('student_delete_own_publication') == 1;
$workList = array();
$workList = [];
while ($row = Database::fetch_array($result, 'ASSOC')) {
$userId = $row['user_id'];
$documentId = $row['document_id'];
@ -2108,7 +2102,7 @@ function get_work_user_list(
$sql .= " LIMIT $start, $limit";
}
$result = Database::query($sql);
$works = array();
$works = [];
if ($getCount) {
$work = Database::fetch_array($result, 'ASSOC');
@ -2129,7 +2123,7 @@ function get_work_user_list(
$saveIcon = Display::return_icon(
'save.png',
get_lang('Save'),
array(),
[],
ICON_SIZE_SMALL
);
@ -2150,7 +2144,7 @@ function get_work_user_list(
$rateIcon = Display::return_icon(
'rate_work.png',
get_lang('CorrectAndRate'),
array(),
[],
ICON_SIZE_SMALL
);
@ -2280,7 +2274,7 @@ function get_work_user_list(
if ($unoconv && empty($work['contains_file'])) {
$action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'" title="'.get_lang('ExportToDoc').'" >'.
Display::return_icon('export_doc.png', get_lang('ExportToDoc'), array(), ICON_SIZE_SMALL).'</a> ';
Display::return_icon('export_doc.png', get_lang('ExportToDoc'), [], ICON_SIZE_SMALL).'</a> ';
}
$alreadyUploaded = '';
@ -2339,17 +2333,17 @@ function get_work_user_list(
if ($locked) {
if ($qualification_exists) {
$action .= Display::return_icon('edit_na.png', get_lang('CorrectAndRate'), array(), ICON_SIZE_SMALL);
$action .= Display::return_icon('edit_na.png', get_lang('CorrectAndRate'), [], ICON_SIZE_SMALL);
} else {
$action .= Display::return_icon('edit_na.png', get_lang('Comment'), array(), ICON_SIZE_SMALL);
$action .= Display::return_icon('edit_na.png', get_lang('Comment'), [], ICON_SIZE_SMALL);
}
} else {
if ($qualification_exists) {
$action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Edit').'" >'.
Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>';
} else {
$action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>';
}
}
@ -2358,21 +2352,21 @@ function get_work_user_list(
$action .= Display::return_icon(
'move_na.png',
get_lang('Move'),
array(),
[],
ICON_SIZE_SMALL
);
} else {
$action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=move&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Move').'">'.
Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
Display::return_icon('move.png', get_lang('Move'), [], ICON_SIZE_SMALL).'</a>';
}
}
if ($work['accepted'] == '1') {
$action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_invisible&item_id='.$item_id.'" title="'.get_lang('Invisible').'" >'.
Display::return_icon('visible.png', get_lang('Invisible'), array(), ICON_SIZE_SMALL).'</a>';
Display::return_icon('visible.png', get_lang('Invisible'), [], ICON_SIZE_SMALL).'</a>';
} else {
$action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_visible&item_id='.$item_id.'" title="'.get_lang('Visible').'" >'.
Display::return_icon('invisible.png', get_lang('Visible'), array(), ICON_SIZE_SMALL).'</a> ';
Display::return_icon('invisible.png', get_lang('Visible'), [], ICON_SIZE_SMALL).'</a> ';
}
if ($locked) {
@ -2383,19 +2377,19 @@ function get_work_user_list(
}
} elseif ($is_author && (empty($work['qualificator_id']) || $work['qualificator_id'] == 0)) {
$action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
Display::return_icon('default.png', get_lang('View'), array(), 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 (api_is_allowed_to_session_edit(false, true)) {
$action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
Display::return_icon('edit.png', get_lang('Comment'), array(), ICON_SIZE_SMALL).'</a>';
Display::return_icon('edit.png', get_lang('Comment'), [], ICON_SIZE_SMALL).'</a>';
}
$action .= ' <a href="'.$url.'work_list.php?'.api_get_cidreq().'&action=delete&item_id='.$item_id.'&id='.$work['parent_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>';
}
} else {
$action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
Display::return_icon('default.png', get_lang('View'), [], ICON_SIZE_SMALL).'</a>';
}
// Status.
@ -2433,7 +2427,7 @@ function send_reminder_users_without_publication($task_data)
$content = get_lang('ReminderToSubmitPendingTask')."\n".get_lang('CourseName').' : '.$_course['name']."\n";
$content .= get_lang('WorkName').' : '.$task_title."\n";
$list_users = get_list_users_without_publication($task_id);
$mails_sent_to = array();
$mails_sent_to = [];
foreach ($list_users as $user) {
$name_user = api_get_person_name($user[1], $user[0], null, PERSON_NAME_EMAIL_ADDRESS);
$dear_line = get_lang('Dear')." ".api_get_person_name($user[1], $user[0]).", \n\n";
@ -2659,7 +2653,7 @@ function get_list_users_without_publication($task_id, $studentId = 0)
}
$result = Database::query($sql);
$users_with_tasks = array();
$users_with_tasks = [];
while ($row = Database::fetch_array($result)) {
$users_with_tasks[] = $row['id'];
}
@ -2683,7 +2677,7 @@ function get_list_users_without_publication($task_id, $studentId = 0)
}
$group_id = api_get_group_id();
$new_group_user_list = array();
$new_group_user_list = [];
if ($group_id) {
$groupInfo = GroupManager::get_group_properties($group_id);
@ -2696,7 +2690,7 @@ function get_list_users_without_publication($task_id, $studentId = 0)
}
$result_users = Database::query($sql_users);
$users_without_tasks = array();
$users_without_tasks = [];
while ($rowUsers = Database::fetch_array($result_users)) {
$userId = $rowUsers['user_id'];
if (in_array($userId, $users_with_tasks)) {
@ -2742,10 +2736,10 @@ function display_list_users_without_publication($task_id, $studentId = null)
$data = get_list_users_without_publication($task_id);
$sorting_options = array();
$sorting_options = [];
$sorting_options['column'] = 1;
$paging_options = array();
$my_params = array();
$paging_options = [];
$my_params = [];
if (isset($_GET['edit_dir'])) {
$my_params['edit_dir'] = Security::remove_XSS($_GET['edit_dir']);
@ -2835,7 +2829,7 @@ function getDocumentToWorkPerUser($documentId, $workId, $courseId, $sessionId, $
";
$result = Database::query($sql);
$workInfo = array();
$workInfo = [];
if (Database::num_rows($result)) {
$workInfo = Database::fetch_array($result, 'ASSOC');
}
@ -2958,7 +2952,7 @@ function userIsSubscribedToWork($userId, $workId, $courseId)
if (empty($subscribedUsers)) {
return true;
} else {
$subscribedUsersList = array();
$subscribedUsersList = [];
foreach ($subscribedUsers as $item) {
$subscribedUsersList[] = $item['user_id'];
}
@ -3063,7 +3057,7 @@ function getDocumentTemplateFromWork($workId, $courseInfo, $documentId)
}
}
}
return array();
return [];
}
/**
@ -3116,7 +3110,7 @@ function getWorkComments($work)
$workId = intval($work['id']);
if (empty($courseId) || empty($workId)) {
return array();
return [];
}
$sql = "SELECT
@ -3165,7 +3159,7 @@ function getTotalWorkScore($workList)
* @param array $courseInfo
* @return int|null
*/
function getTotalWorkComment($workList, $courseInfo = array())
function getTotalWorkComment($workList, $courseInfo = [])
{
if (empty($courseInfo)) {
$courseInfo = api_get_course_info();
@ -3184,7 +3178,7 @@ function getTotalWorkComment($workList, $courseInfo = array())
* @param array $courseInfo
* @return int
*/
function getWorkCommentCount($id, $courseInfo = array())
function getWorkCommentCount($id, $courseInfo = [])
{
if (empty($courseInfo)) {
$courseInfo = api_get_course_info();
@ -3215,7 +3209,7 @@ function getWorkCommentCount($id, $courseInfo = array())
*/
function getWorkCommentCountFromParent(
$parentId,
$courseInfo = array(),
$courseInfo = [],
$sessionId = 0
) {
if (empty($courseInfo)) {
@ -3259,7 +3253,7 @@ function getWorkCommentCountFromParent(
*/
function getLastWorkStudentFromParent(
$parentId,
$courseInfo = array(),
$courseInfo = [],
$sessionId = 0
) {
if (empty($courseInfo)) {
@ -3295,7 +3289,7 @@ function getLastWorkStudentFromParent(
return $comment;
}
return array();
return [];
}
/**
@ -3308,7 +3302,7 @@ function getLastWorkStudentFromParent(
function getLastWorkStudentFromParentByUser(
$userId,
$parentInfo,
$courseInfo = array(),
$courseInfo = [],
$sessionId = 0
) {
if (empty($courseInfo)) {
@ -3348,7 +3342,7 @@ function getLastWorkStudentFromParentByUser(
return $work;
}
return array();
return [];
}
/**
@ -3391,14 +3385,14 @@ function formatWorkScore($score, $weight)
* @param array $courseInfo
* @return string
*/
function getWorkComment($id, $courseInfo = array())
function getWorkComment($id, $courseInfo = [])
{
if (empty($courseInfo)) {
$courseInfo = api_get_course_info();
}
if (empty($courseInfo['real_id'])) {
return array();
return [];
}
$commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT);
@ -3407,7 +3401,7 @@ function getWorkComment($id, $courseInfo = array())
$sql = "SELECT * FROM $commentTable
WHERE id = $id AND c_id = ".$courseInfo['real_id'];
$result = Database::query($sql);
$comment = array();
$comment = [];
if (Database::num_rows($result)) {
$comment = Database::fetch_array($result, 'ASSOC');
$filePath = null;
@ -3437,7 +3431,7 @@ function getWorkComment($id, $courseInfo = array())
* @param int $id
* @param array $courseInfo
*/
function deleteCommentFile($id, $courseInfo = array())
function deleteCommentFile($id, $courseInfo = [])
{
$workComment = getWorkComment($id, $courseInfo);
if (isset($workComment['file']) && !empty($workComment['file'])) {
@ -3494,7 +3488,7 @@ function addWorkComment($courseInfo, $userId, $parentWork, $work, $data)
Database::query($sql);
}
$userIdListToSend = array();
$userIdListToSend = [];
if (api_is_allowed_to_edit()) {
if (isset($data['send_email']) && $data['send_email']) {
// Teacher sends a feedback
@ -4545,7 +4539,7 @@ function updatePublicationAssignment($workId, $params, $courseInfo, $groupId)
*/
function deleteAllWorkPerUser($userId, $courseInfo)
{
$deletedItems = array();
$deletedItems = [];
$workPerUser = getWorkPerUser($userId);
if (!empty($workPerUser)) {
foreach ($workPerUser as $work) {
@ -4949,7 +4943,7 @@ function generateMoveForm($item_id, $path, $courseInfo, $groupId, $sessionId)
{
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$courseId = $courseInfo['real_id'];
$folders = array();
$folders = [];
$session_id = intval($sessionId);
$groupId = intval($groupId);
$sessionCondition = empty($sessionId) ? " AND (session_id = 0 OR session_id IS NULL) " : " AND session_id='".$session_id."'";
@ -5018,7 +5012,7 @@ function showStudentList($workId)
$html = '<script>
$(function() {
'.Display::grid_js('studentList', $url, $columns, $columnModel, $params, array(), null, true).'
'.Display::grid_js('studentList', $url, $columns, $columnModel, $params, [], null, true).'
$("#workList").jqGrid(
"navGrid",
"#studentList_pager",
@ -5124,12 +5118,12 @@ function getWorkUserListData(
$getCount = false
) {
$my_folder_data = get_work_data_by_id($workId);
$workParents = array();
$workParents = [];
if (empty($my_folder_data)) {
$workParents = getWorkList($workId, $my_folder_data, null);
}
$workIdList = array();
$workIdList = [];
if (!empty($workParents)) {
foreach ($workParents as $work) {
$workIdList[] = $work->id;
@ -5152,7 +5146,7 @@ function getWorkUserListData(
if ($getCount) {
return $userList;
}
$results = array();
$results = [];
if (!empty($userList)) {
foreach ($userList as $userId) {
$user = api_get_user_info($userId);
@ -5548,7 +5542,7 @@ function downloadAllFilesPerUser($userId, $courseInfo)
$workPerUser = getWorkPerUser($userId);
if (!empty($workPerUser)) {
$files = array();
$files = [];
foreach ($workPerUser as $work) {
$work = $work['work'];
foreach ($work->user_results as $userResult) {
@ -5621,7 +5615,7 @@ function getWorkCreatedByUser($user_id, $courseId, $sessionId)
$sessionId
);
$list = array();
$list = [];
if (!empty($items)) {
foreach ($items as $work) {
$item = get_work_data_by_id(

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Class ChamiloForm
@ -26,7 +27,6 @@ abstract class ChamiloForm
$this->_customdata = $customdata;
$attributes = array('style' => 'width: 60%; float: '.($text_dir == 'rtl' ? 'right;' : 'left;'));
// $this->_form = new FormValidator($mode.'_instance', 'post', $returnurl, '', $attributes, true);
$this->_form = new FormValidator(
$mode.'_instance',
'post',
@ -203,13 +203,12 @@ abstract class ChamiloForm
$cform->setElementError($element, $msg);
}
$chamilo_val = false;
} else {
// anything else means validation ok
$chamilo_val = true;
}
$validated = ($internal_val and $chamilo_val and $file_val);
$validated = ($internal_val && $chamilo_val && $file_val);
}
return $validated;
@ -254,7 +253,7 @@ abstract class ChamiloForm
if (is_object($default_values)) {
$default_values = (array) $default_values;
}
$filter = $slashed ? 'stripslashes' : NULL;
$filter = $slashed ? 'stripslashes' : null;
$this->_form->setDefaults($default_values, $filter);
}
@ -429,10 +428,11 @@ class InstanceForm extends ChamiloForm
);
// Database name.
$form->addText('main_database',
$form->addText(
'main_database',
[
$plugin->get_lang('maindatabase'),
$plugin->get_lang('DatabaseDescription')
$plugin->get_lang('DatabaseDescription'),
]
);
@ -558,7 +558,6 @@ class InstanceForm extends ChamiloForm
global $plugin;
$errors = array();
$tablename = Database::get_main_table('vchamilo');
$vchamilo = Database::select(
'*',

@ -229,7 +229,6 @@ class CkEditor extends Editor
}
$courseTemplates = $templatesRepo->getCourseTemplates($course, $user);
$templateList = [];
foreach ($courseTemplates as $templateData) {

@ -10,7 +10,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class AgendaStudent extends Basic
{
public $plugins = array();
public $plugins = [];
/**
* Get the toolbar config

@ -16,7 +16,7 @@ class Basic extends Toolbar
* In order to add a new plugin you have to load it in default/layout/head.tpl
* @var array
*/
public $defaultPlugins = array(
public $defaultPlugins = [
'adobeair',
'ajax',
'audio',
@ -61,24 +61,24 @@ class Basic extends Toolbar
'wordcount',
'inserthtml',
'xml',
);
];
/**
* Plugins this toolbar
* @var array
*/
public $plugins = array();
public $plugins = [];
/**
* @inheritdoc
*/
public function __construct(
$toolbar = null,
$config = array(),
$config = [],
$prefix = null
) {
// Adding plugins depending of platform conditions
$plugins = array();
$plugins = [];
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$plugins[] = 'glossary';
@ -140,10 +140,9 @@ class Basic extends Toolbar
*/
public function getConfig()
{
$config = array();
$config = [];
if (api_get_setting('more_buttons_maximized_mode') === 'true') {
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Careers extends Basic
{
/**
* Get the toolbar config
* @return array
@ -95,5 +94,4 @@ class Careers extends Basic
['Toolbarswitch', 'ShowBlocks']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class DocumentsStudent extends Basic
{
/**
* Get the toolbar config
* @return array

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class FAQ extends Basic
{
/**
* Get the toolbar config
* @return array
@ -90,5 +89,4 @@ class FAQ extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Forum extends Basic
{
/**
* Get the toolbar config
* @return array
@ -75,5 +74,4 @@ class Forum extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class ForumStudent extends Basic
{
/**
* Get the toolbar config
* @return array
@ -101,5 +100,4 @@ class ForumStudent extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Glossary extends Basic
{
/**
* Get the toolbar config
* @return array
@ -61,5 +60,4 @@ class Glossary extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class LearningPathAuthor extends Basic
{
/**
* Get the toolbar config
* @return array
@ -63,5 +62,4 @@ class LearningPathAuthor extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Messages extends Basic
{
/**
* Get the toolbar config
* @return array
@ -103,5 +102,4 @@ class Messages extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Minimal extends Basic
{
/**
* @return mixed
*/
@ -40,5 +39,4 @@ class Minimal extends Basic
return $config;
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class NotebookStudent extends Basic
{
/**
* Get the toolbar config
* @return array
@ -100,5 +99,4 @@ class NotebookStudent extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class PortalNews extends Basic
{
/**
* Get the toolbar config
* @return array
@ -100,5 +99,4 @@ class PortalNews extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Profile extends Basic
{
/**
* Get the toolbar config
* @return array
@ -97,5 +96,4 @@ class Profile extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Project extends Basic
{
/**
* Get the toolbar config
* @return array
@ -97,5 +96,4 @@ class Project extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class ProjectComment extends Basic
{
/**
* Get the toolbar config
* @return array
@ -96,5 +95,4 @@ class ProjectComment extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class ProjectCommentStudent extends Basic
{
/**
* Get the toolbar config
* @return array
@ -96,5 +95,4 @@ class ProjectCommentStudent extends Basic
['Toolbarswitch']
];
}
}

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class ProjectStudent extends Basic
{
/**
* Get the toolbar config
* @return array
@ -97,5 +96,4 @@ class ProjectStudent extends Basic
['Toolbarswitch']
];
}
}

@ -10,9 +10,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Register extends Basic
{
public $plugins = array(
);
public $plugins = [];
/**
* Get the toolbar config

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Survey extends Basic
{
/**
* Get the toolbar config
* @return array
@ -98,5 +97,4 @@ class Survey extends Basic
['Toolbarswitch']
];
}
}

@ -39,5 +39,4 @@ class TermsAndConditions extends Basic
['JustifyLeft', 'JustifyCenter', 'JustifyRight']
];
}
}

@ -49,5 +49,4 @@ class TestFreeAnswerStrict extends Basic
{
return [];
}
}

@ -129,5 +129,4 @@ class TestQuestionDescription extends Basic
['Source', 'Toolbarswitch']
];
}
}

@ -3,8 +3,6 @@
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
use Chamilo\CoreBundle\Component\Editor\Toolbar;
/**
* Class ToolbarStartExpanded
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Wiki extends Basic
{
/**
* Get the toolbar config
* @return array

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class WikiStudent extends Basic
{
/**
* Get the toolbar config
* @return array

@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class WikiTask extends Basic
{
/**
* Get the toolbar config
* @return array
@ -98,5 +97,4 @@ class WikiTask extends Basic
['Toolbarswitch']
];
}
}

@ -10,9 +10,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Work extends Basic
{
public $plugins = array(
);
public $plugins = [];
/**
* Get the toolbar config
@ -101,5 +99,4 @@ class Work extends Basic
['Toolbarswitch']
];
}
}

@ -340,7 +340,6 @@ class Connector
public function manageCommands($cmd, $result, $args, $elFinder)
{
$cmd = ucfirst($cmd);
$cmd = 'after'.$cmd;
/*
if (isset($args['target'])) {

@ -19,7 +19,6 @@ class CourseUserDriver extends CourseDriver
if (!empty($this->connector->course)) {
$userId = api_get_user_id();
$path = 'shared_folder/sf_user_'.$userId;
$alias = $this->connector->course['code'].' '.get_lang('CourseUserDocument');
if (!empty($userId)) {

@ -11,10 +11,10 @@ namespace Chamilo\CoreBundle\Component\Editor;
*/
class Toolbar
{
public $config = array();
public $config = [];
public $urlGenerator;
public $plugins = array();
public $defaultPlugins = array();
public $plugins = [];
public $defaultPlugins = [];
/**
* @param string $toolbar
@ -104,7 +104,7 @@ class Toolbar
*/
public function getConditionalPlugins()
{
return array();
return [];
}
/**

@ -3,6 +3,8 @@
namespace Chamilo\CoreBundle\Component\Utils;
use ChamiloSession as Session;
/**
* Class ChamiloApi
* @package Chamilo\CoreBundle\Component

@ -88,13 +88,11 @@ class LegacyLoginListener implements EventSubscriberInterface
//now dispatch the login event
$event = new InteractiveLoginEvent($request, $token);
$this->container->get("event_dispatcher")->dispatch("security.interactive_login", $event);
$this->container->get("event_dispatcher")->addListener(
KernelEvents::RESPONSE, array($this, 'redirectUser')
$this->container->get('event_dispatcher')->dispatch("security.interactive_login", $event);
$this->container->get('event_dispatcher')->addListener(
KernelEvents::RESPONSE,
array($this, 'redirectUser')
);
}
}
}
@ -107,10 +105,10 @@ class LegacyLoginListener implements EventSubscriberInterface
*/
public static function getSubscribedEvents()
{
return array(
return [
// must be registered before the default Locale listener
KernelEvents::REQUEST => array(array('onKernelRequest', 15)),
);
];
}
/**

@ -27,7 +27,6 @@ class NavBuilder extends ContainerAware
{
$factory = $this->container->get('knp_menu.factory');
$menu = $factory->createItem('categories', $itemOptions);
$this->buildCategoryMenu($menu, $itemOptions, $currentUri);
return $menu;

@ -27,8 +27,7 @@ class ChamiloExtension extends \Twig_Extension
*/
public function getFunctions()
{
return array(
);
return [];
}
/**

@ -13,7 +13,6 @@ class Asset extends Resource
public $path;
public $file_type;
/**
* Asset constructor.
* @param int $id

Loading…
Cancel
Save