[svn r10224] new display for left menu in a learning path

skala
Eric Marguin 18 years ago
parent a3d8e09a65
commit 6b4d445fd6
  1. 92
      main/newscorm/learnpath.class.php
  2. 36
      main/newscorm/scorm.css

@ -2569,7 +2569,7 @@ class learnpath {
* Uses the table generated by get_toc() and returns an HTML-formatted string ready to display
* @return string HTML TOC ready to display
*/
function get_html_toc()
/*function get_html_toc()
{
if($this->debug>0){error_log('New LP - In learnpath::get_html_toc()',0);}
$list = $this->get_toc();
@ -2627,7 +2627,97 @@ class learnpath {
}
$html .= "</div>\n";
return $html;
}*/
/**
* Uses the table generated by get_toc() and returns an HTML-formatted string ready to display
* @return string HTML TOC ready to display
*/
function get_html_toc()
{
if($this->debug>0){error_log('New LP - In learnpath::get_html_toc()',0);}
$list = $this->get_toc();
//echo $this->current;
//$parent = $this->items[$this->current]->get_parent();
//if(empty($parent)){$parent = $this->ordered_items[$this->items[$this->current]->get_previous_index()];}
$html = '<div class="inner_lp_toc">'."\n" ;
// " onchange=\"javascript:document.getElementById('toc_$parent').focus();\">\n";
require_once('resourcelinker.inc.php');
//temp variables
$mycurrentitemid = $this->get_current_item_id();
foreach($list as $item)
{
if($this->debug>2){error_log('New LP - learnpath::get_html_toc(): using item '.$item['id'],0);}
//TODO complete this
$icon_name = array('not attempted' => 'notattempted.png',
'incomplete' => 'incomplete.png',
'failed' => 'failed.png',
'completed' => 'completed.png',
'passed' => 'passed.png',
'succeeded' => 'succeeded.png',
'browsed' => 'completed.png');
$style = 'scorm_item';
if($item['id'] == $this->current){
$style = 'scorm_item_highlight';
}
//the anchor will let us center the TOC on the currently viewed item &^D
if($item['type']!='dokeos_module' AND $item['type']!='dokeos_chapter'){
$html .= '<a name="atoc_'.$item['id'].'" /><div class="'.$style.'" style="padding-left: '.($item['level']*2).'em; padding-right:'.($item['level']/2).'em" id="toc_'.$item['id'].'" >' .
'';
}
else{
$html .= '<div class="'.$style.'" style="padding-left: '.($item['level']*2).'em; padding-right:'.($item['level']*2).'em" id="toc_'.$item['id'].'" >' .
'';
}
//$title = htmlspecialchars($item['title'],ENT_QUOTES,$this->encoding);
$title = $item['title'];
if(empty($title)){
$title = rl_get_resource_name(api_get_course_id(),$this->get_id(),$item['id']);
$title = htmlspecialchars($title,ENT_QUOTES,$this->encoding);
}
if(empty($title))$title = '-';
if($item['type']!='dokeos_chapter' and $item['type']!='dir' AND $item['type']!='dokeos_module'){
//$html .= "<a href='lp_controller.php?".api_get_cidReq()."&action=content&lp_id=".$this->get_id()."&item_id=".$item['id']."' target='lp_content_frame_name'>".$title."</a>" ;
$url = $this->get_link('http',$item['id']);
//$html .= '<a href="'.$url.'" target="content_name" onclick="top.load_item('.$item['id'].',\''.$url.'\');">'.$title.'</a>' ;
//$html .= '<a href="" onclick="top.load_item('.$item['id'].',\''.$url.'\');return false;">'.$title.'</a>' ;
$html .= '<a href="" onclick="dokeos_xajax_handler.switch_item(' .
$mycurrentitemid.',' .
$item['id'].');' .
'return false;" ><img align="absbottom" width="13" height="13" src="img/lp_document.png">&nbsp;'.$title.'</a>' ;
}
elseif($item['type']=='dokeos_module'){
$html .= "<img align='absbottom' width='13' height='13' src='img/lp_dokeos_module.png'>&nbsp;".$title;
}
elseif($item['type']=='dokeos_chapter'){
$html .= "<img align='absbottom' width='13' height='13' src='img/lp_dokeos_chapter.png'>&nbsp;".$title;
}
elseif($item['type']=='dir'){
$html .= $title;
}
$html .= "<img id='toc_img_".$item['id']."' src='".$icon_name[$item['status']]."' alt='".substr($item['status'],0,1)."' /></div>\n";
}
$html .= "</div>\n";
return $html;
}
/**
* Gets the user-friendly message stored in $this->message
* @return string Message

@ -14,28 +14,50 @@ font-size: small;
background-color: white;
height: 310px;
width: 180px;
border:none;
border-right: 1px none;
}
.inner_lp_toc{
overflow: auto;
background-color: white;
height: 290px;
width: 180px;
border:none;
width: 99%;
border-right: 1px #999999 solid;
}
.inner_lp_toc .scorm_item{
font-size: smaller;
font-size: 11px;
margin-left: 10px;
margin-right:10px;
padding-bottom: 2px;
text-decoration: none;
}
.inner_lp_toc .scorm_item A{
font-weight: normal;
}
.inner_lp_toc .scorm_item A.chapter_module{
font-weight: normal;
}
.inner_lp_toc .scorm_item_highlight{
font-size: smaller;
font-size: 11px;
margin-left: 10px;
margin-right: 10px;
background-color: #e2e2e2;
text-decoration: underline;
padding-bottom: 2px;
text-decoration: none;
background:#F8F8F8; border:1px dashed #999999;
}
.inner_lp_toc .scorm_item_highlight A{
font-weight: normal;
}
.inner_lp_toc .scorm_item_highlight .highlight{
font-weight: normal;
background:#F3F3F3; border:1px dashed #949494;
margin-right: 1px;
}
.inner_lp_toc .scorm_status_img{
margin:0px;
margin-left: -10px;

Loading…
Cancel
Save