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


PHP Exercise::getId方法代码示例

本文整理汇总了PHP中Exercise::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::getId方法的具体用法?PHP Exercise::getId怎么用?PHP Exercise::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Exercise的用法示例。


在下文中一共展示了Exercise::getId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: header

    }
    if (isset($csv)) {
        header("Content-type: application/csv");
        header('Content-Disposition: attachment; filename="' . $csvFileName . '.csv"');
        echo $csv;
        exit;
    }
}
$out = '';
// display title
$titleTab['mainTitle'] = $nameTools;
$titleTab['subTitle'] = $exercise->getTitle();
$out .= claro_html_tool_title($titleTab);
if (get_conf('is_trackingEnabled')) {
    // get global infos about scores in the exercise
    $sql = "SELECT  MIN(TEX.`result`) AS `minimum`,\n                MAX(TEX.`result`) AS `maximum`,\n                AVG(TEX.`result`) AS `average`,\n                MAX(TEX.`weighting`) AS `weighting` ,\n                COUNT(DISTINCT TEX.`user_id`) AS `users`,\n                COUNT(TEX.`user_id`) AS `tusers`,\n                AVG(`TEX`.`time`) AS `avgTime`\n        FROM `" . $tbl_qwz_tracking . "` AS TEX\n        WHERE TEX.`exo_id` = " . (int) $exercise->getId() . "\n                AND TEX.`user_id` IS NOT NULL";
    $exo_scores_details = claro_sql_query_get_single_row($sql);
    if (!isset($exo_scores_details['minimum'])) {
        $exo_scores_details['minimum'] = 0;
        $exo_scores_details['maximum'] = 0;
        $exo_scores_details['average'] = 0;
    } else {
        // round average number for a better display
        $exo_scores_details['average'] = round($exo_scores_details['average'] * 100) / 100;
    }
    if (isset($exo_score_details['weighting']) || $exo_scores_details['weighting'] != '') {
        $displayedWeighting = '/' . $exo_scores_details['weighting'];
    } else {
        $displayedWeighting = '';
    }
    $out .= '<ul>' . "\n" . '<li>' . get_lang('Worst score') . ' : ' . $exo_scores_details['minimum'] . $displayedWeighting . '</li>' . "\n" . '<li>' . get_lang('Best score') . ' : ' . $exo_scores_details['maximum'] . $displayedWeighting . '</li>' . "\n" . '<li>' . get_lang('Average score') . ' : ' . $exo_scores_details['average'] . $displayedWeighting . '</li>' . "\n" . '<li>' . get_lang('Average Time') . ' : ' . claro_html_duration(floor($exo_scores_details['avgTime'])) . '</li>' . "\n" . '</ul>' . "\n\n" . '<ul>' . "\n" . '<li>' . get_lang('User attempts') . ' : ' . $exo_scores_details['users'] . '</li>' . "\n" . '<li>' . get_lang('Total attempts') . ' : ' . $exo_scores_details['tusers'] . '</li>' . "\n" . '</ul>' . "\n\n";
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:track_exercises.php

示例2: Exercise

    if ($cmd == 'exMkInvis' && $exId) {
        Exercise::updateExerciseVisibility($exId, 'INVISIBLE');
        $eventNotifier->notifyCourseEvent("exercise_invisible", claro_get_current_course_id(), claro_get_current_tool_id(), $exId, claro_get_current_group_id(), "0");
        $eventNotifier->notifyCourseEvent("exercise_updated", claro_get_current_course_id(), claro_get_current_tool_id(), $exId, claro_get_current_group_id(), "0");
    }
}
// Save question list
if ($cmd == 'exSaveQwz') {
    if (is_null($exId)) {
        $dialogBox->error(get_lang('Error : unable to save the questions list'));
    } else {
        $exercise = new Exercise();
        if (!$exercise->load($exId)) {
            $dialogBox->error(get_lang('Error: unable to load exercise'));
        } elseif (isset($_SESSION['lastRandomQuestionList'])) {
            if (!$exercise->saveRandomQuestionList($_SESSION['_user']['userId'], $exercise->getId(), @unserialize($_SESSION['lastRandomQuestionList']))) {
                $dialogBox->error(get_lang('Error: unable to save this questions list'));
            } else {
                $dialogBox->success(get_lang('The list of questions has been saved'));
            }
            unset($_SESSION['lastRandomQuestionList']);
        } else {
            $dialogBox->error(get_lang('Error: no questions list in memory'));
        }
    }
}
/*
 * Get list
 */
// pager initialisation
if (!isset($_REQUEST['offset'])) {
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:exercise.php


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