skala
cvargas 16 years ago
commit 587b851654
  1. 2
      main/course_description/edit.php
  2. 2
      main/dropbox/index.php
  3. 159
      main/inc/lib/text.lib.php
  4. 4
      main/newscorm/blank.php
  5. 4
      main/newscorm/learnpath.class.php
  6. 8
      main/newscorm/lp_content.php
  7. 28
      main/newscorm/lp_view.php
  8. 99
      main/newscorm/lp_view_item.php

@ -77,7 +77,7 @@ if ($description_type == THEMATIC_ADVANCE) {
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"'); $form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
// Set some default values // Set some default values
$default['title'] = Security::remove_XSS($description_title); $default['title'] = Security::remove_XSS($description_title);
$default['contentDescription'] = Security::remove_XSS($description_content,STUDENT); $default['contentDescription'] = Security::remove_XSS($description_content,COURSEMANAGERLOWSECURITY);
$default['description_type'] = $description_type; $default['description_type'] = $description_type;
$form->setDefaults($default); $form->setDefaults($default);

@ -580,7 +580,7 @@ if ($_GET['action'] != 'add') {
$receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma.
$dropbox_file_data[] = $receivers_celldata; $dropbox_file_data[] = $receivers_celldata;
$last_upload_date = api_get_local_time($dropbox_file->last_upload_date, 'Y-m-d H:i:s', null, date_default_timezone_get()); $last_upload_date = api_get_local_time($dropbox_file->last_upload_date, 'Y-m-d H:i:s', null, date_default_timezone_get());
$dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.api_get_local_time($last_upload_date).'</span>'; $dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.api_format_date_time_long($last_upload_date).'</span>';
//$dropbox_file_data[] = $dropbox_file->author; //$dropbox_file_data[] = $dropbox_file->author;
$receivers_celldata = ''; $receivers_celldata = '';

@ -1,19 +1,14 @@
<?php // $Id: text.lib.php 20709 2009-05-15 19:12:37Z ivantcholakov $ <?php
/* For licensing terms, see /dokeos_license.txt */ /* For licensing terms, see /license.txt */
/** /**
============================================================================== * This is the text library for Chamilo.
* This is the text library for Dokeos.
* Include/require it in your code to use its functionality. * Include/require it in your code to use its functionality.
* *
* @package dokeos.library * @package chamilo.library
==============================================================================
*/ */
/* /* FUNCTIONS */
==============================================================================
FUNCTIONS
==============================================================================
*/
/** /**
* function make_clickable($string) * function make_clickable($string)
@ -39,66 +34,32 @@
* have it require something like xxxx@yyyy.zzzz or such. We'll see. * have it require something like xxxx@yyyy.zzzz or such. We'll see.
*/ */
function make_clickable($string) function make_clickable($string) {
{ // TODO: eregi_replace() is deprecated as of PHP 5.3
if(!stristr($string,' src=') && !stristr($string,' href=')) if (!stristr($string, ' src=') && !stristr($string, ' href=')) {
{
$string = eregi_replace("(https?|ftp)://([a-z0-9#?/&=._+:~%-]+)", "<a href=\"\\1://\\2\" target=\"_blank\">\\1://\\2</a>", $string); $string = eregi_replace("(https?|ftp)://([a-z0-9#?/&=._+:~%-]+)", "<a href=\"\\1://\\2\" target=\"_blank\">\\1://\\2</a>", $string);
$string = eregi_replace("([a-z0-9_.-]+@[a-z0-9.-]+)", "<a href=\"mailto:\\1\">\\1</a>", $string); $string = eregi_replace("([a-z0-9_.-]+@[a-z0-9.-]+)", "<a href=\"mailto:\\1\">\\1</a>", $string);
} }
return $string; return $string;
} }
/** /**
* formats the date according to the locale settings * Formats the date according to the locale settings
* *
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @author Christophe Gesch<EFBFBD> <gesche@ipm.ucl.ac.be> * @author Christophe Gesché <gesche@ipm.ucl.ac.be>
* originally inspired from from PhpMyAdmin * originally inspired from from PhpMyAdmin
* @param string $date_format date pattern * @param string $date_format date pattern
* @param integer $time_stamp, default is NOW. * @param integer $time_stamp, default is NOW.
* @return the formatted date * @return the formatted date
*/ */
function format_locale_date($date_format, $time_stamp = -1, $language = null) function format_locale_date($date_format, $time_stamp = -1, $language = null) {
{
/*
static $initialized = false;
static $days_short, $days_long, $months_short, $months_long;
if (!$initialized)
{
// Defining the shorts for the days
$days_short = array (get_lang("SundayShort"), get_lang("MondayShort"), get_lang("TuesdayShort"), get_lang("WednesdayShort"), get_lang("ThursdayShort"), get_lang("FridayShort"), get_lang("SaturdayShort"));
// Defining the days of the week to allow translation of the days
$days_long = array (get_lang("SundayLong"), get_lang("MondayLong"), get_lang("TuesdayLong"), get_lang("WednesdayLong"), get_lang("ThursdayLong"), get_lang("FridayLong"), get_lang("SaturdayLong"));
// Defining the shorts for the months
$months_short = array (get_lang("JanuaryShort"), get_lang("FebruaryShort"), get_lang("MarchShort"), get_lang("AprilShort"), get_lang("MayShort"), get_lang("JuneShort"), get_lang("JulyShort"), get_lang("AugustShort"), get_lang("SeptemberShort"), get_lang("OctoberShort"), get_lang("NovemberShort"), get_lang("DecemberShort"));
// Defining the months of the year to allow translation of the months
$months_long = array (get_lang("JanuaryLong"), get_lang("FebruaryLong"), get_lang("MarchLong"), get_lang("AprilLong"), get_lang("MayLong"), get_lang("JuneLong"), get_lang("JulyLong"), get_lang("AugustLong"), get_lang("SeptemberLong"), get_lang("OctoberLong"), get_lang("NovemberLong"), get_lang("DecemberLong"));
$initialized = true;
}
if ($time_stamp == -1) $time_stamp = time();
// with the ereg we replace %aAbB of date format
//(they can be done by the system when locale date aren't aivailable
$date = ereg_replace('%[A]', $days_long[(int)strftime('%w', $time_stamp)], $date_format);
$date = ereg_replace('%[a]', $days_short[(int)strftime('%w', $time_stamp)], $date);
$date = ereg_replace('%[B]', $months_long[(int)strftime('%m', $time_stamp)-1], $date);
$date = ereg_replace('%[b]', $months_short[(int)strftime('%m', $time_stamp)-1], $date);
return strftime($date, $time_stamp);
*/
return api_format_date($date_format, $time_stamp, $language); return api_format_date($date_format, $time_stamp, $language);
} // end function format_locale_date }
/** /**
* @desc this function does some parsing on the text that gets inputted. This parsing can be of any kind * @desc This function does some parsing on the text that gets inputted. This parsing can be of any kind
* LaTeX notation, Word Censoring, Glossary Terminology (extension will available soon), Musical Notations, ... * LaTeX notation, Word Censoring, Glossary Terminology (extension will available soon), Musical Notations, ...
* The inspiration for this filter function came from Moodle an phpBB who both use a similar approach * The inspiration for this filter function came from Moodle an phpBB who both use a similar approach
* @param $input string. some text * @param $input string. some text
@ -107,24 +68,20 @@ function format_locale_date($date_format, $time_stamp = -1, $language = null)
* @author Patrick Cool <patrick.cool@UGent.be> * @author Patrick Cool <patrick.cool@UGent.be>
* @version March 2OO6 * @version March 2OO6
*/ */
function text_filter($input, $filter=true) function text_filter($input, $filter = true) {
{
//$input = stripslashes($input); //$input = stripslashes($input);
if ($filter==true) if ($filter) {
{
// *** parse [tex]...[/tex] tags *** // // *** parse [tex]...[/tex] tags *** //
// which will return techexplorer or image html depending on the capabilities of the // which will return techexplorer or image html depending on the capabilities of the
// browser of the user (using some javascript that checks if the browser has the TechExplorer plugin installed or not) // browser of the user (using some javascript that checks if the browser has the TechExplorer plugin installed or not)
$input = _text_parse_tex($input); $input = _text_parse_tex($input);
// *** parse [teximage]...[/teximage] tags *** // // *** parse [teximage]...[/teximage] tags *** //
// these force the gif rendering of LaTeX using the mimetex gif renderer // these force the gif rendering of LaTeX using the mimetex gif renderer
//$input=_text_parse_tex_image($input); //$input=_text_parse_tex_image($input);
// *** parse [texexplorer]...[/texexplorer] tags *** // // *** parse [texexplorer]...[/texexplorer] tags *** //
// these force the texeplorer LaTeX notation // these force the texeplorer LaTeX notation
$input = _text_parse_texexplorer($input); $input = _text_parse_texexplorer($input);
@ -135,7 +92,7 @@ function text_filter($input, $filter=true)
// $input=text_censor_words($input); // $input=text_censor_words($input);
// *** parse [?]...[/?] tags *** // // *** parse [?]...[/?] tags *** //
// for the glossary tool (see http://www.dokeos.com/extensions) // for the glossary tool
$input = _text_parse_glossary($input); $input = _text_parse_glossary($input);
// parse [wiki]...[/wiki] tags // parse [wiki]...[/wiki] tags
@ -156,9 +113,8 @@ function text_filter($input, $filter=true)
return $input; return $input;
} }
/** /**
* Apply parsing to content to parse tex commandos that are seperated by [tex] * Applies parsing for tex commandos that are seperated by [tex]
* [/tex] to make it readable for techexplorer plugin. * [/tex] to make it readable for techexplorer plugin.
* This function should not be accessed directly but should be accesse through the text_filter function * This function should not be accessed directly but should be accesse through the text_filter function
* @param string $text The text to parse * @param string $text The text to parse
@ -166,18 +122,14 @@ function text_filter($input, $filter=true)
* @author Patrick Cool <patrick.cool@UGent.be> * @author Patrick Cool <patrick.cool@UGent.be>
* @version June 2004 * @version June 2004
*/ */
function _text_parse_tex($textext) function _text_parse_tex($textext) {
{
//$textext = str_replace(array ("[tex]", "[/tex]"), array ('[*****]', '[/*****]'), $textext); //$textext = str_replace(array ("[tex]", "[/tex]"), array ('[*****]', '[/*****]'), $textext);
//$textext=stripslashes($texttext); //$textext=stripslashes($texttext);
$input_array = preg_split("/(\[tex]|\[\/tex])/", $textext, -1, PREG_SPLIT_DELIM_CAPTURE); $input_array = preg_split("/(\[tex]|\[\/tex])/", $textext, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($input_array as $key => $value) {
foreach ($input_array as $key=>$value) if ($key > 0 && $input_array[$key - 1] == '[tex]' AND $input_array[$key + 1] == '[/tex]') {
{
if ($key>0 && $input_array[$key-1]=='[tex]' AND $input_array[$key+1]=='[/tex]')
{
$input_array[$key] = latex_gif_renderer($value); $input_array[$key] = latex_gif_renderer($value);
unset($input_array[$key - 1]); unset($input_array[$key - 1]);
unset($input_array[$key + 1]); unset($input_array[$key + 1]);
@ -188,8 +140,9 @@ function _text_parse_tex($textext)
$output=implode('',$input_array); $output=implode('',$input_array);
return $output; return $output;
} }
/** /**
* Apply parsing to content to parse tex commandos that are seperated by [tex] * Applies parsing for tex commandos that are seperated by [tex]
* [/tex] to make it readable for techexplorer plugin. * [/tex] to make it readable for techexplorer plugin.
* This function should not be accessed directly but should be accesse through the text_filter function * This function should not be accessed directly but should be accesse through the text_filter function
* @param string $text The text to parse * @param string $text The text to parse
@ -197,25 +150,21 @@ function _text_parse_tex($textext)
* @author Patrick Cool <patrick.cool@UGent.be> * @author Patrick Cool <patrick.cool@UGent.be>
* @version June 2004 * @version June 2004
*/ */
function _text_parse_texexplorer($textext) function _text_parse_texexplorer($textext) {
{ if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE'))
{
$textext = str_replace(array("[texexplorer]", "[/texexplorer]"), array("<object classid=\"clsid:5AFAB315-AD87-11D3-98BB-002035EFB1A4\"><param name=\"autosize\" value=\"true\" /><param name=\"DataType\" value=\"0\" /><param name=\"Data\" value=\"", "\" /></object>"), $textext); $textext = str_replace(array("[texexplorer]", "[/texexplorer]"), array("<object classid=\"clsid:5AFAB315-AD87-11D3-98BB-002035EFB1A4\"><param name=\"autosize\" value=\"true\" /><param name=\"DataType\" value=\"0\" /><param name=\"Data\" value=\"", "\" /></object>"), $textext);
} } else {
else
{
$textext = str_replace(array("[texexplorer]", "[/texexplorer]"), array("<embed type=\"application/x-techexplorer\" texdata=\"", "\" autosize=\"true\" pluginspage=\"http://www.integretechpub.com/techexplorer/\">"), $textext); $textext = str_replace(array("[texexplorer]", "[/texexplorer]"), array("<embed type=\"application/x-techexplorer\" texdata=\"", "\" autosize=\"true\" pluginspage=\"http://www.integretechpub.com/techexplorer/\">"), $textext);
} }
return $textext; return $textext;
} }
/** /**
* This function should not be accessed directly but should be accesse through the text_filter function * This function should not be accessed directly but should be accesse through the text_filter function
* @author Patrick Cool <patrick.cool@UGent.be> * @author Patrick Cool <patrick.cool@UGent.be>
*/ */
function _text_parse_glossary($input) function _text_parse_glossary($input) {
{
return $input; return $input;
} }
@ -224,8 +173,7 @@ function _text_parse_glossary($input)
* This function should not be accessed directly but should be accesse through the text_filter function * This function should not be accessed directly but should be accesse through the text_filter function
* @author Patrick Cool <patrick.cool@UGent.be> * @author Patrick Cool <patrick.cool@UGent.be>
*/ */
function _text_parse_tool($input) function _text_parse_tool($input) {
{
// an array with all the valid tools // an array with all the valid tools
$tools[] = array(TOOL_ANNOUNCEMENT, 'announcements/announcements.php'); $tools[] = array(TOOL_ANNOUNCEMENT, 'announcements/announcements.php');
$tools[] = array(TOOL_CALENDAR_EVENT, 'calendar/agenda.php'); $tools[] = array(TOOL_CALENDAR_EVENT, 'calendar/agenda.php');
@ -233,15 +181,11 @@ function _text_parse_tool($input)
// check if the name between the [tool] [/tool] tags is a valid one // check if the name between the [tool] [/tool] tags is a valid one
} }
/** /**
* render LaTeX code into a gif or retrieve a cached version of the gif * render LaTeX code into a gif or retrieve a cached version of the gif
* @author Patrick Cool <patrick.cool@UGent.be> Ghent University * @author Patrick Cool <patrick.cool@UGent.be> Ghent University
*/ */
function latex_gif_renderer($latex_code) function latex_gif_renderer($latex_code) {
{
global $_course; global $_course;
// setting the paths and filenames // setting the paths and filenames
@ -249,21 +193,17 @@ function latex_gif_renderer($latex_code)
$temp_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/temp/'; $temp_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/temp/';
$latex_filename = md5($latex_code).'.gif'; $latex_filename = md5($latex_code).'.gif';
if(!file_exists($temp_path.$latex_filename) OR isset($_GET['render'])) if (!file_exists($temp_path.$latex_filename) OR isset($_GET['render'])) {
{ if ((PHP_OS == "WINNT") || (PHP_OS == "WIN32") || (PHP_OS == "Windows")) {
if ((PHP_OS == "WINNT") || (PHP_OS == "WIN32") || (PHP_OS == "Windows"))
{
$mimetex_command = $mimetex_path.'mimetex.exe -e "'.$temp_path.md5($latex_code).'.gif" '.escapeshellarg($latex_code).''; $mimetex_command = $mimetex_path.'mimetex.exe -e "'.$temp_path.md5($latex_code).'.gif" '.escapeshellarg($latex_code).'';
} } else {
else
{
$mimetex_command = $mimetex_path.'mimetex.linux -e "'.$temp_path.md5($latex_code).'.gif" '.escapeshellarg($latex_code); $mimetex_command = $mimetex_path.'mimetex.linux -e "'.$temp_path.md5($latex_code).'.gif" '.escapeshellarg($latex_code);
} }
exec($mimetex_command); exec($mimetex_command);
//echo 'volgende shell commando werd uitgevoerd:<br /><pre>'.$mimetex_command.'</pre><hr>'; //echo 'volgende shell commando werd uitgevoerd:<br /><pre>'.$mimetex_command.'</pre><hr>';
} }
$return = "<a href=\"\" onclick=\"newWindow=window.open('".api_get_path(WEB_CODE_PATH)."inc/latex.php?code=".urlencode($latex_code)."&amp;filename=$latex_filename','latexCode','toolbar=no,location=no,scrollbars=yes,resizable=yes,status=yes,width=375,height=250,left=200,top=100');\">"; $return = "<a href=\"\" onclick=\"javascript: newWindow=window.open('".api_get_path(WEB_CODE_PATH)."inc/latex.php?code=".urlencode($latex_code)."&amp;filename=$latex_filename','latexCode','toolbar=no,location=no,scrollbars=yes,resizable=yes,status=yes,width=375,height=250,left=200,top=100');\">";
$return .= '<img src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/temp/'.$latex_filename.'" alt="'.$latex_code.'" border="0" /></a>'; $return .= '<img src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/temp/'.$latex_filename.'" alt="'.$latex_code.'" border="0" /></a>';
return $return; return $return;
} }
@ -279,8 +219,8 @@ function latex_gif_renderer($latex_code)
* @author Julio Montoya * @author Julio Montoya
*/ */
function date_to_str_ago($date) function date_to_str_ago($date) {
{
static $initialized = false; static $initialized = false;
static $today, $yesterday; static $today, $yesterday;
static $min_decade, $min_year, $min_month, $min_week, $min_day, $min_hour, $min_minute; static $min_decade, $min_year, $min_month, $min_week, $min_day, $min_hour, $min_minute;
@ -316,10 +256,10 @@ function date_to_str_ago($date)
$initialized = true; $initialized = true;
} }
$dst_date=strtotime($date); $dst_date = is_string($date) ? strtotime($date) : $date;
//for not call date several times // For avoiding calling date() several times
$date_array=date("s/i/G/j/n/Y",$dst_date); $date_array = date('s/i/G/j/n/Y', $dst_date);
$date_split=explode("/",$date_array); $date_split = explode('/', $date_array);
$dst_s = $date_split[0]; $dst_s = $date_split[0];
$dst_m = $date_split[1]; $dst_m = $date_split[1];
@ -329,9 +269,9 @@ function date_to_str_ago($date)
$dst_yr = $date_split[5]; $dst_yr = $date_split[5];
$dst_date = mktime($dst_h, $dst_m, $dst_s, $dst_mth, $dst_day, $dst_yr); $dst_date = mktime($dst_h, $dst_m, $dst_s, $dst_mth, $dst_day, $dst_yr);
$time=$offset = time()-$dst_date; //seconds between current days and today $time = $offset = time() - $dst_date; // Seconds between current days and today.
//------------ Here start the functions sec_to_str // Here start the functions sec_to_str()
$act_day = date('d'); $act_day = date('d');
$act_mth = date('n'); $act_mth = date('n');
$act_yr = date('Y'); $act_yr = date('Y');
@ -390,6 +330,7 @@ function date_to_str_ago($date)
} }
return $str; return $str;
} }
/** /**
* This functions cuts a paragraph * This functions cuts a paragraph
* i.e cut('Merry Xmas from Lima',13) = "Merry Xmas fr..." * i.e cut('Merry Xmas from Lima',13) = "Merry Xmas fr..."
@ -398,17 +339,16 @@ function date_to_str_ago($date)
* @param bool Whether to embed in a <span title="...">...</span> * @param bool Whether to embed in a <span title="...">...</span>
* @return string * @return string
* */ * */
function cut($text,$maxchar,$embed=false) function cut($text, $maxchar, $embed = false) {
{
if (api_strlen($text) > $maxchar) { if (api_strlen($text) > $maxchar) {
if ($embed==true) { if ($embed) {
return '<span title="'.$text.'">'.api_substr($text, 0, $maxchar).'...</span>'; return '<span title="'.$text.'">'.api_substr($text, 0, $maxchar).'...</span>';
} }
return api_substr($text, 0, $maxchar).'...' ; return api_substr($text, 0, $maxchar).'...' ;
} else {
return $text;
} }
return $text;
} }
/** /**
* Show a number as only integers if no decimals, but will show 2 decimals if exist. * Show a number as only integers if no decimals, but will show 2 decimals if exist.
* *
@ -416,8 +356,7 @@ function cut($text,$maxchar,$embed=false)
* @param int decimal points 0=never, 1=if needed, 2=always * @param int decimal points 0=never, 1=if needed, 2=always
* @return mixed an integer or a float depends on the parameter * @return mixed an integer or a float depends on the parameter
*/ */
function float_format($number, $flag = 1) function float_format($number, $flag = 1) {
{
if (is_numeric($number)) { // a number if (is_numeric($number)) { // a number
if (!$number) { // zero if (!$number) { // zero
$result = ($flag == 2 ? '0.00' : '0'); // output zero $result = ($flag == 2 ? '0.00' : '0'); // output zero
@ -452,5 +391,3 @@ function get_last_week() {
} }
return $arrdays; return $arrdays;
} }
?>

@ -1,8 +1,8 @@
<?php //$id: $ <?php //$id: $
/* For licensing terms, see /chamilo_license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Script that displays a blank page (with later a message saying why) * Script that displays a blank page (with later a message saying why)
* @package dokeos.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */

@ -1,5 +1,5 @@
<?php <?php
/* For licensing terms, see /dokeos_license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This (abstract?) class defines the parent attributes and methods for the dokeos learnpaths and scorm * This (abstract?) class defines the parent attributes and methods for the dokeos learnpaths and scorm
@ -10,7 +10,7 @@
*/ */
/** /**
* Defines the learnpath parent class * Defines the learnpath parent class
* @package dokeos.learnpath * @package chamilo.learnpath
*/ */
class learnpath { class learnpath {

@ -1,12 +1,10 @@
<?php //$id: $ <?php
/* For licensing terms, see /license.txt */
/** /**
* Script that displays an error message when no content could be loaded * Script that displays an error message when no content could be loaded
* @package dokeos.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
/**
* Nothing very interesting
*/
// including the global file // including the global file
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';

@ -1,32 +1,28 @@
<?php // $Id: lp_view.php,v 1.33 2006/09/12 10:20:46 yannoo Exp $ <?php
/* For licensing terms, see /license.txt */
/** /**
============================================================================== * This file was originally the copy of document.php, but many modifications happened since then ;
* This file was origially the copy of document.php, but many modifications happened since then ;
* the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory * the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory
* will be automatically created for it, and the files will be uncompressed there for example ; * will be automatically created for it, and the files will be uncompressed there for example ;
* *
* @package dokeos.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> - redesign * @author Yannick Warnier <ywarnier@beeznest.org> - redesign
* @author Denes Nagy, principal author * @author Denes Nagy, principal author
* @author Isthvan Mandak, several new features * @author Isthvan Mandak, several new features
* @author Roan Embrechts, code improvements and refactoring * @author Roan Embrechts, code improvements and refactoring
* @license GNU/GPL - See Dokeos license directory for details * @license GNU/GPL - See Dokeos license directory for details
==============================================================================
*/ */
/** /**
* Script * Script
*/ */
/* /* INIT SECTION */
==============================================================================
INIT SECTION
==============================================================================
*/
$_SESSION['whereami'] = 'lp/view'; $_SESSION['whereami'] = 'lp/view';
$this_section=SECTION_COURSES; $this_section=SECTION_COURSES;
if($lp_controller_touched!=1){ if($lp_controller_touched!=1){
header('location: lp_controller.php?action=view&item_id='.$_REQUEST['item_id']); header('location: lp_controller.php?action=view&item_id='.$_REQUEST['item_id']);
exit;
} }
/* /*
@ -61,11 +57,8 @@ $user_id = api_get_user_id();
$platform_theme = api_get_setting('stylesheets'); // plataform's css $platform_theme = api_get_setting('stylesheets'); // plataform's css
$my_style=$platform_theme; $my_style=$platform_theme;
//escape external variables //escape external variables
/*
----------------------------------------------------------- /* Header */
Header
-----------------------------------------------------------
*/
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) { if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) {
@ -117,6 +110,11 @@ if (!isset($src)) {
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id); $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if($prereq_check === true){ if($prereq_check === true){
$src = $_SESSION['oLP']->get_link('http',$lp_item_id); $src = $_SESSION['oLP']->get_link('http',$lp_item_id);
//Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP
$file_info = pathinfo($src);
if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) {
$src = 'lp_view_item.php?src='.$src;
}
$_SESSION['oLP']->start_current_item(); //starts time counter manually if asset $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset
} else { } else {
$src = 'blank.php?error=prerequisites'; $src = 'blank.php?error=prerequisites';

@ -1,48 +1,38 @@
<?php <?php
/* /* For licensing terms, see /license.txt */
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Patrick Cool
Copyright (c) Denes Nagy
Copyright (c) Yannick Warnier
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/** /**
==============================================================================
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php * This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php
* *
* @author Patrick Cool * @author Patrick Cool
* @author Denes Nagy * @author Denes Nagy
* @author Roan Embrechts, refactoring and code cleaning * @author Roan Embrechts, refactoring and code cleaning
* @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool * @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
* @package dokeos.learnpath * @package chamilo.learnpath
==============================================================================
*/ */
/* //Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP
============================================================================== if(isset($_GET['src'])) {
INIT SECTION // including the global file
============================================================================== require_once '../inc/global.inc.php';
*/ api_protect_course_script();
//get parameter only came from lp_view.php
$url_info = parse_url($_GET['src']);
$real_url_info = parse_url(api_get_path(WEB_PATH));
//the host must be the same
if ($url_info['host'] == $real_url_info['host']) {
header("Location: ".urldecode(Security::remove_XSS($_GET['src'])));
exit;
} else {
header("Location: blank.php?error=document_not_found");
exit;
}
}
/* INIT SECTION */
$_SESSION['whereami'] = 'lp/build'; $_SESSION['whereami'] = 'lp/build';
if(isset($_SESSION['oLP']) && isset($_GET['id'])) if(isset($_SESSION['oLP']) && isset($_GET['id'])) {
{
$_SESSION['oLP'] -> current = intval($_GET['id']); $_SESSION['oLP'] -> current = intval($_GET['id']);
} }
$this_section=SECTION_COURSES; $this_section=SECTION_COURSES;
@ -50,30 +40,21 @@ $this_section=SECTION_COURSES;
api_protect_course_script(); api_protect_course_script();
/* /*
-----------------------------------------------------------
Libraries Libraries
-----------------------------------------------------------
*/ */
//the main_api.lib.php, database.lib.php and display.lib.php //the main_api.lib.php, database.lib.php and display.lib.php
//libraries are included by default //libraries are included by default
include('learnpath_functions.inc.php'); require_once 'learnpath_functions.inc.php';
//include('../resourcelinker/resourcelinker.inc.php'); //include('../resourcelinker/resourcelinker.inc.php');
include('resourcelinker.inc.php'); require_once 'resourcelinker.inc.php';
//rewrite the language file, sadly overwritten by resourcelinker.inc.php //rewrite the language file, sadly overwritten by resourcelinker.inc.php
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = "learnpath"; $language_file = "learnpath";
/*
----------------------------------------------------------- /* Header and action code */
Header and action code /* 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);
@ -96,9 +77,7 @@ $prereq = $_REQUEST['prereq'];
$type = $_REQUEST['type']; $type = $_REQUEST['type'];
*/ */
/* /*
==============================================================================
MAIN CODE MAIN CODE
==============================================================================
*/ */
// using the resource linker as a tool for adding resources to the learning path // using the resource linker as a tool for adding resources to the learning path
if ($action=="add" and $type=="learnpathitem") if ($action=="add" and $type=="learnpathitem")
@ -123,15 +102,11 @@ $therow=Database::fetch_array($result);
- all the functions not available for students - always available in this case (page only shown to admin) - all the functions not available for students - always available in this case (page only shown to admin)
----------------------------------------------------------- -----------------------------------------------------------
*/ */
/*================================================== /* SHOWING THE ADMIN TOOLS */
SHOWING THE ADMIN TOOLS
==================================================*/
/*================================================== /* prerequisites setting end */
prerequisites setting end
==================================================*/
if (isset($_SESSION['gradebook'])){ if (isset($_SESSION['gradebook'])){
$gradebook= $_SESSION['gradebook']; $gradebook= $_SESSION['gradebook'];
} }
@ -179,11 +154,7 @@ function confirmation(name) {
//echo $admin_output; //echo $admin_output;
/* /* DISPLAY SECTION */
-----------------------------------------------------------
DISPLAY SECTION
-----------------------------------------------------------
*/
echo $_SESSION['oLP']->build_action_menu(); echo $_SESSION['oLP']->build_action_menu();
echo '<table cellpadding="0" cellspacing="0" class="lp_build">'; echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
@ -200,10 +171,6 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
/* /* FOOTER */
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer(); Display::display_footer();
?> ?>
Loading…
Cancel
Save