public function get() { if ($t = parent::get()) { $this->_brand->id = $t['brand']; $t['brand'] = $this->_brand->get(); } return $t; }
public function create($id) { $campaign = new Campaign($id); $cinfo = $campaign->get(); $buser = new User($cinfo['brand']); $binfo = $buser->get(); $this->mail_enqueue(array('to' => $binfo['email'], 'from' => $this->_from_email, 'subject' => 'Campaign Created', 'message' => $this->_mail_body($this->_prefix . __FUNCTION__ . '.php', array('user' => $binfo, 'campaign' => $cinfo)))); // Send notification to admins $admin = new Admin(null); $emails = array(); $recipients = array(); foreach ($admin->filter(array()) as $doc) { $emails[$doc['email']] = true; $recipients[] = $doc['_id']; } $this->add(array('sender' => $binfo['_id'], 'recipients' => $recipients, 'text' => $this->_body('admin.' . $this->_prefix . __FUNCTION__ . '.php', array('brand' => $binfo)), 'type' => $this->_prefix . __FUNCTION__, 'url' => Url::base('admin/campaign/view/' . $id))); $this->mail_enqueue(array('to' => array_keys($emails), 'from' => $this->_from_email, 'subject' => 'New Campaign Approval', 'message' => $this->_mail_body('admin.' . $this->_prefix . __FUNCTION__ . '.php', array('brand' => $binfo, 'campaign' => $cinfo)))); }