evalID = $args['evalID']; else $this->evalID = Request::option("evalID"); $this->load_mode = ($args['load_mode'] ? $args['load_mode'] : EVAL_LOAD_NO_CHILDREN); if (empty($this->evalID)){ print _("Fehler in EvaluationTree: Es wurde keine evalID übergeben"); exit (); } /* ------------------------------------------------------------------- */ parent::__construct(); } # =========================================== end: constructor and destructor # # Define public functions =================================================== # /** * initializes the tree * store rows from evaluation tables in array $tree_data * @access public */ function init() { /* create the evaluation -------------------> */ $this->eval = new Evaluation( $this->evalID, NULL, $this->load_mode ); $this->root_name = $this->eval->getTitle(); $this->root_content = $this->eval->getText(); /* create the tree structure ---------------> */ parent::init(); foreach( $this->eval->getChildren() as $group ) { $this->recursiveInit( $group ); $this->tree_data[$group->getObjectID()]["text"] = $group->getText(); $this->tree_data[$group->getObjectID()]["object"] = $group; $this->storeItem( $group->getObjectID(), "root", $group->getTitle(), $group->getPosition() ); } /* <---------------------------------------- */ } /** * initialize the sub-groups. * * @access private * @param object EvaluationGroup the current group to be initialized. */ function recursiveInit( $group ) { // only groups are interesting here. if( $group->x_instanceof() != INSTANCEOF_EVALGROUP ) return; if( $children = $group->getChildren() ) { foreach( $children as $child ) { $this->recursiveInit( $child ); } } // store current object itself $this->tree_data[$group->getObjectID()]["object"] = $group; $this->storeItem( $group->getObjectID(), $group->getParentID(), $group->getTitle(), $group->getPosition() ); } function &getGroupObject($item_id, $renew = false){ if (is_object($this->tree_data[$item_id]['object'])){ if ($renew) $this->recursiveInit(new EvaluationGroup($item_id,null,$this->load_mode)); return $this->tree_data[$item_id]['object']; } else { return new EvaluationGroup($item_id,null,$this->load_mode); } } # ===================================================== end: public functions # } ?>