当前位置: 首页>>代码示例>>PHP>>正文


PHP JoomdleHelperContent::multisort方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:76,代码来源:content.php

示例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;
     }
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:64,代码来源:content.php


注:本文中的JoomdleHelperContent::multisort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。