Exemple #1
0
 public function findUsers($groupId, $count, $withPhoto = true)
 {
     $userTable = BOL_UserDao::getInstance()->getTableName();
     $avatarJoin = !$withPhoto ? '' : "INNER JOIN `" . BOL_AvatarDao::getInstance()->getTableName() . "` as `a`\n    \t\t\tON( `u`.`id` = `a`.`userId` )";
     $query = "\n            SELECT `u`.* FROM `{$userTable}` AS `u`\n\n            INNER JOIN `" . GROUPS_BOL_GroupUserDao::getInstance()->getTableName() . "` AS `g`\n                    ON( `u`.`id` = `g`.`userId` )\n\n            LEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` as `s`\n                    ON( `u`.`id` = `s`.`userId` )\n\n            LEFT JOIN `" . BOL_UserApproveDao::getInstance()->getTableName() . "` as `d`\n                    ON( `u`.`id` = `d`.`userId` )\n\n            {$avatarJoin}\n\n            WHERE g.groupId=:g AND `s`.`id` IS NULL AND `d`.`id` IS NULL\n            ORDER BY `u`.`activityStamp` DESC\n            LIMIT :ls, :le";
     return OW::getDbo()->queryForObjectList($query, BOL_UserDao::getInstance()->getDtoClassName(), array('ls' => 0, 'le' => $count, 'g' => $groupId));
 }
 /**
  * Class constructor
  */
 private function __construct()
 {
     $this->avatarDao = BOL_AvatarDao::getInstance();
 }
Exemple #3
0
 public function findByAccountTypes($count, $accountTypes, $withPhoto = true)
 {
     if (empty($accountTypes)) {
         return array();
     }
     $avatarJoin = !$withPhoto ? '' : "INNER JOIN `" . BOL_AvatarDao::getInstance()->getTableName() . "` as `a`\n    \t\t\tON( `u`.`id` = `a`.`userId` )";
     $query = "\n            SELECT DISTINCT `u`.*\n            FROM `{$this->getTableName()}` AS `u`\n\n    \t\tLEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` as `s`\n    \t\t\tON( `u`.`id` = `s`.`userId` )\n\n    \t\tLEFT JOIN `" . BOL_UserApproveDao::getInstance()->getTableName() . "` as `d`\n    \t\t\tON( `u`.`id` = `d`.`userId` )\n\n                {$avatarJoin}\n                    \n    \t\tWHERE `s`.`id` IS NULL AND `d`.`id` IS NULL AND `u`.`accountType` IN ( '" . implode("', '", $accountTypes) . "' )\n\n            ORDER BY `u`.`activityStamp` DESC\n            LIMIT ?, ?\n            ";
     return $this->dbo->queryForObjectList($query, $this->getDtoClassName(), array(0, $count));
 }