[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/question/ -> export_form.php (source)

   1  <?php  // $Id$
   2  
   3  require_once($CFG->libdir.'/formslib.php');
   4  
   5  class question_export_form extends moodleform {
   6  
   7      function definition() {
   8          $mform    =& $this->_form;
   9  
  10          $defaultcategory   = $this->_customdata['defaultcategory'];
  11          $contexts   = $this->_customdata['contexts'];
  12          $defaultfilename = $this->_customdata['defaultfilename'];
  13  //--------------------------------------------------------------------------------
  14          $mform->addElement('header','fileformat',get_string('fileformat','quiz'));
  15          $fileformatnames = get_import_export_formats('export');
  16          $radioarray = array();
  17          foreach ($fileformatnames as $id => $fileformatname) {
  18              $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id);
  19          }
  20          $mform->addGroup($radioarray,'format','',array('<br />'),false);
  21          $mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));
  22          $mform->addRule('format',null,'required',null,'client'); 
  23  
  24  //--------------------------------------------------------------------------------
  25          $mform->addElement('header','general', get_string('general', 'form'));
  26  
  27          $mform->addElement('questioncategory', 'category', get_string('category','quiz'), compact('contexts'));
  28          $mform->setDefault('category', $defaultcategory);
  29          $mform->setHelpButton('category', array('exportcategory', get_string('exportcategory','question'), 'quiz'));
  30  
  31          $categorygroup = array();
  32          $categorygroup[] =& $mform->createElement('checkbox', 'cattofile', '', get_string('tofilecategory', 'question'));
  33          $categorygroup[] =& $mform->createElement('checkbox', 'contexttofile', '', get_string('tofilecontext', 'question'));
  34          $mform->addGroup($categorygroup, 'categorygroup', '', '', false);
  35          $mform->disabledIf('categorygroup', 'cattofile', 'notchecked');
  36          $mform->setDefault('cattofile', 1);
  37          $mform->setDefault('contexttofile', 1);
  38          
  39  
  40  //        $fileformatnames = get_import_export_formats('export');
  41  //        $mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
  42  //        $mform->setDefault('format', 'gift');
  43  //        $mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));
  44  
  45          $mform->addElement('text', 'exportfilename', get_string('exportname', 'quiz'), array('size'=>40));
  46          $mform->setDefault('exportfilename', $defaultfilename);
  47          $mform->setType('exportfilename', PARAM_CLEANFILE);
  48  
  49  
  50  //--------------------------------------------------------------------------------
  51          $this->add_action_buttons(false, get_string('exportquestions', 'quiz'));
  52  //--------------------------------------------------------------------------------
  53      }
  54  }
  55  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7