Minor - format code, remove unused comments, update from master

pull/3683/head
Julio Montoya 5 years ago
parent 088a4c6be4
commit 9b450bda56
  1. 2
      main/inc/lib/pdf.lib.php
  2. 4
      main/inc/lib/redirect.class.php
  3. 2
      main/inc/lib/security.lib.php
  4. 6
      main/inc/lib/sortable_table.class.php
  5. 12
      main/inc/lib/system_announcements.lib.php
  6. 2
      main/inc/lib/timeline.lib.php
  7. 32
      main/inc/lib/usermanager.lib.php
  8. 4
      main/inc/lib/userportal.lib.php
  9. 2
      main/lp/index.php
  10. 7
      main/lp/learnpath.class.php
  11. 3
      main/lp/learnpathItem.class.php
  12. 5
      main/lp/lp_add_item.php
  13. 4
      main/lp/lp_ajax_initialize.php
  14. 4
      main/lp/lp_ajax_save_item.php
  15. 2
      main/lp/lp_ajax_save_objectives.php
  16. 2
      main/lp/lp_ajax_start_timer.php
  17. 6
      main/lp/lp_ajax_switch_item.php
  18. 6
      main/lp/lp_ajax_switch_item_toc.php
  19. 2
      main/lp/lp_build.php
  20. 22
      main/lp/lp_controller.php
  21. 4
      main/lp/lp_list_search.php
  22. 2
      main/lp/lp_move_item.php
  23. 6
      main/lp/lp_nav.php
  24. 4
      main/lp/lp_save.php
  25. 4
      main/lp/lp_stats.php
  26. 2
      main/lp/lp_subscribe_users_to_category.php
  27. 2
      main/lp/lp_update_scorm.php
  28. 6
      main/lp/lp_view_item.php
  29. 2
      main/lp/readout_text.php
  30. 10
      main/lp/scorm.class.php
  31. 18
      main/lp/scormItem.class.php
  32. 8
      main/lp/scormMetadata.class.php
  33. 6
      main/lp/scormOrganization.class.php
  34. 2
      main/lp/scormResource.class.php

