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


PHP get_list_of_themes函数代码示例

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


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

示例1: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $category = $this->_customdata;
     // get list of categories to use as parents, with site as the first one
     $options = array(get_string('top'));
     $parents = array();
     if ($category->id) {
         // Editing an existing category.
         make_categories_list($options, $parents, 'moodle/category:manage', $category->id);
         $strsubmit = get_string('savechanges');
     } else {
         // Making a new category
         make_categories_list($options, $parents, 'moodle/category:manage');
         $strsubmit = get_string('createcategory');
     }
     $mform->addElement('select', 'parent', get_string('parentcategory'), $options);
     $mform->addElement('text', 'name', get_string('categoryname'), array('size' => '30'));
     $mform->addRule('name', get_string('required'), 'required', null);
     $mform->addElement('htmleditor', 'description', get_string('description'));
     $mform->setType('description', PARAM_RAW);
     if (!empty($CFG->allowcategorythemes)) {
         $themes = array();
         $themes[''] = get_string('forceno');
         $themes += get_list_of_themes();
         $mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
     }
     $mform->setHelpButton('description', array('writing', 'richtext2'), false, 'editorhelpbutton');
     $mform->addElement('hidden', 'id', 0);
     $mform->setType('id', PARAM_INT);
     $mform->setDefault('id', $category->id);
     $this->add_action_buttons(true, $strsubmit);
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:34,代码来源:editcategory_form.php

