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


PHP question_backup_answers函數代碼示例

本文整理匯總了PHP中question_backup_answers函數的典型用法代碼示例。如果您正苦於以下問題:PHP question_backup_answers函數的具體用法?PHP question_backup_answers怎麽用?PHP question_backup_answers使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: backup

 function backup($bf, $preferences, $question, $level = 6)
 {
     $status = true;
     $multianswers = get_records("question_multianswer", "question", $question, "id");
     //If there are multianswers
     if ($multianswers) {
         //Print multianswers header
         $status = fwrite($bf, start_tag("MULTIANSWERS", $level, true));
         //Iterate over each multianswer
         foreach ($multianswers as $multianswer) {
             $status = fwrite($bf, start_tag("MULTIANSWER", $level + 1, true));
             //Print multianswer contents
             fwrite($bf, full_tag("ID", $level + 2, false, $multianswer->id));
             fwrite($bf, full_tag("QUESTION", $level + 2, false, $multianswer->question));
             fwrite($bf, full_tag("SEQUENCE", $level + 2, false, $multianswer->sequence));
             $status = fwrite($bf, end_tag("MULTIANSWER", $level + 1, true));
         }
         //Print multianswers footer
         $status = fwrite($bf, end_tag("MULTIANSWERS", $level, true));
         //Now print question_answers
         $status = question_backup_answers($bf, $preferences, $question);
     }
     return $status;
 }
開發者ID:JackCanada,項目名稱:moodle-hacks,代碼行數:24,代碼來源:questiontype.php

示例2: backup

 /**
  * Backup the extra information specific to an essay question - over and above
  * what is in the mdl_question table.
  *
  * @param file $bf The backup file to write to.
  * @param object $preferences the blackup options controlling this backup.
  * @param $questionid the id of the question being backed up.
  * @param $level indent level in the backup file - so it can be formatted nicely.
  */
 function backup($bf, $preferences, $questionid, $level = 6)
 {
     return question_backup_answers($bf, $preferences, $questionid, $level);
 }
開發者ID:edwinphillips,項目名稱:moodle-485cb39,代碼行數:13,代碼來源:questiontype.php

示例3: backup

 /**
  * Backup the data in the question
  *
  * This is used in question/backuplib.php
  */
 function backup($bf, $preferences, $question, $level = 6)
 {
     $status = true;
     $webworks = get_records('question_webwork', 'question', $question, 'id');
     //If there are webworks
     if ($webworks) {
         //Iterate over each webwork
         foreach ($webworks as $webwork) {
             $status = fwrite($bf, start_tag("WEBWORK", $level, true));
             fwrite($bf, full_tag("CODECHECK", $level + 1, false, $webwork->codecheck));
             fwrite($bf, full_tag("CODE", $level + 1, false, $webwork->code));
             fwrite($bf, full_tag("GRADING", $level + 1, false, $webwork->grading));
             $status = fwrite($bf, end_tag("WEBWORK", $level, true));
         }
         $status = question_backup_answers($bf, $preferences, $question);
     }
     return $status;
 }
開發者ID:xiongchiamiov,項目名稱:wwmqt-svn,代碼行數:23,代碼來源:questiontype.php

示例4: backup

 function backup($bf, $preferences, $question, $level = 6)
 {
     $status = true;
     $extraquestionfields = $this->extra_question_fields();
     if (is_array($extraquestionfields)) {
         $questionextensiontable = array_shift($extraquestionfields);
         $record = get_record($questionextensiontable, $this->questionid_column_name(), $question);
         if ($record) {
             $tagname = strtoupper($this->name());
             $status = $status && fwrite($bf, start_tag($tagname, $level, true));
             foreach ($extraquestionfields as $field) {
                 if (!isset($record->{$field})) {
                     echo "No data for field {$field} when backuping " . $this->name() . ' question id ' . $question;
                     return false;
                 }
                 fwrite($bf, full_tag(strtoupper($field), $level + 1, false, $record->{$field}));
             }
             $status = $status && fwrite($bf, end_tag($tagname, $level, true));
         }
     }
     $extraasnwersfields = $this->extra_answer_fields();
     if (is_array($extraasnwersfields)) {
         //TODO backup the answers, with any extra data.
     } else {
         $status = $status && question_backup_answers($bf, $preferences, $question);
     }
     return $status;
 }