@ -5,8 +5,6 @@ use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
/**
* Class PDF.
*
* @package chamilo.library
*/
class PDF
{

@ -34,7 +34,7 @@ class Redirect
self::navigate($www);
}
$is_full_uri = (strpos($url, 'http') === 0);
$is_full_uri = (0 === strpos($url, 'http'));
if ($is_full_uri) {
self::navigate($url);
}
@ -116,7 +116,7 @@ class Redirect
}
}
$redirect = api_get_setting('redirect_admin_to_courses_list');
if ($redirect !== 'true') {
if ('true' !== $redirect) {
// If the user is a platform admin, redirect to the main admin page
if (api_is_multiple_url_enabled()) {
// if multiple URLs are enabled, make sure he's admin of the

@ -23,8 +23,6 @@ use ChamiloSession as Session;
* For basic filtering, use filter()
* For files inclusions (using dynamic paths) use check_rel_path() and check_abs_path()
*
* @package chamilo.library
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/

@ -219,7 +219,7 @@ class SortableTable extends HTML_Table
} else {
if ('ASC' === $my_get_direction) {
$this->direction = 'ASC';
} elseif ($my_get_direction === 'DESC') {
} elseif ('DESC' === $my_get_direction) {
$this->direction = 'DESC';
}
}
@ -293,7 +293,7 @@ class SortableTable extends HTML_Table
*/
public function get_pager()
{
if ($this->pager === null) {
if (null === $this->pager) {
$params['mode'] = 'Sliding';
$params['perPage'] = $this->per_page;
$params['totalItems'] = $this->get_total_number_of_items();
@ -1142,7 +1142,7 @@ class SortableTable extends HTML_Table
$sort = null
) {
$data = [];
if ($this->get_data_function !== null) {
if (null !== $this->get_data_function) {
$data = call_user_func(
$this->get_data_function,
$from,

@ -7,13 +7,13 @@
*/
class SystemAnnouncementManager
{
const VISIBLE_GUEST = 'visible_guest';
const VISIBLE_STUDENT = 'visible_student';
const VISIBLE_TEACHER = 'visible_teacher';
public const VISIBLE_GUEST = 'visible_guest';
public const VISIBLE_STUDENT = 'visible_student';
public const VISIBLE_TEACHER = 'visible_teacher';
// Requires DB change
const VISIBLE_DRH = 'visible_drh';
const VISIBLE_SESSION_ADMIN = 'visible_session_admin';
const VISIBLE_STUDENT_BOSS = 'visible_boss';
public const VISIBLE_DRH = 'visible_drh';
public const VISIBLE_SESSION_ADMIN = 'visible_session_admin';
public const VISIBLE_STUDENT_BOSS = 'visible_boss';
/**
* @return array

@ -4,8 +4,6 @@
/**
* Class Timeline
* Timeline model class definition.
*
* @package chamilo.library
*/
class Timeline extends Model
{

@ -23,20 +23,20 @@ use Symfony\Component\Security\Core\Encoder\EncoderFactory;
class UserManager
{
// This constants are deprecated use the constants located in ExtraField
const USER_FIELD_TYPE_TEXT = 1;
const USER_FIELD_TYPE_TEXTAREA = 2;
const USER_FIELD_TYPE_RADIO = 3;
const USER_FIELD_TYPE_SELECT = 4;
const USER_FIELD_TYPE_SELECT_MULTIPLE = 5;
const USER_FIELD_TYPE_DATE = 6;
const USER_FIELD_TYPE_DATETIME = 7;
const USER_FIELD_TYPE_DOUBLE_SELECT = 8;
const USER_FIELD_TYPE_DIVIDER = 9;
const USER_FIELD_TYPE_TAG = 10;
const USER_FIELD_TYPE_TIMEZONE = 11;
const USER_FIELD_TYPE_SOCIAL_PROFILE = 12;
const USER_FIELD_TYPE_FILE = 13;
const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER = 14;
public const USER_FIELD_TYPE_TEXT = 1;
public const USER_FIELD_TYPE_TEXTAREA = 2;
public const USER_FIELD_TYPE_RADIO = 3;
public const USER_FIELD_TYPE_SELECT = 4;
public const USER_FIELD_TYPE_SELECT_MULTIPLE = 5;
public const USER_FIELD_TYPE_DATE = 6;
public const USER_FIELD_TYPE_DATETIME = 7;
public const USER_FIELD_TYPE_DOUBLE_SELECT = 8;
public const USER_FIELD_TYPE_DIVIDER = 9;
public const USER_FIELD_TYPE_TAG = 10;
public const USER_FIELD_TYPE_TIMEZONE = 11;
public const USER_FIELD_TYPE_SOCIAL_PROFILE = 12;
public const USER_FIELD_TYPE_FILE = 13;
public const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER = 14;
private static $encryptionMethod;
@ -3577,7 +3577,7 @@ class UserManager
$daysLeft = SessionManager::getDayLeftInSession($row, $user_id);
// User portal filters:
if ($ignoreTimeLimit === false) {
if (false === $ignoreTimeLimit) {
if ($is_time_over) {
// History
if ($row['duration']) {
@ -3944,7 +3944,7 @@ class UserManager
$join_access_url = $where_access_url = '';
if (api_get_multiple_access_url()) {
$urlId = api_get_current_access_url_id();
if ($urlId != -1) {
if (-1 != $urlId) {
$tbl_url_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$join_access_url = " , $tbl_url_session url_rel_session ";
$where_access_url = " AND access_url_id = $urlId AND url_rel_session.session_id = $session_id ";

@ -7,8 +7,8 @@
*/
class IndexManager
{
const VIEW_BY_DEFAULT = 0;
const VIEW_BY_SESSION = 1;
public const VIEW_BY_DEFAULT = 0;
public const VIEW_BY_SESSION = 1;
// An instance of the template engine
// No need to initialize because IndexManager is not static,

@ -3,8 +3,6 @@
/**
* Redirection script.
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/

@ -32,8 +32,8 @@ use Symfony\Component\Finder\Finder;
*/
class learnpath
{
const MAX_LP_ITEM_TITLE_LENGTH = 32;
const STATUS_CSS_CLASS_NAME = [
public const MAX_LP_ITEM_TITLE_LENGTH = 32;
public const STATUS_CSS_CLASS_NAME = [
'not attempted' => 'scorm_not_attempted',
'incomplete' => 'scorm_not_attempted',
'failed' => 'scorm_failed',
@ -119,9 +119,6 @@ class learnpath
{
$debug = $this->debug;
$this->encoding = api_get_system_encoding();
if ($debug) {
error_log('In learnpath::__construct('.$course.','.$lp_id.','.$user_id.')');
}
if (empty($course)) {
$course = api_get_course_id();
}

@ -255,9 +255,6 @@ class learnpathItem
*/
public function close()
{
if (self::DEBUG > 0) {
error_log('learnpathItem::close()', 0);
}
$this->current_stop_time = time();
$type = $this->get_type();
if ($type !== 'sco') {

@ -4,16 +4,11 @@
use ChamiloSession as Session;
/**
* This is a learning path creation and player tool in Chamilo - previously
* learnpath_handler.php.
*
* @author Patrick Cool
* @author Denes Nagy
* @author Roan Embrechts, refactoring and code cleaning
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update
* @author Julio Montoya - Improving the list of templates
*
* @package chamilo.learnpath
*/
$this_section = SECTION_COURSES;

@ -6,8 +6,6 @@
* This script, in particular, enables the process of SCO's initialization. It
* resets the JavaScript values for each SCO to the current LMS status.
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
@ -76,7 +74,7 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
*/
$myscore = $mylpi->get_score();
$mymax = $mylpi->get_max();
if ($mymax === '') {
if ('' === $mymax) {
$mymax = "''";
}
$mymin = $mylpi->get_min();

@ -7,8 +7,6 @@ use ChamiloSession as Session;
* This script contains the server part of the AJAX interaction process.
* The client part is located * in lp_api.php or other api's.
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
@ -110,7 +108,7 @@ function save_item(
$myLPI->set_lp_view($view_id);
// Launch the prerequisites check and set error if needed
if ($prerequisitesCheck !== true) {
if (true !== $prerequisitesCheck) {
// If prerequisites were not matched, don't update any item info
if ($debug) {
error_log("prereq_check: ".intval($prerequisitesCheck));

@ -6,8 +6,6 @@
* This is a first attempt at using xajax and AJAX in general,
* so the code might be a bit unsettling.
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
echo time();

@ -8,8 +8,6 @@ use ChamiloSession as Session;
* in lp_api.php or other api's.
* This is a first attempt at using xajax and AJAX in general, so the code might be a bit unsettling.
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
@ -119,7 +117,7 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
*/
$myscore = $mylpi->get_score();
$mymax = $mylpi->get_max();
if ($mymax === '') {
if ('' === $mymax) {
$mymax = "''";
}
$mymin = $mylpi->get_min();
@ -190,7 +188,7 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
$mytotal = $mylp->getTotalItemsCountWithoutDirs();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode == '' ? '%' : $myprogress_mode);
$myprogress_mode = ('' == $myprogress_mode ? '%' : $myprogress_mode);
$mynext = $mylp->get_next_item_id();
$myprevious = $mylp->get_previous_item_id();
$myitemtype = $mylpi->get_type();

@ -8,8 +8,6 @@ use ChamiloSession as Session;
* in lp_api.php or other api's.
* This script updated the TOC of the SCORM without updating the SCO's attributes.
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
@ -120,7 +118,7 @@ function switch_item_toc($lpId, $userId, $viewId, $currentItem, $nextItem)
$totalItems = $myLP->getTotalItemsCountWithoutDirs();
$completedItems = $myLP->get_complete_items_count();
$progressMode = $myLP->get_progress_bar_mode();
$progressMode = ($progressMode == '' ? '%' : $progressMode);
$progressMode = ('' == $progressMode ? '%' : $progressMode);
$nextItemId = $myLP->get_next_item_id();
$previousItemId = $myLP->get_previous_item_id();
$itemType = $myLPI->get_type();
@ -155,7 +153,7 @@ function switch_item_toc($lpId, $userId, $viewId, $currentItem, $nextItem)
$progressBarSpecial = false;
$scoreAsProgressSetting = api_get_configuration_value('lp_score_as_progress_enable');
if ($scoreAsProgressSetting === true) {
if (true === $scoreAsProgressSetting) {
$scoreAsProgress = $myLP->getUseScoreAsProgress();
if ($scoreAsProgress) {
$score = $myLPI->get_score();

@ -10,8 +10,6 @@ use ChamiloSession as Session;
* @author Denes Nagy
* @author Roan Embrechts, refactoring and code cleaning
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
*
* @package chamilo.learnpath
*/
$this_section = SECTION_COURSES;

@ -27,8 +27,8 @@ $_course = api_get_course_info();
$glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
$showGlossary = in_array($glossaryExtraTools, ['true', 'lp', 'exercise_and_lp']);
if ($showGlossary) {
if (api_get_setting('show_glossary_in_documents') === 'ismanual' ||
api_get_setting('show_glossary_in_documents') === 'isautomatic'
if ('ismanual' === api_get_setting('show_glossary_in_documents') ||
'isautomatic' === api_get_setting('show_glossary_in_documents')
) {
$htmlHeadXtra[] = '<script>
<!--
@ -118,12 +118,9 @@ $htmlHeadXtra[] = '
// We are brothers!
if (parentId == myParentId) {
console.log("Brothers");
console.log(subItems.length);
if (subItems.length > 0) {
var lastItem = $(jItems[index - 1]).find("li.sub_item");
parentIndex = jItems.index(lastItem);
console.log(parentIndex);
jItem.detach().insertAfter(lastItem);
//console.log("not classic");
} else {
@ -294,25 +291,17 @@ $lpfound = false;
$myrefresh = 0;
$myrefresh_id = 0;
$refresh = Session::read('refresh');
if ($refresh == 1) {
if (1 == $refresh) {
// Check if we should do a refresh of the oLP object (for example after editing the LP).
// If refresh is set, we regenerate the oLP object from the database (kind of flush).
Session::erase('refresh');
$myrefresh = 1;
}
if ($debug > 0) {
error_log(' $refresh: '.$refresh);
error_log(' $myrefresh: '.$myrefresh);
}
$lp_controller_touched = 1;
$lp_found = false;
$lpObject = Session::read('lpobject');
if (!empty($lpObject)) {
if ($debug) {
error_log(' SESSION[lpobject] is defined');
}
/** @var learnpath $oLP */
$oLP = UnserializeApi::unserialize('lp', $lpObject);
if (isset($oLP) && is_object($oLP)) {
@ -487,7 +476,7 @@ if (isset($_POST['title'])) {
$post_title = Security::remove_XSS($_POST['title']);
if (isset($_POST['type']) &&
isset($_POST['title']) &&
$_POST['type'] == TOOL_QUIZ &&
TOOL_QUIZ == $_POST['type'] &&
!empty($_POST['title'])
) {
$post_title = Exercise::format_title_variable($_POST['title']);
@ -1502,9 +1491,6 @@ switch ($action) {
if (!$lp_found) {
require 'lp_list.php';
} else {
if ($debug > 0) {
error_log('Trying to impress this LP item to '.$_REQUEST['item_id'], 0);
}
if (!empty($_REQUEST['item_id'])) {
$_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
}

@ -4,8 +4,6 @@
/**
* Script to draw the results from a query.
*
* @package chamilo.learnpath
*
* @author Diego Escalante Urrelo <diegoe@gmail.com>
* @author Marco Antonio Villegas Vega <marvil07@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> bug fixing
@ -179,7 +177,7 @@ if (count($blocks) > 0) {
$additional_parameters['operator'] = $op;
$s->additional_parameters = $additional_parameters;
if ($mode == 'default') {
if ('default' == $mode) {
$s->set_header(0, get_lang(ucfirst(TOOL_SEARCH)), false);
}

@ -104,7 +104,7 @@ echo '<div class="col-md-3">';
echo '</div>';
echo '<div class="col-md-9">';
if (isset($is_success) && $is_success === true) {
if (isset($is_success) && true === $is_success) {
$msg = '<div class="lp_message" style="margin-bottom:10px;">';
$msg .= 'The item has been moved.';
$msg .= '</div>';

@ -5,8 +5,6 @@
* Script opened in an iframe and containing the
* learning path's navigation and progress bar.
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
@ -38,11 +36,11 @@ if ($myLP) {
// Setting up the CSS theme if exists
$myCourseLpTheme = null;
if (api_get_setting('allow_course_theme') === 'true') {
if ('true' === api_get_setting('allow_course_theme')) {
$myCourseLpTheme = api_get_course_setting('allow_learning_path_theme');
}
if (!empty($lp_theme_css) && !empty($myCourseLpTheme) && $myCourseLpTheme != -1 && $myCourseLpTheme == 1) {
if (!empty($lp_theme_css) && !empty($myCourseLpTheme) && -1 != $myCourseLpTheme && 1 == $myCourseLpTheme) {
global $lp_theme_css;
} else {
$lp_theme_css = $my_style;

@ -6,8 +6,6 @@ use ChamiloSession as Session;
/**
* Script that handles the saving of item status.
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
@ -26,7 +24,7 @@ use ChamiloSession as Session;
<?php
/** @var learnpath $lp */
$lp = Session::read('oLP');
if ($lp->mode != 'fullscreen') {
if ('fullscreen' != $lp->mode) {
}
?>
</script>

@ -24,12 +24,12 @@ $extendId = isset($_GET['extend_id']) ? $_GET['extend_id'] : null;
$extendAttemptId = isset($_GET['extend_attempt_id']) ? $_GET['extend_attempt_id'] : null;
$extendedAttempt = isset($_GET['extend_attempt']) ? $_GET['extend_attempt'] : null;
$extendedAll = isset($_GET['extend_all']) ? $_GET['extend_all'] : null;
$export = isset($_GET['export']) && $_GET['export'] === 'csv';
$export = isset($_GET['export']) && 'csv' === $_GET['export'];
$allowExtend = isset($_GET['allow_extend']) ? $_GET['allow_extend'] : 1;
$lpReportType = api_get_setting('lp_show_reduced_report');
$type = 'classic';
if ($lpReportType === 'true') {
if ('true' === $lpReportType) {
$type = 'simple';
}
$courseInfo = api_get_course_info($courseCode);

@ -26,7 +26,7 @@ if (empty($categoryId)) {
}
$subscriptionSettings = learnpath::getSubscriptionSettings();
if ($subscriptionSettings['allow_add_users_to_lp_category'] == false) {
if (false == $subscriptionSettings['allow_add_users_to_lp_category']) {
api_not_allowed(true);
}

@ -5,8 +5,6 @@
* This is a learning path creation and player tool in Chamilo - previously.
*
* @author Julio Montoya - Improving the list of templates
*
* @package chamilo.learnpath
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -10,8 +10,6 @@ use ChamiloSession as Session;
* @author Denes Nagy
* @author Roan Embrechts, refactoring and code cleaning
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
*
* @package chamilo.learnpath
*/
// Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP
@ -49,7 +47,7 @@ if (empty($lp)) {
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'fullpage';
if (isset($_SESSION['oLP']) && isset($_GET['id'])) {
$_SESSION['oLP']->current = intval($_GET['id']);
$_SESSION['oLP']->current = (int) $_GET['id'];
}
$this_section = SECTION_COURSES;
/* Header and action code */
@ -89,7 +87,7 @@ $interbreadcrumb[] = [
$show_learn_path = true;
$lp_theme_css = $lp->get_theme();
if ($mode == 'fullpage') {
if ('fullpage' === $mode) {
Display::display_header(get_lang('Item'), 'Path');
}

@ -5,8 +5,6 @@ use Chamilo\CourseBundle\Entity\CDocument;
/**
* Print a read-out text inside a session.
*
* @package chamilo.learnpath
*/
$_in_course = true;

@ -6,8 +6,6 @@ use Symfony\Component\DomCrawler\Crawler;
/**
* Defines the scorm class, which is meant to contain the scorm items (nuclear elements).
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
class scorm extends learnpath
@ -118,7 +116,7 @@ class scorm extends learnpath
if ($root->hasAttributes()) {
$attributes = $root->attributes;
if ($attributes->length !== 0) {
if (0 !== $attributes->length) {
foreach ($attributes as $attrib) {
// <manifest> element attributes
$this->manifest[$attrib->name] = $attrib->value;
@ -128,10 +126,10 @@ class scorm extends learnpath
$this->manifest['name'] = $root->tagName;
if ($root->hasChildNodes()) {
$children = $root->childNodes;
if ($children->length !== 0) {
if (0 !== $children->length) {
foreach ($children as $child) {
// <manifest> element children (can be <metadata>, <organizations> or <resources> )
if ($child->nodeType == XML_ELEMENT_NODE) {
if (XML_ELEMENT_NODE == $child->nodeType) {
switch ($child->tagName) {
case 'metadata':
// Parse items from inside the <metadata> element.
@ -143,7 +141,7 @@ class scorm extends learnpath
$orgs_attribs = $child->attributes;
foreach ($orgs_attribs as $orgs_attrib) {
// Attributes of the <organizations> element.
if ($orgs_attrib->nodeType == XML_ATTRIBUTE_NODE) {
if (XML_ATTRIBUTE_NODE == $orgs_attrib->nodeType) {
$this->manifest['organizations'][$orgs_attrib->name] = $orgs_attrib->value;
}
}

@ -6,8 +6,6 @@
* This class handles the <item> elements from an imsmanifest file.
* Container for the scormItem class that deals with <item> elements in an imsmanifest file.
*
* @package chamilo.learnpath.scorm
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
class scormItem extends learnpathItem
@ -57,33 +55,33 @@ class scormItem extends learnpathItem
switch ($child->tagName) {
case 'title':
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
if (1 == $tmp_children->length && '' != $child->firstChild->nodeValue) {
$this->title = $child->firstChild->nodeValue;
}
break;
case 'max_score':
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
if (1 == $tmp_children->length && '' != $child->firstChild->nodeValue) {
$this->max_score = $child->firstChild->nodeValue;
}
break;
case 'maxtimeallowed':
case 'adlcp:maxtimeallowed':
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
if (1 == $tmp_children->length && '' != $child->firstChild->nodeValue) {
$this->max_time_allowed = $child->firstChild->nodeValue;
}
break;
case 'prerequisites':
case 'adlcp:prerequisites':
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
if (1 == $tmp_children->length && '' != $child->firstChild->nodeValue) {
$this->prereq_string = $child->firstChild->nodeValue;
}
break;
case 'timelimitaction':
case 'adlcp:timelimitaction':
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
if (1 == $tmp_children->length && '' != $child->firstChild->nodeValue) {
$this->timelimitaction = $child->firstChild->nodeValue;
}
break;
@ -91,20 +89,20 @@ class scormItem extends learnpathItem
case 'adlcp:datafromlms':
case 'adlcp:launchdata': //in some cases (Wouters)
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
if (1 == $tmp_children->length && '' != $child->firstChild->nodeValue) {
$this->datafromlms = $child->firstChild->nodeValue;
}
break;
case 'masteryscore':
case 'adlcp:masteryscore':
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
if (1 == $tmp_children->length && '' != $child->firstChild->nodeValue) {
$this->mastery_score = $child->firstChild->nodeValue;
}
break;
case 'item':
$oItem = new scormItem('manifest', $child);
if ($oItem->identifier != '') {
if ('' != $oItem->identifier) {
$this->sub_items[$oItem->identifier] = $oItem;
}
break;

@ -3,8 +3,6 @@
/**
* Container for the scormMetadata class, setup to hold information about the <metadata> element in imsmanifest files.
*
* @package chamilo.learnpath.scorm
*/
/**
@ -75,8 +73,8 @@ class scormMetadata
}
break;
case XML_TEXT_NODE:
if (trim($child->textContent) != '') {
if (count($children == 1)) {
if ('' != trim($child->textContent)) {
if (count(1 == $children)) {
// If this is the only child at this level and it is a content... save differently.
$this->text = $child->textContent;
} else {
@ -90,7 +88,7 @@ class scormMetadata
//$keep_href = '';
if (is_array($attributes)) {
foreach ($attributes as $attrib) {
if (trim($attrib->value) != '') {
if ('' != trim($attrib->value)) {
$this->attribs[$attrib->name] = $attrib->value;
}
}

@ -4,8 +4,6 @@
/**
* Container for the scormOrganization class.
*
* @package chamilo.learnpath.scorm
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
@ -49,7 +47,7 @@ class scormOrganization
'manifest',
$child
);
if ($oItem->identifier != '') {
if ('' != $oItem->identifier) {
$this->items[$oItem->identifier] = $oItem;
}
break;
@ -61,7 +59,7 @@ class scormOrganization
break;
case 'title':
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
if (1 == $tmp_children->length && '' != $child->firstChild->nodeValue) {
$this->title = api_utf8_decode(
api_html_entity_decode(
$child->firstChild->nodeValue,

@ -4,8 +4,6 @@
/**
* Container for the scormResource class.
*
* @package chamilo.learnpath.scorm
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*/

Loading…
Cancel
Save