示例2: get_options

 function get_options($dataobject)
 {
     $result = get_list_of_themes();
     //option for not setting a cluster theme
     $unset_option = array('' => get_string('unset_theme_option', 'crlm_manual'));
     return $unset_option + $result;
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:7,代码来源:themes.php

示例3: get_options

 function get_options($dataobject)
 {
     $result = array();
     //get list of theme objects
     $themes = get_list_of_themes();
     foreach ($themes as $theme) {
         //we just need the name of each theme
         $result[$theme->name] = $theme->name;
     }
     //option for not setting a cluster theme
     $unset_option = array('' => get_string('unset_theme_option', 'elisfields_manual'));
     return $unset_option + $result;
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:13,代码来源:themes.php

示例4: definition

    function definition() {
        global $CFG, $DB;
        $mform =& $this->_form;
        $category = $this->_customdata['category'];
        $editoroptions = $this->_customdata['editoroptions'];

        // get list of categories to use as parents, with site as the first one
        $options = array();
        if (has_capability('moodle/category:manage', context_system::instance()) || $category->parent == 0) {
            $options[0] = get_string('top');
        }
        if ($category->id) {
            // Editing an existing category.
            $options += coursecat::make_categories_list('moodle/category:manage', $category->id);
            if (empty($options[$category->parent])) {
                $options[$category->parent] = $DB->get_field('course_categories', 'name', array('id'=>$category->parent));
            }
            $strsubmit = get_string('savechanges');
        } else {
            // Making a new category
            $options += coursecat::make_categories_list('moodle/category:manage');
            $strsubmit = get_string('createcategory');
        }

        $mform->addElement('select', 'parent', get_string('parentcategory'), $options);
        $mform->addElement('text', 'name', get_string('categoryname'), array('size'=>'30'));
        $mform->addRule('name', get_string('required'), 'required', null);
        $mform->setType('name', PARAM_TEXT);
        $mform->addElement('text', 'idnumber', get_string('idnumbercoursecategory'),'maxlength="100"  size="10"');
        $mform->addHelpButton('idnumber', 'idnumbercoursecategory');
        $mform->setType('idnumber', PARAM_RAW);
        $mform->addElement('editor', 'description_editor', get_string('description'), null, $editoroptions);
        $mform->setType('description_editor', PARAM_RAW);
        if (!empty($CFG->allowcategorythemes)) {
            $themes = array(''=>get_string('forceno'));
            $allthemes = get_list_of_themes();
            foreach ($allthemes as $key=>$theme) {
                if (empty($theme->hidefromselector)) {
                    $themes[$key] = get_string('pluginname', 'theme_'.$theme->name);
                }
            }
            $mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
        }

        $mform->addElement('hidden', 'id', 0);
        $mform->setType('id', PARAM_INT);
        $mform->setDefault('id', $category->id);

        $this->add_action_buttons(true, $strsubmit);
    }
开发者ID:number33,项目名称:moodle,代码行数:50,代码来源:editcategory_form.php

示例5: get_content

 function get_content()
 {
     global $CFG, $ME, $COURSE;
     //get list of themes
     $themes = get_list_of_themes();
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content->footer = '';
     $this->content->text = '';
     $context = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
     if (has_capability('block/session_theme:switchthemes', $context)) {
         $this->content->text .= popup_form($ME . '?id=' . $COURSE->id . '&theme=', $themes, 'sessionthemeform', current_theme(), 'choose', '', '', true);
         $this->content->footer .= '';
     } else {
         $this->content = '';
     }
     return $this->content;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:19,代码来源:block_session_theme.php

示例6: definition

 function definition()
 {
     global $CFG, $DB;
     $mform =& $this->_form;
     $category = $this->_customdata['category'];
     $editoroptions = $this->_customdata['editoroptions'];
     // get list of categories to use as parents, with site as the first one
     $options = array();
     if (has_capability('moodle/category:manage', get_system_context()) || $category->parent == 0) {
         $options[0] = get_string('top');
     }
     $parents = array();
     if ($category->id) {
         // Editing an existing category.
         //make_categories_list($options, $parents, 'moodle/category:manage', $category->id);
         if (empty($options[$category->parent])) {
             $options[$category->parent] = $DB->get_field('course_categories', 'name', array('id' => $category->parent));
         }
         $strsubmit = get_string('savechanges');
     } else {
         // Making a new category
         //make_categories_list($options, $parents, 'moodle/category:manage');
         $strsubmit = 'Crear materia';
     }
     $mform->addElement('select', 'parent', 'Materia padre', $options);
     $mform->addElement('text', 'name', 'Nombre de la materia', array('size' => '30'));
     $mform->addRule('name', get_string('required'), 'required', null);
     $mform->addElement('editor', 'description_editor', get_string('description'), null, $editoroptions);
     $mform->setType('description_editor', PARAM_RAW);
     if (!empty($CFG->allowcategorythemes)) {
         $themes = array('' => get_string('forceno'));
         $allthemes = get_list_of_themes();
         foreach ($allthemes as $key => $theme) {
             $themes[$key] = $theme->name;
         }
         $mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
     }
     $mform->addElement('hidden', 'id', 0);
     $mform->setType('id', PARAM_INT);
     $mform->setDefault('id', $category->id);
     $this->add_action_buttons(true, $strsubmit);
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:42,代码来源:editcategory_form.php

示例7: definition


//.........这里部分代码省略.........
     }
     if (!empty($course->id) and !has_capability('moodle/course:changesummary', $coursecontext)) {
         // Remove the description header it does not contain anything any more.
         $mform->removeElement('descriptionhdr');
         $mform->hardFreeze($summaryfields);
     }
     // Course format.
     $mform->addElement('header', 'courseformathdr', get_string('type_format', 'plugin'));
     $courseformats = get_sorted_course_formats(true);
     $formcourseformats = array();
     foreach ($courseformats as $courseformat) {
         $formcourseformats[$courseformat] = get_string('pluginname', "format_{$courseformat}");
     }
     if (isset($course->format)) {
         $course->format = course_get_format($course)->get_format();
         // replace with default if not found
         if (!in_array($course->format, $courseformats)) {
             // this format is disabled. Still display it in the dropdown
             $formcourseformats[$course->format] = get_string('withdisablednote', 'moodle', get_string('pluginname', 'format_' . $course->format));
         }
     }
     $mform->addElement('select', 'format', get_string('format'), $formcourseformats);
     $mform->addHelpButton('format', 'format');
     $mform->setDefault('format', $courseconfig->format);
     // Button to update format-specific options on format change (will be hidden by JavaScript).
     $mform->registerNoSubmitButton('updatecourseformat');
     $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
     // Just a placeholder for the course format options.
     $mform->addElement('hidden', 'addcourseformatoptionshere');
     $mform->setType('addcourseformatoptionshere', PARAM_BOOL);
     // Appearance.
     $mform->addElement('header', 'appearancehdr', get_string('appearance'));
     if (!empty($CFG->allowcoursethemes)) {
         $themeobjects = get_list_of_themes();
         $themes = array();
         $themes[''] = get_string('forceno');
         foreach ($themeobjects as $key => $theme) {
             if (empty($theme->hidefromselector)) {
                 $themes[$key] = get_string('pluginname', 'theme_' . $theme->name);
             }
         }
         $mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
     }
     $languages = array();
     $languages[''] = get_string('forceno');
     $languages += get_string_manager()->get_list_of_translations();
     $mform->addElement('select', 'lang', get_string('forcelanguage'), $languages);
     $mform->setDefault('lang', $courseconfig->lang);
     $options = range(0, 10);
     $mform->addElement('select', 'newsitems', get_string('newsitemsnumber'), $options);
     $mform->addHelpButton('newsitems', 'newsitemsnumber');
     $mform->setDefault('newsitems', $courseconfig->newsitems);
     $mform->addElement('selectyesno', 'showgrades', get_string('showgrades'));
     $mform->addHelpButton('showgrades', 'showgrades');
     $mform->setDefault('showgrades', $courseconfig->showgrades);
     $mform->addElement('selectyesno', 'showreports', get_string('showreports'));
     $mform->addHelpButton('showreports', 'showreports');
     $mform->setDefault('showreports', $courseconfig->showreports);
     // Files and uploads.
     $mform->addElement('header', 'filehdr', get_string('filesanduploads'));
     if (!empty($course->legacyfiles) or !empty($CFG->legacyfilesinnewcourses)) {
         if (empty($course->legacyfiles)) {
             //0 or missing means no legacy files ever used in this course - new course or nobody turned on legacy files yet
             $choices = array('0' => get_string('no'), '2' => get_string('yes'));
         } else {
             $choices = array('1' => get_string('no'), '2' => get_string('yes'));
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:67,代码来源:edit_form.php

示例8: restore_create_users


//.........这里部分代码省略.........
                if (empty($user->password)) {
                    // Only if restore comes without password
                    if (!array_key_exists($user->auth, $authcache)) {
                        // Not in cache
                        $userauth = new stdClass();
                        $authplugin = get_auth_plugin($user->auth);
                        $userauth->preventpassindb = $authplugin->prevent_local_passwords();
                        $userauth->isinternal = $authplugin->is_internal();
                        $userauth->canresetpwd = $authplugin->can_reset_password();
                        $authcache[$user->auth] = $userauth;
                    } else {
                        $userauth = $authcache[$user->auth];
                        // Get from cache
                    }
                    // Most external plugins do not store passwords locally
                    if (!empty($userauth->preventpassindb)) {
                        $user->password = 'not cached';
                        // If Moodle is responsible for storing/validating pwd and reset functionality is available, mark
                    } else {
                        if ($userauth->isinternal and $userauth->canresetpwd) {
                            $user->password = 'restored';
                        }
                    }
                }
                //We need to process the POLICYAGREED field to recalculate it:
                //    - if the destination site is different (by wwwroot) reset it.
                //    - if the destination site is the same (by wwwroot), leave it unmodified
                if (!backup_is_same_site($restore)) {
                    $user->policyagreed = 0;
                } else {
                    //Nothing to do, we are in the same server
                }
                //Check if the theme exists in destination server
                $themes = get_list_of_themes();
                if (!in_array($user->theme, $themes)) {
                    $user->theme = '';
                }
                //We are going to create the user
                //The structure is exactly as we need
                $newid = insert_record("user", addslashes_recursive($user));
                //Put the new id
                $status = backup_putid($restore->backup_unique_code, "user", $userid, $newid, "new");
            }
            ///TODO: This seccion is to support pre 1.7 course backups, using old roles
            ///      teacher, coursecreator, student.... providing a basic mapping to new ones.
            ///      Someday we'll drop support for them and this section will be safely deleted (2.0?)
            //Here, if create_roles, do it as necessary
            if ($create_roles) {
                //Get the newid and current info from backup_ids
                $data = backup_getid($restore->backup_unique_code, "user", $userid);
                $newid = $data->new_id;
                $currinfo = $data->info . ",";
                //Now, depending of the role, create records in user_studentes and user_teacher
                //and/or mark it in backup_ids
                if ($is_admin) {
                    //If the record (user_admins) doesn't exists
                    //Only put status in backup_ids
                    $currinfo = $currinfo . "admin,";
                    $status = backup_putid($restore->backup_unique_code, "user", $userid, $newid, $currinfo);
                }
                if ($is_coursecreator) {
                    //If the record (user_coursecreators) doesn't exists
                    //Only put status in backup_ids
                    $currinfo = $currinfo . "coursecreator,";
                    $status = backup_putid($restore->backup_unique_code, "user", $userid, $newid, $currinfo);
                }
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:67,代码来源:restorelib.php

示例9: definition


//.........这里部分代码省略.........
        $mform->addHelpButton('newsitems', 'newsitemsnumber');
        $mform->setDefault('newsitems', $courseconfig->newsitems);

        $mform->addElement('selectyesno', 'showgrades', get_string('showgrades'));
        $mform->addHelpButton('showgrades', 'showgrades');
        $mform->setDefault('showgrades', $courseconfig->showgrades);

        $mform->addElement('selectyesno', 'showreports', get_string('showreports'));
        $mform->addHelpButton('showreports', 'showreports');
        $mform->setDefault('showreports', $courseconfig->showreports);

        $choices = get_max_upload_sizes($CFG->maxbytes);
        $mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
        $mform->addHelpButton('maxbytes', 'maximumupload');
        $mform->setDefault('maxbytes', $courseconfig->maxbytes);

        if (!empty($course->legacyfiles) or !empty($CFG->legacyfilesinnewcourses)) {
            if (empty($course->legacyfiles)) {
                //0 or missing means no legacy files ever used in this course - new course or nobody turned on legacy files yet
                $choices = array('0'=>get_string('no'), '2'=>get_string('yes'));
            } else {
                $choices = array('1'=>get_string('no'), '2'=>get_string('yes'));
            }
            $mform->addElement('select', 'legacyfiles', get_string('courselegacyfiles'), $choices);
            $mform->addHelpButton('legacyfiles', 'courselegacyfiles');
            if (!isset($courseconfig->legacyfiles)) {
                // in case this was not initialised properly due to switching of $CFG->legacyfilesinnewcourses
                $courseconfig->legacyfiles = 0;
            }
            $mform->setDefault('legacyfiles', $courseconfig->legacyfiles);
        }

        if (!empty($CFG->allowcoursethemes)) {
            $themeobjects = get_list_of_themes();
            $themes=array();
            $themes[''] = get_string('forceno');
            foreach ($themeobjects as $key=>$theme) {
                $themes[$key] = $theme->name;
            }
            $mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
        }

//--------------------------------------------------------------------------------
        enrol_course_edit_form($mform, $course, $context);

//--------------------------------------------------------------------------------
        $mform->addElement('header','', get_string('groups', 'group'));

        $choices = array();
        $choices[NOGROUPS] = get_string('groupsnone', 'group');
        $choices[SEPARATEGROUPS] = get_string('groupsseparate', 'group');
        $choices[VISIBLEGROUPS] = get_string('groupsvisible', 'group');
        $mform->addElement('select', 'groupmode', get_string('groupmode', 'group'), $choices);
        $mform->addHelpButton('groupmode', 'groupmode', 'group');
        $mform->setDefault('groupmode', $courseconfig->groupmode);

        $choices = array();
        $choices['0'] = get_string('no');
        $choices['1'] = get_string('yes');
        $mform->addElement('select', 'groupmodeforce', get_string('groupmodeforce', 'group'), $choices);
        $mform->addHelpButton('groupmodeforce', 'groupmodeforce', 'group');
        $mform->setDefault('groupmodeforce', $courseconfig->groupmodeforce);

        //default groupings selector
        $options = array();
        $options[0] = get_string('none');
开发者ID:nottmoo,项目名称:moodle,代码行数:67,代码来源:edit_form.php

示例10: useredit_shared_definition


//.........这里部分代码省略.........
        // Empty string means use the first chosen text editor.
        $mform->addElement('hidden', 'preference_htmleditor');
        $mform->setDefault('preference_htmleditor', '');
        $mform->setType('preference_htmleditor', PARAM_PLUGIN);
    }
    $mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="21"');
    $mform->setType('city', PARAM_TEXT);
    if (!empty($CFG->defaultcity)) {
        $mform->setDefault('city', $CFG->defaultcity);
    }
    $choices = get_string_manager()->get_list_of_countries();
    $choices = array('' => get_string('selectacountry') . '...') + $choices;
    $mform->addElement('select', 'country', get_string('selectacountry'), $choices);
    if (!empty($CFG->country)) {
        $mform->setDefault('country', $CFG->country);
    }
    $choices = get_list_of_timezones();
    $choices['99'] = get_string('serverlocaltime');
    if ($CFG->forcetimezone != 99) {
        $mform->addElement('static', 'forcedtimezone', get_string('timezone'), $choices[$CFG->forcetimezone]);
    } else {
        $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
        $mform->setDefault('timezone', '99');
    }
    $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
    $mform->setDefault('lang', $CFG->lang);
    // Multi-Calendar Support - see MDL-18375.
    $calendartypes = \core_calendar\type_factory::get_list_of_calendar_types();
    // We do not want to show this option unless there is more than one calendar type to display.
    if (count($calendartypes) > 1) {
        $mform->addElement('select', 'calendartype', get_string('preferredcalendar', 'calendar'), $calendartypes);
    }
    if (!empty($CFG->allowuserthemes)) {
        $choices = array();
        $choices[''] = get_string('default');
        $themes = get_list_of_themes();
        foreach ($themes as $key => $theme) {
            if (empty($theme->hidefromselector)) {
                $choices[$key] = get_string('pluginname', 'theme_' . $theme->name);
            }
        }
        $mform->addElement('select', 'theme', get_string('preferredtheme'), $choices);
    }
    $mform->addElement('editor', 'description_editor', get_string('userdescription'), null, $editoroptions);
    $mform->setType('description_editor', PARAM_CLEANHTML);
    $mform->addHelpButton('description_editor', 'userdescription');
    if (empty($USER->newadminuser)) {
        $mform->addElement('header', 'moodle_picture', get_string('pictureofuser'));
        if (!empty($CFG->enablegravatar)) {
            $mform->addElement('html', html_writer::tag('p', get_string('gravatarenabled')));
        }
        $mform->addElement('static', 'currentpicture', get_string('currentpicture'));
        $mform->addElement('checkbox', 'deletepicture', get_string('delete'));
        $mform->setDefault('deletepicture', 0);
        $mform->addElement('filemanager', 'imagefile', get_string('newpicture'), '', $filemanageroptions);
        $mform->addHelpButton('imagefile', 'newpicture');
        $mform->addElement('text', 'imagealt', get_string('imagealt'), 'maxlength="100" size="30"');
        $mform->setType('imagealt', PARAM_TEXT);
    }
    // Display user name fields that are not currenlty enabled here if there are any.
    $disabledusernamefields = useredit_get_disabled_name_fields($enabledusernamefields);
    if (count($disabledusernamefields) > 0) {
        $mform->addElement('header', 'moodle_additional_names', get_string('additionalnames'));
        foreach ($disabledusernamefields as $allname) {
            $mform->addElement('text', $allname, get_string($allname), 'maxlength="100" size="30"');
            $mform->setType($allname, PARAM_NOTAGS);
        }
    }
    if (!empty($CFG->usetags) and empty($USER->newadminuser)) {
        $mform->addElement('header', 'moodle_interests', get_string('interests'));
        $mform->addElement('tags', 'interests', get_string('interestslist'), array('display' => 'noofficial'));
        $mform->addHelpButton('interests', 'interestslist');
    }
    /// Moodle optional fields
    $mform->addElement('header', 'moodle_optional', get_string('optional', 'form'));
    $mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
    $mform->setType('url', PARAM_URL);
    $mform->addElement('text', 'icq', get_string('icqnumber'), 'maxlength="15" size="25"');
    $mform->setType('icq', PARAM_NOTAGS);
    $mform->addElement('text', 'skype', get_string('skypeid'), 'maxlength="50" size="25"');
    $mform->setType('skype', PARAM_NOTAGS);
    $mform->addElement('text', 'aim', get_string('aimid'), 'maxlength="50" size="25"');
    $mform->setType('aim', PARAM_NOTAGS);
    $mform->addElement('text', 'yahoo', get_string('yahooid'), 'maxlength="50" size="25"');
    $mform->setType('yahoo', PARAM_NOTAGS);
    $mform->addElement('text', 'msn', get_string('msnid'), 'maxlength="50" size="25"');
    $mform->setType('msn', PARAM_NOTAGS);
    $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
    $mform->setType('idnumber', PARAM_NOTAGS);
    $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="255" size="25"');
    $mform->setType('institution', PARAM_TEXT);
    $mform->addElement('text', 'department', get_string('department'), 'maxlength="255" size="25"');
    $mform->setType('department', PARAM_TEXT);
    $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
    $mform->setType('phone1', PARAM_NOTAGS);
    $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
    $mform->setType('phone2', PARAM_NOTAGS);
    $mform->addElement('text', 'address', get_string('address'), 'maxlength="255" size="25"');
    $mform->setType('address', PARAM_TEXT);
}
开发者ID:helenagarcia90,项目名称:moodle,代码行数:101,代码来源:editlib.php

示例11: useredit_shared_definition


//.........这里部分代码省略.........
    }
    if ($CFG->htmleditor) {
        $choices = array();
        $choices['0'] = get_string('texteditor');
        $choices['1'] = get_string('htmleditor');
        $mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
        $mform->setDefault('htmleditor', 1);
        $mform->setAdvanced('htmleditor');
    }
    if (empty($CFG->enableajax)) {
        $mform->addElement('static', 'ajaxdisabled', get_string('ajaxuse'), get_string('ajaxno'));
        $mform->setAdvanced('ajaxdisabled');
    } else {
        $choices = array();
        $choices['0'] = get_string('ajaxno');
        $choices['1'] = get_string('ajaxyes');
        $mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
        $mform->setDefault('ajax', 0);
        $mform->setAdvanced('ajax');
    }
    $choices = array();
    $choices['0'] = get_string('screenreaderno');
    $choices['1'] = get_string('screenreaderyes');
    $mform->addElement('select', 'screenreader', get_string('screenreaderuse'), $choices);
    $mform->setDefault('screenreader', 0);
    $mform->setAdvanced('screenreader');
    $mform->addElement('text', 'city', get_string('city'), 'maxlength="20" size="21"');
    $mform->setType('city', PARAM_MULTILANG);
    $mform->addRule('city', $strrequired, 'required', null, 'client');
    $choices = get_list_of_countries();
    $choices = array('' => get_string('selectacountry') . '...') + $choices;
    $mform->addElement('select', 'country', get_string('selectacountry'), $choices);
    $mform->addRule('country', $strrequired, 'required', null, 'client');
    if (!empty($CFG->country)) {
        $mform->setDefault('country', $CFG->country);
    }
    $choices = get_list_of_timezones();
    $choices['99'] = get_string('serverlocaltime');
    if ($CFG->forcetimezone != 99) {
        $mform->addElement('static', 'forcedtimezone', get_string('timezone'), $choices[$CFG->forcetimezone]);
    } else {
        $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
        $mform->setDefault('timezone', '99');
    }
    $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_list_of_languages());
    $mform->setDefault('lang', $CFG->lang);
    if (!empty($CFG->allowuserthemes)) {
        $choices = array();
        $choices[''] = get_string('default');
        $choices += get_list_of_themes();
        $mform->addElement('select', 'theme', get_string('preferredtheme'), $choices);
        $mform->setAdvanced('theme');
    }
    $mform->addElement('htmleditor', 'description', get_string('userdescription'));
    $mform->setType('description', PARAM_CLEAN);
    $mform->setHelpButton('description', array('text', get_string('helptext')));
    if (!empty($CFG->gdversion)) {
        $mform->addElement('header', 'moodle_picture', get_string('pictureof'));
        //TODO: Accessibility fix fieldset legend
        $mform->addElement('static', 'currentpicture', get_string('currentpicture'));
        $mform->addElement('checkbox', 'deletepicture', get_string('delete'));
        $mform->setDefault('deletepicture', false);
        $mform->addElement('file', 'imagefile', get_string('newpicture'));
        $mform->setHelpButton('imagefile', array('picture', get_string('helppicture')));
        $mform->addElement('text', 'imagealt', get_string('imagealt'), 'maxlength="100" size="30"');
        $mform->setType('imagealt', PARAM_MULTILANG);
    }
    if (!empty($CFG->usetags)) {
        $mform->addElement('header', 'moodle_interests', get_string('interests'));
        $mform->addElement('textarea', 'interests', get_string('interestslist'), 'cols="45" rows="3"');
        $mform->setHelpButton('interests', array('interestslist', get_string('helpinterestslist'), false, true, false));
    }
    /// Moodle optional fields
    $mform->addElement('header', 'moodle_optional', get_string('optional', 'form'));
    $mform->setAdvanced('moodle_optional');
    $mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
    $mform->setType('url', PARAM_URL);
    $mform->addElement('text', 'icq', get_string('icqnumber'), 'maxlength="15" size="25"');
    $mform->setType('icq', PARAM_CLEAN);
    $mform->addElement('text', 'skype', get_string('skypeid'), 'maxlength="50" size="25"');
    $mform->setType('skype', PARAM_CLEAN);
    $mform->addElement('text', 'aim', get_string('aimid'), 'maxlength="50" size="25"');
    $mform->setType('aim', PARAM_CLEAN);
    $mform->addElement('text', 'yahoo', get_string('yahooid'), 'maxlength="50" size="25"');
    $mform->setType('yahoo', PARAM_CLEAN);
    $mform->addElement('text', 'msn', get_string('msnid'), 'maxlength="50" size="25"');
    $mform->setType('msn', PARAM_CLEAN);
    $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
    $mform->setType('idnumber', PARAM_CLEAN);
    $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
    $mform->setType('institution', PARAM_MULTILANG);
    $mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
    $mform->setType('department', PARAM_MULTILANG);
    $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
    $mform->setType('phone1', PARAM_CLEAN);
    $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
    $mform->setType('phone2', PARAM_CLEAN);
    $mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
    $mform->setType('address', PARAM_MULTILANG);
}
开发者ID:r007,项目名称:PMoodle,代码行数:101,代码来源:editlib.php