開發者ID:kai707,項目名稱:ITSA-backup,代碼行數:28,代碼來源:questiontype.php

示例5: backup

 /**
  * Backup the data in the question to a backup file.
  *
  * This function is used by question/backuplib.php to create a copy of the data
  * in the question so that it can be restored at a later date. The method writes
  * all the supplementary algebra type-specific information from the question_algebra
  * data base table as well as writing out all the variables used by the question.
  * It also uses the question_backup_answers function from question/backuplib.php to
  * backup all the question answers.
  *
  * @param $bf the backup file to write the information to
  * @param $preferences backup preferences in effect (not used)
  * @param $question the ID number of the question being backed up
  * @param $level the indentation level of the data being written
  * 
  * @return bool true if the backup was successful, false if it failed.
  */
 function backup($bf, $preferences, $question, $level = 6)
 {
     // Set the devault return value, $status, to be true
     $status = true;
     $algebraqs = get_records('question_algebra', 'questionid', $question, 'id ASC');
     // If there are algebra questions
     if ($algebraqs) {
         // Iterate over each algebra question
         foreach ($algebraqs as $algebra) {
             $status = $status && fwrite($bf, start_tag('ALGEBRA', $level, true));
             // Print algebra question contents
             fwrite($bf, full_tag('COMPAREBY', $level + 1, false, $algebra->compareby));
             fwrite($bf, full_tag('VARIABLES', $level + 1, false, $algebra->variables));
             fwrite($bf, full_tag('NCHECKS', $level + 1, false, $algebra->nchecks));
             fwrite($bf, full_tag('TOLERANCE', $level + 1, false, $algebra->tolerance));
             fwrite($bf, full_tag('ALLOWEDFUNCS', $level + 1, false, $algebra->allowedfuncs));
             fwrite($bf, full_tag('DISALLOW', $level + 1, false, $algebra->disallow));
             fwrite($bf, full_tag('ANSWERPREFIX', $level + 1, false, $algebra->answerprefix));
             // Backup all the variables
             $status = $status && $this->backup_variables($bf, $preferences, $question, 7);
             // End algebra data
             $status = $status && fwrite($bf, end_tag('ALGEBRA', $level, true));
         }
         // Backup the answers
         $status = $status && question_backup_answers($bf, $preferences, $question);
     }
     return $status;
 }
開發者ID:hmatulis,項目名稱:RTL-BIDI-Hebrew-Moodle-Plugins,代碼行數:45,代碼來源:questiontype.php

示例6: backup

 function backup($bf, $preferences, $question, $level = 6)
 {
     $status = true;
     $calculateds = get_records("question_calculated", "question", $question, "id");
     //If there are calculated-s
     if ($calculateds) {
         //Iterate over each calculateds
         foreach ($calculateds as $calculated) {
             $status = $status && fwrite($bf, start_tag("CALCULATED", $level, true));
             //Print calculated contents
             fwrite($bf, full_tag("ANSWER", $level + 1, false, $calculated->answer));
             fwrite($bf, full_tag("TOLERANCE", $level + 1, false, $calculated->tolerance));
             fwrite($bf, full_tag("TOLERANCETYPE", $level + 1, false, $calculated->tolerancetype));
             fwrite($bf, full_tag("CORRECTANSWERLENGTH", $level + 1, false, $calculated->correctanswerlength));
             fwrite($bf, full_tag("CORRECTANSWERFORMAT", $level + 1, false, $calculated->correctanswerformat));
             //Now backup numerical_units
             $status = question_backup_numerical_units($bf, $preferences, $question, 7);
             //Now backup required dataset definitions and items...
             $status = question_backup_datasets($bf, $preferences, $question, 7);
             //End calculated data
             $status = $status && fwrite($bf, end_tag("CALCULATED", $level, true));
         }
         //Now print question_answers
         $status = question_backup_answers($bf, $preferences, $question);
     }
     return $status;
 }
