bos =& $Dippler->backoffice;
if ($id) {
$this->id = $id;
}
}
public function create() {
//var_dump($this->dataXML());exit;
$created = $this->bos->createLearningOutcome($this->dataXML());
if ($created) {
$this->id = $created->id[0][0];
return $this->id;
}
return false;
}
public function save() {
return $this->bos->editLearningOutcome($this->dataXML());
}
public function delete() {
return $this->bos->deleteLearningOutcome($this->idXML());
}
public function load($loader = false) {
if (!$loader) $loader = $this->bos->loadLearningOutcome($this->idXML());
if ($loader) {
$this->type = 'learningoutcome';
$this->id = $loader->id[0][0];
$this->title = $loader->title[0][0];
$this->creator = $loader->creator[0][0];
if (isset($loader->created[0][0])) $this->created = $loader->created[0][0];
if (isset($loader->modified[0][0])) $this->modified = $loader->modified[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->id}/edit";
}
public function canEdit() {
if (!is_logged_in()) {
return 0;
}
if (is_admin() || ($this->getOwner() == get_logged_in_user_id()) || $this->getCourseEntity()->canEdit()) {
return 1;
}
return 0;
}
public function getId() {
return $this->id;
}
public function getType() {
return $this->type;
}
public function getOwner() {
return $this->creator;
}
public function getOwnerEntity() {
if (!isset($this->creator_entity)) {
$user = new User($this->creator);
$user->load();
$this->creator_entity = $user;
return $user;
}
return $this->creator_entity;
}
public function getCourse() {
return $this->course;
}
public function getCourseEntity() {
if (!isset($this->course_entity)) {
$course = new Course($this->course);
$course->load();
$this->course_entity = $course;
return $course;
}
return $this->course_entity;
}
/*function categoriesXML() {
$data = "";
foreach ($this->categories as $cat) {
$categories = $cat->categoriesXML();
$data .= "";
$data .= "".$cat->id."";
$data .= "".$cat->course."";
$data .= "name."]]>";
$data .= "slug."]]>";
$data .= "{$categories}";
$data .= "";
}
return $data;
}*/
function categoriesXML() {
$data = "";
foreach ($this->categories as $cat) {
$data .= "";
$data .= $cat->getId();
$data .= "";
}
return $data;
}
function idXML() {
$data = "";
$data .= "";
$data .= "".$this->id."";
$data .= "";
return $data;
}
function dataXML() {
$categories = $this->categoriesXML();
$data = "";
$data .= "";
$data .= "".$this->id."";
$data .= "title."]]>";
$data .= "{$this->course}";
$data .= "{$categories}";
$data .= "";
return $data;
}
}
?>