Permalink
Browse files

var rename

  • Loading branch information...
1 parent 1873f38 commit 00692ed704302022a2b323d434b320d68ee1813f @koopa committed Oct 23, 2012
Showing with 14 additions and 17 deletions.
  1. +8 −11 courses/course.php
  2. +6 −6 courses/index.php
View
@@ -23,19 +23,16 @@
?>
<div id="course">
<?
- //
- // Description: Load the course file specified by the GET variable 'id'
- //
+ $category = isset($_GET['category']) ? $_GET['category'] : null;
+ $course = isset($_GET['course']) ? $_GET['course'] : null;
+ $chapter = isset($_GET['chapter']) ? $_GET['chapter'] : null;
+ //TODO: implement static pages for non-js browsers (via url rewriting)
+ $mincourseid = 0;
+ $maxcourseid = 100000;
- if(isset($_GET['id'])){
-
- }
-
- $errorstring = "<p class=\"center\"><img alt=\"Y U NO GIVE ID\" src=\"images/yuno.png\" /><br /><br />No active course, select a valid course from the navigation on the left!
+ $selectCourse = "<p class=\"center\"><img alt=\"Y U NO GIVE ID\" src=\"images/yuno.png\" /><br /><br />No active course, select a valid course from the navigation on the left!
</p>";
- $mincourseid = 0;
- $maxcourseid = 100000;
echo '<div id="coursenavigation">
<ol class="tree">';
@@ -84,5 +81,5 @@
</div><!-- end div id="coursenavigation" -->';
?>
- <div id="coursecontent"><?php echo $errorstring; ?></div>
+ <div id="coursecontent"><?php echo $selectCourse; ?></div>
</div>
View
@@ -62,18 +62,18 @@
updateState = function(e){
var parts = e.path.split('/')
, tab = parts[1]
- , panel = parts[2] || ''
+ , category = parts[2] || ''
, course = parts[3] || ''
, chapter = parts[4] || '';
if(tab.length){ //select tab
$("#tabs").tabs("select", '#'+tab.replace(/^#/,''));
}
- if(panel.length){ //select accordion panel
- $("#courses").accordion("activate", getPanelIndex(panel));
- $('a[href$="/course/'+panel+'"]').siblings('input').attr('checked', true);
+ if(category.length){ //select accordion panel
+ $("#courses").accordion("activate", getPanelIndex(category));
+ $('a[href$="/course/'+category+'"]').siblings('input').attr('checked', true);
}
if(course.length){ //select course
- $('a[href$="/course/'+panel+'/'+course+'"]').siblings('input').attr('checked', true);
+ $('a[href$="/course/'+category+'/'+course+'"]').siblings('input').attr('checked', true);
}
if(chapter.length){ //select chapter
$('#coursenavigation li.file a').each(function(){
@@ -83,7 +83,7 @@
});
$('#coursecontent').html(
$('[id="'
- + $('a[href$="/course/'+panel+'/'+course+'/'+chapter+'"]:not([rel=overview])').data('chapterid')
+ + $('a[href$="/course/'+category+'/'+course+'/'+chapter+'"]:not([rel=overview])').data('chapterid')
+ '"]').html());
}
};

0 comments on commit 00692ed

Please sign in to comment.