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


PHP scorm_get_popup_options_array函数代码示例

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


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

示例1: definition


//.........这里部分代码省略.........
     // Force new attempt
     $mform->addElement('selectyesno', 'forcenewattempt', get_string('forcenewattempt', 'scorm'));
     $mform->setHelpButton('forcenewattempt', array('forcenewattempt', get_string('forcenewattempt', 'scorm'), 'scorm'));
     $mform->setDefault('forcenewattempt', $cfg_scorm->forcenewattempt);
     $mform->setAdvanced('forcenewattempt');
     // Last attempt lock - lock the enter button after the last available attempt has been made
     $mform->addElement('selectyesno', 'lastattemptlock', get_string('lastattemptlock', 'scorm'));
     $mform->setHelpButton('lastattemptlock', array('lastattemptlock', get_string('lastattemptlock', 'scorm'), 'scorm'));
     $mform->setDefault('lastattemptlock', $cfg_scorm->lastattemptlock);
     $mform->setAdvanced('lastattemptlock');
     // What Grade
     $mform->addElement('select', 'whatgrade', get_string('whatgrade', 'scorm'), scorm_get_what_grade_array());
     $mform->disabledIf('whatgrade', 'maxattempt', 'eq', 1);
     $mform->setHelpButton('whatgrade', array('whatgrade', get_string('whatgrade', 'scorm'), 'scorm'));
     $mform->setDefault('whatgrade', $cfg_scorm->whatgrade);
     $mform->setAdvanced('whatgrade');
     // Activation period
     /*        $mform->addElement('static', '', '' ,'<hr />');
             $mform->addElement('static', 'activation', get_string('activation','scorm'));
             $datestartgrp = array();
             $datestartgrp[] = &$mform->createElement('date_time_selector', 'startdate');
             $datestartgrp[] = &$mform->createElement('checkbox', 'startdisabled', null, get_string('disable'));
             $mform->addGroup($datestartgrp, 'startdategrp', get_string('from'), ' ', false);
             $mform->setDefault('startdate', 0);
             $mform->setDefault('startdisabled', 1);
             $mform->disabledIf('startdategrp', 'startdisabled', 'checked');
     
             $dateendgrp = array();
             $dateendgrp[] = &$mform->createElement('date_time_selector', 'enddate');
             $dateendgrp[] = &$mform->createElement('checkbox', 'enddisabled', null, get_string('disable'));
             $mform->addGroup($dateendgrp, 'dateendgrp', get_string('to'), ' ', false);
             $mform->setDefault('enddate', 0);
             $mform->setDefault('enddisabled', 1);
             $mform->disabledIf('dateendgrp', 'enddisabled', 'checked');
     */
     // Stage Size
     $mform->addElement('static', '', '', '<hr />');
     $mform->addElement('static', 'stagesize', get_string('stagesize', 'scorm'));
     $mform->setHelpButton('stagesize', array('stagesize', get_string('stagesize', 'scorm'), 'scorm'));
     // Width
     $mform->addElement('text', 'width', get_string('width', 'scorm'), 'maxlength="5" size="5"');
     $mform->setDefault('width', $cfg_scorm->framewidth);
     $mform->setType('width', PARAM_INT);
     // Height
     $mform->addElement('text', 'height', get_string('height', 'scorm'), 'maxlength="5" size="5"');
     $mform->setDefault('height', $cfg_scorm->frameheight);
     $mform->setType('height', PARAM_INT);
     // Framed / Popup Window
     $mform->addElement('select', 'popup', get_string('display', 'scorm'), scorm_get_popup_display_array());
     $mform->setDefault('popup', $cfg_scorm->popup);
     $mform->setAdvanced('popup');
     // Window Options
     $winoptgrp = array();
     foreach (scorm_get_popup_options_array() as $key => $value) {
         $winoptgrp[] =& $mform->createElement('checkbox', $key, '', get_string($key, 'scorm'));
         $mform->setDefault($key, $value);
     }
     $mform->addGroup($winoptgrp, 'winoptgrp', get_string('options', 'scorm'), '<br />', false);
     $mform->setAdvanced('winoptgrp');
     $mform->disabledIf('winoptgrp', 'popup', 'eq', 0);
     // Skip view page
     $mform->addElement('select', 'skipview', get_string('skipview', 'scorm'), scorm_get_skip_view_array());
     $mform->setHelpButton('skipview', array('skipview', get_string('skipview', 'scorm'), 'scorm'));
     $mform->setDefault('skipview', $cfg_scorm->skipview);
     $mform->setAdvanced('skipview');
     // Hide Browse
     $mform->addElement('selectyesno', 'hidebrowse', get_string('hidebrowse', 'scorm'));
     $mform->setHelpButton('hidebrowse', array('hidebrowse', get_string('hidebrowse', 'scorm'), 'scorm'));
     $mform->setDefault('hidebrowse', $cfg_scorm->hidebrowse);
     $mform->setAdvanced('hidebrowse');
     // Toc display
     $mform->addElement('select', 'hidetoc', get_string('hidetoc', 'scorm'), scorm_get_hidetoc_array());
     $mform->setDefault('hidetoc', $cfg_scorm->hidetoc);
     $mform->setAdvanced('hidetoc');
     // Hide Navigation panel
     $mform->addElement('selectyesno', 'hidenav', get_string('hidenav', 'scorm'));
     $mform->setDefault('hidenav', $cfg_scorm->hidenav);
     $mform->setAdvanced('hidenav');
     // Autocontinue
     $mform->addElement('selectyesno', 'auto', get_string('autocontinue', 'scorm'));
     $mform->setHelpButton('auto', array('autocontinue', get_string('autocontinue', 'scorm'), 'scorm'));
     $mform->setDefault('auto', $cfg_scorm->auto);
     $mform->setAdvanced('auto');
     // Update packages timing
     $mform->addElement('select', 'updatefreq', get_string('updatefreq', 'scorm'), scorm_get_updatefreq_array());
     $mform->setDefault('updatefreq', $cfg_scorm->updatefreq);
     $mform->setAdvanced('updatefreq');
     //-------------------------------------------------------------------------------
     // Hidden Settings
     $mform->addElement('hidden', 'datadir', null);
     $mform->addElement('hidden', 'pkgtype', null);
     $mform->addElement('hidden', 'launch', null);
     $mform->addElement('hidden', 'redirect', null);
     $mform->addElement('hidden', 'redirecturl', null);
     //-------------------------------------------------------------------------------
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------------------------------
     // buttons
     $this->add_action_buttons();
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:mod_form.php

