• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ExerciseLib类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: exercise_time_control_is_valid

 /**
  * Validates the time control key
  */
 public static function exercise_time_control_is_valid($exercise_id, $lp_id = 0, $lp_item_id = 0)
 {
     $course_id = api_get_course_int_id();
     $exercise_id = intval($exercise_id);
     $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
     $sql = "SELECT expired_time FROM {$TBL_EXERCICES} WHERE c_id = {$course_id} AND iid = {$exercise_id}";
     $result = Database::query($sql);
     $row = Database::fetch_array($result, 'ASSOC');
     if (!empty($row['expired_time'])) {
         $current_expired_time_key = ExerciseLib::get_time_control_key($exercise_id, $lp_id, $lp_item_id);
         if (isset($_SESSION['expired_time'][$current_expired_time_key])) {
             $current_time = time();
             $expired_time = api_strtotime($_SESSION['expired_time'][$current_expired_time_key], 'UTC');
             $total_time_allowed = $expired_time + 30;
             //error_log('expired time converted + 30: '.$total_time_allowed);
             //error_log('$current_time: '.$current_time);
             if ($total_time_allowed < $current_time) {
                 return false;
             }
             return true;
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:30,代码来源:exercise.lib.php


示例2: return_exercise_block

 function return_exercise_block($personal_course_list)
 {
     $exercise_list = array();
     if (!empty($personal_course_list)) {
         foreach ($personal_course_list as $course_item) {
             $course_code = $course_item['c'];
             $session_id = $course_item['id_session'];
             $exercises = ExerciseLib::get_exercises_to_be_taken($course_code, $session_id);
             foreach ($exercises as $exercise_item) {
                 $exercise_item['course_code'] = $course_code;
                 $exercise_item['session_id'] = $session_id;
                 $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC');
                 $exercise_list[] = $exercise_item;
             }
         }
         if (!empty($exercise_list)) {
             $exercise_list = ArrayClass::msort($exercise_list, 'tms');
             $my_exercise = $exercise_list[0];
             $url = Display::url($my_exercise['title'], api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?exerciseId=' . $my_exercise['id'] . '&cidReq=' . $my_exercise['course_code'] . '&id_session=' . $my_exercise['session_id']);
             $this->tpl->assign('exercise_url', $url);
             $this->tpl->assign('exercise_end_date', api_convert_and_format_date($my_exercise['end_time'], DATE_FORMAT_SHORT));
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:24,代码来源:userportal.lib.php


示例3: saveExerciseAttemptHotspot

 /**
  * Record an hotspot spot for this attempt at answering an hotspot question
  * @param	int		Exercise ID
  * @param	int		Question ID
  * @param	int		Answer ID
  * @param	int		Whether this answer is correct (1) or not (0)
  * @param	string	Coordinates of this point (e.g. 123;324)
  * @param	bool update results?
  * @return	boolean	Result of the insert query
  * @uses Course code and user_id from global scope $_cid and $_user
  */
 public static function saveExerciseAttemptHotspot($exe_id, $question_id, $answer_id, $correct, $coords, $updateResults = false, $exerciseId = 0)
 {
     global $safe_lp_id, $safe_lp_item_id;
     if ($updateResults == false) {
         // Validation in case of fraud with activated control time
         if (!ExerciseLib::exercise_time_control_is_valid($exerciseId, $safe_lp_id, $safe_lp_item_id)) {
             $correct = 0;
         }
     }
     $tbl_track_e_hotspot = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
     if ($updateResults) {
         $params = array('hotspot_correct' => $correct, 'hotspot_coordinate' => $coords);
         Database::update($tbl_track_e_hotspot, $params, array('hotspot_user_id = ? AND hotspot_exe_id = ? AND hotspot_question_id = ? AND hotspot_answer_id = ? ' => array(api_get_user_id(), $exe_id, $question_id, $answer_id, $answer_id)));
     } else {
         return Database::insert($tbl_track_e_hotspot, ['hotspot_course_code' => api_get_course_id(), 'hotspot_user_id' => api_get_user_id(), 'c_id' => api_get_course_int_id(), 'hotspot_exe_id' => $exe_id, 'hotspot_question_id' => $question_id, 'hotspot_answer_id' => $answer_id, 'hotspot_correct' => $correct, 'hotspot_coordinate' => $coords]);
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:28,代码来源:events.lib.php


示例4: foreach

 foreach ($exercise_data as $exercise_item) {
     $result_list = $exercise_item['results'];
     $exercise_info = $exercise_item['exercise_data'];
     if ($exercise_info->start_time == '0000-00-00 00:00:00') {
         $start_date = '-';
     } else {
         $start_date = $exercise_info->start_time;
     }
     if (!empty($result_list)) {
         foreach ($result_list as $exercise_result) {
             $platform_score = ExerciseLib::show_score($exercise_result['exe_result'], $exercise_result['exe_weighting']);
             $my_score = 0;
             if (!empty($exercise_result['exe_weighting']) && intval($exercise_result['exe_weighting']) != 0) {
                 $my_score = $exercise_result['exe_result'] / $exercise_result['exe_weighting'];
             }
             $position = ExerciseLib::get_exercise_result_ranking($my_score, $exercise_result['exe_id'], $my_exercise_id, $my_course_code, $session_id, $user_list);
             $exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH) . "exercice/result.php?cidReq={$my_course_code}&id={$exercise_result['exe_id']}&id_session={$session_id}&show_headers=1", array('target' => SESSION_LINK_TARGET, 'class' => 'exercise-result-link'));
             $my_real_array[] = array('status' => Display::return_icon('quiz.gif', get_lang('Attempted'), '', ICON_SIZE_SMALL), 'date' => $start_date, 'course' => $course_data['name'], 'exercise' => $exercise_info->exercise, 'attempt' => $counter, 'result' => $platform_score, 'best_result' => $best_score, 'position' => $position);
             $counter++;
         }
     } else {
         // We check the date validation of the exercise if the user can make it
         if ($exercise_info->start_time != '0000-00-00 00:00:00') {
             $allowed_time = api_strtotime($exercise_info->start_time, 'UTC');
             if ($now < $allowed_time) {
                 continue;
             }
         }
         $exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH) . "exercice/overview.php?cidReq={$my_course_code}&exerciseId={$exercise_info->id}&id_session={$session_id}", array('target' => SESSION_LINK_TARGET));
         $new_exercises[] = array('status' => Display::return_icon('star.png', get_lang('New'), array('width' => ICON_SIZE_SMALL)), 'date' => $start_date, 'course' => $course_data['name'], 'exercise' => $exercise_info->exercise, 'attempt' => '-', 'result' => '-', 'best_result' => '-', 'position' => '-');
     }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:index.php


示例5: header

}
if (empty($objExercise)) {
    if (!empty($_SESSION['objExercise'])) {
        $objExercise = Session::read('objExercise');
    } else {
        $objExercise = null;
    }
}
if (!$objExercise) {
    //Redirect to the exercise overview
    //Check if the exe_id exists
    header("Location: overview.php?exerciseId=" . $exerciseId);
    exit;
}
$time_control = false;
$clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) {
    $time_control = true;
}
if ($time_control) {
    // Get time left for exipiring time
    $time_left = api_strtotime($clock_expired_time, 'UTC') - time();
    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/epiclock/stylesheet/jquery.epiclock.css');
    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/epiclock/renderers/minute/epiclock.minute.css');
    $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
    $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
    $htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
    $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
}
$exe_id = intval(Session::read('exe_id'));
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:exercise_reminder.php


示例6: api_not_allowed

                break;
            case 'csv':
            default:
                $export->exportCompleteReportCSV($documentPath, null, $loadExtraData, null, $_GET['exerciseId']);
                exit;
                break;
        }
    } else {
        api_not_allowed(true);
    }
}
//Send student email @todo move this code in a class, library
if (isset($_REQUEST['comments']) && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor || $allowCoachFeedbackExercises)) {
    //filtered by post-condition
    $id = intval($_GET['exeid']);
    $track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id);
    if (empty($track_exercise_info)) {
        api_not_allowed();
    }
    $test = $track_exercise_info['title'];
    $student_id = $track_exercise_info['exe_user_id'];
    $session_id = $track_exercise_info['session_id'];
    $lp_id = $track_exercise_info['orig_lp_id'];
    //$lp_item_id        = $track_exercise_info['orig_lp_item_id'];
    $lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
    $course_info = api_get_course_info();
    // Teacher data
    $teacher_info = api_get_user_info(api_get_user_id());
    $from_name = api_get_person_name($teacher_info['firstname'], $teacher_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
    $url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?id=' . $track_exercise_info['exe_id'] . '&' . api_get_cidreq() . '&show_headers=1&id_session=' . $session_id;
    $my_post_info = array();
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:exercise_report.php


示例7: get_stats_table_by_attempt

 /**
  * Returns a category summary report
  *
  * @param int exercise id
  * @param array prefilled array with the category_id, score, and weight example: array(1 => array('score' => '10', 'total' => 20));
  * @param bool $categoryMinusOne shows category - 1 see BT#6540
  * @return string
  */
 public static function get_stats_table_by_attempt($exercise_id, $category_list = array(), $categoryMinusOne = false)
 {
     if (empty($category_list)) {
         return null;
     }
     $category_name_list = Testcategory::getListOfCategoriesNameForTest($exercise_id, false);
     $table = new HTML_Table(array('class' => 'data_table'));
     $table->setHeaderContents(0, 0, get_lang('Categories'));
     $table->setHeaderContents(0, 1, get_lang('AbsoluteScore'));
     $table->setHeaderContents(0, 2, get_lang('RelativeScore'));
     $row = 1;
     $none_category = array();
     if (isset($category_list['none'])) {
         $none_category = $category_list['none'];
         unset($category_list['none']);
     }
     $total = array();
     if (isset($category_list['total'])) {
         $total = $category_list['total'];
         unset($category_list['total']);
     }
     $em = Database::getManager();
     $repo = $em->getRepository('ChamiloCoreBundle:CQuizCategory');
     $redefineCategoryList = array();
     if (!empty($category_list) && count($category_list) > 1) {
         $globalCategoryScore = array();
         foreach ($category_list as $category_id => $category_item) {
             $cat = $em->find('ChamiloCoreBundle:CQuizCategory', $category_id);
             $path = $repo->getPath($cat);
             $categoryName = $category_name_list[$category_id];
             $index = 0;
             if ($categoryMinusOne) {
                 $index = 1;
             }
             if (isset($path[$index])) {
                 $category_id = $path[$index]->getIid();
                 $categoryName = $path[$index]->getTitle();
             }
             if (!isset($globalCategoryScore[$category_id])) {
                 $globalCategoryScore[$category_id] = array();
                 $globalCategoryScore[$category_id]['score'] = 0;
                 $globalCategoryScore[$category_id]['total'] = 0;
                 $globalCategoryScore[$category_id]['title'] = '';
             }
             $globalCategoryScore[$category_id]['score'] += $category_item['score'];
             $globalCategoryScore[$category_id]['total'] += $category_item['total'];
             $globalCategoryScore[$category_id]['title'] = $categoryName;
         }
         foreach ($globalCategoryScore as $category_item) {
             $table->setCellContents($row, 0, $category_item['title']);
             $table->setCellContents($row, 1, ExerciseLib::show_score($category_item['score'], $category_item['total'], false));
             $table->setCellContents($row, 2, ExerciseLib::show_score($category_item['score'], $category_item['total'], true, false, true));
             $class = 'class="row_odd"';
             if ($row % 2) {
                 $class = 'class="row_even"';
             }
             $table->setRowAttributes($row, $class, true);
             $row++;
         }
         if (!empty($none_category)) {
             $table->setCellContents($row, 0, get_lang('None'));
             $table->setCellContents($row, 1, ExerciseLib::show_score($none_category['score'], $none_category['total'], false));
             $table->setCellContents($row, 2, ExerciseLib::show_score($none_category['score'], $none_category['total'], true, false, true));
             $row++;
         }
         if (!empty($total)) {
             $table->setCellContents($row, 0, get_lang('Total'));
             $table->setCellContents($row, 1, ExerciseLib::show_score($total['score'], $total['total'], false));
             $table->setCellContents($row, 2, ExerciseLib::show_score($total['score'], $total['total'], true, false, true));
             $table->setRowAttributes($row, 'class="row_total"', true);
         }
         return $table->toHtml();
     }
     return null;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:83,代码来源:testcategory.class.php


示例8: array

     if (!(api_is_allowed_to_edit() || api_is_coach())) {
         return array();
     }
     require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php';
     $columns = array('student', 'works');
     $result = getWorkUserListData($workId, api_get_course_id(), api_get_session_id(), api_get_group_id(), $start, $limit, $sidx, $sord);
     break;
 case 'get_hotpotatoes_exercise_results':
     $course = api_get_course_info();
     $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
     if (api_is_allowed_to_edit(null, true) || api_is_drh()) {
         $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
     } else {
         $columns = array('exe_date', 'score', 'actions');
     }
     $result = ExerciseLib::get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $whereCondition);
     break;
 case 'get_sessions_tracking':
     if (api_is_drh()) {
         $sessions = SessionManager::get_sessions_followed_by_drh(api_get_user_id(), $start, $limit, false, false, false, null, $keyword, $description);
     } else {
         // Sessions for the coach
         $sessions = Tracking::get_sessions_coached_by_user(api_get_user_id(), $start, $limit, false, $keyword, $description);
     }
     $columns = array('name', 'date', 'course_per_session', 'student_per_session', 'details');
     $result = array();
     if (!empty($sessions)) {
         foreach ($sessions as $session) {
             if (api_drh_can_access_all_session_content()) {
                 $count_courses_in_session = count(SessionManager::get_course_list_by_session_id($session['id']));
             } else {
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:model.ajax.php


示例9: array

                if (empty($objQuestionTmp->level)) {
                    $txtQuestionLevel = '-';
                }
                $questionLevel = Display::tag('div', $txtQuestionLevel, array('style' => $styleLevel));
                // Question score
                $questionScore = Display::tag('div', $objQuestionTmp->selectWeighting(), array('style' => $styleScore));
                echo '<div id="question_id_list_' . $id . '" >';
                echo '<div class="header_operations">';
                echo $questionName;
                echo $questionType;
                echo $questionCategory;
                echo $questionLevel;
                echo $questionScore;
                echo $actions;
                echo '</div>';
                echo '<div class="question-list-description-block">';
                echo '<p class="lead">' . get_lang($question_class) . '</p>';
                //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
                ExerciseLib::showQuestion($id, false, null, null, false, true, false, true, $objExercise->feedback_type, true);
                echo '</div>';
                echo '</div>';
                unset($objQuestionTmp);
            }
        }
    }
    if (!$nbrQuestions) {
        echo Display::display_warning_message(get_lang('NoQuestion'));
    }
    echo '</div>';
    //question list div
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:question_list_admin.inc.php


示例10: Exercise

     $mytime = (int) $time_exe_date - (int) $time_start_date;
     $score = (double) $row_dates['exe_result'];
     $max_score = (double) $row_dates['exe_weighting'];
     $sql = "UPDATE {$TBL_LP_ITEM} SET\n                    max_score = '{$max_score}'\n                WHERE c_id = {$course_id} AND id = '" . $safe_item_id . "'";
     Database::query($sql);
     $sql = "SELECT id FROM {$TBL_LP_ITEM_VIEW}\n                WHERE\n                    c_id = {$course_id} AND\n                    lp_item_id = '{$safe_item_id}' AND\n                    lp_view_id = '" . $learnPath->lp_view_id . "'\n                ORDER BY id DESC\n                LIMIT 1";
     $res_last_attempt = Database::query($sql);
     if (Database::num_rows($res_last_attempt) && !api_is_invitee()) {
         $row_last_attempt = Database::fetch_row($res_last_attempt);
         $lp_item_view_id = $row_last_attempt[0];
         $exercise = new Exercise(api_get_course_int_id());
         $exercise->read($row_dates['exe_exo_id']);
         $status = 'completed';
         if (!empty($exercise->pass_percentage)) {
             $status = 'failed';
             $success = ExerciseLib::is_success_exercise_result($score, $max_score, $exercise->pass_percentage);
             if ($success) {
                 $status = 'passed';
             }
         }
         $sql = "UPDATE {$TBL_LP_ITEM_VIEW} SET\n                        status = '{$status}',\n                        score = {$score},\n                        total_time = {$mytime}\n                    WHERE id='" . $lp_item_view_id . "' AND c_id = {$course_id} ";
         if ($debug) {
             error_log($sql);
         }
         Database::query($sql);
         $sql = "UPDATE {$TBL_TRACK_EXERCICES} SET\n                        orig_lp_item_view_id = {$lp_item_view_id}\n                    WHERE exe_id = " . $safe_exe_id;
         Database::query($sql);
     }
 }
 if (intval($_GET['fb_type']) > 0) {
     $src = 'blank.php?msg=exerciseFinished';
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:lp_view.php


示例11: array

 if (isset($exerciseLevel) && $exerciseLevel != -1) {
     $filter .= ' AND level=' . $exerciseLevel . ' ';
 }
 if (isset($answerType) && $answerType > 0) {
     $filter .= ' AND qu.type=' . $answerType . ' ';
 }
 if (!empty($session_id) && $session_id != '-1') {
     $main_question_list = array();
     if (!empty($course_list)) {
         foreach ($course_list as $course_item) {
             if (!empty($selected_course) && $selected_course != '-1') {
                 if ($selected_course != $course_item['id']) {
                     continue;
                 }
             }
             $exercise_list = ExerciseLib::get_all_exercises($course_item, $session_id);
             if (!empty($exercise_list)) {
                 foreach ($exercise_list as $exercise) {
                     $my_exercise = new Exercise($course_item['id']);
                     $my_exercise->read($exercise['id']);
                     if (!empty($my_exercise)) {
                         if (!empty($my_exercise->questionList)) {
                             foreach ($my_exercise->questionList as $question_id) {
                                 $question_obj = Question::read($question_id, $course_item['id']);
                                 if ($exerciseLevel != '-1') {
                                     if ($exerciseLevel != $question_obj->level) {
                                         continue;
                                     }
                                 }
                                 if ($answerType > 0) {
                                     if ($answerType != $question_obj->type) {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:question_pool.php


示例12: array

$my_attempt_array = array();
$table_content = '';
/* Make a special case for IE, which doesn't seem to be able to handle the
 * results popup -> send it to the full results page */
$browser = new Browser();
$current_browser = $browser->getBrowser();
$url_suffix = '';
$btn_class = 'ajax ';
if ($current_browser == 'Internet Explorer') {
    $url_suffix = '&amp;show_headers=1';
    $btn_class = '';
}
if (!empty($attempts)) {
    $i = $counter;
    foreach ($attempts as $attempt_result) {
        $score = ExerciseLib::show_score($attempt_result['exe_result'], $attempt_result['exe_weighting']);
        $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?' . api_get_cidreq() . '&amp;id=' . $attempt_result['exe_id'] . '&amp;id_session=' . api_get_session_id() . '&amp;height=500&amp;width=950' . $url_suffix;
        $attempt_link = Display::url(get_lang('Show'), $attempt_url, array('class' => $btn_class . 'btn'));
        $teacher_revised = Display::label(get_lang('Validated'), 'success');
        //$attempt_link = get_lang('NoResult');
        //$attempt_link = Display::return_icon('quiz_na.png', get_lang('NoResult'), array(), ICON_SIZE_SMALL);
        if ($attempt_result['attempt_revised'] == 0) {
            $teacher_revised = Display::label(get_lang('NotValidated'), 'info');
        }
        $row = array('count' => $i, 'date' => api_convert_and_format_date($attempt_result['start_date'], DATE_TIME_FORMAT_LONG));
        $attempt_link .= "&nbsp;&nbsp;&nbsp;" . $teacher_revised;
        if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_SCORE_ONLY, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) {
            $row['result'] = $score;
        }
        if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES)) || $objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY && $objExercise->feedback_type == EXERCISE_FEEDBACK_TYPE_END) {
            $row['attempt_link'] = $attempt_link;
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:overview.php


示例13: sprintf

             if ($row['start_time'] != '0000-00-00 00:00:00') {
                 $attempt_text = sprintf(get_lang('ExerciseAvailableFromX'), api_convert_and_format_date($row['start_time']));
             }
             if ($row['end_time'] != '0000-00-00 00:00:00') {
                 $attempt_text = sprintf(get_lang('ExerciseAvailableUntilX'), api_convert_and_format_date($row['end_time']));
             }
         }
     }
 } else {
     //Normal behaviour
     //Show results
     if ($my_result_disabled == 0 || $my_result_disabled == 2) {
         if ($num > 0) {
             $row_track = Database::fetch_array($qryres);
             $attempt_text = get_lang('LatestAttempt') . ' : ';
             $attempt_text .= ExerciseLib::show_score($row_track['exe_result'], $row_track['exe_weighting']);
         } else {
             $attempt_text = get_lang('NotAttempted');
         }
     } else {
         $attempt_text = get_lang('CantShowResults');
     }
 }
 $class_tip = '';
 if (empty($num)) {
     $num = '';
 } else {
     $class_tip = 'link_tooltip';
     //@todo use sprintf and show the results validated by the teacher
     if ($num == 1) {
         $num = $num . ' ' . get_lang('Result');
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:exercice.php


示例14: cut

                    $count = ExerciseLib::get_number_students_answer_hotspot_count($answer_id, $question_id, $exercise_id, $courseCode, $sessionId);
                    $percentange = 0;
                    if (!empty($count_students)) {
                        $percentange = $count / $count_students * 100;
                    }
                    $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count . ' / ' . $count_students);
                    break;
                default:
                    if ($answer_id == 1) {
                        $data[$id]['name'] = cut($question_obj->question, 100);
                    } else {
                        $data[$id]['name'] = '-';
                    }
                    $data[$id]['answer'] = $answer_info;
                    $data[$id]['correct'] = $correct_answer;
                    $count = ExerciseLib::get_number_students_answer_count($real_answer_id, $question_id, $exercise_id, $courseCode, $sessionId);
                    $percentange = 0;
                    if (!empty($count_students)) {
                        $percentange = $count / $count_students * 100;
                    }
                    $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count . ' / ' . $count_students);
            }
            $id++;
        }
    }
}
// Format A table
$table = new HTML_Table(array('class' => 'data_table'));
$row = 0;
$column = 0;
foreach ($headers as $header) {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:stats.php


示例15: saveExerciseAttemptHotspot

 /**
  * Record an hotspot spot for this attempt at answering an hotspot question
  * @param	int		Exercise ID
  * @param	int		Question ID
  * @param	int		Answer ID
  * @param	int		Whether this answer is correct (1) or not (0)
  * @param	string	Coordinates of this point (e.g. 123;324)
  * @param	bool update results?
  * @return	boolean	Result of the insert query
  * @uses Course code and user_id from global scope $_cid and $_user
  */
 public static function saveExerciseAttemptHotspot($exe_id, $question_id, $answer_id, $correct, $coords, $updateResults = false, $exerciseId = 0)
 {
     global $safe_lp_id, $safe_lp_item_id;
     if ($updateResults == false) {
         // Validation in case of fraud with activated control time
         if (!ExerciseLib::exercise_time_control_is_valid($exerciseId, $safe_lp_id, $safe_lp_item_id)) {
             $correct = 0;
         }
     }
     $tbl_track_e_hotspot = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
     if ($updateResults) {
         $params = array('hotspot_correct' => $correct, 'hotspot_coordinate' => $coords);
         Database::update($tbl_track_e_hotspot, $params, array('hotspot_user_id = ? AND hotspot_exe_id = ? AND hotspot_question_id = ? AND hotspot_answer_id = ? ' => array(api_get_user_id(), $exe_id, $question_id, $answer_id, $answer_id)));
     } else {
         $sql = "INSERT INTO {$tbl_track_e_hotspot} (hotspot_course_code, hotspot_user_id, c_id, hotspot_exe_id, hotspot_question_id, hotspot_answer_id, hotspot_correct, hotspot_coordinate)\n                VALUES (\n                '" . api_get_course_id() . "',\n                " . api_get_user_id() . "'," . " " . api_get_course_int_id() . ", " . " '" . Database::escape_string($exe_id) . "', " . " '" . Database::escape_string($question_id) . "'," . " '" . Database::escape_string($answer_id) . "'," . " '" . Database::escape_string($correct) . "'," . " '" . Database::escape_string($coords) . "')";
         return $result = Database::query($sql);
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:29,代码来源:events.lib.php


示例16: array

 if ($objExercise->type == ALL_ON_ONE_PAGE && isset($_GET['reminder']) && $_GET['reminder'] == 2) {
     $remind_highlight = 'no_remind_highlight';
 }
 $exercise_actions = '';
 $is_remind_on = false;
 $attributes = array('id' => 'remind_list[' . $questionId . ']');
 if (in_array($questionId, $remind_list)) {
     $is_remind_on = true;
     $attributes['checked'] = 1;
     $remind_question = true;
     $remind_highlight = ' remind_highlight ';
 }
 // Showing the question
 echo '<div id="question_div_' . $questionId . '" class="main-question ' . $remind_highlight . '" >';
 // Shows the question and its answers
 ExerciseLib::showQuestion($questionId, false, $origin, $i, true, false, $user_choice, false);
 // Button save and continue
 switch ($objExercise->type) {
     case ONE_PER_PAGE:
         $exercise_actions .= $objExercise->show_button($questionId, $current_question);
         break;
     case ALL_ON_ONE_PAGE:
         $button = '<a href="javascript://" class="btn btn-info" onclick="save_now(\'' . $questionId . '\'); ">' . get_lang('SaveForNow') . '</a>';
         $button .= '<span id="save_for_now_' . $questionId . '"></span>&nbsp;';
         $exercise_actions .= Display::div($button, array('class' => 'exercise_save_now_button'));
         break;
 }
 // Checkbox review answers
 if ($objExercise->review_answers) {
     $remind_question_div = Display::tag('label', Display::input('checkbox', 'remind_list[' . $questionId . ']', '', $attributes) . get_lang('ReviewQuestionLater'), array('class' => 'checkbox', 'for' => 'remind_list[' . $questionId . ']'));
     $exercise_actions .= Display::div($remind_question_div, array('class' => 'exercise_save_now_button'));
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:exercise_submit.php


示例17: AND

         $sql = "SELECT u.user_id as id, u.username, u.lastname, u.firstname\n                    FROM {$user} u\n                    INNER JOIN {$session_course_user} r ON u.user_id = r.user_id\n                    WHERE session_id = %d AND c_id =  '%s'\n                    AND (u.firstname LIKE '%s' OR u.username LIKE '%s' OR u.lastname LIKE '%s')";
         $needle = '%' . $_GET['q'] . '%';
         $sql_query = sprintf($sql, $_GET['session_id'], $course['real_id'], $needle, $needle, $needle);
         $result = Database::query($sql_query);
         while ($user = Database::fetch_assoc($result)) {
             $userCompleteName = api_get_person_name($user['firstname'], $user['lastname']);
             $json['items'][] = ['id' => $user['id'], 'text' => "{$user['username']} ({$userCompleteName})"];
         }
         echo json_encode($json);
     }
     break;
 case 'search_exercise_by_course':
     if (api_is_platform_admin()) {
         $course = api_get_course_info_by_id($_GET['course_id']);
         $session_id = !empty($_GET['session_id']) ? intval($_GET['session_id']) : 0;
         $exercises = ExerciseLib::get_all_exercises($course, $session_id, false, $_GET['q'], true, 3);
         foreach ($exercises as $exercise) {
             $data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title']));
         }
         if (!empty($data)) {
             $data[] = array('id' => 'T', 'text' => 'TODOS');
             echo json_encode($data);
         } else {
             echo json_encode(array(array('id' => 'T', 'text' => 'TODOS')));
         }
     }
     break;
 case 'search_survey_by_course':
     if (api_is_platform_admin()) {
         $survey = Database::get_course_table(TABLE_SURVEY);
         $sql = "SELECT survey_id as id, title, anonymous\n                    FROM {$survey}\n                    WHERE\n                      c_id = %d AND\n                      session_id = %d AND\n                      title LIKE '%s'";
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:31,代码来源:course.ajax.php


示例18: scoreAttemptAction

 /**
  * @Route("/score-attempt/{exeId}/jury/{juryId}")
  * @Method({"GET"})
  */
 public function scoreAttemptAction($exeId, $juryId)
 {
     $userId = $this->getUser()->getUserId();
     $trackExercise = \ExerciseLib::get_exercise_track_exercise_info($exeId);
     if (empty($trackExercise)) {
         $this->createNotFoundException();
     }
     /** @var \Chamilo\CoreBundle\Entity\Jury $jury */
     $jury = $this->getRepository()->find($juryId);
     if (empty($jury)) {
         $this->createNotFoundException('Jury does not exists');
     }
     if ($jury->getExerciseId() != $trackExercise['exe_exo_id']) {
         $this->createNotFoundException('Exercise attempt is not related with this jury.');
     }
     $members = $jury->getMembers();
     $criteria = Criteria::create()->where(Criteria::expr()->eq("userId", $userId))->setFirstResult(0)->setMaxResults(1);
     /** @var JuryMembers $member */
     $member = $members->matching($criteria)->first();
     if (empty($member)) {
         $this->createNotFoundException('You are not part of the jury.');
     }
     $students = $member->getStudents();
     $criteria = Criteria::create()->where(Criteria::expr()->eq("userId", $trackExercise['exe_user_id']))->setFirstResult(0)->setMaxResults(1);
     /** @var JuryMembers $member */
     $student = $students->matching($criteria)->first();
     if (empty($student)) {
         $this->createNotFoundException('You are not assigned to this user.');
     }
     // Setting member only for president.
     if ($this->isGranted('ROLE_JURY_PRESIDENT')) {
         // Relating user with president
         if ($member) {
             $this->getManager()->getRepository('Chamilo\\CoreBundle\\Entity\\JuryMembers')->assignUserToJuryMember($trackExercise['exe_user_id'], $member->getId());
         }
     }
     $questionScoreTypeModel = array();
     $criteria = array('exeId' => $exeId, 'juryUserId' => $userId);
     $trackJury = $this->getManager()->getRepository('Chamilo\\CoreBundle\\Entity\\TrackAttemptJury')->findBy($criteria);
     if ($trackJury) {
         $this->get('session')->getFlashBag()->add('info', "You already review this exercise attempt.");
         /** @var TrackAttemptJury $track */
         foreach ($trackJury as $track) {
             $questionScoreTypeModel[$track->getQuestionId()] = $track->getQuestionScoreNameId();
         }
     }
     $questionList = explode(',', $trackExercise['data_tracking']);
     $exerciseResult = \ExerciseLib::getExerciseResult($trackExercise);
     $counter = 1;
     $objExercise = new \Exercise($trackExercise['c_id']);
     $objExercise->read($trackExercise['exe_exo_id']);
     $totalScore = $totalWeighting = 0;
     $show_media = true;
     $tempParentId = null;
     $mediaCounter = 0;
     $media_list = array();
     $modelType = $objExercise->getScoreTypeModel();
     $options = array();
     if ($modelType) {
         /** @var \Chamilo\CoreBundle\Entity\QuestionScore $questionScoreName */
         $questionScore = $this->get('orm.em')->getRepository('Chamilo\\CoreBundle\\Entity\\QuestionScore')->find($modelType);
         if ($questionScore) {
             $items = $questionScore->getItems();
             /** @var \Chamilo\CoreBundle\Entity\QuestionScoreName  $score */
             foreach ($items as $score) {
                 $options[$score->getId() . ':' . $score->getScore()] = $score;
             }
         }
     } else {
         return $this->createNotFoundException('The exercise does not contain a model type.');
     }
     $exerciseContent = null;
     foreach ($questionList as $questionId) {
         ob_start();
         $choice = isset($exerciseResult[$questionId]) ? $exerciseResult[$questionId] : null;
         // Creates a temporary Question object
         /** @var \Question $objQuestionTmp */
         $objQuestionTmp = \Question::read($questionId);
         if ($objQuestionTmp->parent_id != 0) {
             if (!in_array($objQuestionTmp->parent_id, $media_list)) {
                 $media_list[] = $objQuestionTmp->parent_id;
                 $show_media = true;
             }
             if ($tempParentId == $objQuestionTmp->parent_id) {
                 $mediaCounter++;
             } else {
                 $mediaCounter = 0;
             }
             $counterToShow = chr(97 + $mediaCounter);
             $tempParentId = $objQuestionTmp->parent_id;
         }
         $questionWeighting = $objQuestionTmp->selectWeighting();
         $answerType = $objQuestionTmp->selectType();
         $question_result = $objExercise->manageAnswers($exeId, $questionId, $choice, 'exercise_show', array(), false, true, true);
         $questionScore = $question_result['score'];
         $totalScore += $question_result['score'];
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:JuryMemberController.php


示例19: get_exercise_result

 /**
  * Returns the exercise result
  * @param 	int		attempt id
  * @return 	float 	exercise result
  */
 public function get_exercise_result($exe_id)
 {
     $result = array();
     $track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($exe_id);
     if (!empty($track_exercise_info)) {
         $totalScore = 0;
         $objExercise = new Exercise();
         $objExercise->read($track_exercise_info['exe_exo_id']);
         if (!empty($track_exercise_info['data_tracking'])) {
             $question_list = explode(',', $track_exercise_info['data_tracking']);
         }
         foreach ($question_list as $questionId) {
             $question_result = $objExercise->manage_answer($exe_id, $questionId, '', 'exercise_show', array(), false, true, false, $objExercise->selectPropagateNeg());
             $totalScore += $question_result['score'];
         }
         if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) {
             $totalScore = 0;
         }
         $result = array('score' => $totalScore, 'weight' => $track_exercise_info['exe_weighting']);
     }
     

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Expectations类代码示例发布时间:2022-05-23
下一篇:
PHP Exercise类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap