Format code.

1.10.x
Julio Montoya 10 years ago
parent 8519c89d0d
commit 16134e67f3
  1. 8
      main/newscorm/aiccItem.class.php
  2. 3
      main/newscorm/aiccResource.class.php
  3. 13
      main/newscorm/resourcelinker.php
  4. 54
      main/newscorm/scormOrganization.class.php
  5. 8
      main/newscorm/scormResource.class.php

@ -84,9 +84,11 @@ class aiccItem extends learnpathItem
break;
}
}
return true;
}
}
return false;
}
@ -97,7 +99,8 @@ class aiccItem extends learnpathItem
* @param integer Optional relative order of the item at this level
* @param integer Optional level. If not given, assumes it's level 0
*/
function get_flat_list(&$list, &$abs_order, $rel_order = 1, $level = 0) {
function get_flat_list(&$list, &$abs_order, $rel_order = 1, $level = 0)
{
$list[] = array(
'au_type' => $this->au_type,
'command_line' => $this->command_line,
@ -124,7 +127,8 @@ class aiccItem extends learnpathItem
* Save function. Uses the parent save function and adds a layer for AICC.
* @param boolean Save from URL params (1) or from object attributes (0)
*/
function save($from_outside = true, $prereqs_complete = false) {
function save($from_outside = true, $prereqs_complete = false)
{
parent::save($from_outside, $prereqs_complete = false);
// Under certain conditions, the scorm_contact should not be set, because no scorm signal was sent.
$this->aicc_contact = true;

@ -23,7 +23,6 @@ class aiccResource
*/
public function aiccResource($type = 'config', $params)
{
if (isset($params)) {
switch ($type) {
case 'db':
@ -46,9 +45,11 @@ class aiccResource
break;
}
}
return true;
}
}
return false;
}
}

@ -9,14 +9,10 @@
* @todo reorganise code,
* use Database API instead of creating table names locally.
*/
/**
* Code
*/
/* INIT SECTION */
// Flag to allow for anonymous user - needs to be set before global.inc.php.
use \ChamiloSession as Session;
use ChamiloSession as Session;
$use_anonymous = true;
@ -34,10 +30,6 @@ include 'resourcelinker.inc.php';
$link_table = Database :: get_course_table(TABLE_LINK);
$item_property_table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
//$tbl_learnpath_main = Database :: get_course_table(TABLE_LEARNPATH_MAIN);
//$tbl_learnpath_chapter = Database :: get_course_table(TABLE_LEARNPATH_CHAPTER);
//$tbl_learnpath_item = Database :: get_course_table(TABLE_LEARNPATH_ITEM);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
@ -141,7 +133,8 @@ if (!empty ($_POST['external_link_submit'])) {
$external_link = 'http://'.$external_link;
}
$sql = "INSERT INTO $link_table (c_id, url, title, category_id) VALUES ($course_id, '$external_link','$external_link','$add_2_links')";
$sql = "INSERT INTO $link_table (c_id, url, title, category_id)
VALUES ($course_id, '$external_link','$external_link','$add_2_links')";
$result = Database::query($sql);
$addedresource[] = "Link";
$addedresourceid[] = Database::insert_id();

@ -24,11 +24,11 @@ class scormOrganization
* @param string Type of construction needed ('db' or 'manifest', default = 'manifest')
* @param mixed Depending on the type given, DB id for the lp_item or reference to the DOM element
*/
public function __construct($type = 'manifest', &$element, $scorm_charset = 'UTF-8') {
public function __construct($type = 'manifest', &$element, $scorm_charset = 'UTF-8')
{
if (isset($element)) {
// Parsing using PHP5 DOMXML methods.
switch ($type) {
case 'db':
// TODO: Implement this way of metadata object creation.
@ -39,29 +39,30 @@ class scormOrganization
$children = $element->childNodes;
foreach ($children as $child) {
switch ($child->nodeType) {
case XML_ELEMENT_NODE:
case XML_ELEMENT_NODE:
switch ($child->tagName) {
case 'item':
case 'item':
$oItem = new scormItem('manifest', $child);
if ($oItem->identifier != '') {
$this->items[$oItem->identifier] = $oItem;
}
break;
case 'metadata':
$this->metadata = new scormMetadata('manifest', $child);
break;
case 'title':
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
$this->title = api_utf8_decode(api_html_entity_decode($child->firstChild->nodeValue, ENT_QUOTES, 'UTF-8'));
}
break;
}
break;
case 'metadata':
$this->metadata = new scormMetadata('manifest', $child);
break;
case 'title':
$tmp_children = $child->childNodes;
if ($tmp_children->length == 1 && $child->firstChild->nodeValue != '') {
$this->title = api_utf8_decode(api_html_entity_decode($child->firstChild->nodeValue, ENT_QUOTES, 'UTF-8'));
}
break;
}
break;
case XML_TEXT_NODE:
break;
}
}
}
if ($element->hasAttributes()) {
$attributes = $element->attributes;
//$keep_href = '';
@ -76,12 +77,13 @@ class scormOrganization
}
}
}
return true;
}
// End parsing using PHP5 DOMXML methods.
}
return false;
}
@ -89,14 +91,17 @@ class scormOrganization
* Get a flat list of items in the organization
* @return array Array containing an ordered list of all items with their level and all information related to each item
*/
public function get_flat_items_list() {
public function get_flat_items_list()
{
$list = array();
$i = 1;
foreach ($this->items as $id => $dummy) {
$abs_order = 0;
$this->items[$id]->get_flat_list($list,$abs_order, $i, 0); // Passes the array as a pointer so it is modified in $list directly.
// Passes the array as a pointer so it is modified in $list directly.
$this->items[$id]->get_flat_list($list,$abs_order, $i, 0);
$i++;
}
return $list;
}
@ -104,7 +109,8 @@ class scormOrganization
* Name getter
* @return string Name or empty string
*/
public function get_name() {
public function get_name()
{
if (!empty($this->title)) {
return Database::escape_string($this->title);
} else {
@ -116,7 +122,8 @@ class scormOrganization
* Reference identifier getter
* @return string Identifier or empty string
*/
public function get_ref() {
public function get_ref()
{
if (!empty($this->identifier)) {
return Database::escape_string($this->identifier);
} else {
@ -126,9 +133,10 @@ class scormOrganization
/**
* Sets the title element
* @param string New title to set
* @param string $title New title to set
*/
public function set_name($title) {
public function set_name($title)
{
if (!empty($title)) {
$this->title = Database::escape_string($title);
}

@ -100,8 +100,8 @@ class scormResource
}
// End parsing using PHP5 DOMXML methods.
}
return false;
}
@ -109,7 +109,8 @@ class scormResource
* Path getter
* @return string Path for this resource
*/
public function get_path() {
public function get_path()
{
if (!empty($this->href)) {
return Database::escape_string($this->href);
} else {
@ -121,7 +122,8 @@ class scormResource
* Scorm type getter
* @return string generally 'asset' or 'sco' as these are the only two values defined in SCORM 1.2
*/
public function get_scorm_type() {
public function get_scorm_type()
{
if (!empty($this->scormtype)) {
return Database::escape_string($this->scormtype);
} else {

Loading…
Cancel
Save