From 5d2468d2ce2c7639374be74b046b9ca567a61b4f Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 27 Aug 2008 01:20:21 +0200 Subject: [PATCH] [svn r16074] Showing the LP image and the author name. FS#2841 --- main/css/academica/scorm.css | 6 + main/css/academica/scormfs.css | 6 + main/css/baby_orange/scorm.css | 7 + main/css/baby_orange/scormfs.css | 6 + main/css/corporate/scorm.css | 7 + main/css/corporate/scormfs.css | 7 + main/css/cosmic_campus/scorm.css | 7 + main/css/cosmic_campus/scormfs.css | 6 + main/css/dokeos_classic/scorm.css | 9 +- main/css/dokeos_classic/scormfs.css | 6 + main/css/medical/scorm.css | 6 + main/css/medical/scormfs.css | 6 + main/css/public_admin/scorm.css | 15 +- main/css/public_admin/scormfs.css | 9 +- main/css/silver_line/scorm.css | 7 + main/css/silver_line/scormfs.css | 6 + main/css/sober_brown/scorm.css | 6 + main/css/sober_brown/scormfs.css | 7 + main/inc/lib/add_course.lib.inc.php | 5 +- main/install/migrate-db-1.8.5-1.8.6-pre.sql | 3 + main/newscorm/aicc.class.php | 36 ++++ main/newscorm/aicc_api.php | 2 +- main/newscorm/learnpath.class.php | 175 +++++++++++++++++--- main/newscorm/learnpathList.class.php | 3 +- main/newscorm/lp_controller.php | 26 ++- main/newscorm/lp_edit.php | 33 +++- main/newscorm/lp_nav.php | 30 +++- main/newscorm/lp_view.php | 12 +- main/newscorm/scorm.class.php | 37 +++++ main/newscorm/scorm_api.php | 6 +- 30 files changed, 444 insertions(+), 53 deletions(-) diff --git a/main/css/academica/scorm.css b/main/css/academica/scorm.css index be67d5a7cb..102441c2a3 100644 --- a/main/css/academica/scorm.css +++ b/main/css/academica/scorm.css @@ -160,3 +160,9 @@ vertical-align: top; .scormpage .footer{ clear: both; } +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/academica/scormfs.css b/main/css/academica/scormfs.css index b84c0ef85d..cb5ff292dd 100644 --- a/main/css/academica/scormfs.css +++ b/main/css/academica/scormfs.css @@ -81,3 +81,9 @@ .scormpage .footer{ clear: both; } +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/baby_orange/scorm.css b/main/css/baby_orange/scorm.css index b44fcccf1a..78b3b72f96 100644 --- a/main/css/baby_orange/scorm.css +++ b/main/css/baby_orange/scorm.css @@ -162,3 +162,10 @@ vertical-align: top; .scormpage .footer{ clear: both; } + +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/baby_orange/scormfs.css b/main/css/baby_orange/scormfs.css index b84c0ef85d..cb5ff292dd 100755 --- a/main/css/baby_orange/scormfs.css +++ b/main/css/baby_orange/scormfs.css @@ -81,3 +81,9 @@ .scormpage .footer{ clear: both; } +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/corporate/scorm.css b/main/css/corporate/scorm.css index 36af359eb0..513291cdcd 100644 --- a/main/css/corporate/scorm.css +++ b/main/css/corporate/scorm.css @@ -155,3 +155,10 @@ vertical-align: top; .scormpage .footer{ clear: both; } + +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/corporate/scormfs.css b/main/css/corporate/scormfs.css index b84c0ef85d..6479f26264 100755 --- a/main/css/corporate/scormfs.css +++ b/main/css/corporate/scormfs.css @@ -81,3 +81,10 @@ .scormpage .footer{ clear: both; } + +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/cosmic_campus/scorm.css b/main/css/cosmic_campus/scorm.css index 745a4485e0..6882def835 100644 --- a/main/css/cosmic_campus/scorm.css +++ b/main/css/cosmic_campus/scorm.css @@ -174,3 +174,10 @@ .scormpage .footer{ clear: both; } + +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/cosmic_campus/scormfs.css b/main/css/cosmic_campus/scormfs.css index e9a7656cd6..811bae915a 100644 --- a/main/css/cosmic_campus/scormfs.css +++ b/main/css/cosmic_campus/scormfs.css @@ -77,3 +77,9 @@ .scormpage .footer{ clear: both; } +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/dokeos_classic/scorm.css b/main/css/dokeos_classic/scorm.css index f71bb4ad45..2f4d71b288 100644 --- a/main/css/dokeos_classic/scorm.css +++ b/main/css/dokeos_classic/scorm.css @@ -171,4 +171,11 @@ vertical-align: top; } .scormpage .footer{ clear: both; -} \ No newline at end of file +} + +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/dokeos_classic/scormfs.css b/main/css/dokeos_classic/scormfs.css index b84c0ef85d..cb5ff292dd 100755 --- a/main/css/dokeos_classic/scormfs.css +++ b/main/css/dokeos_classic/scormfs.css @@ -81,3 +81,9 @@ .scormpage .footer{ clear: both; } +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/medical/scorm.css b/main/css/medical/scorm.css index a4d5991e14..2a2895d446 100644 --- a/main/css/medical/scorm.css +++ b/main/css/medical/scorm.css @@ -174,3 +174,9 @@ clear: both; } +.preview_image +{ + text-align: right; + margin-right: 5px; +} + diff --git a/main/css/medical/scormfs.css b/main/css/medical/scormfs.css index afbb2f4a7c..04dbcf91d5 100644 --- a/main/css/medical/scormfs.css +++ b/main/css/medical/scormfs.css @@ -77,3 +77,9 @@ .scormpage .footer{ clear: both; } +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/public_admin/scorm.css b/main/css/public_admin/scorm.css index 0359fc4a50..762a27cb6e 100644 --- a/main/css/public_admin/scorm.css +++ b/main/css/public_admin/scorm.css @@ -126,14 +126,14 @@ } .lp_navigation_elem{ - padding-left: 60px; + padding-left: 15px; padding-top: 0px; } /*.scormpage .menu */ .lp_navigation_elem .progresstext{ - margin-top: -12px; - margin-left: 4em; - font-size: smaller; + margin-top: -15px; + margin-left: 5em; + font-size: normal; } /*.scormpage .menu */ @@ -174,3 +174,10 @@ .scormpage .footer{ clear: both; } + +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/public_admin/scormfs.css b/main/css/public_admin/scormfs.css index e9a7656cd6..ab44bab44d 100644 --- a/main/css/public_admin/scormfs.css +++ b/main/css/public_admin/scormfs.css @@ -21,7 +21,7 @@ } .lp_navigation_elem{ - padding-left: 60px; + padding-left: 15px; padding-top: 0px; } /*.scormpage .menu */ @@ -77,3 +77,10 @@ .scormpage .footer{ clear: both; } + +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/silver_line/scorm.css b/main/css/silver_line/scorm.css index a2c3131470..4e6fe658ef 100644 --- a/main/css/silver_line/scorm.css +++ b/main/css/silver_line/scorm.css @@ -156,3 +156,10 @@ vertical-align: top; .scormpage .footer{ clear: both; } + +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/silver_line/scormfs.css b/main/css/silver_line/scormfs.css index b84c0ef85d..cb5ff292dd 100755 --- a/main/css/silver_line/scormfs.css +++ b/main/css/silver_line/scormfs.css @@ -81,3 +81,9 @@ .scormpage .footer{ clear: both; } +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/css/sober_brown/scorm.css b/main/css/sober_brown/scorm.css index 31db9322a1..1660cb9cb6 100644 --- a/main/css/sober_brown/scorm.css +++ b/main/css/sober_brown/scorm.css @@ -169,3 +169,9 @@ height: 100%; .scormpage .footer{ clear: both; } + +.preview_image +{ + text-align: right; + margin-right: 5px; +} \ No newline at end of file diff --git a/main/css/sober_brown/scormfs.css b/main/css/sober_brown/scormfs.css index e9a7656cd6..b90d4073a8 100755 --- a/main/css/sober_brown/scormfs.css +++ b/main/css/sober_brown/scormfs.css @@ -77,3 +77,10 @@ .scormpage .footer{ clear: both; } + +.preview_image +{ + text-align: right; + margin-right: 5px; + padding-left: 15px; +} diff --git a/main/inc/lib/add_course.lib.inc.php b/main/inc/lib/add_course.lib.inc.php index 89e68f7a42..397373dfac 100644 --- a/main/inc/lib/add_course.lib.inc.php +++ b/main/inc/lib/add_course.lib.inc.php @@ -976,7 +976,10 @@ function update_Db_course($courseDbName) "prevent_reinit tinyint unsigned not null default 1," . //stores the default behaviour regarding items re-initialisation when viewed a second time after success "js_lib tinytext not null default ''," . //the JavaScript library to load for this lp "debug tinyint unsigned not null default 0," . //stores the default behaviour regarding items re-initialisation when viewed a second time after success - "theme varchar(255) not null default '' " . //stores the theme of the LP + "theme varchar(255) not null default '', " . //stores the theme of the LP + "preview_image varchar(255) not null default '', " . //stores the theme of the LP + "author varchar(255) not null default '' " . //stores the theme of the LP + ")"; if(!api_sql_query($sql, __FILE__, __LINE__)) { diff --git a/main/install/migrate-db-1.8.5-1.8.6-pre.sql b/main/install/migrate-db-1.8.5-1.8.6-pre.sql index 6fd1810cdd..25db136d74 100644 --- a/main/install/migrate-db-1.8.5-1.8.6-pre.sql +++ b/main/install/migrate-db-1.8.5-1.8.6-pre.sql @@ -46,3 +46,6 @@ ALTER TABLE survey ADD show_form_profile int NOT NULL default 0; ALTER TABLE survey ADD form_fields TEXT NOT NULL; ALTER TABLE quiz_answer CHANGE hotspot_type hotspot_type ENUM( 'square', 'circle', 'poly', 'delineation' ) NULL DEFAULT NULL; ALTER TABLE forum_forum ADD forum_image varchar(255) NOT NULL default ''; +ALTER TABLE lp ADD preview_image varchar(255) NOT NULL default ''; +ALTER TABLE lp ADD author varchar(255) NOT NULL default ''; + diff --git a/main/newscorm/aicc.class.php b/main/newscorm/aicc.class.php index f288d5b012..60f40a0786 100644 --- a/main/newscorm/aicc.class.php +++ b/main/newscorm/aicc.class.php @@ -587,6 +587,42 @@ class aicc extends learnpath { } } + /** + * Sets the image LP in the database + * @param string Theme setting + */ + function set_preview_image($preview_image=''){ + if($this->debug>0){error_log('In aicc::set_preview_image('.$preview_image.') method',0);} + $lp = $this->get_id(); + if($lp!=0){ + $tbl_lp = Database::get_course_table('lp'); + $sql = "UPDATE $tbl_lp SET preview_image = '$preview_image' WHERE id = ".$lp; + $res = api_sql_query($sql); + return $res; + }else{ + return false; + } + } + + /** + * Sets the Author LP in the database + * @param string Theme setting + */ + function set_author($author=''){ + if($this->debug>0){error_log('In aicc::set_author('.$author.') method',0);} + $lp = $this->get_id(); + if($lp!=0){ + $tbl_lp = Database::get_course_table('lp'); + $sql = "UPDATE $tbl_lp SET author = '$author' WHERE id = ".$lp; + $res = api_sql_query($sql); + return $res; + }else{ + return false; + } + } + + + /** * Sets the content maker setting in the database * @param string Proximity setting diff --git a/main/newscorm/aicc_api.php b/main/newscorm/aicc_api.php index 346d58c7ed..58158a67d6 100644 --- a/main/newscorm/aicc_api.php +++ b/main/newscorm/aicc_api.php @@ -605,7 +605,7 @@ function update_message_frame(msg_msg) * @param string This parameter can be a string specifying the next * item (like 'next', 'previous', 'first' or 'last') or the id to the next item */ -function switch_item(current_item, next_item){ +function switch_item(current_item, next_item){ /* if(!current_item){ logit_lms('In switch - no current_item defined',0); diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 6bb682f2d2..17066212b2 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -37,7 +37,8 @@ class learnpath { var $name; //learnpath name (they generally have one) var $ordered_items = array(); //list of the learnpath items in the order they are to be read var $path = ''; //path inside the scorm directory (if scorm) - var $theme; // the current theme of the learning path + var $theme; // the current theme of the learning path + var $preview_image; // the current image of the learning path // Tells if all the items of the learnpath can be tried again. Defaults to "no" (=1) var $prevent_reinit = 1; @@ -130,6 +131,9 @@ class learnpath { $this->scorm_debug = $row['debug']; $this->js_lib = $row['js_lib']; $this->path = $row['path']; + $this->preview_image= $row['preview_image']; + $this->author= $row['author']; + if($this->type == 2){ if($row['force_commit'] == 1){ $this->force_commit = true; @@ -1578,23 +1582,15 @@ class learnpath { if($this->debug>0){error_log('New LP - In learnpath::get_navigation_bar()',0);} //TODO find a good value for the following variables - $file = ''; - $openDir = ''; - $edoceo = ''; - $time = 0; - $navbar = ''; - $RequestUri = ''; - $mycurrentitemid = $this->get_current_item_id(); - - if($this->mode == 'fullscreen'){ - + if($this->mode == 'fullscreen') + { $navbar = ''."\n". ' '."\n" . @@ -1609,7 +1605,7 @@ class learnpath { '  '."\n" . - ' '."\n" . + //' '."\n" . //' '."\n" . @@ -1639,7 +1635,7 @@ class learnpath { '  '."\n" . - ' '."\n" . + // ' '."\n" . ' '."\n" . @@ -1938,24 +1934,29 @@ class learnpath { list ($percentage, $text_add) = $this->get_progress_bar_text($mode); } $text = $percentage.$text_add; + + //Default progress bar config + $factor=1.5; + $progress_height='16'; $size = str_replace('%','',$percentage); + $output = '' - //.htmlentities(get_lang('ScormCompstatus'),ENT_QUOTES,'ISO-8859-1')."
" + //.htmlentities(get_lang('ScormCompstatus'),ENT_QUOTES,'ISO-8859-1')."
" .'
' - .'' - .'' - .''; + .'' + .'' + .''; if($percentage <= 98) - { - $output .= ''; + { + $output .= ''; } else { - $output .= ''; + $output .= ''; } - $output .= '
' + $output .= '' .'
'.$text.'
'; return $output; } @@ -2031,6 +2032,28 @@ class learnpath { if(!empty($this->theme)){return $this->theme;}else{return '';} } + + /** + * Gets the learnpath image + * @return string Web URL of the LP image + */ + function get_preview_image() + { + if($this->debug>0){error_log('New LP - In learnpath::get_preview_image()',0);} + if(!empty($this->preview_image)){return $this->preview_image;}else{return '';} + } + + + /** + * Gets the learnpath author + * @return string LP's author + */ + function get_author() + { + if($this->debug>0){error_log('New LP - In learnpath::get_author()',0);} + if(!empty($this->author)){return $this->author;}else{return '';} + } + /** * Generate a new prerequisites string for a given item. If this item was a sco and * its prerequisites were strings (instead of IDs), then transform those strings into @@ -3491,7 +3514,7 @@ class learnpath { } - /** + /** * Sets the theme of the LP (local/remote) (and save) * @param string Optional string giving the new theme of this learnpath * @return bool returns true if theme name is not empty @@ -3508,6 +3531,40 @@ class learnpath { return true; } + /** + * Sets the image of a LP (local/remote) (and save) + * @param string Optional string giving the new image of this learnpath + * @return bool returns true if theme name is not empty + */ + function set_preview_image($name=''){ + if($this->debug>0){error_log('New LP - In learnpath::set_preview_image()',0);} + $this->preview_image = $this->escape_string($name); + $lp_table = Database::get_course_table('lp'); + $lp_id = $this->get_id(); + $sql = "UPDATE $lp_table SET preview_image = '".$this->preview_image."' WHERE id = '$lp_id'"; + if($this->debug>2){error_log('New LP - lp updated with new preview image : '.$this->preview_image,0);} + $res = api_sql_query($sql, __FILE__, __LINE__); + return true; + } + + + /** + * Sets the author of a LP (local/remote) (and save) + * @param string Optional string giving the new author of this learnpath + * @return bool returns true if author's name is not empty + */ + function set_author($name=''){ + if($this->debug>0){error_log('New LP - In learnpath::set_author()',0);} + $this->author = $this->escape_string($name); + $lp_table = Database::get_course_table('lp'); + $lp_id = $this->get_id(); + $sql = "UPDATE $lp_table SET author = '".$this->author."' WHERE id = '$lp_id'"; + if($this->debug>2){error_log('New LP - lp updated with new preview author : '.$this->author,0);} + $res = api_sql_query($sql, __FILE__, __LINE__); + return true; + } + + /** * Sets the location/proximity of the LP (local/remote) (and save) * @param string Optional string giving the new location of this learnpath @@ -8352,5 +8409,79 @@ EOD; } } } + /** + * + */ + function delete_lp_image() + { + $img = $this->get_preview_image(); + if ($img!='') + { + $del_file = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$img; + $this->set_preview_image(''); + return @unlink($del_file); + } + else + { + return false; + } + + } + + /** + * + */ + function upload_image($image_array) + { + $image_moved=false; + if(!empty($image_array['name'])) + { + $upload_ok = process_uploaded_file($image_array); + $has_attachment=true; + } + else + { + $image_moved=true; + } + + if($upload_ok) + { + if ($has_attachment) + { + $courseDir = api_get_course_path().'/upload/learning_path/images'; + $sys_course_path = api_get_path(SYS_COURSE_PATH); + $updir = $sys_course_path.$courseDir; + + // Try to add an extension to the file if it hasn't one + $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']); + + // user's file name + $file_name =$image_array['name']; + + if (!filter_extension($new_file_name)) + { + //Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); + $image_moved=false; + } + else + { + $file_extension = explode('.', $image_array['name']); + $file_extension = strtolower($file_extension[sizeof($file_extension) - 1]); + $new_file_name = uniqid('').'.'.$file_extension; + $new_path=$updir.'/'.$new_file_name; + $result= @move_uploaded_file($image_array['tmp_name'], $new_path); + // Storing the attachments if any + if ($result) + { + $image_moved=true; + $this->set_preview_image($new_file_name); + return true; + } + } + } + } + return false; + } + } ?> \ No newline at end of file diff --git a/main/newscorm/learnpathList.class.php b/main/newscorm/learnpathList.class.php index 3c122c9c43..621f1862dc 100644 --- a/main/newscorm/learnpathList.class.php +++ b/main/newscorm/learnpathList.class.php @@ -75,7 +75,8 @@ class learnpathList { 'lp_prevent_reinit' => $row['prevent_reinit'], 'lp_scorm_debug' => $row['debug'], 'lp_display_order' => $row['display_order'], - ); + 'lp_preview_image' => stripslashes($row['preview_image']) + ); $names[$row['name']]=$row['id']; } $this->alpha_list = asort($names); diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php index 1883e2ffdb..2fad00036f 100644 --- a/main/newscorm/lp_controller.php +++ b/main/newscorm/lp_controller.php @@ -19,11 +19,12 @@ if (isset($_GET['action'])) $language_file[] = 'exercice'; } } -$language_file[] = "course_home"; -$language_file[] = "scormdocument"; -$language_file[] = "scorm"; -$language_file[] = "learnpath"; +$language_file[] = 'course_home'; +$language_file[] = 'scormdocument'; +$language_file[] = 'scorm'; +$language_file[] = 'learnpath'; $language_file[] = 'resourcelinker'; +$language_file[] = 'registration'; //flag to allow for anonymous user - needs to be set before global.inc.php $use_anonymous = true; @@ -89,6 +90,7 @@ if(isset($_SESSION['lpobject'])) } } } + if($debug>0) error_log('New LP - Passed data remains check',0); if($lp_found == false @@ -556,7 +558,7 @@ switch($action) if(!api_is_allowed_to_edit()) { api_not_allowed(true); - } + } if($debug>0) error_log('New LP - edit action triggered',0); if(!$lp_found){ error_log('New LP - No learnpath given for edit',0); require('lp_list.php'); } else{ @@ -573,10 +575,20 @@ switch($action) else{ $_SESSION['refresh'] = 1; $_SESSION['oLP']->set_name($_REQUEST['lp_name']); + $_SESSION['oLP']->set_author($_REQUEST['lp_author']); $_SESSION['oLP']->set_encoding($_REQUEST['lp_encoding']); $_SESSION['oLP']->set_maker($_REQUEST['lp_maker']); - $_SESSION['oLP']->set_proximity($_REQUEST['lp_proximity']); - $_SESSION['oLP']->set_theme($_REQUEST['lp_theme']); + $_SESSION['oLP']->set_proximity($_REQUEST['lp_proximity']); + $_SESSION['oLP']->set_theme($_REQUEST['lp_theme']); + + if ($_REQUEST['remove_picture']) + { + $_SESSION['oLP']->delete_lp_image(); + } + + if ($_FILES['lp_preview_image']['size']>0) + $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']); + require('lp_list.php'); } break; diff --git a/main/newscorm/lp_edit.php b/main/newscorm/lp_edit.php index f7b5e0e46c..03ba33e6ea 100644 --- a/main/newscorm/lp_edit.php +++ b/main/newscorm/lp_edit.php @@ -43,6 +43,7 @@ foreach($encodings as $encoding){ //Origin $origin_select = &$form->addElement('select', 'lp_maker', get_lang('Origin')); $lp_orig = $_SESSION['oLP']->get_maker(); + include('content_makers.inc.php'); foreach($content_origins as $origin){ if($lp_orig == $origin){ @@ -78,17 +79,45 @@ if (api_get_setting('allow_course_theme') == 'true') } } +//Author +$form -> addElement('text', 'lp_author', ucfirst(get_lang('Author'))); + + + +// LP image + +$form->add_progress_bar(); +if( strlen($_SESSION['oLP']->get_preview_image() ) > 0) +{ + $show_preview_image='get_preview_image().'>'; + $div = '
+
'.get_lang('ImagePreview').'
+
+ '.$show_preview_image.' +
+
'; + + $form->addElement('html', $div .'
'); + $form->addElement('checkbox', 'remove_picture', null, get_lang('DelImage')); +} + +$form->addElement('file', 'lp_preview_image', ($_SESSION['oLP']->get_preview_image() != '' ? get_lang('UpdateImage') : get_lang('AddImage'))); + +$form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'mimetype', array('image/gif', 'image/jpeg', 'image/png')); + + + //default values $content_proximity_select -> setSelected($s_selected_proximity); $origin_select -> setSelected($s_selected_origin); $encoding_select -> setSelected($s_selected_encoding); -$defaults["lp_name"]=$_SESSION['oLP']->get_name(); +$defaults['lp_name']=$_SESSION['oLP']->get_name(); +$defaults['lp_author']=$_SESSION['oLP']->get_author(); //Submit button $form->addElement('submit', 'Submit', get_lang('Ok')); - //Hidden fields $form->addElement('hidden', 'action', 'update_lp'); $form->addElement('hidden', 'lp_id', $_SESSION['oLP']->get_id()); diff --git a/main/newscorm/lp_nav.php b/main/newscorm/lp_nav.php index c5752e9184..21b09dd4e7 100644 --- a/main/newscorm/lp_nav.php +++ b/main/newscorm/lp_nav.php @@ -42,8 +42,7 @@ if(isset($_SESSION['lpobject'])) //error_log('New LP - in lp_nav.php - SESSION[lpobject] is not object - dying',0); die('Could not instanciate lp object'); } - $display_mode = $_SESSION['oLP']->mode; - + $display_mode = $_SESSION['oLP']->mode; $scorm_css_header=true; $lp_theme_css=$_SESSION['oLP']->get_theme(); @@ -57,16 +56,37 @@ if(isset($_SESSION['lpobject'])) else { $lp_theme_css=$my_style; - } + } $progress_bar = $_SESSION['oLP']->get_progress_bar(); $navigation_bar = $_SESSION['oLP']->get_navigation_bar(); } session_write_close(); ?> + +'."\n"; +if ($_SESSION['oLP']->get_preview_image()!='') + $html .='get_preview_image().'>'; + +if ($_SESSION['oLP']->get_author()!='') +{ + $html .='
'.get_lang('Author').': '.$_SESSION['oLP']->get_author(); +} +$html .=''; +echo $html; +?>
- - + + + + + +
+ + + +
diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php index 6387dc9676..6831a7b5a6 100644 --- a/main/newscorm/lp_view.php +++ b/main/newscorm/lp_view.php @@ -131,7 +131,7 @@ $_setting['show_navigation_menu'] = false; $scorm_css_header=true; $lp_theme_css=$_SESSION['oLP']->get_theme(); //sets the css theme of the LP this call is also use at the frames (toc, nav, message) - + if($_SESSION['oLP']->mode == 'fullscreen') { $htmlHeadXtra[] = ""; @@ -175,14 +175,16 @@ else $_SESSION['loaded_lp_view'] = true; ?> - + - '; - ?> + ?> + + - + diff --git a/main/newscorm/scorm.class.php b/main/newscorm/scorm.class.php index fc9335f45c..477151ec1a 100644 --- a/main/newscorm/scorm.class.php +++ b/main/newscorm/scorm.class.php @@ -719,6 +719,43 @@ class scorm extends learnpath { } } + /** + * Sets the image setting in the database + * @param string preview_image setting + */ + function set_preview_image($preview_image=''){ + if($this->debug>0){error_log('In scorm::set_theme('.$preview_image.') method',0);} + $lp = $this->get_id(); + if($lp!=0){ + $tbl_lp = Database::get_course_table('lp'); + $sql = "UPDATE $tbl_lp SET preview_image = '$preview_image' WHERE id = ".$lp; + $res = api_sql_query($sql); + return $res; + }else{ + return false; + } + } + + + /** + * Sets the author setting in the database + * @param string preview_image setting + */ + function set_author($author=''){ + if($this->debug>0){error_log('In scorm::set_author('.$author.') method',0);} + $lp = $this->get_id(); + if($lp!=0){ + $tbl_lp = Database::get_course_table('lp'); + $sql = "UPDATE $tbl_lp SET author = '$author' WHERE id = ".$lp; + $res = api_sql_query($sql); + return $res; + }else{ + return false; + } + } + + + /** * Sets the content maker setting in the database diff --git a/main/newscorm/scorm_api.php b/main/newscorm/scorm_api.php index 4e8695a2e0..27eea41edb 100644 --- a/main/newscorm/scorm_api.php +++ b/main/newscorm/scorm_api.php @@ -1,4 +1,4 @@ -