本文整理汇总了PHP中question_type::delete_question方法的典型用法代码示例。如果您正苦于以下问题:PHP question_type::delete_question方法的具体用法?PHP question_type::delete_question怎么用?PHP question_type::delete_question使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_type
的用法示例。
在下文中一共展示了question_type::delete_question方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_question
public function delete_question($questionid, $contextid)
{
global $DB;
$DB->delete_records('question_multianswer', array('question' => $questionid));
parent::delete_question($questionid, $contextid);
}
示例2: delete_question
public function delete_question($questionid, $contextid)
{
global $DB;
$DB->delete_records('question_calculated', array('question' => $questionid));
$DB->delete_records('question_calculated_options', array('question' => $questionid));
$DB->delete_records('question_numerical_units', array('question' => $questionid));
if ($datasets = $DB->get_records('question_datasets', array('question' => $questionid))) {
foreach ($datasets as $dataset) {
if (!$DB->get_records_select('question_datasets', "question != ? AND datasetdefinition = ? ", array($questionid, $dataset->datasetdefinition))) {
$DB->delete_records('question_dataset_definitions', array('id' => $dataset->datasetdefinition));
$DB->delete_records('question_dataset_items', array('definition' => $dataset->datasetdefinition));
}
}
}
$DB->delete_records('question_datasets', array('question' => $questionid));
parent::delete_question($questionid, $contextid);
}
示例3:
/**
* Deletes question from the question-type specific tables
*
* @param integer $questionid The question being deleted
* @return boolean to indicate success of failure.
*/
function delete_question($questionid, $contextid = null)
{
if (empty($questionid)) {
return false;
}
global $DB;
$transaction = $DB->start_delegated_transaction();
$this->delete_question_options($questionid);
parent::delete_question($questionid, $contextid);
$transaction->allow_commit();
return true;
}
示例4: delete_question
public function delete_question($questionid, $contextid)
{
global $DB;
$DB->delete_records('qtype_multichoiceset_options', array('questionid' => $questionid));
return parent::delete_question($questionid, $contextid);
}
示例5: delete_question
public function delete_question($questionid, $contextid) {
global $DB;
$DB->delete_records('question_match', array('question' => $questionid));
$DB->delete_records('question_match_sub', array('question' => $questionid));
parent::delete_question($questionid, $contextid);
}
示例6: delete_question
public function delete_question($questionid, $contextid)
{
global $DB;
$DB->delete_records('qtype_' . $this->name(), array('questionid' => $questionid));
$DB->delete_records('qtype_' . $this->name() . '_drags', array('questionid' => $questionid));
$DB->delete_records('qtype_' . $this->name() . '_drops', array('questionid' => $questionid));
return parent::delete_question($questionid, $contextid);
}
示例7: delete_question
public function delete_question($questionid, $contextid) {
global $DB;
$DB->delete_records('question_numerical', array('question' => $questionid));
$DB->delete_records('question_numerical_options', array('question' => $questionid));
$DB->delete_records('question_numerical_units', array('question' => $questionid));
parent::delete_question($questionid, $contextid);
}
示例8: delete_question
public function delete_question($questionid, $contextid)
{
global $DB;
$this->delete_question_tests($questionid);
$DB->delete_records('qtype_stack_deployed_seeds', array('questionid' => $questionid));
$DB->delete_records('qtype_stack_prt_nodes', array('questionid' => $questionid));
$DB->delete_records('qtype_stack_prts', array('questionid' => $questionid));
$DB->delete_records('qtype_stack_inputs', array('questionid' => $questionid));
$DB->delete_records('qtype_stack_options', array('questionid' => $questionid));
parent::delete_question($questionid, $contextid);
}
示例9: delete_question
public function delete_question($questionid, $contextid)
{
parent::delete_question($questionid, $contextid);
}
示例10: delete_question
public function delete_question($questionid, $contextid)
{
global $DB;
// TODO: find a solution to the problem of deleting in-use
// prototypes. The code below isn't isn't correct (it doesn't
// check the context of the question) so the entire block has
// been commented out. Currently it's over to
// to user to make sure they don't delete in-use prototypes.
/*$question = $DB->get_record(
'question_coderunner_options',
array('questionid' => $questionid));
if ($question->prototypetype != 0) {
$typeName = $question->coderunnertype;
$nUses = $DB->count_records('question_coderunner_options',
array('prototypetype' => 0,
'coderunnertype' => $typeName));
if ($nUses != 0) {
// TODO: see if a better solution to this problem can be found.
// Throwing an exception is very heavy-handed but the return
// value from this function is ignored by the question bank,
// and other deletion (e.g. of the question itself) proceeds
// regardless, leaving things in an even worse state than if
// I didn't even check for an in-use prototype!
throw new moodle_exception('Attempting to delete in-use prototype');
}
}
*/
$success = $DB->delete_records("question_coderunner_tests", array('questionid' => $questionid));
return $success && parent::delete_question($questionid, $contextid);
}