Format code.

1.10.x
Julio Montoya 11 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. 26
      main/newscorm/scormOrganization.class.php
  5. 8
      main/newscorm/scormResource.class.php

@ -84,9 +84,11 @@ class aiccItem extends learnpathItem
break; break;
} }
} }
return true; return true;
} }
} }
return false; return false;
} }
@ -97,7 +99,8 @@ class aiccItem extends learnpathItem
* @param integer Optional relative order of the item at this level * @param integer Optional relative order of the item at this level
* @param integer Optional level. If not given, assumes it's level 0 * @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( $list[] = array(
'au_type' => $this->au_type, 'au_type' => $this->au_type,
'command_line' => $this->command_line, '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. * 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) * @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); parent::save($from_outside, $prereqs_complete = false);
// Under certain conditions, the scorm_contact should not be set, because no scorm signal was sent. // Under certain conditions, the scorm_contact should not be set, because no scorm signal was sent.
$this->aicc_contact = true; $this->aicc_contact = true;

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

@ -9,14 +9,10 @@
* @todo reorganise code, * @todo reorganise code,
* use Database API instead of creating table names locally. * 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. // 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; $use_anonymous = true;
@ -34,10 +30,6 @@ include 'resourcelinker.inc.php';
$link_table = Database :: get_course_table(TABLE_LINK); $link_table = Database :: get_course_table(TABLE_LINK);
$item_property_table = Database :: get_course_table(TABLE_ITEM_PROPERTY); $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 = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $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; $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); $result = Database::query($sql);
$addedresource[] = "Link"; $addedresource[] = "Link";
$addedresourceid[] = Database::insert_id(); $addedresourceid[] = Database::insert_id();

@ -24,11 +24,11 @@ class scormOrganization
* @param string Type of construction needed ('db' or 'manifest', default = 'manifest') * @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 * @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)) { if (isset($element)) {
// Parsing using PHP5 DOMXML methods. // Parsing using PHP5 DOMXML methods.
switch ($type) { switch ($type) {
case 'db': case 'db':
// TODO: Implement this way of metadata object creation. // TODO: Implement this way of metadata object creation.
@ -62,6 +62,7 @@ class scormOrganization
break; break;
} }
} }
if ($element->hasAttributes()) { if ($element->hasAttributes()) {
$attributes = $element->attributes; $attributes = $element->attributes;
//$keep_href = ''; //$keep_href = '';
@ -76,12 +77,13 @@ class scormOrganization
} }
} }
} }
return true; return true;
} }
// End parsing using PHP5 DOMXML methods. // End parsing using PHP5 DOMXML methods.
} }
return false; return false;
} }
@ -89,14 +91,17 @@ class scormOrganization
* Get a flat list of items in the organization * 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 * @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(); $list = array();
$i = 1; $i = 1;
foreach ($this->items as $id => $dummy) { foreach ($this->items as $id => $dummy) {
$abs_order = 0; $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++; $i++;
} }
return $list; return $list;
} }
@ -104,7 +109,8 @@ class scormOrganization
* Name getter * Name getter
* @return string Name or empty string * @return string Name or empty string
*/ */
public function get_name() { public function get_name()
{
if (!empty($this->title)) { if (!empty($this->title)) {
return Database::escape_string($this->title); return Database::escape_string($this->title);
} else { } else {
@ -116,7 +122,8 @@ class scormOrganization
* Reference identifier getter * Reference identifier getter
* @return string Identifier or empty string * @return string Identifier or empty string
*/ */
public function get_ref() { public function get_ref()
{
if (!empty($this->identifier)) { if (!empty($this->identifier)) {
return Database::escape_string($this->identifier); return Database::escape_string($this->identifier);
} else { } else {
@ -126,9 +133,10 @@ class scormOrganization
/** /**
* Sets the title element * 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)) { if (!empty($title)) {
$this->title = Database::escape_string($title); $this->title = Database::escape_string($title);
} }

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

Loading…
Cancel
Save