Changeset - 758f11033eb1
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 14 years ago 2011-04-10 00:34:54
ohnobinki@ohnopublishing.net
When crawling, use `course' instead of `class' in the JSON output.
1 file changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
inc/class.course.inc
Show inline comments
 
@@ -204,13 +204,13 @@ class Course implements IteratorAggregat
 
  {
 
    if (!empty($recursion_trace[$this->getName()]))
 
      return NULL;
 
    $recursion_trace[$this->getName()] = TRUE;
 

	
 
    $json_array = array(
 
			'class' => $this->getName(),
 
			'course' => $this->getName(),
 
			'title' => $this->title_get(),
 
			'sections' => array(),
 
			'dependencies' => array(),
 
			);
 
    foreach ($this->sections as $section)
 
      {
 
@@ -241,13 +241,18 @@ class Course implements IteratorAggregat
 
   */
 
  public static function from_json_array($json)
 
  {
 
    $title = NULL;
 
    if (!empty($json['title']))
 
      $title = $json['title'];
 
    $course = new Course($json['class'], $title);
 
    if (!empty($json['class']))
 
      {
 
	$json['course'] = $json['class'];
 
	unset($json['class']);
 
      }
 
    $course = new Course($json['course'], $title);
 

	
 
    if (!empty($json['sections']))
 
      $course->section_add(Section::from_json_arrays($json['sections']));
 
    
 
    if (!empty($json['dependencies']))
 
      foreach ($json['dependencies'] as $dependency)
0 comments (0 inline, 0 general)