開發者ID:arshanam,項目名稱:Moodle-ITScholars-LMS,代碼行數:27,代碼來源:questiontype.php

示例7: backup

 /**
  * Backup the data in the question
  *
  * This is used in question/backuplib.php
  */
 function backup($bf, $preferences, $question, $level = 6)
 {
     $status = true;
     $numericals = get_records('question_numerical', 'question', $question, 'id ASC');
     //If there are numericals
     if ($numericals) {
         //Iterate over each numerical
         foreach ($numericals as $numerical) {
             $status = fwrite($bf, start_tag("NUMERICAL", $level, true));
             //Print numerical contents
             fwrite($bf, full_tag("ANSWER", $level + 1, false, $numerical->answer));
             fwrite($bf, full_tag("TOLERANCE", $level + 1, false, $numerical->tolerance));
             //Now backup numerical_units
             $status = question_backup_numerical_units($bf, $preferences, $question, 7);
             $status = fwrite($bf, end_tag("NUMERICAL", $level, true));
         }
         //Now print question_answers
         $status = question_backup_answers($bf, $preferences, $question);
     }
     return $status;
 }
開發者ID:veritech,項目名稱:pare-project,代碼行數:26,代碼來源:questiontype.php

示例8: backup

 /**
  * Backup the data in the question
  *
  * This is used in question/backuplib.php
  */
 function backup($bf, $preferences, $question, $level = 6)
 {
     $status = true;
     if (!($alldata = self::load_all_data($question))) {
         return $status;
     }
     $status = $status && fwrite($bf, start_tag('MATRIX', $level, true));
     $status = $status && fwrite($bf, full_tag('QUESTIONID', $level + 1, false, $question));
     $status = $status && fwrite($bf, full_tag('GRADEMETHOD', $level + 1, false, $alldata->grademethod));
     $status = $status && fwrite($bf, full_tag('MULTIPLE', $level + 1, false, $alldata->multiple));
     $status = $status && fwrite($bf, full_tag('RENDERER', $level + 1, false, $alldata->renderer));
     $status = $status && fwrite($bf, start_tag('ROWS', $level + 1, true));
     foreach ($alldata->rows as $row) {
         $status = $status && fwrite($bf, start_tag('ROW', $level + 2, true));
         $status = $status && fwrite($bf, full_tag('ID', $level + 3, false, $row->id));
         $status = $status && fwrite($bf, full_tag('MATRIXID', $level + 3, false, $row->matrixid));
         $status = $status && fwrite($bf, full_tag('SHORTTEXT', $level + 3, false, $row->shorttext));
         $status = $status && fwrite($bf, full_tag('DESCRIPTION', $level + 3, false, $row->description));
         $status = $status && fwrite($bf, full_tag('FEEDBACK', $level + 3, false, $row->feedback));
         $status = $status && fwrite($bf, end_tag('ROW', $level + 2, true));
     }
     $status = $status && fwrite($bf, end_tag('ROWS', $level + 1, true));
     $status = $status && fwrite($bf, start_tag('COLS', $level + 1, true));
     foreach ($alldata->cols as $col) {
         $status = $status && fwrite($bf, start_tag('COL', $level + 2, true));
         $status = $status && fwrite($bf, full_tag('ID', $level + 3, false, $col->id));
         $status = $status && fwrite($bf, full_tag('MATRIXID', $level + 3, false, $col->matrixid));
         $status = $status && fwrite($bf, full_tag('SHORTTEXT', $level + 3, false, $col->shorttext));
         $status = $status && fwrite($bf, full_tag('DESCRIPTION', $level + 3, false, $col->description));
         $status = $status && fwrite($bf, end_tag('COL', $level + 2, true));
     }
     $status = $status && fwrite($bf, end_tag('COLS', $level + 1, true));
     $status = $status && fwrite($bf, start_tag('WEIGHTS', $level + 1, true));
     foreach ($alldata->rawweights as $weight) {
         $status = $status && fwrite($bf, start_tag('WEIGHT', $level + 2, true));
         $status = $status && fwrite($bf, full_tag('ID', $level + 3, false, $weight->id));
         $status = $status && fwrite($bf, full_tag('ROWID', $level + 3, false, $weight->rowid));
         $status = $status && fwrite($bf, full_tag('COLID', $level + 3, false, $weight->colid));
         $status = $status && fwrite($bf, full_tag('WEIGHT', $level + 3, false, $weight->weight));
         $status = $status && fwrite($bf, end_tag('WEIGHT', $level + 2, true));
     }
     $status = $status && fwrite($bf, end_tag('WEIGHTS', $level + 1, true));
     $status = $status && fwrite($bf, end_tag('MATRIX', $level, true));
     $status = question_backup_answers($bf, $preferences, $question);
     return $status;
 }
