diff --git a/main/inc/lib/add_course.lib.inc.php b/main/inc/lib/add_course.lib.inc.php
index 06ab1d0e48..505bcd1d41 100755
--- a/main/inc/lib/add_course.lib.inc.php
+++ b/main/inc/lib/add_course.lib.inc.php
@@ -2177,6 +2177,8 @@ function fill_Db_course($course_db_name, $course_repository, $language, $default
Database::query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('display_info_advance_inside_homecourse',1,'thematic_advance')");
Database::query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_students_on_new_homework',0,'work')");
Database::query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('enable_lp_auto_launch',0,'learning_path')");
+ Database::query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('pdf_export_watermark_text','','learning_path')");
+
/* Course homepage tools for platform admin only */
/* Group tool */
diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php
index 258acbfe98..b772f46695 100755
--- a/main/inc/lib/document.lib.php
+++ b/main/inc/lib/document.lib.php
@@ -986,6 +986,27 @@ class DocumentManager {
}
return false;
}
+
+ /**
+ * Gets the document data with a given id
+ *
+ * @param array $_course
+ * @param string $path
+ * @return int id of document / false if no doc found
+ */
+ public static function get_document_data_by_id($id,$course_code) {
+ $course_info = api_get_course_info($course_code);
+ $TABLE_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT, $course_info['dbName']);
+ $id = intval($id);
+ $sql = "SELECT * FROM $TABLE_DOCUMENT WHERE id = $id";
+ $result = Database::query($sql);
+ if ($result && Database::num_rows($result) == 1) {
+ $row = Database::fetch_array($result,'ASSOC');
+ return $row;
+ }
+ return false;
+ }
+
/**
* Allow to set a specific document as a new template for FCKEditor for a particular user in a particular course
diff --git a/main/inc/lib/export.lib.inc.php b/main/inc/lib/export.lib.inc.php
index a93ad54fd5..78c823c7a2 100755
--- a/main/inc/lib/export.lib.inc.php
+++ b/main/inc/lib/export.lib.inc.php
@@ -1,7 +1,7 @@
]*?>.*?@si',
+ '@@siU'
+ );
+ //mPDF($codepage='win-1252',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P')
+ $pdf = new mPDF('UTF-8', 'A4', '', '', 30, 20, 27, 25, 16, 13, 'P');
+
+ // $pdf->SetBasePath($basehref);
+
+ $pdf->directionality = api_get_text_direction(); // TODO: To be read from the html document.
+ $pdf->useOnlyCoreFonts = true;
+ $pdf->mirrorMargins = 1; // Use different Odd/Even headers and footers and mirror margins
+
+ $pdf->defaultheaderfontsize = 10; // in pts
+ $pdf->defaultheaderfontstyle = BI; // blank, B, I, or BI
+ $pdf->defaultheaderline = 1; // 1 to include line below header/above footer
+
+
+ $my_header = self::get_header($course_code);
+ $pdf->SetHeader($my_header);// ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title);
+
+ $pdf->defaultfooterfontsize = 12; // in pts
+ $pdf->defaultfooterfontstyle = B; // blank, B, I, or BI
+ $pdf->defaultfooterline = 1; // 1 to include line below header/above footer
+
+ //@todo remove this and use a simpler way
+ $footer = array (
+ 'odd' => array (
+ 'L' => array (
+ 'content' => '',
+ 'font-size' => 10,
+ 'font-style' => 'B',
+ 'font-family' => 'serif',
+ 'color'=>'#000000'
+ ),
+ 'C' => array (
+ 'content' => '',
+ 'font-size' => 10,
+ 'font-style' => 'B',
+ 'font-family' => 'serif',
+ 'color'=>'#000000'
+ ),
+ 'R' => array (
+ 'content' => '{PAGENO}',
+ 'font-size' => 10,
+ 'font-style' => 'B',
+ 'font-family' => 'serif',
+ 'color'=>'#000000'
+ ),
+ 'line' => 1,
+ ),
+ 'even' => array (
+ 'L' => array (
+ 'content' => '',
+ 'font-size' => 10,
+ 'font-style' => 'B',
+ 'font-family' => 'serif',
+ 'color'=>'#000000'
+ ),
+ 'C' => array (
+ 'content' => '',
+ 'font-size' => 10,
+ 'font-style' => 'B',
+ 'font-family' => 'serif',
+ 'color'=>'#000000'
+ ),
+ 'R' => array (
+ 'content' => '{PAGENO}',
+ 'font-size' => 10,
+ 'font-style' => 'B',
+ 'font-family' => 'serif',
+ 'color'=>'#000000'
+ ),
+ 'line' => 1,
+ ),
+ );
+
+ $pdf->SetFooter($footer); // defines footer for Odd and Even Pages - placed at Outer margin http://mpdf1.com/manual/index.php?tid=151&searchstring=setfooter
+
+ if (api_get_setting('pdf_export_watermark_enable') == 'true') {
+ $watermark_file = self::get_watermark($course_code);
+ if (!empty($watermark_file)) {
+ //http://mpdf1.com/manual/index.php?tid=269&searchstring=watermark
+ $pdf->SetWatermarkImage($watermark_file);
+ $pdf->showWatermarkImage = true;
+ }
+ }
+
+ /*$pdf->SetAuthor('Documents Chamilo');
+ $pdf->SetTitle('title');
+ $pdf->SetSubject('Exported from Chamilo Documents');
+ $pdf->SetKeywords('Chamilo Documents');
+ */
+ foreach ($html_file_array as $html_file) {
+ if (!file_exists($html_file)) {
+ continue;
+ }
+ $file_info = pathinfo($html_file);
+ $dirname = str_replace("\\", '/', $file_info['dirname']);
+ $filename = $file_info['basename'];
+ $filename =str_replace('_',' ',$filename);
+ $extension = $file_info['extension'];
+ if (!($extension == 'html' || $extension == 'htm')) {
+ return false;
+ }
+ if ($extension == 'html'){
+ $filename =basename($filename,'.html');
+ } elseif($extension == 'htm'){
+ $filename =basename($filename,'.htm');
+ }
+
+ $document_html = @file_get_contents($html_file);
+ $document_html = preg_replace($clean_search, '', $document_html);
+
+ //absolute path for frames.css //TODO: necessary?
+ $absolute_css_path=api_get_path(WEB_CODE_PATH).'css/'.api_get_setting('stylesheets').'/frames.css';
+ $document_html=str_replace('href="./css/frames.css"',$absolute_css_path, $document_html);
+
+ //$document_html=str_replace('','', $document_html);
+
+ $document_html= str_replace('../','',$document_html);
+ $document_path = api_get_path(WEB_COURSE_PATH).$course_data['path'].'/document/';
+
+ $doc = new DOMDocument();
+ $result = @$doc->loadHTML($document_html);
+
+ //Fixing only images @todo do the same thing with other elements
+ $elements = $doc->getElementsByTagName('img');
+ $replace_img_elements = array();
+ if (!empty($elements)) {
+ foreach($elements as $item) {
+ $old_src = $item->getAttribute('src');
+ //$old_src= str_replace('../','',$old_src);
+ if (strrpos('http', $old_src) === false) {
+ $document_html= str_replace($old_src, $document_path.$old_src, $document_html);
+ }
+ }
+ }
+
+ //replace relative path by absolute path for resources
+ //$document_html= str_replace('src="/chamilo/main/default_course_document/', 'temp_template_path', $document_html);// before save src templates not apply
+ //$document_html= str_replace('src="/', 'temp_template_path', $document_html);// before save src templates not apply
+ //$document_html= str_replace('src="/chamilo/main/default_course_document/', 'temp_template_path', $document_html);// before save src templates not apply
+
+ //$src_http_www= 'src="'.api_get_path(WEB_COURSE_PATH).$course_data['path'].'/document/';
+ //$document_html= str_replace('src="',$src_http_www, $document_html);
+ //$document_html= str_replace('temp_template_path', 'src="/main/default_course_document/', $document_html);// restore src templates
+
+ api_set_encoding_html($document_html, 'UTF-8'); // The library mPDF expects UTF-8 encoded input data.
+ $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through
+ // $_GET[] too, as it is done with file name.
+ // At the moment the title is retrieved from the html document itself.
+ if (empty($title)) {
+ $title = $filename; // Here file name is expected to contain ASCII symbols only.
+ }
+ //var_dump($document_html);
+ $pdf->WriteHTML($document_html,2);
+ }
+ $output_file = 'pdf_'.date('Y-m-d-his').'.pdf';
+ $result = $pdf->Output($output_file, 'D'); /// F to save the pdf in a file
+ exit;
+ }
+
+ /**
+ * Gets the watermark from the platform or a course
+ * @param string course code (optional)
+ * @param mixed web path of the watermark image, false if there is nothing to return
+ */
+ public function get_watermark($course_code = null) {
+ $web_path = false;
+ if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') {
+ $course_info = api_get_course_info($course_code);
+ $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/pdf_watermark.png'; // course path
+ if (file_exists($store_path))
+ $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/pdf_watermark.png';
+ } else {
+ $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/pdf_watermark.png'; // course path
+ if (file_exists($store_path))
+ $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/pdf_watermark.png';
+ }
+ return $store_path;
+ }
+
+ /**
+ * Uploads the pdf watermark
+ */
+ public function upload_watermark($filename, $source_file, $course_code = null) {
+ if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') {
+ $course_info = api_get_course_info($course_code);
+ $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path
+ $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'pdf_watermark.png';
+ } else {
+ $store_path = api_get_path(SYS_CODE_PATH).'default_course_document'; // course path
+ $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/pdf_watermark.png';
+ }
+
+ $course_image = $store_path.'/pdf_watermark.png';
+ $extension = strtolower(substr(strrchr($filename, '.'), 1));
+ $result = false;
+ $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
+ if (in_array($extension, $allowed_picture_types)) {
+ if (file_exists($course_image)) {
+ @unlink($course_image);
+ }
+ if ($extension != 'png') {
+ // convert image to png extension
+ if ($extension == 'jpg' || $extension == 'jpeg') {
+ $image = imagecreatefromjpeg($source_file);
+ } else {
+ $image = imagecreatefromgif($source_file);
+ }
+ ob_start();
+ imagepng($image);
+ $imagevariable = ob_get_contents();
+ ob_end_clean();
+ // save picture
+ if (@file_put_contents($course_image, $imagevariable)) {
+ $result = true;
+ }
+ } else {
+ $result = @move_uploaded_file($source_file, $course_image);
+ }
+ }
+ if ($result) {
+ $result = $web_path;
+ }
+ return $result;
+ }
+ /**
+ * Returns the default header
+ */
+ public function get_header($course_code = null) {
+ $header = '';
+
+ if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') {
+ $header = api_get_course_setting('pdf_export_watermark_text');
+ } else {
+ $header = api_get_setting('pdf_export_watermark_text');
+ }
+ return $header;
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/main/inc/lib/xht.lib.php b/main/inc/lib/xht.lib.php
index a4de68ce7e..6652c11d84 100755
--- a/main/inc/lib/xht.lib.php
+++ b/main/inc/lib/xht.lib.php
@@ -7,7 +7,6 @@
*/
/**
-==============================================================================
* This is an XML HTML template library.
* Include/require it in your code to use its functionality.
*
@@ -20,8 +19,7 @@
* Assign xht_xmldoc (, xht_get_lang, xht_resource, xht_dbgn)
* before calling the class methods.
*
-* @package dokeos.library
-==============================================================================
+* @package chamilo.library
*/
diff --git a/main/inc/lib/xmd.lib.php b/main/inc/lib/xmd.lib.php
index 82015421a3..624b868694 100755
--- a/main/inc/lib/xmd.lib.php
+++ b/main/inc/lib/xmd.lib.php
@@ -7,13 +7,11 @@
*/
/**
-==============================================================================
* This is the XML Dom library for Dokeos.
* Include/require it in your code to use its functionality.
*
* @author René Haentjens
-* @package dokeos.library
-==============================================================================
+* @package chamilo.library
*/
class xmddoc
diff --git a/main/install/db_main.sql b/main/install/db_main.sql
index 94a7c26967..29af0d7210 100755
--- a/main/install/db_main.sql
+++ b/main/install/db_main.sql
@@ -776,7 +776,10 @@ VALUES
('force_wiki_paste_as_plain_text',NULL,'radio','Editor','true','ForceWikiPasteAsPlainTextTitle','ForceWikiPasteAsPlainTextComment',NULL,NULL, 0),
('enabled_googlemaps',NULL,'radio','Editor','true','EnabledGooglemapsTitle','EnabledGooglemapsComment',NULL,NULL, 0),
('enabled_imgmap',NULL,'radio','Editor','true','EnabledImageMapsTitle','EnabledImageMapsComment',NULL,NULL, 0),
-('enabled_support_svg',NULL,'radio','Tools','true','EnabledSVGTitle','EnabledSVGComment',NULL,NULL, 0),
+('enabled_support_svg', NULL,'radio', 'Tools', 'true', 'EnabledSVGTitle','EnabledSVGComment',NULL,NULL, 0),
+('pdf_export_watermark_enable', NULL,'radio', 'Platform', 'false','PDFExportWatermarkEnableTitle', 'PDFExportWatermarkEnableComment', 'platform',NULL, 1),
+('pdf_export_watermark_by_course', NULL,'radio', 'Platform', 'false','PDFExportWatermarkByCourseTitle', 'PDFExportWatermarkByCourseComment','platform',NULL, 1),
+('pdf_export_watermark_text', NULL,'textfield', 'Platform', '', 'PDFExportWatermarkTextTitle', 'PDFExportWatermarkTextComment', 'platform',NULL, 1),
('chamilo_database_version', NULL, 'textfield', NULL, '1.8.8.13050', 'DokeosDatabaseVersion', '', NULL, NULL, 0);
@@ -1011,7 +1014,11 @@ VALUES
('enabled_imgmap','true','Yes'),
('enabled_imgmap','false','No'),
('enabled_support_svg','true','Yes'),
-('enabled_support_svg','false','No');
+('enabled_support_svg','false','No'),
+('pdf_export_watermark_enable','true','Yes'),
+('pdf_export_watermark_enable','false','No'),
+('pdf_export_watermark_by_course','true','Yes'),
+('pdf_export_watermark_by_course','false','No');
UNLOCK TABLES;
diff --git a/main/install/migrate-db-1.8.7-1.8.8-pre.sql b/main/install/migrate-db-1.8.7-1.8.8-pre.sql
index fcc9e2a165..f480a06a4f 100755
--- a/main/install/migrate-db-1.8.7-1.8.8-pre.sql
+++ b/main/install/migrate-db-1.8.7-1.8.8-pre.sql
@@ -70,6 +70,18 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_im
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enabled_support_svg',NULL,'radio','Editor','true','EnabledSVGTitle','EnabledSVGComment',NULL,NULL, 0);
INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_support_svg', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_support_svg', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('pdf_export_watermark_enable', NULL,'radio', 'Platform', 'false','PDFExportWatermarkEnableTitle', 'PDFExportWatermarkEnableComment','platform',NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('pdf_export_watermark_enable','true','Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('pdf_export_watermark_enable','false','No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('pdf_export_watermark_by_course', NULL,'radio', 'Platform', 'false','PDFExportWatermarkByCourseTitle', 'PDFExportWatermarkByCourseComment','platform',NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('pdf_export_watermark_by_course','true','Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('pdf_export_watermark_by_course','false','No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('pdf_export_watermark_text', NULL,'textfield', 'Platform', '', 'PDFExportWatermarkTextTitle', 'PDFExportWatermarkTextComment','platform',NULL, 1);
+
+
ALTER TABLE personal_agenda ADD PRIMARY KEY (id);
-- xxSTATSxx
@@ -92,3 +104,5 @@ ALTER TABLE tool MODIFY COLUMN category varchar(20) not null default 'authoring'
ALTER TABLE lp ADD COLUMN autolunch INT DEFAULT 0;
INSERT INTO course_setting(variable,value,category) VALUES ('enable_lp_auto_launch',0,'learning_path');
+INSERT INTO course_setting(variable,value,category) VALUES ('pdf_export_watermark_text','','course');
+
diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php
index 3eccb538e2..f7f58ef0a3 100755
--- a/main/newscorm/learnpath.class.php
+++ b/main/newscorm/learnpath.class.php
@@ -19,7 +19,7 @@
class learnpath {
public $attempt = 0; // The number for the current ID view.
- public $cc; // Course (code) this learnpath is located in.
+ public $cc; // Course (code) this learnpath is located in. @todo change name for something more comprensible ...
public $current; // Id of the current item the user is viewing.
public $current_score; // The score of the current item.
public $current_time_start; // The time the user loaded this resource (this does not mean he can see it yet).
@@ -8356,6 +8356,37 @@ EOD;
DocumentManager::file_send_for_download($temp_zip_file, true, $name);
}
+
+ public function scorm_export_to_pdf($lp_id) {
+ $lp_id = intval($lp_id);
+ $files_to_export = array();
+ $course_data = api_get_course_info($this->cc);
+
+ $scorm_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/scorm/'.$this->path;
+ require_once api_get_path(LIBRARY_PATH).'document.lib.php';
+ foreach($this->items as $item) {
+ //Getting documents from a LP with chamilo documents
+ switch ($item->type) {
+ case 'document':
+ $file_data = DocumentManager::get_document_data_by_id($item->path, $this->cc);
+ $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
+ if (file_exists($file_path)) {
+ $files_to_export[] = $file_path;
+ }
+ break;
+ case 'sco':
+ $file_path = $scorm_path.'/'.$item->path;
+ if (file_exists($file_path)) {
+ $files_to_export[] = $file_path;
+ }
+ break;
+
+ }
+ }
+ require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
+ $result = PDF::html_to_pdf($files_to_export, $this->cc);
+ return $result;
+ }
/**
* Temp function to be moved in main_api or the best place around for this. Creates a file path
@@ -8496,11 +8527,13 @@ EOD;
//Setting everything to autolunch = 0
$attributes['autolunch'] = 0;
- Database::update_query($lp_table, $attributes);
+ $where = array('session_id = ? '=> api_get_session_id());
+ Database::update_query($lp_table, $attributes,$where);
if ($status == 1) {
//Setting my lp_id to autolunch = 1
$attributes['autolunch'] = 1;
- Database::update_query($lp_table, $attributes, " id = $lp_id" );
+ $where = array('id = ? AND session_id = ? '=> array($lp_id, api_get_session_id()));
+ Database::update_query($lp_table, $attributes, $where );
}
}
}
diff --git a/main/newscorm/learnpathList.class.php b/main/newscorm/learnpathList.class.php
index 2e8a6a5a91..35da176443 100755
--- a/main/newscorm/learnpathList.class.php
+++ b/main/newscorm/learnpathList.class.php
@@ -92,7 +92,8 @@ class learnpathList {
'lp_scorm_debug' => $row['debug'],
'lp_display_order' => $row['display_order'],
'lp_preview_image' => stripslashes($row['preview_image']),
- 'autolaunch' => $row['autolunch']
+ 'autolaunch' => $row['autolunch'],
+ 'session_id' => $row['session_id']
);
$names[$row['name']] = $row['id'];
}
diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php
index 7ef6ceec13..a2401039f9 100755
--- a/main/newscorm/lp_controller.php
+++ b/main/newscorm/lp_controller.php
@@ -197,6 +197,7 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$action = (!empty($_REQUEST['action']) ? $_REQUEST['action'] : '');
switch ($action) {
+
case 'add_item':
if (!$is_allowed_to_edit) {
@@ -283,27 +284,36 @@ switch ($action) {
break;
case 'admin_view':
-
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
-
if ($debug > 0) error_log('New LP - admin_view action triggered', 0);
-
if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; }
else {
$_SESSION['refresh'] = 1;
require 'lp_admin_view.php';
}
-
- break;
-
+ break;
+
+ case 'auto_launch':
+ if (api_get_course_setting('enable_lp_auto_launch')) {
+ if (!$is_allowed_to_edit) {
+ api_not_allowed(true);
+ }
+ if ($debug > 0) error_log('New LP - export action triggered', 0);
+ if (!$lp_found) { error_log('New LP - No learnpath given for set_autolunch', 0); require 'lp_list.php'; }
+ else {
+ $_SESSION['oLP']->set_autolunch($_GET['lp_id'], $_GET['status']);
+ require 'lp_list.php';
+ exit;
+ }
+ }
+ break;
+
case 'build':
-
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
-
if ($debug > 0) error_log('New LP - build action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; }
@@ -311,47 +321,37 @@ switch ($action) {
$_SESSION['refresh'] = 1;
require 'lp_build.php';
}
-
break;
case 'delete_item':
-
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
-
if ($debug > 0) error_log('New LP - delete item action triggered', 0);
-
if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; }
else {
$_SESSION['refresh'] = 1;
-
if (is_numeric($_GET['id'])) {
$_SESSION['oLP']->delete_item($_GET['id']);
$is_success = true;
}
-
if (isset($_GET['view']) && $_GET['view'] == 'build') {
require 'lp_build.php';
} else {
require 'lp_admin_view.php';
}
}
-
break;
-
+
case 'edit_item':
-
if (!$is_allowed_to_edit) {
api_not_allowed(true);
- }
-
+ }
if ($debug > 0) error_log('New LP - edit item action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; }
else {
$_SESSION['refresh'] = 1;
-
if (isset($_POST['submit_button']) && !empty($_POST['title'])) {
//$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites']);
// TODO: mp3 edit
@@ -364,22 +364,18 @@ switch ($action) {
}
$is_success = true;
}
-
if (isset($_GET['view']) && $_GET['view'] == 'build') {
require 'lp_edit_item.php';
} else {
require 'lp_admin_view.php';
}
}
-
break;
case 'edit_item_prereq':
-
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
-
if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
@@ -390,26 +386,21 @@ switch ($action) {
}
require 'lp_edit_item_prereq.php';
}
-
break;
case 'move_item':
-
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
-
if ($debug > 0) error_log('New LP - move item action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; }
else {
$_SESSION['refresh'] = 1;
-
if (isset($_POST['submit_button'])) {
$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description']);
$is_success = true;
}
-
if (isset($_GET['view']) && $_GET['view'] == 'build') {
require 'lp_move_item.php';
} else {
@@ -422,9 +413,7 @@ switch ($action) {
require 'lp_admin_view.php';
}
}
-
break;
-
case 'view_item':
if (!$is_allowed_to_edit) {
api_not_allowed(true);
@@ -463,22 +452,20 @@ switch ($action) {
//require 'lp_list.php';
}
break;
-
- case 'auto_launch':
- if (api_get_course_setting('enable_lp_auto_launch')) {
- if (!$is_allowed_to_edit) {
- api_not_allowed(true);
- }
- if ($debug > 0) error_log('New LP - export action triggered', 0);
- if (!$lp_found) { error_log('New LP - No learnpath given for set_autolunch', 0); require 'lp_list.php'; }
- else {
- $_SESSION['oLP']->set_autolunch($_GET['lp_id'], $_GET['status']);
- require 'lp_list.php';
- exit;
+ case 'export_to_pdf':
+ if (!$is_allowed_to_edit) {
+ api_not_allowed(true);
+ }
+ if ($debug > 0) error_log('New LP - export action triggered', 0);
+ if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php'; }
+ else {
+ $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']);
+ if (!$result) {
+ require 'lp_list.php';
}
+ exit;
}
break;
-
case 'delete':
if (!$is_allowed_to_edit) {
api_not_allowed(true);
diff --git a/main/newscorm/lp_list.php b/main/newscorm/lp_list.php
index d0c205b1c6..027deac503 100755
--- a/main/newscorm/lp_list.php
+++ b/main/newscorm/lp_list.php
@@ -165,7 +165,6 @@ if (is_array($flat_list)) {
$current = 0;
$autolunch_exists = false;
foreach ($flat_list as $id => $details) {
-
// Validacion when belongs to a session
$session_img = api_get_session_image($details['lp_session'], $_user['status']);
@@ -416,8 +415,7 @@ if (is_array($flat_list)) {
/* Auto Lunch LP code*/
$lp_auto_lunch_icon = '';
- if (api_get_course_setting('enable_lp_auto_launch')) {
-
+ if (api_get_course_setting('enable_lp_auto_launch')) {
if ($details['autolaunch'] == 1 && $autolunch_exists == false) {
$autolunch_exists = true;
$lp_auto_lunch_icon = '
@@ -427,7 +425,14 @@ if (is_array($flat_list)) {
';
}
}
+
+ if (api_get_setting('pdf_export_watermark_enable') == 'true') {
+ $export_icon = '
';
+ }
+
+
/* COLUMN ORDER */
+
// Only active while session mode is not active
if ($current_session == 0) {
@@ -456,7 +461,7 @@ if (is_array($flat_list)) {
}
} // end if ($is_allowedToEdit)
- echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_publish.$dsp_reinit.$dsp_default_view.$dsp_debug.$dsp_edit_lp.$dsp_delete.$dsp_disk.$lp_auto_lunch_icon.$dsp_order.$dsp_edit_close;
+ echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_publish.$dsp_reinit.$dsp_default_view.$dsp_debug.$dsp_edit_lp.$dsp_delete.$dsp_disk.$lp_auto_lunch_icon.$export_icon.$dsp_order.$dsp_edit_close;
echo "\n";
$current ++; //counter for number of elements treated