本文整理汇总了PHP中JoomdleHelperContent::multisort方法的典型用法代码示例。如果您正苦于以下问题:PHP JoomdleHelperContent::multisort方法的具体用法?PHP JoomdleHelperContent::multisort怎么用?PHP JoomdleHelperContent::multisort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JoomdleHelperContent
的用法示例。
在下文中一共展示了JoomdleHelperContent::multisort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNotJoomdleUsers
static function getNotJoomdleUsers($limitstart, $limit, $order, $order_dir, $search)
{
$lang = JFactory::getLanguage();
$db = JFactory::getDBO();
$searchEscaped = $db->Quote('%' . $db->escape($search, true) . '%', false);
if ($search) {
$query = 'SELECT *' . ' FROM #__users' . ' WHERE (username LIKE ' . $searchEscaped . ' OR email LIKE ' . $searchEscaped . ' OR name LIKE ' . $searchEscaped . ')';
} else {
$query = 'SELECT *' . ' FROM #__users';
}
$db->setQuery($query);
$jusers = $db->loadObjectList();
$ju_by_usernames = array();
foreach ($jusers as $user) {
$ju_by_usernames[$user->username] = $user;
}
$musers = JoomdleHelperContent::call_method('get_moodle_users', $limitstart, $limit, $order, $order_dir, $search);
$mu_by_usernames = array();
foreach ($musers as $user) {
$mu_by_usernames[$user['username']] = $user;
}
$rdo = array();
foreach ($jusers as $user) {
$item = array();
$item = get_object_vars($user);
$item['j_account'] = 1;
if (!array_key_exists($user->username, $mu_by_usernames)) {
// User not found in Moodle -> not a Joomdle user
$item['m_account'] = 0;
if (JoomdleHelperContent::is_admin($user->id)) {
$item['admin'] = 1;
} else {
$item['admin'] = 0;
}
$item['auth'] = 'N/A';
} else {
// User in Joomla and Moodle
$item['m_account'] = 1;
if (!$mu_by_usernames[$user->username]['admin']) {
if (JoomdleHelperContent::is_admin($user->id)) {
$item['admin'] = 1;
} else {
$item['admin'] = 0;
}
} else {
$item['admin'] = 1;
}
$item['auth'] = $mu_by_usernames[$user->username]['auth'];
}
if ($item['m_account'] == 1 && $item['auth'] == 'joomdle') {
continue;
}
$rdo[] = $item;
}
// Get Moodle only users: those without a Joomla account
$rdo2 = array();
foreach ($musers as $user) {
$item = array();
$item = $user;
$item['m_account'] = 1;
if (!array_key_exists($user['username'], $ju_by_usernames)) {
// User not found in Joomla -> not a Joomdle user
$item['j_account'] = 0;
$item['m_account'] = 1;
$item['id'] = -$user['id'];
$rdo2[] = $item;
}
}
$merged = array_merge($rdo, $rdo2);
$all = JoomdleHelperContent::multisort($merged, $order_dir, $order, 'id', 'name', 'username', 'email', 'm_account', 'j_account', 'auth', 'admin');
if ($limit) {
return array_slice($all, $limitstart, $limit);
} else {
return $all;
}
}
示例2: getNotJoomdleUsers
static function getNotJoomdleUsers($limitstart, $limit, $order, $order_dir, $search)
{
$lang = JFactory::getLanguage();
$db = JFactory::getDBO();
$searchEscaped = $db->Quote('%' . $db->escape($search, true) . '%', false);
if ($search) {
$query = 'SELECT *' . ' FROM #__users' . ' WHERE (username LIKE ' . $searchEscaped . ' OR email LIKE ' . $searchEscaped . ' OR name LIKE ' . $searchEscaped . ')';
} else {
$query = 'SELECT *' . ' FROM #__users';
}
$db->setQuery($query);
$users = $db->loadObjectList();
$u = array();
foreach ($users as $user) {
$u[]['username'] = $user->username;
}
$u_usernames = $u;
$u = JoomdleHelperContent::call_method('check_moodle_users', $u);
// print_r ($users);
$rdo = array();
$i = 0;
foreach ($users as $user) {
if ($u[$i]['m_account'] == 1 && $u[$i]['auth'] == 'joomdle') {
$i++;
continue;
}
$rdo[$i] = get_object_vars($user);
if (!$u[$i]['admin']) {
if (JoomdleHelperContent::is_admin($user->id)) {
$rdo[$i]['admin'] = 1;
} else {
$rdo[$i]['admin'] = 0;
}
} else {
$rdo[$i]['admin'] = 1;
}
$rdo[$i]['j_account'] = 1;
$rdo[$i]['m_account'] = $u[$i]['m_account'];
if ($rdo[$i]['m_account']) {
$rdo[$i]['auth'] = $u[$i]['auth'];
} else {
$rdo[$i]['auth'] = 'N/A';
}
$i++;
}
$u = JoomdleHelperContent::call_method('get_moodle_only_users', $u_usernames, $search);
if (!is_array($u)) {
$u = array();
}
$i = 0;
foreach ($u as $user) {
$u[$i]['m_account'] = 1;
$u[$i]['j_account'] = 0;
$u[$i]['id'] = -$u[$i]['id'];
$i++;
}
$merged = array_merge($rdo, $u);
$all = JoomdleHelperContent::multisort($merged, $order_dir, $order, 'id', 'name', 'username', 'email', 'm_account', 'j_account', 'auth', 'admin');
if ($limit) {
return array_slice($all, $limitstart, $limit);
} else {
return $all;
}
}