開發者ID:sunilwebaccess,項目名稱:moodle-question-matrix,代碼行數:51,代碼來源:questiontype.php

示例9: backup

 /**
  * Backup the data in the question
  *
  * This is used in question/backuplib.php
  */
 function backup($bf, $preferences, $question, $level = 6)
 {
     $status = true;
     $fileresponses = get_records("question_fileresponse", "question", $question, "id ASC");
     // If there is a question
     if ($fileresponses) {
         // Iterate over each
         foreach ($fileresponses as $fileresponse) {
             $status = $status && fwrite($bf, start_tag("FILERESPONSE", $level, true));
             // Print contents
             $status = $status && fwrite($bf, full_tag("MAXBYTES", $level + 1, false, $fileresponse->maxbytes));
             $status = $status && fwrite($bf, full_tag("ESSAY", $level + 1, false, $fileresponse->essay));
             $status = $status && fwrite($bf, end_tag("FILERESPONSE", $level, true));
         }
         // Now print question_answers
         $status = $status && question_backup_answers($bf, $preferences, $question, $level);
     }
     return $status;
 }
開發者ID:nadavkav,項目名稱:MoodleTAO,代碼行數:24,代碼來源:questiontype.php

示例10: wrsqz_backup

function wrsqz_backup($questionType, $dbType, &$bf, &$preferences, &$question, &$level, $extraquestionfields, $questionid_column_name) {
	
	$problemRecord = get_records('question_' . $dbType, 'question', $question, 'id');
	$questionRecord = get_records('question_' . $questionType . 'wiris', 'question', $question, 'id');

  $questions = array();
  $status = true;

	if ($questionRecord !== false) {
    foreach($questionRecord as $quest){
      $questions[$quest->question]->options = unserialize($quest->options);
    }
  }

	if ($questionType == 'shortanswer') {
		if ($questionRecord !== false) {
			foreach ($questionRecord as $quest) {
				$questions[$quest->question]->eqoption = $quest->eqoption;
			}
		}

    //This is what does the parent (/question/questiontype.php) class,
    //but in the shortanswer case we cannot call the parent because
    //the tag name is the same ("<SHORTANSWERWIRIS>").
    $record = get_record('question_shortanswer', 'question', $question);
    $answers = $record->answers;
    $usecase = $record->usecase;
	}else if ($questionType == 'truefalse' || $questionType == 'multichoice') {
		if ($questionRecord !== false) {
			foreach ($questionRecord as $quest) {
				$questions[$quest->question]->override = $quest->override;
			}
		}
	}

	if ($problemRecord !== false) {
		foreach ($problemRecord as $quest) {
			$questions[$quest->question]->program = $quest->program;
		}
	}
    
	$tagname = strtoupper($questionType) . 'WIRIS';

  foreach ($questions as $q) {
    $status = fwrite($bf, start_tag($tagname, $level, true));
    if (!empty($q->program)) {
      $programParsed = wrsqz_mathmlEncode($q->program);
      $levelUp = $level + 1;
      $status = fwrite($bf, full_tag('WIRISPROGRAM', $levelUp, false, $programParsed)) && $status;

      if ($questionType == 'truefalse' || $questionType == 'multichoice') {
        $status = fwrite($bf, full_tag('WIRISOVERRIDEANSWER', $levelUp, false, $q->override));
      }else if ($questionType == 'shortanswer') {
        $status = fwrite($bf, full_tag('WIRISEDITOR', $levelUp, false, $q->eqoption)) && $status;
      }else if ($questionType == 'multianswer') {
        //TODO
        //$status = fwrite($bf, full_tag('WIRISEDITOR', $levelUp, false, $q->eqoption)) && $status;
      }
      $status = fwrite($bf, start_tag('WIRISOPTIONS', $levelUp, true))&& $status;
      foreach($q->options as $key=>$value){
        if($key == 'hiddenInitialCASValue') $value = wrsqz_mathmlEncode($value);
        $status = fwrite($bf, full_tag($key, $levelUp+1, false, print_r($value, true))) && $status;
      }
      $status = fwrite($bf, end_tag('WIRISOPTIONS', $levelUp, true)) && $status;
      
    }

    $status = fwrite($bf, end_tag($tagname, $level, true)) && $status;

    if ($questionType == 'shortanswer'){
      //this is done by the parent class in the other questiontypes
      $status = fwrite($bf, start_tag('SHORTANSWER', $level, true)) && $status;
      $status = fwrite($bf, full_tag('ANSWERS', $levelUp, false, $answers)) && $status;
      $status = fwrite($bf, full_tag('USECASE', $levelUp, false, $usecase)) && $status;
      $status = fwrite($bf, end_tag('SHORTANSWER', $level, true)) && $status;
      $status = question_backup_answers($bf, $preferences, $question) && $status;
    }
	}
	
  return $status;
}
開發者ID:nagyistoce,項目名稱:moodle-Teach-Pilot,代碼行數:81,代碼來源:libquestiontype.php

