本文整理汇总了PHP中GradebookUtils::get_user_array_from_sql_result方法的典型用法代码示例。如果您正苦于以下问题:PHP GradebookUtils::get_user_array_from_sql_result方法的具体用法?PHP GradebookUtils::get_user_array_from_sql_result怎么用?PHP GradebookUtils::get_user_array_from_sql_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GradebookUtils
的用法示例。
在下文中一共展示了GradebookUtils::get_user_array_from_sql_result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_all_users
/**
* @param array $evals
* @param array $links
* @return array
*/
public static function get_all_users($evals = array(), $links = array())
{
$coursecodes = array();
$users = array();
// By default add all user in course
$coursecodes[api_get_course_id()] = '1';
$users = GradebookUtils::get_users_in_course(api_get_course_id());
foreach ($evals as $eval) {
$coursecode = $eval->get_course_code();
// evaluation in course
if (isset($coursecode) && !empty($coursecode)) {
if (!array_key_exists($coursecode, $coursecodes)) {
$coursecodes[$coursecode] = '1';
$users = array_merge($users, GradebookUtils::get_users_in_course($coursecode));
}
} else {
// course independent evaluation
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_res = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'SELECT user.user_id, lastname, firstname, user.official_code
FROM ' . $tbl_res . ' as res, ' . $tbl_user . ' as user
WHERE
res.evaluation_id = ' . intval($eval->get_id()) . ' AND
res.user_id = user.user_id
';
$sql .= ' ORDER BY lastname, firstname';
if (api_is_western_name_order()) {
$sql .= ' ORDER BY firstname, lastname';
}
$result = Database::query($sql);
$users = array_merge($users, GradebookUtils::get_user_array_from_sql_result($result));
}
}
foreach ($links as $link) {
// links are always in a course
$coursecode = $link->get_course_code();
if (!array_key_exists($coursecode, $coursecodes)) {
$coursecodes[$coursecode] = '1';
$users = array_merge($users, GradebookUtils::get_users_in_course($coursecode));
}
}
return $users;
}