本文整理汇总了PHP中Network::get_members_by_type方法的典型用法代码示例。如果您正苦于以下问题:PHP Network::get_members_by_type方法的具体用法?PHP Network::get_members_by_type怎么用?PHP Network::get_members_by_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network::get_members_by_type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_links
private function get_links()
{
//get total count
$param = array('network_id' => PA::$network_info->network_id, 'cnt' => TRUE, 'user_type' => NETWORK_WAITING_MEMBER);
$param['sort_by'] = $this->sort_by;
$param['direction'] = $this->direction;
$this->Paging["count"] = Network::get_members_by_type($param);
//now we dont need $param['cnt']
unset($param['cnt']);
$param['show'] = $this->Paging['show'];
$param['page'] = $this->Paging['page'];
//get actual list
$users = Network::get_members_by_type($param);
$links = $users['users_data'];
return $links;
}
示例2: get_members
/**
* Function : get_members()
* Purpose : get members of the network based on the parameters passed to it
* @param $params - array - the various elements of this array may be defined
* as follows
* $params['search_keyword']=>'blah'
* $params['neglect_owner']=>TRUE - if we want to exclude owner of n/w
* $params['cnt']=>TRUE - if we want to get count
* $params['network_id']=>2 - get members of network having id 2
* $params['sort_by']=> 'U.created' - column name
* $params['direction']=> DESC - order by clause
* $params['page']=> 2 - page number 2
* $params['show']=> 5 - show 5 records
* $params['also_search_fullname'] => true - will match against user's
* first, last, and full (combined) name as well as their username
* @return type array
* returns array of members of n/w
*/
public static function get_members($params)
{
Logger::log("[ Enter: function Network::get_members] \n");
// fix Mother Network owner not set issue
if ($params['network_id'] == 1) {
$owner_arr = Network::get_members_by_type(array('network_id' => 1, 'user_type' => NETWORK_OWNER));
if ($owner_arr['total_users'] == 0) {
Network::update_membership_type(array('user_id_array' => array(1), 'user_type' => NETWORK_OWNER, 'network_id' => 1));
}
}
$data = array();
$notshow = UNVERIFIED;
if (isset($params['show_waiting_users']) && $params['show_waiting_users'] == true) {
$sql = "SELECT DISTINCT U.user_id, NU.user_id, NU.network_id, NU.user_type, U.*\n FROM {networks_users} AS NU, {users} AS U\n WHERE NU.network_id = ?\n AND NU.user_id = U.user_id\n AND U.is_active <> ? ";
//count query to find total members
$sql_count = "SELECT count(DISTINCT U.user_id) AS CNT\n FROM {networks_users} AS NU, {users} AS U\n WHERE NU.network_id = ?\n AND NU.user_id = U.user_id\n AND U.is_active <> ? ";
array_push($data, $params['network_id'], DELETED);
} else {
$sql = "SELECT NU.user_id, NU.network_id, NU.user_type, U.*\n FROM {networks_users} AS NU, {users} AS U\n WHERE NU.network_id = ?\n AND NU.user_id = U.user_id\n AND U.is_active <> ? AND U.is_active <> ? AND NU.user_type <> ? ";
//count query to find total members
$sql_count = "SELECT count(*) AS CNT\n FROM {networks_users} AS NU, {users} AS U\n WHERE NU.network_id = ?\n AND NU.user_id = U.user_id\n AND U.is_active <> ? AND U.is_active <> ? AND NU. user_type <> ? ";
array_push($data, $params['network_id'], DELETED, UNVERIFIED, NETWORK_WAITING_MEMBER);
// get only active members
}
//we dont want the owner of the network to come in listing
if (!empty($params['neglect_owner']) && $params['neglect_owner'] == TRUE) {
$sql .= " AND NU.user_type <> ? AND U.user_id <> ? ";
$sql_count .= " AND NU.user_type <> ? AND U.user_id <> ? ";
array_push($data, NETWORK_OWNER, SUPER_USER_ID);
}
//we have search criteria
if (!empty($params['search_keyword'])) {
$sql .= " AND ( U.login_name LIKE '%" . $params['search_keyword'] . "%' ";
$sql_count .= " AND ( U.login_name LIKE '%" . $params['search_keyword'] . "%' ";
// If we want to search for the full name, not just username
if (isset($params['also_search_fullname']) && $params['also_search_fullname'] == true) {
$sql .= "OR U.first_name LIKE '%" . $params['search_keyword'] . "%' \n OR U.last_name LIKE '%" . $params['search_keyword'] . "%'\n OR CONCAT(U.first_name, ' ',U.last_name) LIKE '%" . $params['search_keyword'] . "%'";
$sql_count .= "OR U.first_name LIKE '%" . $params['search_keyword'] . "%'\n OR U.last_name LIKE '%" . $params['search_keyword'] . "%'\n OR CONCAT(U.first_name, ' ',U.last_name) LIKE '%" . $params['search_keyword'] . "%'";
}
$sql .= ")";
$sql_count .= ")";
}
// if we are intersted in getting total records only then return count
if (!empty($params['cnt']) && $params['cnt'] == TRUE) {
$cnt = Dal::query_one_assoc($sql_count, $data);
Logger::log("[ Enter: function Network::get_members returning count] \n");
return $cnt['CNT'];
}
// OK we want to find the details
$sort_by = !empty($params['sort_by']) ? $params['sort_by'] : 'U.created';
$direction = !empty($params['direction']) ? $params['direction'] : 'DESC';
$order_by = ' ORDER BY ' . $sort_by . ' ' . $direction;
if (!empty($params['page']) && !empty($params['show'])) {
$start = ($params['page'] - 1) * $params['show'];
$limit = ' LIMIT ' . $start . ',' . $params['show'];
} else {
$limit = "";
}
$sql = $sql . $order_by . $limit;
$res = Dal::query($sql, $data);
$users_data = array();
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
// get current info for the user
$u = new User();
$u->load((int) $row['user_id']);
$row['display_name'] = $u->display_name;
$row['user_obj'] = $u;
// add user object, when it is already loaded!
$users_data[] = $row;
}
if (empty($users_data)) {
return NULL;
}
$final_array = array('users_data' => $users_data, 'total_users' => count($users_data));
Logger::log("[ Exit: function Network::get_members] \n");
return $final_array;
}