bos = new BackOfficeService(); if ($identifier) { if (is_numeric($identifier)) { $this->id = $identifier; } else { $this->email = $identifier; } } } public function load($loader = NULL) { if (!is_object($loader)) { $loader = $this->bos->loadUser($this->idXML()); } if ($loader) { $this->type = "user"; $this->id = $loader->id[0][0]; $this->email = $loader->email[0][0]; $this->level = $loader->level[0][0]; $this->username = $loader->username[0][0]; $this->firstname = $loader->firstname[0][0]; $this->lastname = $loader->lastname[0][0]; $this->fullname = $this->firstname ." ". $this->lastname; } } public function approve() { return $this->bos->approveUser($this->dataXML()); } public function unapprove() { return $this->bos->unApproveUser($this->dataXML()); } public function getURL() { return WWW_ROOT."profile/view/".$this->id; } public function getAvatarURL($size=20) { $default = WWW_ROOT."views/graphics/user.png"; return "http://www.gravatar.com/avatar/".md5(strtolower(trim($this->email)))."?d=".urlencode($default)."&s={$size}"; } public function getType() { return $this->type; } public function getId() { return $this->id; } public function getEmail() { return $this->email; } public function getLevel() { return $this->level; } public function getUsername() { return $this->username; } public function getFirstname() { return $this->firstname; } public function getLastname() { return $this->lastname; } public function getFullname() { return $this->fullname; } function idXML() { $data = ""; $data .= ""; if ($this->id) { $data .= "{$this->id}"; } else { $data .= "{$this->email}"; } $data .= ""; return $data; } function dataXML() { $data = ""; $data .= ""; $data .= "{$this->id}"; $data .= "{$this->email}"; $data .= "{$this->level}"; $data .= ""; return $data; } } ?>