Minor - format code , add api_get_cidreq in breadcrumb

pull/2487/head
jmontoyaa 8 years ago
parent 2b8e60e35e
commit 339fc60e91
  1. 145
      main/lp/lp_admin_view.php
  2. 20
      main/lp/lp_ajax_initialize.php
  3. 9
      main/lp/lp_ajax_save_objectives.php
  4. 7
      main/lp/lp_build.php
  5. 1
      main/lp/lp_content.php
  6. 16
      main/lp/lp_edit.php
  7. 1
      main/lp/lp_edit_item.php
  8. 1
      main/lp/lp_edit_item_prereq.php
  9. 73
      main/lp/lp_final_item.php
  10. 5
      main/lp/lp_impress.php
  11. 2
      main/lp/lp_move_item.php
  12. 1
      main/lp/lp_nav.php
  13. 4
      main/lp/lp_view.php
  14. 4
      main/lp/lp_view_item.php
  15. 5
      main/lp/openoffice_document.class.php
  16. 14
      main/lp/openoffice_presentation.class.php
  17. 23
      main/lp/openoffice_text.class.php
  18. 114
      main/lp/scormMetadata.class.php
  19. 54
      main/lp/scormOrganization.class.php
  20. 2
      main/lp/scormResource.class.php

@ -50,9 +50,12 @@ if (!empty($gradebook) && $gradebook == 'view') {
);
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array(
'url' => api_get_self()."?action=build&lp_id=$learnpath_id",
'url' => 'lp_controller.php?action=list&'.api_get_cidreq(),
'name' => get_lang('LearningPaths')
);
$interbreadcrumb[] = array(
'url' => api_get_self()."?action=build&lp_id=$learnpath_id&".api_get_cidreq(),
"name" => stripslashes("{$therow['name']}"),
);
$interbreadcrumb[] = array(
@ -72,7 +75,6 @@ $lp_theme_css = $_SESSION['oLP']->get_theme();
// POST action handling (uploading mp3, deleting mp3)
if (isset($_POST['save_audio'])) {
//Updating the lp.modified_on
$_SESSION['oLP']->set_modified_on();
@ -93,7 +95,9 @@ if (isset($_POST['save_audio'])) {
// Uploading the audio files.
foreach ($_FILES as $key => $value) {
if (substr($key, 0, 7) == 'mp3file' && !empty($_FILES[$key]['tmp_name'])) {
if (substr($key, 0, 7) == 'mp3file' &&
!empty($_FILES[$key]['tmp_name'])
) {
// The id of the learning path item.
$lp_item_id = str_ireplace('mp3file', '', $key);
@ -109,7 +113,6 @@ if (isset($_POST['save_audio'])) {
$clean_name = api_replace_dangerous_char($file_name);
// No "dangerous" files.
$clean_name = disable_dangerous_file($clean_name);
$check_file_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/audio/'.$clean_name;
// If the file exists we generate a new name.
@ -145,9 +148,10 @@ if (isset($_POST['save_audio'])) {
// Store the mp3 file in the lp_item table.
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$sql_insert_audio = "UPDATE $tbl_lp_item SET audio = '".Database::escape_string($file)."'
WHERE c_id = $course_id AND id = '".Database::escape_string($lp_item_id)."'";
Database::query($sql_insert_audio);
$sql = "UPDATE $tbl_lp_item
SET audio = '".Database::escape_string($file)."'
WHERE c_id = $course_id AND id = '".Database::escape_string($lp_item_id)."'";
Database::query($sql);
}
}
//echo Display::return_message(get_lang('ItemUpdated'), 'confirm');
@ -168,69 +172,65 @@ $(function() {
<?php
if (!isset($_REQUEST['updateaudio'])) {
?>
$("#lp_item_list").sortable({
items: "li",
handle: ".moved", //only the class "moved"
cursor: "move",
placeholder: "ui-state-highlight" //defines the yellow highlight
});
$("#listSubmit").click(function () {
//Disable the submit button to prevent a double-click
$(this).attr("disabled","disabled");
//Initialize the variable that will contain the data to submit to the form
newOrderData= "";
//All direct descendants of the lp_item_list will have a parentId of 0
var parentId= 0;
//Walk through the direct descendants of the lp_item_list <ul>
$("#lp_item_list").children().each(function () {
/*Only process elements with an id attribute (in order to skip the blank,
unmovable <li> elements.*/
if ($(this).attr("id")) {
/*Build a string of data with the child's ID and parent ID,
using the "|" as a delimiter between the two IDs and the "^"
as a record delimiter (these delimiters were chosen in case the data
involved includes more common delimiters like commas within the content)
*/
newOrderData= newOrderData + $(this).attr("id") + "|" + "0" + "^";
//Determine if this child is a containter
if ($(this).is(".li_container")) {
//Process the child elements of the container
processChildren($(this).attr("id"));
}
}
}); //end of lp_item_list children loop
//Write the newOrderData string out to the listResults form element
//$("#listResults").val(newOrderData);
var order = "new_order="+ newOrderData + "&a=update_lp_item_order";
$.post("<?php echo api_get_path(WEB_AJAX_PATH)?>lp.ajax.php", order, function(reponse){
$("#message").html(reponse);
});
$("#lp_item_list").sortable({
items: "li",
handle: ".moved", //only the class "moved"
cursor: "move",
placeholder: "ui-state-highlight" //defines the yellow highlight
});
$("#listSubmit").click(function () {
//Disable the submit button to prevent a double-click
$(this).attr("disabled","disabled");
//Initialize the variable that will contain the data to submit to the form
newOrderData= "";
//All direct descendants of the lp_item_list will have a parentId of 0
var parentId= 0;
//Walk through the direct descendants of the lp_item_list <ul>
$("#lp_item_list").children().each(function () {
/*Only process elements with an id attribute (in order to skip the blank,
unmovable <li> elements.*/
if ($(this).attr("id")) {
/*Build a string of data with the child's ID and parent ID,
using the "|" as a delimiter between the two IDs and the "^"
as a record delimiter (these delimiters were chosen in case the data
involved includes more common delimiters like commas within the content)
*/
newOrderData= newOrderData + $(this).attr("id") + "|" + "0" + "^";
//Determine if this child is a containter
if ($(this).is(".li_container")) {
//Process the child elements of the container
processChildren($(this).attr("id"));
}
}
setTimeout(function() {
$("#message").html('');
}, 3000);
}); //end of lp_item_list children loop
return false;
//Write the newOrderData string out to the listResults form element
//$("#listResults").val(newOrderData);
var order = "new_order="+ newOrderData + "&a=update_lp_item_order";
$.post("<?php echo api_get_path(WEB_AJAX_PATH)?>lp.ajax.php", order, function(reponse) {
$("#message").html(reponse);
});
}); //end of lp_item_list event assignment
setTimeout(function() {
$("#message").html('');
}, 3000);
<?php } ?>
function processChildren(parentId) {
//Loop through the children of the UL element defined by the parentId
var ulParentID= "UL_" + parentId;
$("#" + ulParentID).children().each(function () {
return false;
/*Only process elements with an id attribute (in order to skip the blank,
unmovable <li> elements.*/
}); //end of lp_item_list event assignment
<?php } ?>
if ($(this).attr("id")) {
function processChildren(parentId) {
//Loop through the children of the UL element defined by the parentId
var ulParentID= "UL_" + parentId;
$("#" + ulParentID).children().each(function () {
/*Only process elements with an id attribute (in order to skip the blank,
unmovable <li> elements.*/
if ($(this).attr("id")) {
/*Build a string of data with the child's ID and parent ID,
using the "|" as a delimiter between the two IDs and the "^"
as a record delimiter (these delimiters were chosen in case the data
@ -244,8 +244,8 @@ $(function() {
processChildren($(this).attr("id"));
}
}
}); //end of children loop
} //end of processChildren function
}); //end of children loop
} //end of processChildren function
});
/* <![CDATA[ */
@ -279,14 +279,20 @@ echo '<div class="col-md-8">';
switch ($_GET['action']) {
case 'edit_item':
if (isset($is_success) && $is_success === true) {
echo Display::return_message(get_lang('LearnpathItemEdited'), 'confirm');
echo Display::return_message(
get_lang('LearnpathItemEdited'),
'confirm'
);
} else {
echo $_SESSION['oLP']->display_edit_item($_GET['id']);
}
break;
case 'delete_item':
if (isset($is_success) && $is_success === true) {
echo Display::return_message(get_lang('LearnpathItemDeleted'), 'confirm');
echo Display::return_message(
get_lang('LearnpathItemDeleted'),
'confirm'
);
}
break;
}
@ -298,5 +304,4 @@ if (!empty($_GET['updateaudio'])) {
echo '</div>';
echo '</div>';
/* FOOTER */
Display::display_footer();

@ -10,7 +10,6 @@
*/
// Flag to allow for anonymous user - needs to be set before global.inc.php
$use_anonymous = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -66,7 +65,6 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
$mymax = "''";
}
$mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status();
$mytotal_time = $mylpi->get_scorm_time('js', null, true);
$mymastery_score = $mylpi->get_mastery_score();
@ -84,13 +82,11 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
$myistring = substr($myistring, 1);
}
// Obtention des donnees d'objectifs
$mycoursedb = Database::get_course_table(TABLE_LP_IV_OBJECTIVE);
// Obtention des donnees d'objectifs
$mycoursedb = Database::get_course_table(TABLE_LP_IV_OBJECTIVE);
$course_id = api_get_course_int_id();
$mylp_iv_id = $mylpi->db_item_view_id;
$mylp_iv_id = $mylpi->db_item_view_id;
$phpobjectives = array();
if (!empty($mylp_iv_id)) {
$sql = "SELECT objective_id, status, score_raw, score_max, score_min
FROM $mycoursedb
@ -101,7 +97,7 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
$phpobjectives[] = $row;
}
}
$myobjectives = json_encode($phpobjectives);
$myobjectives = json_encode($phpobjectives);
$return .=
"olms.score=".$myscore.";".
@ -172,4 +168,10 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
return $return;
}
echo initialize_item($_POST['lid'], $_POST['uid'], $_POST['vid'], $_POST['iid']);
echo initialize_item(
$_POST['lid'],
$_POST['uid'],
$_POST['vid'],
$_POST['iid']
);

@ -1,9 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The client part is located
* 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.
* This script contains the server part of the xajax interaction process.
* The client part is located 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>
*/
@ -30,7 +31,7 @@ function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = arr
$mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id);
$mylpi = & $mylp->items[$item_id];
if (is_array($objectives) && count($objectives) > 0) {
foreach ($objectives as $index=>$objective) {
foreach ($objectives as $index => $objective) {
$mylpi->add_objective($index, $objectives[$index]);
}
$mylpi->write_objectives_to_db();

@ -17,7 +17,6 @@ $this_section = SECTION_COURSES;
api_protect_course_script();
/* Constants and variables */
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
@ -119,9 +118,7 @@ if (isset($is_success) && $is_success === true) {
}
// Display::addFlash(Display::return_message(get_lang('LPCreatedAddChapterStep'), 'normal', false));
$gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : null;
echo Display::page_subheader(get_lang('LearnPathAddedTitle'));
echo '<ul id="lp_overview" class="thumbnails">';
echo show_block(
'lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add_item&type=step&lp_id='.$_SESSION['oLP']->lp_id,
@ -140,8 +137,8 @@ if (isset($is_success) && $is_success === true) {
echo '</div>';
echo '</div>';
function show_block($link, $title, $subtitle, $icon) {
function show_block($link, $title, $subtitle, $icon)
{
$html = '<li class="col-md-4">';
$html .= '<div class="thumbnail">';
$html .= '<a href="'.$link.'" title="'.$title.'">';

@ -33,7 +33,6 @@ if ($debug > 0) {
}
$list = $_SESSION['oLP']->get_toc();
$dir = false;
foreach ($list as $toc) {

@ -25,7 +25,10 @@ if (!empty($gradebook) && $gradebook == 'view') {
'name' => get_lang('ToolGradebook')
);
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&'.api_get_cidreq(), 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array(
'url' => 'lp_controller.php?action=list&'.api_get_cidreq(),
'name' => get_lang('LearningPaths')
);
$interbreadcrumb[] = array(
'url' => api_get_self()."?action=build&lp_id=".$_SESSION['oLP']->get_id().'&'.api_get_cidreq(),
'name' => $_SESSION['oLP']->get_name()
@ -51,9 +54,12 @@ function activate_end_date() {
</script>';
$gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : null;
$defaults = array();
$form = new FormValidator('form1', 'post', 'lp_controller.php?'.api_get_cidreq());
$form = new FormValidator(
'form1',
'post',
'lp_controller.php?'.api_get_cidreq()
);
// Form title
$form->addElement('header', get_lang('EditLPSettings'));
@ -176,8 +182,8 @@ $form->addElement(
);
$display_date = 'none';
if (!empty($expired_on)) {
$display_date = 'block';
$defaults['activate_end_date_check'] = 1;
$display_date = 'block';
$defaults['activate_end_date_check'] = 1;
}
$form->addElement('html', '<div id="end_date_div" style="display:'.$display_date.';">');

@ -13,7 +13,6 @@
*/
$this_section = SECTION_COURSES;
api_protect_course_script();
/* Header and action code */

@ -60,7 +60,6 @@ $interbreadcrumb[] = array(
'name' => get_lang('NewStep'),
);
Display::display_header(get_lang('LearnpathPrerequisites'), 'Path');
$suredel = trim(get_lang('AreYouSureToDeleteJS'));

@ -74,8 +74,7 @@ $currentItem = $lp->items[$currentItemId];
$currentItemStatus = $currentItem->get_status();
$accessGranted = false;
if (
($count - $completed == 0) ||
if (($count - $completed == 0) ||
($count - $completed == 1 && ($currentItemStatus == 'incomplete') || ($currentItemStatus == 'not attempted'))
) {
if ($lp->prerequisites_match($currentItemId)) {
@ -95,10 +94,17 @@ if ($accessGranted == false) {
echo Display::return_message(get_lang('LearnpathPrereqNotCompleted'), 'warning');
$finalItemTemplate = '';
} else {
$catLoad = Category::load(null, null, $courseCode, null, null, $sessionId, 'ORDER By id');
$catLoad = Category::load(
null,
null,
$courseCode,
null,
null,
$sessionId,
'ORDER By id'
);
// If not gradebook has been defined
if (empty($catLoad)) {
$finalItemTemplate = generateLPFinalItemTemplate(
$id,
$courseCode,
@ -110,7 +116,14 @@ if ($accessGranted == false) {
} else {
// A gradebook was found, proceed...
$categoryId = $catLoad[0]->get_id();
$link = LinkFactory::load(null, null, $lpId, null, $courseCode, $categoryId);
$link = LinkFactory::load(
null,
null,
$lpId,
null,
$courseCode,
$categoryId
);
if ($link) {
$cat = new Category();
@ -119,26 +132,53 @@ if ($accessGranted == false) {
if ($show_message == '') {
if (!api_is_allowed_to_edit() && !api_is_excluded_user_type()) {
$certificate = Category::generateUserCertificate($categoryId, $userId);
$certificate = Category::generateUserCertificate(
$categoryId,
$userId
);
if (!empty($certificate['pdf_url']) || !empty($certificate['badge_link'])) {
if (is_array($certificate) && isset($certificate['pdf_url'])) {
$downloadCertificateLink = generateLPFinalItemTemplateCertificateLinks($certificate);
$downloadCertificateLink = generateLPFinalItemTemplateCertificateLinks(
$certificate
);
}
if (is_array($certificate) && isset($certificate['badge_link'])) {
if (is_array($certificate) &&
isset($certificate['badge_link'])
) {
$courseId = api_get_course_int_id();
$badgeLink = generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId);
$badgeLink = generateLPFinalItemTemplateBadgeLinks(
$userId,
$courseId,
$sessionId
);
}
}
$currentScore = Category::getCurrentScore($userId, $categoryId, $courseCode, $sessionId, true);
Category::registerCurrentScore($currentScore, $userId, $categoryId);
$currentScore = Category::getCurrentScore(
$userId,
$categoryId,
$courseCode,
$sessionId,
true
);
Category::registerCurrentScore(
$currentScore,
$userId,
$categoryId
);
}
}
}
$finalItemTemplate = generateLPFinalItemTemplate($id, $courseCode, $sessionId, $downloadCertificateLink, $badgeLink);
$finalItemTemplate = generateLPFinalItemTemplate(
$id,
$courseCode,
$sessionId,
$downloadCertificateLink,
$badgeLink
);
if (!$finalItemTemplate) {
echo Display::return_message(get_lang('FileNotFound'), 'warning');
@ -162,8 +202,13 @@ $tpl->display_blank_template();
* @param string $badgeLink
* @return mixed|string
*/
function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId = 0, $downloadCertificateLink = '', $badgeLink = '')
{
function generateLPFinalItemTemplate(
$lpItemId,
$courseCode,
$sessionId = 0,
$downloadCertificateLink = '',
$badgeLink = ''
) {
$documentInfo = DocumentManager::get_document_data_by_id(
$lpItemId,
$courseCode,

@ -47,10 +47,9 @@ $debug = 0;
if ($debug) { error_log('------ Entering lp_impress.php -------'); }
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/impress/impress-demo.css');
$list = $_SESSION['oLP']->get_toc();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);

@ -112,7 +112,7 @@ Display::display_header(get_lang('Move'), 'Path');
$suredel = trim(get_lang('AreYouSureToDeleteJS'));
?>
<script type='text/javascript'>
<script>
/* <![CDATA[ */
function stripslashes(str) {
str=str.replace(/\\'/g,'\'');

@ -34,7 +34,6 @@ if ($myLP) {
$display_mode = $myLP->mode;
$scorm_css_header = true;
$lp_theme_css = $myLP->get_theme();
$my_style = api_get_visual_theme();
// Setting up the CSS theme if exists

@ -41,8 +41,7 @@ $sessionId = api_get_session_id();
// Check if the learning path is visible for student - (LP requisites)
if (!api_is_platform_admin()) {
if (
!api_is_allowed_to_edit(null, true, false, false) &&
if (!api_is_allowed_to_edit(null, true, false, false) &&
!learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())
) {
api_not_allowed(true);
@ -542,7 +541,6 @@ $template->assign('lp_title_scorm', $_SESSION['oLP']->name);
$template->assign('data_list', $_SESSION['oLP']->getListArrayToc($get_toc_list));
$template->assign('lp_id', $_SESSION['oLP']->lp_id);
$template->assign('lp_current_item_id', $_SESSION['oLP']->get_current_item_id());
$view = $template->get_template('learnpath/view.tpl');
$content = $template->fetch($view);

@ -56,8 +56,8 @@ $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
$isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']);
$learnpath_id = (int) $_REQUEST['lp_id'];
$isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']);
$learnpath_id = (int) $_REQUEST['lp_id'];
if ((!$is_allowed_to_edit) || $isStudentView) {
error_log('New LP - User not authorized in lp_view_item.php');

@ -16,7 +16,6 @@
*/
abstract class OpenofficeDocument extends learnpath
{
public $first_item = 0;
public $original_charset = 'utf-8';
public $original_locale = 'en_US.UTF-8';
@ -255,9 +254,7 @@ abstract class OpenofficeDocument extends learnpath
}
abstract function make_lp();
abstract function add_docs_to_visio();
abstract function add_command_parameters();
/**
@ -280,7 +277,6 @@ abstract class OpenofficeDocument extends learnpath
$permissionFile = api_get_permissions_for_new_files();
$permissionFolder = api_get_permissions_for_new_directories();
if (file_exists($this->base_work_dir.'/'.$this->created_dir)) {
return $ids;
}
@ -353,7 +349,6 @@ abstract class OpenofficeDocument extends learnpath
}
if (file_exists($this->base_work_dir.'/'.$this->created_dir)) {
// Register Files to Document tool
$ids[] = add_document(
$_course,

@ -14,6 +14,7 @@
* Defines the "OpenofficePresentation" child of class "OpenofficeDocument"
*/
require_once 'openoffice_document.class.php';
if (api_get_setting('search_enabled') == 'true') {
require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
@ -22,7 +23,6 @@ if (api_get_setting('search_enabled') == 'true') {
class OpenofficePresentation extends OpenofficeDocument
{
public $take_slide_name;
public function __construct($take_slide_name = false, $course_code = null, $resource_id = null, $user_id = null)
@ -125,7 +125,15 @@ class OpenofficePresentation extends OpenofficeDocument
$slide_name
);
api_item_property_update($_course, TOOL_THUMBNAIL, $document_id_thumb, 'DocumentAdded', api_get_user_id(), 0, 0);
api_item_property_update(
$_course,
TOOL_THUMBNAIL,
$document_id_thumb,
'DocumentAdded',
api_get_user_id(),
0,
0
);
// Create an html file.
$html_file = $file_name.'.html';
@ -183,7 +191,7 @@ class OpenofficePresentation extends OpenofficeDocument
if (isset($_POST['index_document']) && $_POST['index_document']) {
$di = new ChamiloIndexer();
isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english';
$di->connectDb(NULL, NULL, $lang);
$di->connectDb(null, null, $lang);
$ic_slide = new IndexableChunk();
$ic_slide->addValue('title', $slide_name);
$specific_fields = get_specific_field_list();

@ -22,10 +22,9 @@ if (api_get_setting('search_enabled') == 'true') {
/**
* @package chamilo.learnpath.OpenofficeDocument
*/
class OpenofficeText extends OpenofficeDocument {
class OpenofficeText extends OpenofficeDocument
{
public $split_steps;
/**
* Class constructor. Calls the parent class and initialises the local attribute split_steps
* @param boolean Whether to split steps (true) or make one large page (false)
@ -33,7 +32,12 @@ class OpenofficeText extends OpenofficeDocument {
* @param integer Resource ID
* @param integer Creator user id
*/
public function __construct($split_steps = false, $course_code = null, $resource_id = null, $user_id = null) {
public function __construct(
$split_steps = false,
$course_code = null,
$resource_id = null,
$user_id = null
) {
$this -> split_steps = $split_steps;
parent::__construct($course_code, $resource_id, $user_id);
}
@ -112,7 +116,6 @@ class OpenofficeText extends OpenofficeDocument {
// Empty the fake chapters.
$new_index = 0;
for ($i = 0; $i < count($matches_temp[0]); $i++) {
if (trim($matches_temp[1][$i]) !== '') {
$matches[0][$new_index] = $matches_temp[0][$i];
$matches[1][$new_index] = $matches_temp[1][$i];
@ -224,9 +227,7 @@ class OpenofficeText extends OpenofficeDocument {
);
$slide_name = '';
if ($document_id) {
// Put the document in item_property update.
api_item_property_update(
$_course,
@ -305,7 +306,8 @@ class OpenofficeText extends OpenofficeDocument {
* Returns additional Java command parameters
* @return string The additional parameters to be used in the Java call
*/
public function add_command_parameters() {
public function add_command_parameters()
{
return ' -d woogie "'.$this->base_work_dir.'/'.$this->file_path.'" "'.$this->base_work_dir.$this->created_dir.'/'.$this->file_name.'.html"';
}
@ -340,7 +342,6 @@ class OpenofficeText extends OpenofficeDocument {
$defined_width = preg_match("|width=([^\s]*)|i", $images[0][$key], $img_width);
$img_width = $img_width[1];
if (!$defined_width) {
list($img_width, $img_height, $type) = getimagesize($this->base_work_dir.$this->created_dir.'/'.$image);
$new_width = $max_width - 10;
@ -361,7 +362,7 @@ class OpenofficeText extends OpenofficeDocument {
/**
* Add documents to the visioconference (to be implemented)
*/
public function add_docs_to_visio() {
public function add_docs_to_visio()
{
}
}

@ -11,7 +11,7 @@
*/
class scormMetadata
{
public $lom = '';
public $lom = '';
public $schema = '';
public $schemaversion = '';
public $location = '';
@ -36,68 +36,66 @@ class scormMetadata
return false;
//break;
case 'manifest': // Do the same as the default.
$children = $element->childNodes;
$children = $element->childNodes;
foreach ($children as $child) {
switch ($child->nodeType) {
case XML_ELEMENT_NODE:
switch ($child->nodeType) {
case XML_ELEMENT_NODE:
// Could be 'lom', 'schema', 'schemaversion' or 'location'.
switch ($child->tagName) {
case 'lom':
$childchildren = $child->childNodes;
foreach ($childchildren as $childchild) {
$this->lom = $childchild->nodeValue;
}
break;
case 'schema':
$childchildren = $child->childNodes;
foreach ($childchildren as $childchild) {
// There is generally only one child here.
$this->schema = $childchild->nodeValue;
}
break;
case 'schemaversion':
$childchildren = $child->childNodes;
foreach ($childchildren as $childchild) {
// There is generally only one child here.
$this->schemaversion = $childchild->nodeValue;
}
break;
case 'location':
$childchildren = $child->childNodes;
foreach ($childchildren as $childchild) {
// There is generally only one child here.
$this->location = $childchild->nodeValue;
}
break;
}
break;
case XML_TEXT_NODE:
if (trim($child->textContent) != '') {
if (count($children == 1)) {
// If this is the only child at this level and it is a content... save differently.
$this->text = $child->textContent;
} else {
$this->text[$element->tagName] = $child->textContent;
}
}
break;
}
}
$attributes = $element->attributes;
//$keep_href = '';
if (is_array($attributes)) {
foreach ($attributes as $attrib) {
if (trim($attrib->value) != '') {
$this->attribs[$attrib->name] = $attrib->value;
}
}
}
switch ($child->tagName) {
case 'lom':
$childchildren = $child->childNodes;
foreach ($childchildren as $childchild) {
$this->lom = $childchild->nodeValue;
}
break;
case 'schema':
$childchildren = $child->childNodes;
foreach ($childchildren as $childchild) {
// There is generally only one child here.
$this->schema = $childchild->nodeValue;
}
break;
case 'schemaversion':
$childchildren = $child->childNodes;
foreach ($childchildren as $childchild) {
// There is generally only one child here.
$this->schemaversion = $childchild->nodeValue;
}
break;
case 'location':
$childchildren = $child->childNodes;
foreach ($childchildren as $childchild) {
// There is generally only one child here.
$this->location = $childchild->nodeValue;
}
break;
}
break;
case XML_TEXT_NODE:
if (trim($child->textContent) != '') {
if (count($children == 1)) {
// If this is the only child at this level and it is a content... save differently.
$this->text = $child->textContent;
} else {
$this->text[$element->tagName] = $child->textContent;
}
}
break;
}
}
$attributes = $element->attributes;
//$keep_href = '';
if (is_array($attributes)) {
foreach ($attributes as $attrib) {
if (trim($attrib->value) != '') {
$this->attribs[$attrib->name] = $attrib->value;
}
}
}
return true;
//break;
//break;
}
// End parsing using PHP5 DOMXML methods.
}
return false;
}

@ -27,7 +27,6 @@ class scormOrganization
public function __construct($type = 'manifest', &$element, $scorm_charset = 'UTF-8')
{
if (isset($element)) {
// Parsing using PHP5 DOMXML methods.
switch ($type) {
case 'db':
@ -38,44 +37,55 @@ class scormOrganization
//if ($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function.
$children = $element->childNodes;
foreach ($children as $child) {
switch ($child->nodeType) {
switch ($child->nodeType) {
case XML_ELEMENT_NODE:
switch ($child->tagName) {
case 'item':
$oItem = new scormItem('manifest', $child);
if ($oItem->identifier != '') {
$oItem = new scormItem(
'manifest',
$child
);
if ($oItem->identifier != '') {
$this->items[$oItem->identifier] = $oItem;
}
}
break;
case 'metadata':
$this->metadata = new scormMetadata('manifest', $child);
$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'));
$this->title = api_utf8_decode(
api_html_entity_decode(
$child->firstChild->nodeValue,
ENT_QUOTES,
'UTF-8'
)
);
}
break;
}
break;
case XML_TEXT_NODE:
break;
}
case XML_TEXT_NODE:
break;
}
}
if ($element->hasAttributes()) {
$attributes = $element->attributes;
//$keep_href = '';
foreach ($attributes as $attrib) {
switch ($attrib->name) {
case 'identifier':
$this->identifier = $attrib->value;
break;
case 'structure':
$this->structure = $attrib->value;
break;
}
}
$attributes = $element->attributes;
//$keep_href = '';
foreach ($attributes as $attrib) {
switch ($attrib->name) {
case 'identifier':
$this->identifier = $attrib->value;
break;
case 'structure':
$this->structure = $attrib->value;
break;
}
}
}
return true;

@ -34,9 +34,7 @@ class scormResource
public function __construct($type = 'manifest', &$element)
{
if (isset($element)) {
// Parsing using PHP5 DOMXML methods.
switch ($type) {
case 'db':
// TODO: Implement this way of metadata object creation.

Loading…
Cancel
Save