예제 #1
0
 /**
  * Returns an instance of class.
  *
  * @return USERCREDITS_BOL_ActionPriceDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
예제 #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));
 }
예제 #3
0
 /**
  * @param USERCREDITS_BOL_ActionPrice $ap
  */
 public function updateCreditsActionPrice(USERCREDITS_BOL_ActionPrice $ap)
 {
     $this->actionPriceDao->save($ap);
 }