Example #1
0
 /**
  * Class constructor
  *
  * This function is used to instantiate the class. The instatiation is done
  * based on a lesson id. If an entry with this id is not found in the database,
  * an eF_ManifestException is thrown.
  * <br/>Example:
  * <code>
  * $manifest = new EfrontManifest(32);                     //32 is a lesson id
  * </code>
  *
  * @param int $lesson_id The lesson id
  * @since 1.0
  * @access public
  */
 function __construct($lesson_id)
 {
     if (!eF_checkParameter($lesson_id, 'id')) {
         throw new eF_ManifestException(_INVALIDID, eF_ManifestException::INVALID_ID);
     }
     $lesson = eF_getTableData("lessons", "*", "id = {$lesson_id}");
     if (sizeof($lesson) == 0) {
         throw new eF_ManifestException(_LESSONDOESNOTEXIST, eF_GroupException::LESSON_NOT_EXISTS);
     } else {
         $this->lesson_id = $lesson_id;
         $content = new EfrontContentTree($this->lesson_id);
         $cunit = $content->getCurrentNode();
         $this->addUnit(new EfrontUnit($cunit[0]));
         $lunits = $content->getNextNodes();
         for ($i = 0; $i < sizeof($lunits); $i++) {
             $this->addUnit(new EfrontUnit($lunits[$i]));
         }
     }
 }