示例2: scorm_option2text

/**
 * @param object $scorm
 * @return object $scorm
 */
function scorm_option2text($scorm) {
    $scormpopoupoptions = scorm_get_popup_options_array();

    if (isset($scorm->popup)) {
        if ($scorm->popup == 1) {
            $optionlist = array();
            foreach ($scormpopoupoptions as $name => $option) {
                if (isset($scorm->$name)) {
                    $optionlist[] = $name.'='.$scorm->$name;
                } else {
                    $optionlist[] = $name.'=0';
                }
            }
            $scorm->options = implode(',', $optionlist);
        } else {
            $scorm->options = '';
        }
    } else {
        $scorm->popup = 0;
        $scorm->options = '';
    }
    return $scorm;
}
开发者ID:ruddj,项目名称:moodle,代码行数:27,代码来源:lib.php

示例3: definition

 public function definition()
 {
     global $CFG, $COURSE, $OUTPUT;
     $cfgscorm = get_config('scorm');
     $mform = $this->_form;
     if (!$CFG->slasharguments) {
         $mform->addElement('static', '', '', $OUTPUT->notification(get_string('slashargs', 'scorm'), 'notifyproblem'));
     }
     $mform->addElement('header', 'general', get_string('general', 'form'));
     // Name.
     $mform->addElement('text', 'name', get_string('name'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEANHTML);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     // Summary.
     $this->add_intro_editor(true);
     // Package.
     $mform->addElement('header', 'packagehdr', get_string('packagehdr', 'scorm'));
     $mform->setExpanded('packagehdr', true);
     // Scorm types.
     $scormtypes = array(SCORM_TYPE_LOCAL => get_string('typelocal', 'scorm'));
     if ($cfgscorm->allowtypeexternal) {
         $scormtypes[SCORM_TYPE_EXTERNAL] = get_string('typeexternal', 'scorm');
     }
     if ($cfgscorm->allowtypelocalsync) {
         $scormtypes[SCORM_TYPE_LOCALSYNC] = get_string('typelocalsync', 'scorm');
     }
     if ($cfgscorm->allowtypeexternalaicc) {
         $scormtypes[SCORM_TYPE_AICCURL] = get_string('typeaiccurl', 'scorm');
     }
     // Reference.
     if (count($scormtypes) > 1) {
         $mform->addElement('select', 'scormtype', get_string('scormtype', 'scorm'), $scormtypes);
         $mform->setType('scormtype', PARAM_ALPHA);
         $mform->addHelpButton('scormtype', 'scormtype', 'scorm');
         $mform->addElement('text', 'packageurl', get_string('packageurl', 'scorm'), array('size' => 60));
         $mform->setType('packageurl', PARAM_RAW);
         $mform->addHelpButton('packageurl', 'packageurl', 'scorm');
         $mform->disabledIf('packageurl', 'scormtype', 'eq', SCORM_TYPE_LOCAL);
     } else {
         $mform->addElement('hidden', 'scormtype', SCORM_TYPE_LOCAL);
         $mform->setType('scormtype', PARAM_ALPHA);
     }
     // New local package upload.
     $filemanageroptions = array();
     $filemanageroptions['accepted_types'] = array('.zip', '.xml');
     $filemanageroptions['maxbytes'] = 0;
     $filemanageroptions['maxfiles'] = 1;
     $filemanageroptions['subdirs'] = 0;
     $mform->addElement('filemanager', 'packagefile', get_string('package', 'scorm'), null, $filemanageroptions);
     $mform->addHelpButton('packagefile', 'package', 'scorm');
     $mform->disabledIf('packagefile', 'scormtype', 'noteq', SCORM_TYPE_LOCAL);
     // Update packages timing.
     $mform->addElement('select', 'updatefreq', get_string('updatefreq', 'scorm'), scorm_get_updatefreq_array());
     $mform->setType('updatefreq', PARAM_INT);
     $mform->setDefault('updatefreq', $cfgscorm->updatefreq);
     $mform->addHelpButton('updatefreq', 'updatefreq', 'scorm');
     // Display Settings.
     $mform->addElement('header', 'displaysettings', get_string('appearance'));
     // Framed / Popup Window.
     $mform->addElement('select', 'popup', get_string('display', 'scorm'), scorm_get_popup_display_array());
     $mform->setDefault('popup', $cfgscorm->popup);
     $mform->setAdvanced('popup', $cfgscorm->popup_adv);
     // Width.
     $mform->addElement('text', 'width', get_string('width', 'scorm'), 'maxlength="5" size="5"');
     $mform->setDefault('width', $cfgscorm->framewidth);
     $mform->setType('width', PARAM_INT);
     $mform->setAdvanced('width', $cfgscorm->framewidth_adv);
     $mform->disabledIf('width', 'popup', 'eq', 0);
     // Height.
     $mform->addElement('text', 'height', get_string('height', 'scorm'), 'maxlength="5" size="5"');
     $mform->setDefault('height', $cfgscorm->frameheight);
     $mform->setType('height', PARAM_INT);
     $mform->setAdvanced('height', $cfgscorm->frameheight_adv);
     $mform->disabledIf('height', 'popup', 'eq', 0);
     // Window Options.
     $winoptgrp = array();
     foreach (scorm_get_popup_options_array() as $key => $value) {
         $winoptgrp[] =& $mform->createElement('checkbox', $key, '', get_string($key, 'scorm'));
         $mform->setDefault($key, $value);
     }
     $mform->addGroup($winoptgrp, 'winoptgrp', get_string('options', 'scorm'), '<br />', false);
     $mform->disabledIf('winoptgrp', 'popup', 'eq', 0);
     $mform->setAdvanced('winoptgrp', $cfgscorm->winoptgrp_adv);
     // Display activity name.
     $mform->addElement('advcheckbox', 'displayactivityname', get_string('displayactivityname', 'scorm'));
     $mform->addHelpButton('displayactivityname', 'displayactivityname', 'scorm');
     $mform->setDefault('displayactivityname', $cfgscorm->displayactivityname);
     // Skip view page.
     $skipviewoptions = scorm_get_skip_view_array();
     if ($COURSE->format == 'singleactivity') {
         // Remove option that would cause a constant redirect.
         unset($skipviewoptions[SCORM_SKIPVIEW_ALWAYS]);
         if ($cfgscorm->skipview == SCORM_SKIPVIEW_ALWAYS) {
             $cfgscorm->skipview = SCORM_SKIPVIEW_FIRST;
         }
//.........这里部分代码省略.........
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:101,代码来源:mod_form.php

示例4: defined

//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
    require_once $CFG->dirroot . '/mod/scorm/locallib.php';
    $yesno = array(0 => get_string('no'), 1 => get_string('yes'));
    // Default display settings.
    $settings->add(new admin_setting_heading('scorm/displaysettings', get_string('defaultdisplaysettings', 'scorm'), ''));
    $settings->add(new admin_setting_configselect_with_advanced('scorm/displaycoursestructure', get_string('displaycoursestructure', 'scorm'), get_string('displaycoursestructuredesc', 'scorm'), array('value' => 0, 'adv' => false), $yesno));
    $settings->add(new admin_setting_configselect_with_advanced('scorm/popup', get_string('display', 'scorm'), get_string('displaydesc', 'scorm'), array('value' => 0, 'adv' => false), scorm_get_popup_display_array()));
    $settings->add(new admin_setting_configcheckbox('scorm/displayactivityname', get_string('displayactivityname', 'scorm'), get_string('displayactivityname_help', 'scorm'), 1));
    $settings->add(new admin_setting_configtext_with_advanced('scorm/framewidth', get_string('width', 'scorm'), get_string('framewidth', 'scorm'), array('value' => '100', 'adv' => true)));
    $settings->add(new admin_setting_configtext_with_advanced('scorm/frameheight', get_string('height', 'scorm'), get_string('frameheight', 'scorm'), array('value' => '500', 'adv' => true)));
    $settings->add(new admin_setting_configcheckbox('scorm/winoptgrp_adv', get_string('optionsadv', 'scorm'), get_string('optionsadv_desc', 'scorm'), 1));
    foreach (scorm_get_popup_options_array() as $key => $value) {
        $settings->add(new admin_setting_configcheckbox('scorm/' . $key, get_string($key, 'scorm'), '', $value));
    }
    $settings->add(new admin_setting_configselect_with_advanced('scorm/skipview', get_string('skipview', 'scorm'), get_string('skipviewdesc', 'scorm'), array('value' => 0, 'adv' => true), scorm_get_skip_view_array()));
    $settings->add(new admin_setting_configselect_with_advanced('scorm/hidebrowse', get_string('hidebrowse', 'scorm'), get_string('hidebrowsedesc', 'scorm'), array('value' => 0, 'adv' => true), $yesno));
    $settings->add(new admin_setting_configselect_with_advanced('scorm/hidetoc', get_string('hidetoc', 'scorm'), get_string('hidetocdesc', 'scorm'), array('value' => 0, 'adv' => true), scorm_get_hidetoc_array()));
    $settings->add(new admin_setting_configselect_with_advanced('scorm/nav', get_string('nav', 'scorm'), get_string('navdesc', 'scorm'), array('value' => SCORM_NAV_UNDER_CONTENT, 'adv' => true), scorm_get_navigation_display_array()));
    $settings->add(new admin_setting_configtext_with_advanced('scorm/navpositionleft', get_string('fromleft', 'scorm'), get_string('navpositionleft', 'scorm'), array('value' => -100, 'adv' => true)));
    $settings->add(new admin_setting_configtext_with_advanced('scorm/navpositiontop', get_string('fromtop', 'scorm'), get_string('navpositiontop', 'scorm'), array('value' => -100, 'adv' => true)));
    $settings->add(new admin_setting_configtext_with_advanced('scorm/collapsetocwinsize', get_string('collapsetocwinsize', 'scorm'), get_string('collapsetocwinsizedesc', 'scorm'), array('value' => 767, 'adv' => true)));
    $settings->add(new admin_setting_configselect_with_advanced('scorm/displayattemptstatus', get_string('displayattemptstatus', 'scorm'), get_string('displayattemptstatusdesc', 'scorm'), array('value' => 1, 'adv' => false), $yesno));
    // Default grade settings.
    $settings->add(new admin_setting_heading('scorm/gradesettings', get_string('defaultgradesettings', 'scorm'), ''));
    $settings->add(new admin_setting_configselect('scorm/grademethod', get_string('grademethod', 'scorm'), get_string('grademethoddesc', 'scorm'), GRADEHIGHEST, scorm_get_grade_method_array()));
    for ($i = 0; $i <= 100; $i++) {
        $grades[$i] = "{$i}";
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:settings.php

示例5: definition

 function definition()
 {
     global $CFG, $COURSE;
     $mform =& $this->_form;
     if (isset($CFG->slasharguments) && !$CFG->slasharguments) {
         $mform->addElement('static', '', '', notify(get_string('slashargs', 'scorm'), 'notifyproblem', 'center', true));
     }
     $zlib = ini_get('zlib.output_compression');
     //check for zlib compression - if used, throw error because of IE bug. - SEE MDL-16185
     if (isset($zlib) && $zlib) {
         $mform->addElement('static', '', '', notify(get_string('zlibwarning', 'scorm'), 'notifyproblem', 'center', true));
     }
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     // Name
     $mform->addElement('text', 'name', get_string('name'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEAN);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     // Summary
     $mform->addElement('htmleditor', 'summary', get_string('summary'));
     $mform->setType('summary', PARAM_RAW);
     $mform->addRule('summary', get_string('required'), 'required', null, 'client');
     $mform->setHelpButton('summary', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
     // Reference
     $mform->addElement('choosecoursefileorimsrepo', 'reference', get_string('package', 'scorm'));
     $mform->setType('reference', PARAM_RAW);
     // We need to find a better PARAM
     $mform->addRule('reference', get_string('required'), 'required');
     $mform->setHelpButton('reference', array('package', get_string('package', 'scorm'), 'scorm'));
     //-------------------------------------------------------------------------------
     // Other Settings
     $mform->addElement('header', 'advanced', get_string('othersettings', 'form'));
     // Grade Method
     $mform->addElement('select', 'grademethod', get_string('grademethod', 'scorm'), scorm_get_grade_method_array());
     $mform->setHelpButton('grademethod', array('grademethod', get_string('grademethod', 'scorm'), 'scorm'));
     $mform->setDefault('grademethod', $CFG->scorm_grademethod);
     // Maximum Grade
     for ($i = 0; $i <= 100; $i++) {
         $grades[$i] = "{$i}";
     }
     $mform->addElement('select', 'maxgrade', get_string('maximumgrade'), $grades);
     $mform->setDefault('maxgrade', $CFG->scorm_maxgrade);
     $mform->disabledIf('maxgrade', 'grademethod', 'eq', GRADESCOES);
     // Attempts
     $mform->addElement('static', '', '', '<hr />');
     // Max Attempts
     $mform->addElement('select', 'maxattempt', get_string('maximumattempts', 'scorm'), scorm_get_attempts_array());
     $mform->setHelpButton('maxattempt', array('maxattempt', get_string('maximumattempts', 'scorm'), 'scorm'));
     $mform->setDefault('maxattempt', $CFG->scorm_maxattempts);
     // What Grade
     $mform->addElement('select', 'whatgrade', get_string('whatgrade', 'scorm'), scorm_get_what_grade_array());
     $mform->disabledIf('whatgrade', 'maxattempt', 'eq', 1);
     $mform->setHelpButton('whatgrade', array('whatgrade', get_string('whatgrade', 'scorm'), 'scorm'));
     $mform->setDefault('whatgrade', $CFG->scorm_whatgrade);
     $mform->setAdvanced('whatgrade');
     // Activation period
     /*        $mform->addElement('static', '', '' ,'<hr />');
             $mform->addElement('static', 'activation', get_string('activation','scorm'));
             $datestartgrp = array();
             $datestartgrp[] = &$mform->createElement('date_time_selector', 'startdate');
             $datestartgrp[] = &$mform->createElement('checkbox', 'startdisabled', null, get_string('disable'));
             $mform->addGroup($datestartgrp, 'startdategrp', get_string('from'), ' ', false);
             $mform->setDefault('startdate', 0);
             $mform->setDefault('startdisabled', 1);
             $mform->disabledIf('startdategrp', 'startdisabled', 'checked');
     
             $dateendgrp = array();
             $dateendgrp[] = &$mform->createElement('date_time_selector', 'enddate');
             $dateendgrp[] = &$mform->createElement('checkbox', 'enddisabled', null, get_string('disable'));
             $mform->addGroup($dateendgrp, 'dateendgrp', get_string('to'), ' ', false);
             $mform->setDefault('enddate', 0);
             $mform->setDefault('enddisabled', 1);
             $mform->disabledIf('dateendgrp', 'enddisabled', 'checked');
     */
     // Stage Size
     $mform->addElement('static', '', '', '<hr />');
     $mform->addElement('static', 'stagesize', get_string('stagesize', 'scorm'));
     $mform->setHelpButton('stagesize', array('stagesize', get_string('stagesize', 'scorm'), 'scorm'));
     // Width
     $mform->addElement('text', 'width', get_string('width', 'scorm'), 'maxlength="5" size="5"');
     $mform->setDefault('width', $CFG->scorm_framewidth);
     $mform->setType('width', PARAM_INT);
     // Height
     $mform->addElement('text', 'height', get_string('height', 'scorm'), 'maxlength="5" size="5"');
     $mform->setDefault('height', $CFG->scorm_frameheight);
     $mform->setType('height', PARAM_INT);
     // Framed / Popup Window
     $mform->addElement('select', 'popup', get_string('display', 'scorm'), scorm_get_popup_display_array());
     $mform->setDefault('popup', $CFG->scorm_popup);
     $mform->setAdvanced('popup');
     // Window Options
     $winoptgrp = array();
     foreach (scorm_get_popup_options_array() as $key => $value) {
         $winoptgrp[] =& $mform->createElement('checkbox', $key, '', get_string($key, 'scorm'));
         $mform->setDefault($key, $value);
     }
//.........这里部分代码省略.........
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:101,代码来源:mod_form.php

示例6: definition

    function definition() {
        global $CFG, $COURSE, $OUTPUT;
        $cfg_scorm = get_config('scorm');

        $mform = $this->_form;

        if (!$CFG->slasharguments) {
            $mform->addElement('static', '', '', $OUTPUT->notification(get_string('slashargs', 'scorm'), 'notifyproblem'));
        }
        //-------------------------------------------------------------------------------
        $mform->addElement('header', 'general', get_string('general', 'form'));

        // Name.
        $mform->addElement('text', 'name', get_string('name'));
        if (!empty($CFG->formatstringstriptags)) {
            $mform->setType('name', PARAM_TEXT);
        } else {
            $mform->setType('name', PARAM_CLEANHTML);
        }
        $mform->addRule('name', null, 'required', null, 'client');
        $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');

        // Summary.
        $this->add_intro_editor(true);

        // Scorm types.
        $scormtypes = array(SCORM_TYPE_LOCAL => get_string('typelocal', 'scorm'));

        if ($cfg_scorm->allowtypeexternal) {
            $scormtypes[SCORM_TYPE_EXTERNAL] = get_string('typeexternal', 'scorm');
        }

        if ($cfg_scorm->allowtypelocalsync) {
            $scormtypes[SCORM_TYPE_LOCALSYNC] = get_string('typelocalsync', 'scorm');
        }

        if (!empty($CFG->repositoryactivate) and $cfg_scorm->allowtypeimsrepository) {
            $scormtypes[SCORM_TYPE_IMSREPOSITORY] = get_string('typeimsrepository', 'scorm');
        }

        if ($cfg_scorm->allowtypeexternalaicc) {
            $scormtypes[SCORM_TYPE_AICCURL] = get_string('typeaiccurl', 'scorm');
        }

        // Reference.
        if (count($scormtypes) > 1) {
            $mform->addElement('select', 'scormtype', get_string('scormtype', 'scorm'), $scormtypes);
            $mform->addHelpButton('scormtype', 'scormtype', 'scorm');
            $mform->addElement('text', 'packageurl', get_string('packageurl', 'scorm'), array('size'=>60));
            $mform->setType('packageurl', PARAM_RAW);
            $mform->addHelpButton('packageurl', 'packageurl', 'scorm');
            $mform->disabledIf('packageurl', 'scormtype', 'eq', SCORM_TYPE_LOCAL);
        } else {
            $mform->addElement('hidden', 'scormtype', SCORM_TYPE_LOCAL);
        }

        // New local package upload.
        $maxbytes = get_max_upload_file_size($CFG->maxbytes, $COURSE->maxbytes);
        $mform->setMaxFileSize($maxbytes);
        $mform->addElement('filepicker', 'packagefile', get_string('package', 'scorm'));
        $mform->addHelpButton('packagefile', 'package', 'scorm');
        $mform->disabledIf('packagefile', 'scormtype', 'noteq', SCORM_TYPE_LOCAL);

        //-------------------------------------------------------------------------------
        // Time restrictions.
        $mform->addElement('header', 'timerestricthdr', get_string('timerestrict', 'scorm'));

        $mform->addElement('date_time_selector', 'timeopen', get_string("scormopen", "scorm"), array('optional' => true));
        $mform->addElement('date_time_selector', 'timeclose', get_string("scormclose", "scorm"), array('optional' => true));
        //-------------------------------------------------------------------------------
        // Display Settings.
        $mform->addElement('header', 'displaysettings', get_string('displaysettings', 'scorm'));
        // Framed / Popup Window.
        $mform->addElement('select', 'popup', get_string('display', 'scorm'), scorm_get_popup_display_array());
        $mform->setDefault('popup', $cfg_scorm->popup);
        $mform->setAdvanced('popup', $cfg_scorm->popup_adv);

        // Width.
        $mform->addElement('text', 'width', get_string('width', 'scorm'), 'maxlength="5" size="5"');
        $mform->setDefault('width', $cfg_scorm->framewidth);
        $mform->setType('width', PARAM_INT);
        $mform->setAdvanced('width', $cfg_scorm->framewidth_adv);
        $mform->disabledIf('width', 'popup', 'eq', 0);

        // Height.
        $mform->addElement('text', 'height', get_string('height', 'scorm'), 'maxlength="5" size="5"');
        $mform->setDefault('height', $cfg_scorm->frameheight);
        $mform->setType('height', PARAM_INT);
        $mform->setAdvanced('height', $cfg_scorm->frameheight_adv);
        $mform->disabledIf('height', 'popup', 'eq', 0);

        // Window Options.
        $winoptgrp = array();
        foreach (scorm_get_popup_options_array() as $key => $value) {
            $winoptgrp[] = &$mform->createElement('checkbox', $key, '', get_string($key, 'scorm'));
            $mform->setDefault($key, $value);
        }
        $mform->addGroup($winoptgrp, 'winoptgrp', get_string('options', 'scorm'), '<br />', false);
        $mform->disabledIf('winoptgrp', 'popup', 'eq', 0);
        $mform->setAdvanced('winoptgrp', $cfg_scorm->winoptgrp_adv);
//.........这里部分代码省略.........
开发者ID:ncsu-delta,项目名称:moodle,代码行数:101,代码来源:mod_form.php


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