當前位置: 首頁>>代碼示例>>PHP>>正文


PHP quiz_access_manager::load_settings方法代碼示例

本文整理匯總了PHP中quiz_access_manager::load_settings方法的典型用法代碼示例。如果您正苦於以下問題:PHP quiz_access_manager::load_settings方法的具體用法?PHP quiz_access_manager::load_settings怎麽用?PHP quiz_access_manager::load_settings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在quiz_access_manager的用法示例。


在下文中一共展示了quiz_access_manager::load_settings方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: data_preprocessing

 public function data_preprocessing(&$toform)
 {
     if (isset($toform['grade'])) {
         // Convert to a real number, so we don't get 0.0000.
         $toform['grade'] = $toform['grade'] + 0;
     }
     if (count($this->_feedbacks)) {
         $key = 0;
         foreach ($this->_feedbacks as $feedback) {
             $draftid = file_get_submitted_draft_itemid('feedbacktext[' . $key . ']');
             $toform['feedbacktext[' . $key . ']']['text'] = file_prepare_draft_area($draftid, $this->context->id, 'mod_quiz', 'feedback', !empty($feedback->id) ? (int) $feedback->id : null, null, $feedback->feedbacktext);
             $toform['feedbacktext[' . $key . ']']['format'] = $feedback->feedbacktextformat;
             $toform['feedbacktext[' . $key . ']']['itemid'] = $draftid;
             if ($toform['grade'] == 0) {
                 // When a quiz is un-graded, there can only be one lot of
                 // feedback. If the quiz previously had a maximum grade and
                 // several lots of feedback, we must now avoid putting text
                 // into input boxes that are disabled, but which the
                 // validation will insist are blank.
                 break;
             }
             if ($feedback->mingrade > 0) {
                 $toform['feedbackboundaries[' . $key . ']'] = 100.0 * $feedback->mingrade / $toform['grade'] . '%';
             }
             $key++;
         }
     }
     if (isset($toform['timelimit'])) {
         $toform['timelimitenable'] = $toform['timelimit'] > 0;
     }
     $this->preprocessing_review_settings($toform, 'during', mod_quiz_display_options::DURING);
     $this->preprocessing_review_settings($toform, 'immediately', mod_quiz_display_options::IMMEDIATELY_AFTER);
     $this->preprocessing_review_settings($toform, 'open', mod_quiz_display_options::LATER_WHILE_OPEN);
     $this->preprocessing_review_settings($toform, 'closed', mod_quiz_display_options::AFTER_CLOSE);
     $toform['attemptduring'] = true;
     $toform['overallfeedbackduring'] = false;
     // Password field - different in form to stop browsers that remember
     // passwords from getting confused.
     if (isset($toform['password'])) {
         $toform['quizpassword'] = $toform['password'];
         unset($toform['password']);
     }
     // Load any settings belonging to the access rules.
     if (!empty($toform['instance'])) {
         $accesssettings = quiz_access_manager::load_settings($toform['instance']);
         foreach ($accesssettings as $name => $value) {
             $toform[$name] = $value;
         }
     }
 }
開發者ID:EmmanuelYupit,項目名稱:educursos,代碼行數:50,代碼來源:mod_form.php


注:本文中的quiz_access_manager::load_settings方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。