/**
  * Class constructor
  *
  */
 private function __construct()
 {
     $this->balanceDao = USERCREDITS_BOL_BalanceDao::getInstance();
     $this->actionDao = USERCREDITS_BOL_ActionDao::getInstance();
     $this->actionPriceDao = USERCREDITS_BOL_ActionPriceDao::getInstance();
     $this->packDao = USERCREDITS_BOL_PackDao::getInstance();
     $this->logDao = USERCREDITS_BOL_LogDao::getInstance();
 }
Exemple #2
0
 /**
  * Finds action list by type
  * 
  * @param string $type
  * @param $accTypeId
  * @return array
  */
 public function findList($type, $accTypeId)
 {
     switch ($type) {
         case 'earn':
             $amountCond = ' AND `ap`.`amount` > 0 ';
             break;
         case 'lose':
             $amountCond = ' AND `ap`.`amount` < 0 ';
             break;
         default:
             $amountCond = ' AND `ap`.`amount` = 0 ';
             break;
     }
     $actionPriceDao = USERCREDITS_BOL_ActionPriceDao::getInstance();
     $sql = "SELECT `a`.*, `ap`.`amount`, `ap`.`disabled` FROM `" . $this->getTableName() . "` AS `a`\n            LEFT JOIN `" . $actionPriceDao->getTableName() . "` AS `ap`\n                ON (`a`.`id`=`ap`.`actionId` AND `ap`.`accountTypeId` = :id)\n            WHERE `a`.`isHidden` = 0 AND `a`.`active` = 1 " . $amountCond;
     return $this->dbo->queryForList($sql, array('id' => $accTypeId));
 }