本文整理汇总了PHP中Evaluation::create_evaluation_objects_from_sql_result方法的典型用法代码示例。如果您正苦于以下问题:PHP Evaluation::create_evaluation_objects_from_sql_result方法的具体用法?PHP Evaluation::create_evaluation_objects_from_sql_result怎么用?PHP Evaluation::create_evaluation_objects_from_sql_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evaluation
的用法示例。
在下文中一共展示了Evaluation::create_evaluation_objects_from_sql_result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_evaluations_with_result_for_student
/**
* Retrieve evaluations where a student has results for
* and return them as an array of Evaluation objects
* @param int $cat_id parent category (use 'null' to retrieve them in all categories)
* @param int $stud_id student id
*/
public static function get_evaluations_with_result_for_student($cat_id = null, $stud_id)
{
$tbl_grade_evaluations = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$tbl_grade_results = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'SELECT * FROM ' . $tbl_grade_evaluations . '
WHERE id IN (
SELECT evaluation_id FROM ' . $tbl_grade_results . '
WHERE user_id = ' . intval($stud_id) . ' AND score IS NOT NULL
)';
if (!api_is_allowed_to_edit()) {
$sql .= ' AND visible = 1';
}
if (isset($cat_id)) {
$sql .= ' AND category_id = ' . intval($cat_id);
} else {
$sql .= ' AND category_id >= 0';
}
$result = Database::query($sql);
$alleval = Evaluation::create_evaluation_objects_from_sql_result($result);
return $alleval;
}