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


PHP ExerciseLib::get_time_control_key方法代码示例

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


在下文中一共展示了ExerciseLib::get_time_control_key方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: error_log

     }
 }
 // We're inside *one* question. Go through each possible answer for this question
 $result = $objExercise->manageAnswers($exe_id, $my_question_id, $my_choice, 'exercise_result', $hot_spot_coordinates, true, false, false, $hotspot_delineation_result);
 //Adding the new score
 $total_score += $result['score'];
 if ($debug) {
     error_log("total_score: {$total_score} ");
     error_log("total_weight: {$total_weight} ");
 }
 $duration = 0;
 $now = time();
 if ($type == 'all') {
     $exercise_stat_info = $objExercise->getStatTrackExerciseInfoByExeId($exe_id);
 }
 $key = ExerciseLib::get_time_control_key($exercise_id, $exercise_stat_info['orig_lp_id'], $exercise_stat_info['orig_lp_item_id']);
 /*$durationTime = array(
       'duration_time' => array(
           $key => time()
       )
   );*/
 $durationTime = Session::read('duration_time');
 if (isset($durationTime[$key]) && !empty($durationTime[$key])) {
     $duration = $now - $durationTime[$key];
     if (!empty($exercise_stat_info['exe_duration'])) {
         $duration += $exercise_stat_info['exe_duration'];
     }
     $duration = intval($duration);
 } else {
     if (!empty($exercise_stat_info['exe_duration'])) {
         $duration = $exercise_stat_info['exe_duration'];
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:exercise.ajax.php

示例3: header

}
// If reminder ends we jump to the exercise_reminder
if ($objExercise->review_answers) {
    if ($remind_question_id == -1) {
        header('Location: exercise_reminder.php?origin=' . $origin . '&exerciseId=' . $exerciseId);
        exit;
    }
}
$current_timestamp = time();
$my_remind_list = array();
$time_control = false;
if ($objExercise->expired_time != 0) {
    $time_control = true;
}
// Generating the time control key for the user
$current_expired_time_key = ExerciseLib::get_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
$_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp;
if ($time_control) {
    // Get the expired time of the current exercise in track_e_exercises
    $total_seconds = $objExercise->expired_time * 60;
}
$show_clock = true;
$user_id = api_get_user_id();
if ($objExercise->selectAttempts() > 0) {
    $attempt_html = '';
    $attempt_count = Event::get_attempt_count($user_id, $exerciseId, $learnpath_id, $learnpath_item_id, $learnpath_item_view_id);
    if ($attempt_count >= $objExercise->selectAttempts()) {
        $show_clock = false;
        if (!api_is_allowed_to_edit(null, true)) {
            if ($objExercise->results_disabled == 0 && $origin != 'learnpath') {
                // Showing latest attempt according with task BT#1628
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:exercise_submit.php

示例4: createEventExercise

 /**
  * This function creates an empty Exercise in STATISTIC_TRACK_E_EXERCICES table.
  * After that in exercise_result.php we call the update_event_exercise() to update the exercise
  * @return int $id the last id registered, or false on error
  * @author Julio Montoya <gugli100@gmail.com>
  * @desc Record result of user when an exercice was done
  * @deprecated this function seems to be deprecated
  */
 function createEventExercise($exo_id)
 {
     if (empty($exo_id) or intval($exo_id) != $exo_id) {
         return false;
     }
     $tbl_track_exe = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
     $tbl_exe = Database::get_course_table(TABLE_QUIZ_TEST);
     $uid = api_get_user_id();
     $course_id = api_get_course_int_id();
     // First, check the exercise exists
     $sql_exe_id = "SELECT exercises.id FROM {$tbl_exe} as exercises WHERE c_id = {$course_id} AND exercises.id={$exo_id}";
     $res_exe_id = Database::query($sql_exe_id);
     if ($res_exe_id === false) {
         return false;
     }
     //sql error
     if (Database::num_rows($res_exe_id) < 1) {
         return false;
     }
     //exe not found
     $row_exe_id = Database::fetch_row($res_exe_id);
     $exercise_id = intval($row_exe_id[0]);
     // Second, check if the record exists in the database (looking for incomplete records)
     $sql = "SELECT exe_id FROM {$tbl_track_exe}\n            WHERE exe_exo_id =   {$exo_id} AND\n            exe_user_id =  {$uid} AND c_id = '" . $course_id . "' AND " . "status = 'incomplete' AND " . "session_id = " . api_get_session_id();
     $res = Database::query($sql);
     if ($res === false) {
         return false;
     }
     if (Database::num_rows($res) > 0) {
         $row = Database::fetch_array($res);
         return $row['exe_id'];
     }
     // No record was found, so create one
     // get expire time to insert into the tracking record
     $current_expired_time_key = ExerciseLib::get_time_control_key($exercise_id);
     if (isset($_SESSION['expired_time'][$current_expired_time_key])) {
         //Only for exercice of type "One page"
         $expired_date = $_SESSION['expired_time'][$current_expired_time_key];
     } else {
         $expired_date = '0000-00-00 00:00:00';
     }
     $sql = "INSERT INTO {$tbl_track_exe} (exe_user_id, c_id, expired_time_control, exe_exo_id, session_id)\n                VALUES ({$uid},  '" . $course_id . "' ,'{$expired_date}','{$exo_id}','" . api_get_session_id() . "')";
     Database::query($sql);
     $id = Database::insert_id();
     return $id;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:54,代码来源:events.lib.inc.php


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