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


PHP assQuestion::_logAction方法代码示例

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


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

示例1: _setReachedPoints

 /**
  * Sets the points, a learner has reached answering the question
  * Additionally objective results are updated
  *
  * @param integer $user_id The database ID of the learner
  * @param integer $test_id The database Id of the test containing the question
  * @param integer $points The points the user has reached answering the question
  * @return boolean true on success, otherwise false
  * @access public
  */
 function _setReachedPoints($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
 {
     global $ilDB;
     if ($points <= $maxpoints) {
         if (is_null($pass)) {
             $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
         }
         // retrieve the already given points
         $old_points = 0;
         $result = $ilDB->queryF("SELECT points FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('integer', 'integer', 'integer'), array($active_id, $question_id, $pass));
         $manual = $manualscoring ? 1 : 0;
         $rowsnum = $result->numRows();
         if ($rowsnum) {
             $row = $ilDB->fetchAssoc($result);
             $old_points = $row["points"];
             if ($old_points != $points) {
                 $affectedRows = $ilDB->manipulateF("UPDATE tst_test_result SET points = %s, manual = %s, tstamp = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('float', 'integer', 'integer', 'integer', 'integer', 'integer'), array($points, $manual, time(), $active_id, $question_id, $pass));
             }
         } else {
             $next_id = $ilDB->nextId('tst_test_result');
             $affectedRows = $ilDB->manipulateF("INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, points, pass, manual, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)", array('integer', 'integer', 'integer', 'float', 'integer', 'integer', 'integer'), array($next_id, $active_id, $question_id, $points, $pass, $manual, time()));
         }
         if ($old_points != $points || !$rowsnum) {
             assQuestion::_updateTestPassResults($active_id, $pass, $obligationsEnabled);
             // finally update objective result
             include_once "./Modules/Test/classes/class.ilObjTest.php";
             include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
             ilCourseObjectiveResult::_updateObjectiveResult(ilObjTest::_getUserIdFromActiveId($active_id), $question_id, $points);
             include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
             if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
                 global $lng, $ilUser;
                 include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
                 $username = ilObjTestAccess::_getParticipantData($active_id);
                 assQuestion::_logAction(sprintf($lng->txtlng("assessment", "log_answer_changed_points", ilObjAssessmentFolder::_getLogLanguage()), $username, $old_points, $points, $ilUser->getFullname() . " (" . $ilUser->getLogin() . ")"), $active_id, $question_id);
             }
         }
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:51,代码来源:class.assQuestion.php


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