bos =& $Dippler->backoffice; if ($id) { $this->id = $id; } } public function add() { return $this->bos->addLearner($this->dataXML()); } public function enroll() { return $this->bos->enrollLearner($this->dataXML()); } public function activate() { return $this->bos->activateLearner($this->dataXML()); } public function remove() { return $this->bos->removeLearner($this->idXML()); } public function load($loader = false) { if (!$loader) $loader = $this->bos->loadLearner($this->idXML()); if ($loader) { $this->type = 'learner'; $this->id = $loader->id[0][0]; $this->course = $loader->course[0][0]; $this->email = $loader->email[0][0]; $this->firstname = $loader->firstname[0][0]; $this->lastname = $loader->lastname[0][0]; $this->status = $loader->status[0][0]; if (isset($loader->groups[0]['coursegroup'])) { foreach ($loader->groups[0]['coursegroup'] as $single) { $group = new Coursegroup(); $group->load((object) $single); $this->groups[$group->id] = $group; } } if (isset($loader->blogurl[0][0])) $this->blogurl = $loader->blogurl[0][0]; $this->user_id = $loader->{'user_id'}[0][0]; if (isset($loader->activity_count[0][0])) $this->activity_count = $loader->activity_count[0][0]; if (isset($loader->last_action_date[0][0])) $this->last_action_date = $loader->last_action_date[0][0]; } } public function getURL() { return $this->getPortfolioURL(); } public function getPortfolioURL() { return WWW_ROOT."course/participants/{$this->course}/portfolio/{$this->id}"; } public function getProfileURL() { return WWW_ROOT."profile/view/{$this->user_id}"; } public function getBlogURL() { return $this->blogurl; } public function getType() { return $this->type; } public function canEdit() { if (is_admin()) { return 1; } return 0; } public function getCourse() { return $this->course; } public function getEmail() { return $this->email; } public function getUserId() { return $user_id; } public function getFirstname() { return $this->firstname; } public function getLastname() { return $this->lastname; } public function getFullname() { return $this->firstname." ".$this->lastname; } public function getStatus() { return $this->status; } public function isEnrolled() { if ($this->getStatus() > 0) { return true; } return false; } public function isActive() { if ($this->getStatus() == 5) { return true; } return false; } public function getActivityCount() { if ((int)$this->activity_count > 0) { return $this->activity_count; } return ""; } public function getLastActionDate() { return $this->last_action_date; } function idXML() { $data = ""; $data .= ""; $data .= "".$this->id.""; $data .= ""; return $data; } function dataXML() { $data = ""; $data .= ""; $data .= "".$this->id.""; $data .= "".$this->course.""; $data .= "{$this->user_id}"; $data .= "firstname."]]>"; $data .= "lastname."]]>"; $data .= "".$this->status.""; $data .= ""; return $data; } function hasGroups() { if (sizeof($this->groups)>0) return true; return false; } function getGroups() { return $this->groups; } } ?>