/** * Set this as awarded * * Unsets any others and then sets itself * */ public function setAwarded() { //loading resources $listing =& $this->getOneToOne('byrdlist_listings'); $awarded =& $listing->getAwarded(); $owner = eFactory::getUser($listing->author_id()); $author = eFactory::getUser($this->author_id()); if ($awarded && !$awarded->isNew()) { $awarded->awarded = 0; $awarded->store(); } $this->awarded = 1; $this->store(); require_once EBOOK_HELPERS . DS . 'mailer.php'; if ($listing->type() == 'donation') { BMailer::donationAwarded_Owner($owner, $listing, $author); BMailer::donationAwarded_Requester($author, $listing); } else { BMailer::needAwarded_Owner($owner, $listing, $author); BMailer::needAwarded_Requester($author, $listing); } return true; }