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


PHP Exercise::get_max_score方法代码示例

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


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

示例1: array

if ($objExercise->selectAttempts() > 0) {
    $attempt_count = Event::get_attempt_count(api_get_user_id(), $objExercise->id, $learnpath_id, $learnpath_item_id, $learnpath_item_view_id);
    if ($attempt_count >= $objExercise->selectAttempts()) {
        Display::display_warning_message(sprintf(get_lang('ReachedMaxAttempts'), $objExercise->selectTitle(), $objExercise->selectAttempts()), false);
        if ($origin != 'learnpath') {
            //we are not in learnpath tool
            Display::display_footer();
        }
        exit;
    }
}
$total_score = 0;
if (!empty($exercise_stat_info)) {
    $total_score = $exercise_stat_info['exe_result'];
}
$max_score = $objExercise->get_max_score();
Display::display_normal_message(get_lang('Saved') . '<br />', false);
// Display and save questions
ExerciseLib::display_question_list_by_attempt($objExercise, $exe_id, true);
//Unset session for clock time
ExerciseLib::exercise_time_control_delete($objExercise->id, $learnpath_id, $learnpath_item_id);
ExerciseLib::delete_chat_exercise_session($exe_id);
if ($origin != 'learnpath') {
    echo '<hr>';
    echo Display::url(get_lang('ReturnToCourseHomepage'), api_get_course_url(), array('class' => 'btn btn-primary'));
    if (api_is_allowed_to_session_edit()) {
        Session::erase('objExercise');
        Session::erase('exe_id');
    }
    Display::display_footer();
} else {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:exercise_result.php

示例2: display_item_prerequisites_form

 /**
  * Return HTML form to allow prerequisites selection
  * @todo use FormValidator
  * @param	integer Item ID
  * @return	string	HTML form
  */
 public function display_item_prerequisites_form($item_id)
 {
     $course_id = api_get_course_int_id();
     $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
     $item_id = intval($item_id);
     /* Current prerequisite */
     $sql = "SELECT * FROM {$tbl_lp_item}\n                WHERE c_id = {$course_id} AND id = " . $item_id;
     $result = Database::query($sql);
     $row = Database::fetch_array($result);
     $prerequisiteId = $row['prerequisite'];
     $return = '<legend>';
     $return .= get_lang('AddEditPrerequisites');
     $return .= '</legend>';
     $return .= '<form method="POST">';
     $return .= '<table class="data_table">';
     $return .= '<tr>';
     $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
     $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
     $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
     $return .= '</tr>';
     // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
     $return .= '<tr >';
     $return .= '<td colspan="3" class="radio">';
     $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
     $return .= '<label for="idNone">' . get_lang('None') . '</label>';
     $return .= '</tr>';
     $sql = "SELECT * FROM {$tbl_lp_item}\n                WHERE c_id = {$course_id} AND lp_id = " . $this->lp_id;
     $result = Database::query($sql);
     $arrLP = array();
     $selectedMinScore = array();
     $selectedMaxScore = array();
     while ($row = Database::fetch_array($result)) {
         if ($row['id'] == $item_id) {
             $selectedMinScore[$row['prerequisite']] = $row['prerequisite_min_score'];
             $selectedMaxScore[$row['prerequisite']] = $row['prerequisite_max_score'];
         }
         $arrLP[] = array('id' => $row['id'], 'item_type' => $row['item_type'], 'title' => $row['title'], 'ref' => $row['ref'], 'description' => $row['description'], 'parent_item_id' => $row['parent_item_id'], 'previous_item_id' => $row['previous_item_id'], 'next_item_id' => $row['next_item_id'], 'max_score' => $row['max_score'], 'min_score' => $row['min_score'], 'mastery_score' => $row['mastery_score'], 'prerequisite' => $row['prerequisite'], 'next_item_id' => $row['next_item_id'], 'display_order' => $row['display_order'], 'prerequisite_min_score' => $row['prerequisite_min_score'], 'prerequisite_max_score' => $row['prerequisite_max_score']);
     }
     $this->tree_array($arrLP);
     $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
     unset($this->arrMenu);
     for ($i = 0; $i < count($arrLP); $i++) {
         $item = $arrLP[$i];
         if ($item['id'] == $item_id) {
             break;
         }
         $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
         $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
         $return .= '<tr>';
         $return .= '<td class="radio"' . ($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES ? ' colspan="3"' : '') . '>';
         $return .= '<label for="id' . $item['id'] . '">';
         $return .= '<input' . (in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '') . ($item['item_type'] == 'dokeos_module' || $item['item_type'] == 'dokeos_chapter' ? ' disabled="disabled" ' : ' ') . 'id="id' . $item['id'] . '" name="prerequisites" style="margin-left:' . $item['depth'] * 10 . 'px; margin-right:10px;" type="radio" value="' . $item['id'] . '" />';
         $icon_name = str_replace(' ', '', $item['item_type']);
         if (file_exists('../img/lp_' . $icon_name . '.png')) {
             $return .= '<img alt="" src="../img/lp_' . $icon_name . '.png" style="margin-right:5px;" title="" />';
         } else {
             if (file_exists('../img/lp_' . $icon_name . '.gif')) {
                 $return .= '<img alt="" src="../img/lp_' . $icon_name . '.gif" style="margin-right:5px;" title="" />';
             } else {
                 $return .= Display::return_icon('folder_document.gif', '', array('style' => 'margin-right:5px;'));
             }
         }
         $return .= $item['title'] . '</label>';
         $return .= '</td>';
         if ($item['item_type'] == TOOL_QUIZ) {
             // lets update max_score Quiz information depending of the Quiz Advanced properties
             $tmp_obj_lp_item = new LpItem($course_id, $item['id']);
             $tmp_obj_exercice = new Exercise();
             $tmp_obj_exercice->read($tmp_obj_lp_item->path);
             $tmp_obj_lp_item->max_score = $tmp_obj_exercice->get_max_score();
             $tmp_obj_lp_item->update_in_bdd();
             $item['max_score'] = $tmp_obj_lp_item->max_score;
             $return .= '<td class="exercise">';
             $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="' . $item['max_score'] . '" value="' . $selectedMinScoreValue . '" />';
             $return .= '</td>';
             $return .= '<td class="exercise">';
             $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="' . $item['max_score'] . '" value="' . $selectedMaxScoreValue . '" />';
             $return .= '</td>';
         }
         if ($item['item_type'] == TOOL_HOTPOTATOES) {
             $return .= '<td class="exercise">';
             $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="' . $item['max_score'] . '" value="' . $selectedMinScoreValue . '" /></center>';
             $return .= '</td>';
             $return .= '<td class="exercise"">';
             $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="' . $item['max_score'] . '"  value="' . $selectedMaxScoreValue . '" /></center>';
             $return .= '</td>';
         }
         $return .= '</tr>';
     }
     $return .= '<tr>';
     $return .= '</tr>';
     $return .= '</table>';
     $return .= '<div style="padding-top:3px;">';
     $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
//.........这里部分代码省略.........
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:101,代码来源:learnpath.class.php


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