예제 #1
0
 /**
  * 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();
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 /**
  * 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;
 }
예제 #4
0
 /**
  * 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);
 }