bos =& $Dippler->backoffice; if ($id) { $this->id = $id; } } public function getType() { return $this->type; } public function create() { //var_dump($this->dataXML());exit; $created = $this->bos->createCategory($this->dataXML()); if ($created) { $this->id = $created->id[0][0]; return $this->id; } return false; } public function save() { return $this->bos->editCategory($this->dataXML()); } public function delete() { return $this->bos->deleteCategory($this->idXML()); } public function load($loader = false) { if (!$loader) $loader = $this->bos->loadCategory($this->idXML()); if ($loader) { $this->id = $loader->id[0][0]; $this->name = $loader->name[0][0]; $this->slug = $loader->slug[0][0]; $this->parent = isset($loader->parent[0][0]) ? $loader->parent[0][0] : NULL; $this->count = $loader->count[0][0]; $this->course = $loader->course[0][0]; if (isset($loader->categories[0]["category"])) { foreach ($loader->categories[0]["category"] as $single) { $cat = new Category(); $cat->load((object) $single); $this->categories[$cat->id] = $cat; } } } } public function getURL() { return WWW_ROOT."course/outcomes/{$this->course}/outcome/{$this->outcome}/category/{$this->id}"; } public function canEdit() { // XXX getOwners does not seem to be defined, nor is it used as a method if (is_admin() || (is_logged_in() && in_array(get_logged_in_user_id(), $this->getOwners))) { return 1; } return 0; } public function getId() { return $this->id; } function categoriesXML() { $data = ""; foreach ($this->categories as $cat) { $categories = $cat->categoriesXML(); $data .= ""; $data .= "".$cat->id.""; $data .= "".$cat->course.""; $data .= "".$cat->parent.""; $data .= "".$cat->outcome.""; $data .= "name."]]>"; $data .= "slug."]]>"; $data .= "{$categories}"; $data .= ""; } return $data; } function idXML() { $data = ""; $data .= ""; $data .= "".$this->id.""; $data .= ""; return $data; } function dataXML() { $categories = $this->categoriesXML(); $data = ""; $data .= ""; $data .= "".$this->id.""; $data .= "".$this->course.""; $data .= "".$this->parent.""; $data .= "".$this->outcome.""; $data .= "name."]]>"; $data .= "slug."]]>"; $data .= "{$categories}"; $data .= ""; return $data; } } ?>