Permalink
Browse files

Merge branch 'address-test'

  • Loading branch information...
2 parents e42562b + 9cc37d6 commit 0b56b71e9641a3e79ec7fec5a3e05858719270f2 @koopa committed Oct 22, 2012
@@ -6,30 +6,30 @@ require("courseheader.php");
<div id="coursenavigation">
<ol class="tree">
- <li class="file"><a href="#" onClick="selectPart('default')">Introduction</a></li>
+ <li class="file"><a data-contentid="default" href="#/course/General/Introduction">Introduction</a></li>
<li>
<label for="theory">Theory</label><input type="checkbox" checked id="theory" />
<ol>
- <li class="file"><a href="#" onClick="selectPart('chapter1')">Chapter 1</a></li>
+ <li class="file"><a data-contentid="chapter1" href="#/course/General/Chapter+1">Chapter 1</a></li>
*** add more chapter links here ***
</ol>
</li>
<li>
<label for="exercises">Exercises</label> <input type="checkbox" checked id="exercises" />
<ol>
- <li class="file"><a href="#" onClick="selectPart('exercise1')">Exercise 1</a></li>
+ <li class="file"><a data-contentid="exercise1" href="#/course/General/Exercise+1">Exercise 1</a></li>
*** add more exercise links here ***
</ol>
</li>
- <li class="file"><a href="#" onClick="selectPart('examn')">Exam</a></li>
+ <li class="file"><a data-contentid="examn" href="#/course/General/Exam">Exam</a></li>
</ol>
</div>
<div id="coursecontent">
<div id="default">
Default
- <p class="center"><a href="#" onClick="selectPart('chapter1')">>> Next Chapter >></a></p>
+ <p class="center"><a href="#/course/General/[nextChapterName]">>> Next Chapter >></a></p>
</div>
<div id="chapter1">
View
@@ -27,20 +27,62 @@
// Description: Load the course file specified by the GET variable 'id'
//
- $courseid = isset($_GET['id']) ? $_GET['id'] : 0;
- $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 overview!</p>";
- $filename = "courses/course".$courseid.".php";
+ 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!
+ </p>";
+
$mincourseid = 0;
$maxcourseid = 100000;
- if(!isset($courseid)||!is_numeric($courseid)||$courseid<$mincourseid||$courseid>$maxcourseid)
- echo $errorstring;
- else
- {
- if(is_readable($filename))
- include($filename);
- else
- echo $errorstring;
- }
+ echo '<div id="coursenavigation">
+ <ol class="tree">';
+
+ foreach($categories as $id => $name){
+ echo '<li><a href="/course/'.urlencode($name).'"><label for="'.urlencode($name).'">
+ '.$name.'</label></a>
+ <input type="checkbox" id="'.urlencode($name).'" />';
+ if(count($tree[$id]) > 0){
+ echo '<ol>';
+ }
+ foreach($tree[$id] as $course){
+ echo '<li><a href="/course/'.urlencode($name)
+ .'/'.urlencode($course['title']).'"><label for="'.urlencode($course['title']).'">
+ '.$course['title'].'</label></a>
+ <input type="checkbox" id="'.urlencode($course['title']).'" />
+ <ol>';
+ $filename = "courses/course".$course['id'].".php";
+ if(is_readable($filename)){
+ $courseData = include($filename);
+ }
+ if($courseData['nav']) foreach($courseData['nav'] as $chapterType => $chapters){
+ if($chapters) foreach($chapters as $contentId => $chapterName){
+ //$chapterType class to style icons
+ echo '<li class="file '.$chapterType.'"><a
+ data-contentid="'.$contentId.'"
+ data-chapterid="'.$chapterName.'_'.$course['id'].'"
+ href="/course/'.urlencode($name)
+ .'/'.urlencode($course['title'])
+ .'/'.urlencode($chapterName).'">'.$chapterName.'
+ </a>
+ <script type="text/html" id="'.$chapterName.'_'.$course['id'].'">
+ '.$courseData['content'][$chapterType][$contentId].'
+ </script>
+ </li>';
+ }
+ }
+ echo '</ol></li>';
+ }
+ if(count($tree[$id]) > 0){
+ echo '</ol>';
+ }
+ echo '</li>';
+ }
+ echo '</ol><!-- end ol class tree -->
+ </div><!-- end div id="coursenavigation" -->';
+
?>
+ <div id="coursecontent"><?php echo $errorstring; ?></div>
</div>
View
@@ -20,25 +20,21 @@
// //
///////////////////////////////////////////////////////////////////////////////////
-require("../getsmfuser.php");
+require_once("../getsmfuser.php");
$notloggedintext = "<p class=\"warning\">Warning: You aren't logged in to the Hackits forum, submitting this exam will only count if you are logged in!</p>";
+$courseid = isset($_GET['id']) ? $_GET['id'] : 0;
?>
<script type="text/javascript">
-
- // shows the specified div and hides all others
- function selectPart(part){ $("#"+part).show().siblings().hide(); }
-
// when the examn form is submitted, show the results in a dialog window
$(document).ready(function(){
$("#examnform").submit( function () {
$.post(
'examnhandler.php?id=<? echo $courseid; ?>',
$(this).serialize(),
function(data){
- $("#examnresult").empty().append( data );
- $("#examnresult").dialog("open");
+ $("#examnresult").empty().append(data).dialog("open");
}
);
return false;
@@ -51,4 +47,4 @@ function(data){
</script>
-<div id="examnresult" title="Exam Results"></div>
+<div id="examnresult" title="Exam Results"></div>
Oops, something went wrong.

0 comments on commit 0b56b71

Please sign in to comment.