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

@ -10,7 +10,6 @@
*/ */
// 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_anonymous = true; $use_anonymous = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
@ -66,7 +65,6 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
$mymax = "''"; $mymax = "''";
} }
$mymin = $mylpi->get_min(); $mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status(); $mylesson_status = $mylpi->get_status();
$mytotal_time = $mylpi->get_scorm_time('js', null, true); $mytotal_time = $mylpi->get_scorm_time('js', null, true);
$mymastery_score = $mylpi->get_mastery_score(); $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); $myistring = substr($myistring, 1);
} }
// Obtention des donnees d'objectifs // Obtention des donnees d'objectifs
$mycoursedb = Database::get_course_table(TABLE_LP_IV_OBJECTIVE); $mycoursedb = Database::get_course_table(TABLE_LP_IV_OBJECTIVE);
$course_id = api_get_course_int_id(); $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(); $phpobjectives = array();
if (!empty($mylp_iv_id)) { if (!empty($mylp_iv_id)) {
$sql = "SELECT objective_id, status, score_raw, score_max, score_min $sql = "SELECT objective_id, status, score_raw, score_max, score_min
FROM $mycoursedb FROM $mycoursedb
@ -101,7 +97,7 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
$phpobjectives[] = $row; $phpobjectives[] = $row;
} }
} }
$myobjectives = json_encode($phpobjectives); $myobjectives = json_encode($phpobjectives);
$return .= $return .=
"olms.score=".$myscore.";". "olms.score=".$myscore.";".
@ -172,4 +168,10 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
return $return; 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 <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script contains the server part of the xajax interaction process. The client part is located * This script contains the server part of the xajax interaction process.
* in lp_api.php or other api's. * 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 is a first attempt at using xajax and AJAX in general,
* so the code might be a bit unsettling.
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @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); $mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id);
$mylpi = & $mylp->items[$item_id]; $mylpi = & $mylp->items[$item_id];
if (is_array($objectives) && count($objectives) > 0) { if (is_array($objectives) && count($objectives) > 0) {
foreach ($objectives as $index=>$objective) { foreach ($objectives as $index => $objective) {
$mylpi->add_objective($index, $objectives[$index]); $mylpi->add_objective($index, $objectives[$index]);
} }
$mylpi->write_objectives_to_db(); $mylpi->write_objectives_to_db();

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

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

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

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

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

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

@ -47,10 +47,9 @@ $debug = 0;
if ($debug) { error_log('------ Entering lp_impress.php -------'); } if ($debug) { error_log('------ Entering lp_impress.php -------'); }
$course_code = api_get_course_id(); $course_code = api_get_course_id();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/impress/impress-demo.css'); $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/impress/impress-demo.css');
$list = $_SESSION['oLP']->get_toc(); $list = $_SESSION['oLP']->get_toc();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false); $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')); $suredel = trim(get_lang('AreYouSureToDeleteJS'));
?> ?>
<script type='text/javascript'> <script>
/* <![CDATA[ */ /* <![CDATA[ */
function stripslashes(str) { function stripslashes(str) {
str=str.replace(/\\'/g,'\''); str=str.replace(/\\'/g,'\'');

@ -34,7 +34,6 @@ if ($myLP) {
$display_mode = $myLP->mode; $display_mode = $myLP->mode;
$scorm_css_header = true; $scorm_css_header = true;
$lp_theme_css = $myLP->get_theme(); $lp_theme_css = $myLP->get_theme();
$my_style = api_get_visual_theme(); $my_style = api_get_visual_theme();
// Setting up the CSS theme if exists // 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) // Check if the learning path is visible for student - (LP requisites)
if (!api_is_platform_admin()) { if (!api_is_platform_admin()) {
if ( if (!api_is_allowed_to_edit(null, true, false, false) &&
!api_is_allowed_to_edit(null, true, false, false) &&
!learnpath::is_lp_visible_for_student($lp_id, api_get_user_id()) !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())
) { ) {
api_not_allowed(true); 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('data_list', $_SESSION['oLP']->getListArrayToc($get_toc_list));
$template->assign('lp_id', $_SESSION['oLP']->lp_id); $template->assign('lp_id', $_SESSION['oLP']->lp_id);
$template->assign('lp_current_item_id', $_SESSION['oLP']->get_current_item_id()); $template->assign('lp_current_item_id', $_SESSION['oLP']->get_current_item_id());
$view = $template->get_template('learnpath/view.tpl'); $view = $template->get_template('learnpath/view.tpl');
$content = $template->fetch($view); $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_item = Database::get_course_table(TABLE_LP_ITEM);
$tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW); $tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
$isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']); $isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']);
$learnpath_id = (int) $_REQUEST['lp_id']; $learnpath_id = (int) $_REQUEST['lp_id'];
if ((!$is_allowed_to_edit) || $isStudentView) { if ((!$is_allowed_to_edit) || $isStudentView) {
error_log('New LP - User not authorized in lp_view_item.php'); error_log('New LP - User not authorized in lp_view_item.php');

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

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

@ -22,10 +22,9 @@ if (api_get_setting('search_enabled') == 'true') {
/** /**
* @package chamilo.learnpath.OpenofficeDocument * @package chamilo.learnpath.OpenofficeDocument
*/ */
class OpenofficeText extends OpenofficeDocument { class OpenofficeText extends OpenofficeDocument
{
public $split_steps; public $split_steps;
/** /**
* Class constructor. Calls the parent class and initialises the local attribute 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) * @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 Resource ID
* @param integer Creator user 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; $this -> split_steps = $split_steps;
parent::__construct($course_code, $resource_id, $user_id); parent::__construct($course_code, $resource_id, $user_id);
} }
@ -112,7 +116,6 @@ class OpenofficeText extends OpenofficeDocument {
// Empty the fake chapters. // Empty the fake chapters.
$new_index = 0; $new_index = 0;
for ($i = 0; $i < count($matches_temp[0]); $i++) { for ($i = 0; $i < count($matches_temp[0]); $i++) {
if (trim($matches_temp[1][$i]) !== '') { if (trim($matches_temp[1][$i]) !== '') {
$matches[0][$new_index] = $matches_temp[0][$i]; $matches[0][$new_index] = $matches_temp[0][$i];
$matches[1][$new_index] = $matches_temp[1][$i]; $matches[1][$new_index] = $matches_temp[1][$i];
@ -224,9 +227,7 @@ class OpenofficeText extends OpenofficeDocument {
); );
$slide_name = ''; $slide_name = '';
if ($document_id) { if ($document_id) {
// Put the document in item_property update. // Put the document in item_property update.
api_item_property_update( api_item_property_update(
$_course, $_course,
@ -305,7 +306,8 @@ class OpenofficeText extends OpenofficeDocument {
* Returns additional Java command parameters * Returns additional Java command parameters
* @return string The additional parameters to be used in the Java call * @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"'; 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); $defined_width = preg_match("|width=([^\s]*)|i", $images[0][$key], $img_width);
$img_width = $img_width[1]; $img_width = $img_width[1];
if (!$defined_width) { if (!$defined_width) {
list($img_width, $img_height, $type) = getimagesize($this->base_work_dir.$this->created_dir.'/'.$image); list($img_width, $img_height, $type) = getimagesize($this->base_work_dir.$this->created_dir.'/'.$image);
$new_width = $max_width - 10; $new_width = $max_width - 10;
@ -361,7 +362,7 @@ class OpenofficeText extends OpenofficeDocument {
/** /**
* Add documents to the visioconference (to be implemented) * 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 class scormMetadata
{ {
public $lom = ''; public $lom = '';
public $schema = ''; public $schema = '';
public $schemaversion = ''; public $schemaversion = '';
public $location = ''; public $location = '';
@ -36,68 +36,66 @@ class scormMetadata
return false; return false;
//break; //break;
case 'manifest': // Do the same as the default. case 'manifest': // Do the same as the default.
$children = $element->childNodes; $children = $element->childNodes;
foreach ($children as $child) { foreach ($children as $child) {
switch ($child->nodeType) { switch ($child->nodeType) {
case XML_ELEMENT_NODE: case XML_ELEMENT_NODE:
// Could be 'lom', 'schema', 'schemaversion' or 'location'. // Could be 'lom', 'schema', 'schemaversion' or 'location'.
switch ($child->tagName) { switch ($child->tagName) {
case 'lom': case 'lom':
$childchildren = $child->childNodes; $childchildren = $child->childNodes;
foreach ($childchildren as $childchild) { foreach ($childchildren as $childchild) {
$this->lom = $childchild->nodeValue; $this->lom = $childchild->nodeValue;
} }
break; break;
case 'schema': case 'schema':
$childchildren = $child->childNodes; $childchildren = $child->childNodes;
foreach ($childchildren as $childchild) { foreach ($childchildren as $childchild) {
// There is generally only one child here. // There is generally only one child here.
$this->schema = $childchild->nodeValue; $this->schema = $childchild->nodeValue;
} }
break; break;
case 'schemaversion': case 'schemaversion':
$childchildren = $child->childNodes; $childchildren = $child->childNodes;
foreach ($childchildren as $childchild) { foreach ($childchildren as $childchild) {
// There is generally only one child here. // There is generally only one child here.
$this->schemaversion = $childchild->nodeValue; $this->schemaversion = $childchild->nodeValue;
} }
break; break;
case 'location': case 'location':
$childchildren = $child->childNodes; $childchildren = $child->childNodes;
foreach ($childchildren as $childchild) { foreach ($childchildren as $childchild) {
// There is generally only one child here. // There is generally only one child here.
$this->location = $childchild->nodeValue; $this->location = $childchild->nodeValue;
} }
break; break;
} }
break; break;
case XML_TEXT_NODE: case XML_TEXT_NODE:
if (trim($child->textContent) != '') { if (trim($child->textContent) != '') {
if (count($children == 1)) { if (count($children == 1)) {
// If this is the only child at this level and it is a content... save differently. // If this is the only child at this level and it is a content... save differently.
$this->text = $child->textContent; $this->text = $child->textContent;
} else { } else {
$this->text[$element->tagName] = $child->textContent; $this->text[$element->tagName] = $child->textContent;
} }
} }
break; break;
} }
} }
$attributes = $element->attributes; $attributes = $element->attributes;
//$keep_href = ''; //$keep_href = '';
if (is_array($attributes)) { if (is_array($attributes)) {
foreach ($attributes as $attrib) { foreach ($attributes as $attrib) {
if (trim($attrib->value) != '') { if (trim($attrib->value) != '') {
$this->attribs[$attrib->name] = $attrib->value; $this->attribs[$attrib->name] = $attrib->value;
} }
} }
} }
return true; return true;
//break; //break;
} }
// End parsing using PHP5 DOMXML methods. // End parsing using PHP5 DOMXML methods.
} }
return false; return false;
} }

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

@ -34,9 +34,7 @@ class scormResource
public function __construct($type = 'manifest', &$element) public function __construct($type = 'manifest', &$element)
{ {
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.

Loading…
Cancel
Save