/** * GET Create action. * * @param int $customer_id Customer ID. * * @return void */ public function get_create($customer_id = null) { $customer = $this->get_customer($customer_id); $this->view->customer = $customer; $this->view->contact = Service_Contact::primary($customer); $this->view->gateway = $this->get_gateway(); }
/** * Attempts to get a contact from a given ID. * * @param int $id Contact ID. * * @return Model_Contact */ protected function get_contact($customer_id, $id) { $customer = $this->get_customer($customer_id); if ($customer->seller != Seller::active()) { throw new HttpNotFoundException(); } $contact = Service_Contact::find_one($id); if (!$contact || $contact != Service_Contact::primary($customer)) { throw new HttpNotFoundException(); } return $contact; }
/** * Primary contact helper function. * * @param string|array $properties One or more contact properties to return. * * @return string */ public function contact($properties = null) { $contact = Service_Contact::primary($this); if (!$contact) { return false; } if ($properties) { $data = array(); $properties = (array) $properties; foreach ($properties as $property) { $data[] = $contact->{$property}; } return implode(' ', $data); } return $contact; }
/** * Displays a seller's contacts. * * @return void */ public function action_index() { $seller = Seller::active(); $this->view->contacts = $seller->contacts; $this->view->primary = Service_Contact::primary($seller); }