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


PHP question_edit_form::question_edit_form方法代码示例

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


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

示例1: fullclone

 function question_edit_multianswer_form(&$submiturl, &$question, &$category, &$contexts, $formeditable = true)
 {
     global $QTYPES, $SESSION, $CFG, $DB;
     $this->regenerate = true;
     if ("1" == optional_param('reload', '', PARAM_INT)) {
         $this->reload = true;
     } else {
         $this->reload = false;
     }
     // $this->question = $question;
     $this->used_in_quiz = false;
     //  echo "<p> question <pre>";print_r($question);echo "</pre></p>";
     if (isset($question->id) && $question->id != 0) {
         $this->savedquestiondisplay = fullclone($question);
         if ($list = $DB->get_records('quiz_question_instances', array('question' => $question->id))) {
             foreach ($list as $key => $li) {
                 $this->nb_of_quiz++;
                 if ($att = $DB->get_records('quiz_attempts', array('quiz' => $li->quiz, 'preview' => '0'))) {
                     $this->nb_of_attempts += count($att);
                     $this->used_in_quiz = true;
                 }
             }
         }
     }
     parent::question_edit_form($submiturl, $question, $category, $contexts, $formeditable);
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:26,代码来源:edit_multianswer_form.php

示例2: array

 function question_edit_calculatedmulti_form(&$submiturl, &$question, &$category, &$contexts, $formeditable = true)
 {
     global $QTYPES, $SESSION, $CFG, $DB;
     $this->question = $question;
     $this->qtypeobj =& $QTYPES[$this->question->qtype];
     if ("1" == optional_param('reload', '', PARAM_INT)) {
         $this->reload = true;
     } else {
         $this->reload = false;
     }
     if (!$this->reload) {
         // use database data as this is first pass
         if (isset($this->question->id)) {
             // remove prefix #{..}# if exists
             $this->initialname = $question->name;
             $regs = array();
             if (preg_match('~#\\{([^[:space:]]*)#~', $question->name, $regs)) {
                 $question->name = str_replace($regs[0], '', $question->name);
             }
         }
     } else {
     }
     parent::question_edit_form($submiturl, $question, $category, $contexts, $formeditable);
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:24,代码来源:edit_calculatedmulti_form.php

示例3: array


//.........这里部分代码省略.........
         $newdatasetvalues = false;
         for ($key = 1; $key <= sizeof($olddef); $key++) {
             $def = $olddef[$key];
             $this->datasetdefs[$def] = new stdClass();
             $this->datasetdefs[$def]->type = 1;
             $this->datasetdefs[$def]->category = 0;
             //  $this->datasets[$key]->name = $datasetname;
             $this->datasetdefs[$def]->options = $oldoptions[$key];
             $this->datasetdefs[$def]->calcmin = $calcmin[$key];
             $this->datasetdefs[$def]->calcmax = $calcmax[$key];
             $this->datasetdefs[$def]->calclength = $calclength[$key];
             //then compare with new values
             if (preg_match('~^(uniform|loguniform):([^:]*):([^:]*):([0-9]*)$~', $this->datasetdefs[$def]->options, $regs)) {
                 if ($this->datasetdefs[$def]->calcmin != $regs[2] || $this->datasetdefs[$def]->calcmax != $regs[3] || $this->datasetdefs[$def]->calclength != $regs[4]) {
                     $newdatasetvalues = true;
                 }
             }
             $this->datasetdefs[$def]->options = "uniform:" . $this->datasetdefs[$def]->calcmin . ":" . $this->datasetdefs[$def]->calcmax . ":" . $this->datasetdefs[$def]->calclength;
         }
         // detect new datasets
         $newdataset = false;
         foreach ($mandatorydatasets as $datasetname) {
             if (!isset($this->datasetdefs["1-0-{$datasetname}"])) {
                 $key = "1-0-{$datasetname}";
                 $this->datasetdefs[$key] = new stdClass();
                 //"1-0-$datasetname";
                 $this->datasetdefs[$key]->type = 1;
                 $this->datasetdefs[$key]->category = 0;
                 $this->datasetdefs[$key]->name = $datasetname;
                 $this->datasetdefs[$key]->options = "uniform:1.0:10.0:1";
                 $newdataset = true;
             } else {
                 $this->datasetdefs["1-0-{$datasetname}"]->name = $datasetname;
             }
         }
         // remove obsolete datasets
         $datasettoremove = false;
         foreach ($this->datasetdefs as $defkey => $datasetdef) {
             if (!isset($datasetdef->name)) {
                 $datasettoremove = true;
                 unset($this->datasetdefs[$defkey]);
             }
         }
     }
     // handle reload
     // create items if  $newdataset and noofitems > 0 and !$newdatasetvalues
     // eliminate any items if $newdatasetvalues
     // eliminate any items if $datasettoremove, $newdataset, $newdatasetvalues
     if ($datasettoremove || $newdataset || $newdatasetvalues) {
         foreach ($this->datasetdefs as $defkey => $datasetdef) {
             $datasetdef->itemcount = 0;
             unset($datasetdef->items);
         }
     }
     $maxnumber = -1;
     if ("" != optional_param('addbutton')) {
         $maxnumber = optional_param('selectadd');
         foreach ($this->datasetdefs as $defid => $datasetdef) {
             $datasetdef->itemcount = $maxnumber;
             unset($datasetdef->items);
             for ($numberadded = 1; $numberadded <= $maxnumber; $numberadded++) {
                 $datasetitem = new stdClass();
                 $datasetitem->itemnumber = $numberadded;
                 $datasetitem->id = 0;
                 $datasetitem->value = $this->qtypeobj->generate_dataset_item($datasetdef->options);
                 $this->datasetdefs[$defid]->items[$numberadded] = $datasetitem;
             }
             //for number added
         }
         // datasetsdefs end
         $this->maxnumber = $maxnumber;
     } else {
         // Handle reload dataset items
         if ("" != optional_param('definition') && !($datasettoremove || $newdataset || $newdatasetvalues)) {
             $i = 1;
             $fromformdefinition = optional_param('definition');
             $fromformnumber = optional_param('number');
             $fromformitemid = optional_param('itemid');
             ksort($fromformdefinition);
             foreach ($fromformdefinition as $key => $defid) {
                 $addeditem = new stdClass();
                 $addeditem->id = $fromformitemid[$i];
                 $addeditem->value = $fromformnumber[$i];
                 $addeditem->itemnumber = ceil($i / count($this->datasetdefs));
                 $this->datasetdefs[$defid]->items[$addeditem->itemnumber] = $addeditem;
                 $this->datasetdefs[$defid]->itemcount = $i;
                 $i++;
             }
         }
         if (isset($addeditem->itemnumber) && $this->maxnumber < $addeditem->itemnumber) {
             $this->maxnumber = $addeditem->itemnumber;
             if (!empty($this->datasetdefs)) {
                 foreach ($this->datasetdefs as $datasetdef) {
                     $datasetdef->itemcount = $this->maxnumber;
                 }
             }
         }
     }
     parent::question_edit_form($submiturl, $question, $category, $contexts, $formeditable);
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:edit_calculatedsimple_form.php


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