예제 #1
0
 public function getMembersList($option = array(), $limit = 10, $page = 1)
 {
     $sql = '';
     if (is_array($option) or $option) {
         $i = 1;
         $count = count($option);
         foreach ($option as $key => $value) {
             if ($i == $count) {
                 $sql .= "{$key}='" . $value . "'";
             } else {
                 $sql .= "{$key}='" . $value . "' AND ";
             }
             $i++;
         }
     }
     $offset = $page == 1 ? 0 : ($page - 1) * $limit;
     $table = $this->members->table;
     $list = $this->members->field("{$table}.id,{$table}.email,{$table}.username,{$table}.published,{$table}.role_id,r.name as role_name,mi.ip,mi.last_ip,im.path as cover,mi.last_dateline as dateline,mi.summary")->joinQuery("user_role as r", "{$table}.role_id=r.id")->joinQuery('member_info as mi', "{$table}.id=mi.id")->joinQuery('images_member as im', "im.imid=mi.avatar_id")->where($sql)->order("{$table}.id")->limit("{$offset},{$limit}")->fetchList();
     if (is_array($list)) {
         foreach ($list as $key => $value) {
             if (isset($value['cover']) and $value['cover']) {
                 $list[$key]['cover_small'] = ImageControl::getRealCoverSize($list[$key]['cover']);
                 $list[$key]['cover_medium'] = ImageControl::getRealCoverSize($list[$key]['cover'], "medium");
                 $list[$key]['cover'] = ImageControl::getRelativeImage($value['cover']);
             }
         }
         return $list;
     }
     return false;
 }