示例#1
0
 private function createUnitElearningPreferences()
 {
     //create steam container for unit elearning preferences
     if ($GLOBALS["STEAM"]->get_login_user_name() != "root") {
         // MUST BE DONE AS ROOT USER
         $root_steam = new steam_connector(STEAM_SERVER, STEAM_PORT, STEAM_ROOT_LOGIN, STEAM_ROOT_PW);
         $this->unit_elearning_preferences = steam_factory::create_container($root_steam->get_id(), $this->unit_elearning_preferences_name, $this->workroom);
         $koala_course = new koala_group_course($this->course_group);
         //$this->unit_elearning_preferences->set_sanction_all($this->steam_user);
         $this->unit_elearning_preferences->set_sanction_all($koala_course->get_group_staff());
         //$this->unit_elearning_preferences->set_sanction_all($koala_course->get_group_admins());
         $root_steam->buffer_flush();
         $root_steam->disconnect();
     } else {
         $this->unit_elearning_preferences = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $this->unit_elearning_preferences_name, $this->workroom);
         $koala_course = new koala_group_course($this->course_group);
         //$this->unit_elearning_preferences->set_sanction_all($this->steam_user);
         $this->unit_elearning_preferences->set_sanction_all($koala_course->get_group_staff());
         //$this->unit_elearning_preferences->set_sanction_all($koala_course->get_group_admins());
         $GLOBALS["STEAM"]->buffer_flush();
     }
     //
     //create attributes.xml
     $this->unit_elearning_preferences = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), $this->path_to_unit_elearning_preferences);
     if ($this->unit_elearning_preferences === 0) {
         $this->unit_elearning_preferences = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), $this->path_to_unit_elearning_preferences);
     }
     if ($this->unit_elearning_preferences === 0) {
         throw new Exception("broke datastructure");
     }
     $attributes_xml = new SimpleXMLElement("<attributes></attributes>");
     $attributes_xml->addChild("OBJ_DESC", "storage for unit_elearning user data");
     $attributes_xml->addChild("OBJ_HIDDEN", "TRUE");
     $attributes_xml->addChild("OBJ_TYPE", "unit_elearning_data");
     steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "attributes.xml", (string) $attributes_xml->asXML(), "text/xml", $this->unit_elearning_preferences);
     $GLOBALS["STEAM"]->buffer_flush();
 }