Example #1
0
 /**
  * Returns user's account by user id
  *
  * @param 	int $userId
  * @return	RM_Points_Account
  */
 public function getAccount($userId)
 {
     if (isNull($obUser = M('User')->loadUserById($userId))) {
         throw new RM_Base_Exception_Internal("Unable to load user by id: `{$userId}'");
     }
     return $this->_mapper->loadAccountByUserOrCreate($obUser);
 }
Example #2
0
 public function registerAmount($eventName, $value, $description, array $params = array())
 {
     $obPayment = $this->_mapper->storage('payment')->createObject(array('account_id' => $this->id(), 'amount' => $value, 'descr' => $description, 'event' => $eventName, 'amount_date' => M('Date')->dbDate()));
     foreach ($params as $name => $value) {
         $obPayment->{$name} = $value;
     }
     return $obPayment->save();
 }
Example #3
0
 public function recountStat()
 {
     $this->_mapper->recountUserStat();
 }
Example #4
0
 public function execute()
 {
     return $this->_mapper->getEvent($this->event)->process($this);
 }
Example #5
0
 public function calculateNoPurchaseMark($date = NULL)
 {
     return $this->_mapper->getEvent('no-purchase')->init($date);
 }