示例12: create_included_users

 /**
  * Given one restoreid, create in DB all the users present
  * in backup_ids having newitemid = 0, as far as
  * precheck_included_users() have left them there
  * ready to be created. Also, annotate their newids
  * once created for later reference
  */
 public static function create_included_users($basepath, $restoreid, $userid)
 {
     global $CFG, $DB;
     $authcache = array();
     // Cache to get some bits from authentication plugins
     $languages = get_string_manager()->get_list_of_translations();
     // Get languages for quick search later
     $themes = get_list_of_themes();
     // Get themes for quick search later
     // Iterate over all the included users with newitemid = 0, have to create them
     $rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $restoreid, 'itemname' => 'user', 'newitemid' => 0), '', 'itemid, parentitemid');
     foreach ($rs as $recuser) {
         $user = (object) self::get_backup_ids_record($restoreid, 'user', $recuser->itemid)->info;
         // if user lang doesn't exist here, use site default
         if (!array_key_exists($user->lang, $languages)) {
             $user->lang = $CFG->lang;
         }
         // if user theme isn't available on target site or they are disabled, reset theme
         if (!empty($user->theme)) {
             if (empty($CFG->allowuserthemes) || !in_array($user->theme, $themes)) {
                 $user->theme = '';
             }
         }
         // if user to be created has mnet auth and its mnethostid is $CFG->mnet_localhost_id
         // that's 100% impossible as own server cannot be accesed over mnet. Change auth to email/manual
         if ($user->auth == 'mnet' && $user->mnethostid == $CFG->mnet_localhost_id) {
             // Respect registerauth
             if ($CFG->registerauth == 'email') {
                 $user->auth = 'email';
             } else {
                 $user->auth = 'manual';
             }
         }
         unset($user->mnethosturl);
         // Not needed anymore
         // Disable pictures based on global setting
         if (!empty($CFG->disableuserimages)) {
             $user->picture = 0;
         }
         // We need to analyse the AUTH field to recode it:
         //   - if the auth isn't enabled in target site, $CFG->registerauth will decide
         //   - finally, if the auth resulting isn't enabled, default to 'manual'
         if (!is_enabled_auth($user->auth)) {
             if ($CFG->registerauth == 'email') {
                 $user->auth = 'email';
             } else {
                 $user->auth = 'manual';
             }
         }
         if (!is_enabled_auth($user->auth)) {
             // Final auth check verify, default to manual if not enabled
             $user->auth = 'manual';
         }
         // Now that we know the auth method, for users to be created without pass
         // if password handling is internal and reset password is available
         // we set the password to "restored" (plain text), so the login process
         // will know how to handle that situation in order to allow the user to
         // recover the password. MDL-20846
         if (empty($user->password)) {
             // Only if restore comes without password
             if (!array_key_exists($user->auth, $authcache)) {
                 // Not in cache
                 $userauth = new stdClass();
                 $authplugin = get_auth_plugin($user->auth);
                 $userauth->preventpassindb = $authplugin->prevent_local_passwords();
                 $userauth->isinternal = $authplugin->is_internal();
                 $userauth->canresetpwd = $authplugin->can_reset_password();
                 $authcache[$user->auth] = $userauth;
             } else {
                 $userauth = $authcache[$user->auth];
                 // Get from cache
             }
             // Most external plugins do not store passwords locally
             if (!empty($userauth->preventpassindb)) {
                 $user->password = 'not cached';
                 // If Moodle is responsible for storing/validating pwd and reset functionality is available, mark
             } else {
                 if ($userauth->isinternal and $userauth->canresetpwd) {
                     $user->password = 'restored';
                 }
             }
         }
         // Creating new user, we must reset the policyagreed always
         $user->policyagreed = 0;
         // Set time created if empty
         if (empty($user->timecreated)) {
             $user->timecreated = time();
         }
         // Done, let's create the user and annotate its id
         $newuserid = $DB->insert_record('user', $user);
         self::set_backup_ids_record($restoreid, 'user', $recuser->itemid, $newuserid);
         // Let's create the user context and annotate it (we need it for sure at least for files)
         // but for deleted users that don't have a context anymore (MDL-30192). We are done for them
//.........这里部分代码省略.........
开发者ID:numbas,项目名称:moodle,代码行数:101,代码来源:restore_dbops.class.php

示例13: restore_create_users


//.........这里部分代码省略.........
            if ($create_user) {
                //Unset the id because it's going to be inserted with a new one
                unset($user->id);
                //We addslashes to necessary fields
                $user->username = addslashes($user->username);
                $user->firstname = addslashes($user->firstname);
                $user->lastname = addslashes($user->lastname);
                $user->email = addslashes($user->email);
                $user->institution = addslashes($user->institution);
                $user->department = addslashes($user->department);
                $user->address = addslashes($user->address);
                $user->city = addslashes($user->city);
                $user->url = addslashes($user->url);
                $user->description = backup_todb($user->description);
                //We need to analyse the AUTH field to recode it:
                //   - if the field isn't set, we are in a pre 1.4 backup and we'll
                //     use manual
                if (empty($user->auth)) {
                    if ($CFG->registerauth == 'email') {
                        $user->auth = 'email';
                    } else {
                        $user->auth = 'manual';
                    }
                }
                //We need to process the POLICYAGREED field to recalculate it:
                //    - if the destination site is different (by wwwroot) reset it.
                //    - if the destination site is the same (by wwwroot), leave it unmodified
                if ($restore->original_wwwroot != $CFG->wwwroot) {
                    $user->policyagreed = 0;
                } else {
                    //Nothing to do, we are in the same server
                }
                //Check if the theme exists in destination server
                $themes = get_list_of_themes();
                if (!in_array($user->theme, $themes)) {
                    $user->theme = '';
                }
                //We are going to create the user
                //The structure is exactly as we need
                $newid = insert_record("user", $user);
                //Put the new id
                $status = backup_putid($restore->backup_unique_code, "user", $userid, $newid, "new");
            }
            //Here, if create_roles, do it as necessary
            if ($create_roles) {
                //Get the newid and current info from backup_ids
                $data = backup_getid($restore->backup_unique_code, "user", $userid);
                $newid = $data->new_id;
                $currinfo = $data->info . ",";
                //Now, depending of the role, create records in user_studentes and user_teacher
                //and/or mark it in backup_ids
                if ($is_admin) {
                    //If the record (user_admins) doesn't exists
                    //Only put status in backup_ids
                    $currinfo = $currinfo . "admin,";
                    $status = backup_putid($restore->backup_unique_code, "user", $userid, $newid, $currinfo);
                }
                if ($is_coursecreator) {
                    //If the record (user_coursecreators) doesn't exists
                    //Only put status in backup_ids
                    $currinfo = $currinfo . "coursecreator,";
                    $status = backup_putid($restore->backup_unique_code, "user", $userid, $newid, $currinfo);
                }
                if ($is_needed) {
                    //Only put status in backup_ids
                    $currinfo = $currinfo . "needed,";
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:67,代码来源:restorelib.php

示例14: process_course

 /**
  * Processing functions go here
  *
  * @global moodledatabase $DB
  * @param stdClass $data
  */
 public function process_course($data)
 {
     global $CFG, $DB;
     $data = (object) $data;
     $coursetags = isset($data->tags['tag']) ? $data->tags['tag'] : array();
     $coursemodules = isset($data->allowed_modules['module']) ? $data->allowed_modules['module'] : array();
     $oldid = $data->id;
     // We'll need this later
     $fullname = $this->get_setting_value('course_fullname');
     $shortname = $this->get_setting_value('course_shortname');
     $startdate = $this->get_setting_value('course_startdate');
     // Calculate final course names, to avoid dupes
     list($fullname, $shortname) = restore_dbops::calculate_course_names($this->get_courseid(), $fullname, $shortname);
     // Need to change some fields before updating the course record
     $data->id = $this->get_courseid();
     $data->fullname = $fullname;
     $data->shortname = $shortname;
     $data->idnumber = '';
     // Category is set by UI when choosing the destination
     unset($data->category);
     $data->startdate = $this->apply_date_offset($data->startdate);
     if ($data->defaultgroupingid) {
         $data->defaultgroupingid = $this->get_mappingid('grouping', $data->defaultgroupingid);
     }
     if (empty($CFG->enablecompletion)) {
         $data->enablecompletion = 0;
         $data->completionstartonenrol = 0;
         $data->completionnotify = 0;
     }
     $languages = get_string_manager()->get_list_of_translations();
     // Get languages for quick search
     if (!array_key_exists($data->lang, $languages)) {
         $data->lang = '';
     }
     $themes = get_list_of_themes();
     // Get themes for quick search later
     if (!in_array($data->theme, $themes) || empty($CFG->allowcoursethemes)) {
         $data->theme = '';
     }
     // Course record ready, update it
     $DB->update_record('course', $data);
     // Course tags
     if (!empty($CFG->usetags) && isset($coursetags)) {
         // if enabled in server and present in backup
         $tags = array();
         foreach ($coursetags as $coursetag) {
             $coursetag = (object) $coursetag;
             $tags[] = $coursetag->rawname;
         }
         tag_set('course', $this->get_courseid(), $tags);
     }
     // Course allowed modules
     if (!empty($data->restrictmodules) && !empty($coursemodules)) {
         $available = get_plugin_list('mod');
         foreach ($coursemodules as $coursemodule) {
             $mname = $coursemodule['modulename'];
             if (array_key_exists($mname, $available)) {
                 if ($module = $DB->get_record('modules', array('name' => $mname, 'visible' => 1))) {
                     $rec = new stdclass();
                     $rec->course = $this->get_courseid();
                     $rec->module = $module->id;
                     if (!$DB->record_exists('course_allowed_modules', (array) $rec)) {
                         $DB->insert_record('course_allowed_modules', $rec);
                     }
                 }
             }
         }
     }
     // Role name aliases
     restore_dbops::set_course_role_names($this->get_restoreid(), $this->get_courseid());
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:77,代码来源:restore_stepslib.php

示例15: useredit_shared_definition


//.........这里部分代码省略.........
        $mform->setDefault('htmleditor', 1);
    } else {
        $mform->addElement('hidden', 'htmleditor');
        $mform->setDefault('htmleditor', 1);
        $mform->setType('htmleditor', PARAM_INT);
    }
    if (empty($CFG->enableajax)) {
        $mform->addElement('static', 'ajaxdisabled', get_string('ajaxuse'), get_string('ajaxno'));
    } else {
        $choices = array();
        $choices['0'] = get_string('ajaxno');
        $choices['1'] = get_string('ajaxyes');
        $mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
        $mform->setDefault('ajax', 0);
    }
    $choices = array();
    $choices['0'] = get_string('screenreaderno');
    $choices['1'] = get_string('screenreaderyes');
    $mform->addElement('select', 'screenreader', get_string('screenreaderuse'), $choices);
    $mform->setDefault('screenreader', 0);
    $mform->addHelpButton('screenreader', 'screenreaderuse');
    $mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="21"');
    $mform->setType('city', PARAM_MULTILANG);
    $mform->addRule('city', $strrequired, 'required', null, 'client');
    if (!empty($CFG->defaultcity)) {
        $mform->setDefault('city', $CFG->defaultcity);
    }
    $choices = get_string_manager()->get_list_of_countries();
    $choices = array('' => get_string('selectacountry') . '...') + $choices;
    $mform->addElement('select', 'country', get_string('selectacountry'), $choices);
    $mform->addRule('country', $strrequired, 'required', null, 'client');
    if (!empty($CFG->country)) {
        $mform->setDefault('country', $CFG->country);
    }
    $choices = get_list_of_timezones();
    $choices['99'] = get_string('serverlocaltime');
    if ($CFG->forcetimezone != 99) {
        $mform->addElement('static', 'forcedtimezone', get_string('timezone'), $choices[$CFG->forcetimezone]);
    } else {
        $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
        $mform->setDefault('timezone', '99');
    }
    $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
    $mform->setDefault('lang', $CFG->lang);
    if (!empty($CFG->allowuserthemes)) {
        $choices = array();
        $choices[''] = get_string('default');
        $themes = get_list_of_themes();
        foreach ($themes as $key => $theme) {
            if (empty($theme->hidefromselector)) {
                $choices[$key] = $theme->name;
            }
        }
        $mform->addElement('select', 'theme', get_string('preferredtheme'), $choices);
    }
    $mform->addElement('editor', 'description_editor', get_string('userdescription'), null, $editoroptions);
    $mform->setType('description_editor', PARAM_CLEANHTML);
    $mform->addHelpButton('description_editor', 'userdescription');
    if (!empty($CFG->gdversion) and empty($USER->newadminuser)) {
        $mform->addElement('header', 'moodle_picture', get_string('pictureofuser'));
        $mform->addElement('static', 'currentpicture', get_string('currentpicture'));
        $mform->addElement('checkbox', 'deletepicture', get_string('delete'));
        $mform->setDefault('deletepicture', 0);
        $mform->addElement('filepicker', 'imagefile', get_string('newpicture'), '', array('maxbytes' => get_max_upload_file_size($CFG->maxbytes)));
        $mform->addHelpButton('imagefile', 'newpicture');
        $mform->addElement('text', 'imagealt', get_string('imagealt'), 'maxlength="100" size="30"');
        $mform->setType('imagealt', PARAM_MULTILANG);
    }
    if (!empty($CFG->usetags) and empty($USER->newadminuser)) {
        $mform->addElement('header', 'moodle_interests', get_string('interests'));
        $mform->addElement('tags', 'interests', get_string('interestslist'), array('display' => 'noofficial'));
        $mform->addHelpButton('interests', 'interestslist');
    }
    /// Moodle optional fields
    $mform->addElement('header', 'moodle_optional', get_string('optional', 'form'));
    $mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
    $mform->setType('url', PARAM_URL);
    $mform->addElement('text', 'icq', get_string('icqnumber'), 'maxlength="15" size="25"');
    $mform->setType('icq', PARAM_NOTAGS);
    $mform->addElement('text', 'skype', get_string('skypeid'), 'maxlength="50" size="25"');
    $mform->setType('skype', PARAM_NOTAGS);
    $mform->addElement('text', 'aim', get_string('aimid'), 'maxlength="50" size="25"');
    $mform->setType('aim', PARAM_NOTAGS);
    $mform->addElement('text', 'yahoo', get_string('yahooid'), 'maxlength="50" size="25"');
    $mform->setType('yahoo', PARAM_NOTAGS);
    $mform->addElement('text', 'msn', get_string('msnid'), 'maxlength="50" size="25"');
    $mform->setType('msn', PARAM_NOTAGS);
    $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
    $mform->setType('idnumber', PARAM_NOTAGS);
    $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
    $mform->setType('institution', PARAM_MULTILANG);
    $mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
    $mform->setType('department', PARAM_MULTILANG);
    $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
    $mform->setType('phone1', PARAM_NOTAGS);
    $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
    $mform->setType('phone2', PARAM_NOTAGS);
    $mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
    $mform->setType('address', PARAM_MULTILANG);
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:101,代码来源:editlib.php


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