示例11: backup

 /**
  * Backup the data in the question
  *
  * This is used in question/backuplib.php
  */
 function backup($bf, $preferences, $question, $level = 6)
 {
     $status = true;
     $webworks = get_records('question_webwork', 'question', $question, 'id');
     //If there are webworks
     if ($webworks) {
         //Print webworks header
         //Iterate over each webwork
         foreach ($webworks as $webwork) {
             $status = fwrite($bf, start_tag("WEBWORK", $level, true));
             fwrite($bf, full_tag("CODE", $level + 1, false, $webwork->code));
             fwrite($bf, full_tag("SEED", $level + 1, false, $webwork->seed));
             fwrite($bf, full_tag("TRIALS", $level + 1, false, $webwork->trials));
             $webworksderived = get_records('question_webwork_derived', 'question_webwork', $webwork->id);
             if ($webworksderived) {
                 $status = fwrite($bf, start_tag("WEBWORKDERIVED", $level + 1, true));
                 foreach ($webworksderived as $webworkderived) {
                     fwrite($bf, full_tag("ID", $level + 2, false, $webworkderived->id));
                     fwrite($bf, full_tag("QUESTION_WEBWORK", $level + 2, false, $webworkderived->question_webwork));
                     fwrite($bf, full_tag("HTML", $level + 2, false, $webworkderived->html));
                     fwrite($bf, full_tag("SEED", $level + 2, false, $webworkderived->seed));
                 }
                 $status = fwrite($bf, end_tag("WEBWORKDERIVED", $level + 1, true));
             }
             $status = fwrite($bf, end_tag("WEBWORK", $level, true));
         }
         //Print webworks footer
         //Now print question_webwork
         $status = question_backup_answers($bf, $preferences, $question);
     }
     return $status;
 }
開發者ID:bjornbe,項目名稱:wwassignment,代碼行數:37,代碼來源:questiontype.php


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