top = $top; $this->state = array(); } function decode_state($encoded_state) { $this->state = json_decode($encoded_state, true); } function encode_state() { return json_encode($this->state); } // get current item and fraction done // function at() { $this->xset = null; $this->top->walk($this, false, $this->frac_done); } // move to the next item, and return it in $this->item // (null if course finished) // function next() { $this->top->walk($this, true, $this->frac_done); } } function enum_course($course) { $iter = new BoltIter($course); while (1) { $x = $iter->at(); if (!$x) break; echo "at: $x->url\n"; $x = $iter->next(); if (!$x) break; echo "next: $x->filename\n"; } echo "course over\n"; } ?>