Esempio n. 1
0
 /**
  * Charity profile page.
  */
 function show($id)
 {
     $c = Charity::find_by_id($id);
     if (!$c) {
         throw new PageNotFoundException();
     }
     return array('charity' => $c);
 }
Esempio n. 2
0
 /**
  * Creates new challenge for given charity and redirects user to payment
  * 
  * @todo read & validate form values
  */
 function new_challenge($charity_id)
 {
     $charity = Charity::find_by_id($charity_id);
     if (!$charity) {
         throw new PageNotFoundException();
     }
     // FIXME: check for duplicates
     $challenge = new Challenge();
     $challenge->charity_id = $charity->id;
     $challenge->user_id = $this->logged_in_user()->id;
     $challenge->base_donation_pence = 1000;
     $challenge->matching_percentage = 10;
     $challenge->matching_upper_limit_pence = 5000;
     $challenge->save();
     return $this->do_prepay_challenge($challenge);
 }