• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP make_categories_list函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_course_categories

 /**
  * Returns an array of course categories
  * @return array of course categories
  */
 function get_course_categories()
 {
     $displaylist = array();
     $parentlist = array();
     make_categories_list($displaylist, $parentlist);
     return array(0 => get_string('anycategory', 'filters')) + $displaylist;
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:11,代码来源:courserole.php


示例2: 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


示例3: get_course_categories

 /**
  * Returns an array of course categories
  * @return array of course categories
  */
 function get_course_categories() {
     global $CFG;
     require_once($CFG->dirroot.'/course/lib.php');
     $displaylist = array();
     $parentlist = array();
     make_categories_list($displaylist, $parentlist);
     return array(0=> get_string('anycategory', 'filters')) + $displaylist;
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:12,代码来源:courserole.php


示例4: definition

 public function definition()
 {
     $mform =& $this->_form;
     // General settings -------------------------------------------------------------
     /// Adding the "general" fieldset, where all the common settings are showed
     $mform->addElement('header', 'general', get_string('general', 'form'));
     /// Adding the standard "name" field
     $mform->addElement('text', 'name', get_string('subcoursename', 'subcourse'), array('size' => '64'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     /// Adding the optional "intro" and "introformat" pair of fields
     $this->add_intro_editor(true, get_string('subcourseintro', 'subcourse'));
     // Subcourse information --------------------------------------------------------
     $mform->addElement('header', 'subcoursefieldset', get_string('refcourse', 'subcourse'));
     /// Referenced course selector
     $mycourses = subcourse_available_courses();
     $catlist = array();
     $catparents = array();
     make_categories_list($catlist, $catparents);
     $options = array();
     foreach ($mycourses as $mycourse) {
         if (empty($options[$catlist[$mycourse->category]])) {
             $options[$catlist[$mycourse->category]] = array();
         }
         $courselabel = $mycourse->fullname . ' (' . $mycourse->shortname . ')';
         $options[$catlist[$mycourse->category]][$mycourse->id] = $courselabel;
         if (empty($mycourse->visible)) {
             $hiddenlabel = ' ' . get_string('hiddencourse', 'subcourse');
             $options[$catlist[$mycourse->category]][$mycourse->id] .= $hiddenlabel;
         }
     }
     unset($mycourse);
     /**
      * @var $refcourseelement HTML_QuickForm_input
      */
     $refcourseelement = $mform->addElement('selectgroups', 'refcourse', get_string('refcourselabel', 'subcourse'), $options);
     $mform->addHelpButton('refcourse', 'refcourse', 'subcourse');
     // Option to add a meta course enrolment to the other course.
     /**
      * @var $addmetaelement HTML_QuickForm_input
      */
     $addmetaelement = $mform->addElement('checkbox', 'addmeta', get_string('addmeta', 'subcourse'));
     // If there is a meta enrolment already, we don't want to allow people to delete it as we
     // may cause problems. Force them to delete the whole subcourse if they want to do this
     if (!empty($this->current->id)) {
         $metaexists = subcourse_meta_exists($this->current->course, $this->current->refcourse);
         if ($metaexists) {
             $mform->setDefault('addmeta', 'checked');
             $refcourseelement->updateAttributes(array('disabled' => true));
             $addmetaelement->updateAttributes(array('disabled' => true));
         }
     }
     // add standard elements, common to all modules
     $this->standard_coursemodule_elements();
     // add standard buttons, common to all modules
     $this->add_action_buttons();
 }
开发者ID:nadavkav,项目名称:moodle-mod_subcourse,代码行数:57,代码来源:mod_form.php


示例5: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $category = $this->_customdata;
     $this->_category = $category;
     $mform->addElement('header', 'general', get_string('categorycurrentcontents', '', format_string($category->name)));
     $displaylist = array();
     $parentlist = array();
     $children = array();
     make_categories_list($displaylist, $parentlist);
     unset($displaylist[$category->id]);
     foreach ($displaylist as $catid => $unused) {
         // remove all children of $category
         if (isset($parentlist[$catid]) and in_array($category->id, $parentlist[$catid])) {
             $children[] = $catid;
             unset($displaylist[$catid]);
             continue;
         }
         if (!has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $catid))) {
             unset($displaylist[$catid]);
         }
     }
     $candeletecontent = true;
     foreach ($children as $catid) {
         $context = get_context_instance(CONTEXT_COURSECAT, $catid);
         if (!has_capability('moodle/category:delete', $context)) {
             $candeletecontent = false;
             break;
         }
     }
     $options = array();
     if ($displaylist) {
         $options[0] = get_string('move');
     }
     if ($candeletecontent) {
         $options[1] = get_string('delete');
     }
     if (empty($options)) {
         print_error('nocategorydelete', 'error', 'index.php', format_string($category->name));
     }
     $mform->addElement('select', 'fulldelete', get_string('categorycontents'), $options);
     $mform->disabledIf('newparent', 'fulldelete', 'eq', '1');
     $mform->setDefault('newparent', 0);
     if ($displaylist) {
         $mform->addElement('select', 'newparent', get_string('movecategorycontentto'), $displaylist);
         if (in_array($category->parent, $displaylist)) {
             $mform->setDefault('newparent', $category->parent);
         }
     }
     $mform->addElement('hidden', 'delete');
     $mform->addElement('hidden', 'sure');
     $mform->setDefault('sure', md5(serialize($category)));
     //--------------------------------------------------------------------------------
     $this->add_action_buttons(true, get_string('delete'));
 }
开发者ID:r007,项目名称:PMoodle,代码行数:56,代码来源:delete_category_form.php


示例6: definition

 function definition()
 {
     global $USER, $CFG;
     $mform =& $this->_form;
     $mform->addElement('header', '', get_string('coursefield', 'block_configurable_reports'), '');
     $options = array(get_string('top'));
     $parents = array();
     make_categories_list($options, $parents);
     $mform->addElement('select', 'categoryid', get_string('category'), $options);
     // buttons
     $this->add_action_buttons(true, get_string('add'));
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:12,代码来源:form.php


示例7: definition

 function definition()
 {
     global $DB, $USER, $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     $mform =& $this->_form;
     $mform->addElement('header', '', get_string('coursefield', 'report_configreports'), '');
     $options = array(get_string('top'));
     $parents = array();
     make_categories_list($options, $parents);
     $mform->addElement('select', 'categoryid', get_string('category'), $options);
     $mform->addElement('checkbox', 'includesubcats', get_string('includesubcats', 'report_configreports'));
     // buttons
     $this->add_action_buttons(true, get_string('add'));
 }
开发者ID:nickkoeppen,项目名称:moodle-report_configreports,代码行数:14,代码来源:form.php


示例8: 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 = 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('text', 'idnumber', get_string('idnumbercoursecategory'), 'maxlength="100"  size="10"');
     $mform->addHelpButton('idnumber', 'idnumbercoursecategory');
     $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('static', 'label1', 'No of subject', '<div id="noofsubject"></div>');
     $mform->addElement('static', 'label1', 'Course Selection', '<div id="basic-modal"><a href="#" class="basic">View All</a></div>');
     $mform->addElement('hidden', 'id', 0);
     $mform->setType('id', PARAM_INT);
     $mform->setDefault('id', $category->id);
     $this->add_action_buttons(true, $strsubmit);
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:48,代码来源:editcategory_form.php


示例9: 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 = 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('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:nuckey,项目名称:moodle,代码行数:45,代码来源:editcategory_form.php


示例10: execute

 function execute($data, $user, $courseid)
 {
     if (isset($data->includesubcats)) {
         if ($category = get_record('course_categories', 'id', $data->categoryid)) {
             make_categories_list($options, $parents, '', 0, $category);
         } else {
             make_categories_list($options, $parents);
         }
         unset($options[$data->categoryid]);
         return array_keys($options);
     } else {
         $categories = get_records('course_categories', 'parent', $data->categoryid);
         if ($categories) {
             return array_keys($categories);
         }
     }
     return array();
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:18,代码来源:plugin.class.php


示例11: execute

 function execute($data, $user, $courseid)
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     if (isset($data->includesubcats)) {
         if ($category = $DB->get_record('course_categories', array('id' => $data->categoryid))) {
             make_categories_list($options, $parents, '', 0, $category);
         } else {
             make_categories_list($options, $parents);
         }
         unset($options[$data->categoryid]);
         return array_keys($options);
     } else {
         $categories = $DB->get_records('course_categories', array('parent' => $data->categoryid));
         if ($categories) {
             return array_keys($categories);
         }
     }
     return array();
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:20,代码来源:plugin.class.php


示例12: get_category_options

 protected function get_category_options($currentcontextid)
 {
     $displaylist = array();
     $parentlist = array();
     make_categories_list($displaylist, $parentlist, 'moodle/cohort:manage');
     $options = array();
     $syscontext = context_system::instance();
     if (has_capability('moodle/cohort:manage', $syscontext)) {
         $options[$syscontext->id] = print_context_name($syscontext);
     }
     foreach ($displaylist as $cid => $name) {
         $context = context_coursecat::instance($cid);
         $options[$context->id] = $name;
     }
     // always add current - this is not likely, but if the logic gets changed it might be a problem
     if (!isset($options[$currentcontextid])) {
         $context = get_context_instance_by_id($currentcontextid, MUST_EXIST);
         $options[$context->id] = print_context_name($syscontext);
     }
     return $options;
 }
开发者ID:nigeli,项目名称:moodle,代码行数:21,代码来源:edit_form.php


示例13: definition

 function definition()
 {
     global $CFG, $DB, $USER;
     $mform =& $this->_form;
     if ($pending = $DB->get_records('course_request', array('requester' => $USER->id))) {
         $mform->addElement('header', 'pendinglist', get_string('coursespending'));
         $list = array();
         foreach ($pending as $cp) {
             $list[] = format_string($cp->fullname);
         }
         $list = implode(', ', $list);
         $mform->addElement('static', 'pendingcourses', get_string('courses'), $list);
     }
     $mform->addElement('header', 'coursedetails', get_string('courserequestdetails'));
     $mform->addElement('text', 'fullname', get_string('fullnamecourse'), 'maxlength="254" size="50"');
     $mform->addHelpButton('fullname', 'fullnamecourse');
     $mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
     $mform->setType('fullname', PARAM_TEXT);
     $mform->addElement('text', 'shortname', get_string('shortnamecourse'), 'maxlength="100" size="20"');
     $mform->addHelpButton('shortname', 'shortnamecourse');
     $mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
     $mform->setType('shortname', PARAM_TEXT);
     if (!empty($CFG->requestcategoryselection)) {
         $displaylist = array();
         $parentlist = array();
         make_categories_list($displaylist, $parentlist, '');
         $mform->addElement('select', 'category', get_string('category'), $displaylist);
         $mform->setDefault('category', $CFG->defaultrequestcategory);
         $mform->addHelpButton('category', 'category');
     }
     $mform->addElement('editor', 'summary_editor', get_string('summary'), null, course_request::summary_editor_options());
     $mform->addHelpButton('summary_editor', 'coursesummary');
     $mform->setType('summary_editor', PARAM_RAW);
     $mform->addElement('header', 'requestreason', get_string('courserequestreason'));
     $mform->addElement('textarea', 'reason', get_string('courserequestsupport'), array('rows' => '15', 'cols' => '50'));
     $mform->addRule('reason', get_string('missingreqreason'), 'required', null, 'client');
     $mform->setType('reason', PARAM_TEXT);
     $this->add_action_buttons(true, get_string('requestcourse'));
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:39,代码来源:request_form.php


示例14: definition

 function definition()
 {
     global $CFG, $DB;
     $mform =& $this->_form;
     $category = $this->_customdata;
     $categorycontext = context_coursecat::instance($category->id);
     $this->_category = $category;
     /// Check permissions, to see if it OK to give the option to delete
     /// the contents, rather than move elsewhere.
     /// Are there any subcategories of this one, can they be deleted?
     $candeletecontent = true;
     $tocheck = get_child_categories($category->id);
     $containscategories = !empty($tocheck);
     $categoryids = array($category->id);
     while (!empty($tocheck)) {
         $checkcat = array_pop($tocheck);
         $childcategoryids[] = $checkcat->id;
         $tocheck = $tocheck + get_child_categories($checkcat->id);
         $chcontext = context_coursecat::instance($checkcat->id);
         if ($candeletecontent && !has_capability('moodle/category:manage', $chcontext)) {
             $candeletecontent = false;
         }
     }
     /// Are there any courses in here, can they be deleted?
     list($test, $params) = $DB->get_in_or_equal($categoryids);
     $containedcourses = $DB->get_records_sql("SELECT id,1 FROM {course} c WHERE c.category {$test}", $params);
     $containscourses = false;
     if ($containedcourses) {
         $containscourses = true;
         foreach ($containedcourses as $courseid => $notused) {
             if ($candeletecontent && !can_delete_course($courseid)) {
                 $candeletecontent = false;
                 break;
             }
         }
     }
     /// Are there any questions in the question bank here?
     $containsquestions = question_context_has_any_questions($categorycontext);
     /// Get the list of categories we might be able to move to.
     $testcaps = array();
     if ($containscourses) {
         $testcaps[] = 'moodle/course:create';
     }
     if ($containscategories || $containsquestions) {
         $testcaps[] = 'moodle/category:manage';
     }
     $displaylist = array();
     $notused = array();
     if (!empty($testcaps)) {
         make_categories_list($displaylist, $notused, $testcaps, $category->id);
     }
     /// Now build the options.
     $options = array();
     if ($displaylist) {
         $options[0] = get_string('movecontentstoanothercategory');
     }
     if ($candeletecontent) {
         $options[1] = get_string('deleteallcannotundo');
     }
     /// Now build the form.
     $mform->addElement('header', 'general', get_string('categorycurrentcontents', '', format_string($category->name, true, array('context' => $categorycontext))));
     if ($containscourses || $containscategories || $containsquestions) {
         if (empty($options)) {
             print_error('youcannotdeletecategory', 'error', 'index.php', format_string($category->name, true, array('context' => $categorycontext)));
         }
         /// Describe the contents of this category.
         $contents = '<ul>';
         if ($containscategories) {
             $contents .= '<li>' . get_string('subcategories') . '</li>';
         }
         if ($containscourses) {
             $contents .= '<li>' . get_string('courses') . '</li>';
         }
         if ($containsquestions) {
             $contents .= '<li>' . get_string('questionsinthequestionbank') . '</li>';
         }
         $contents .= '</ul>';
         $mform->addElement('static', 'emptymessage', get_string('thiscategorycontains'), $contents);
         /// Give the options for what to do.
         $mform->addElement('select', 'fulldelete', get_string('whattodo'), $options);
         if (count($options) == 1) {
             $optionkeys = array_keys($options);
             $option = reset($optionkeys);
             $mform->hardFreeze('fulldelete');
             $mform->setConstant('fulldelete', $option);
         }
         if ($displaylist) {
             $mform->addElement('select', 'newparent', get_string('movecategorycontentto'), $displaylist);
             if (in_array($category->parent, $displaylist)) {
                 $mform->setDefault('newparent', $category->parent);
             }
             $mform->disabledIf('newparent', 'fulldelete', 'eq', '1');
         }
     } else {
         $mform->addElement('hidden', 'fulldelete', 1);
         $mform->setType('fulldelete', PARAM_INT);
         $mform->addElement('static', 'emptymessage', '', get_string('deletecategoryempty'));
     }
     $mform->addElement('hidden', 'delete');
     $mform->setType('delete', PARAM_ALPHANUM);
//.........这里部分代码省略.........
开发者ID:JP-Git,项目名称:moodle,代码行数:101,代码来源:delete_category_form.php


示例15: print_whole_category_list2

function print_whole_category_list2($category = NULL, $displaylist = NULL, $parentslist = NULL, $depth = -1, $showcourses = true)
{
    global $CFG;
    // maxcategorydepth == 0 meant no limit
    if (!empty($CFG->maxcategorydepth) && $depth >= $CFG->maxcategorydepth) {
        return;
    }
    if (!$displaylist) {
        make_categories_list($displaylist, $parentslist);
    }
    if ($category) {
        if ($category->visible or has_capability('moodle/category:viewhiddencategories', get_context_instance(CONTEXT_SYSTEM))) {
            print_category_info2($category, $depth, $showcourses);
        } else {
            return;
            // Don't bother printing children of invisible categories
        }
    } else {
        $category->id = "0";
    }
    if ($categories = get_child_categories($category->id)) {
        // Print all the children recursively
        $countcats = count($categories);
        $count = 0;
        $first = true;
        $last = false;
        foreach ($categories as $cat) {
            $count++;
            if ($count == $countcats) {
                $last = true;
            }
            $up = $first ? false : true;
            $down = $last ? false : true;
            $first = false;
            print_whole_category_list2($cat, $displaylist, $parentslist, $depth + 1, $showcourses);
        }
    }
}
开发者ID:nustlms,项目名称:moodle-block_custom_reports,代码行数:38,代码来源:audit.php


示例16: definition

    function definition() {
        global $USER, $CFG, $DB;

        $mform    = $this->_form;

        $course        = $this->_customdata['course']; // this contains the data of this form
        $category      = $this->_customdata['category'];
        $editoroptions = $this->_customdata['editoroptions'];
        $returnto = $this->_customdata['returnto'];

        $systemcontext   = get_context_instance(CONTEXT_SYSTEM);
        $categorycontext = get_context_instance(CONTEXT_COURSECAT, $category->id);

        if (!empty($course->id)) {
            $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
            $context = $coursecontext;
        } else {
            $coursecontext = null;
            $context = $categorycontext;
        }

        $courseconfig = get_config('moodlecourse');

        $this->course  = $course;
        $this->context = $context;

/// form definition with new course defaults
//--------------------------------------------------------------------------------
        $mform->addElement('header','general', get_string('general', 'form'));

        $mform->addElement('hidden', 'returnto', null);
        $mform->setType('returnto', PARAM_ALPHANUM);
        $mform->setConstant('returnto', $returnto);

        // verify permissions to change course category or keep current
        if (empty($course->id)) {
            if (has_capability('moodle/course:create', $categorycontext)) {
                $displaylist = array();
                $parentlist = array();
                make_categories_list($displaylist, $parentlist, 'moodle/course:create');
                $mform->addElement('select', 'category', get_string('category'), $displaylist);
                $mform->addHelpButton('category', 'category');
                $mform->setDefault('category', $category->id);
            } else {
                $mform->addElement('hidden', 'category', null);
                $mform->setType('category', PARAM_INT);
                $mform->setConstant('category', $category->id);
            }
        } else {
            if (has_capability('moodle/course:changecategory', $coursecontext)) {
                $displaylist = array();
                $parentlist = array();
                make_categories_list($displaylist, $parentlist, 'moodle/course:create');
                if (!isset($displaylist[$course->category])) {
                    //always keep current
                    $displaylist[$course->category] = format_string($DB->get_field('course_categories', 'name', array('id'=>$course->category)));
                }
                $mform->addElement('select', 'category', get_string('category'), $displaylist);
                $mform->addHelpButton('category', 'category');
            } else {
                //keep current
                $mform->addElement('hidden', 'category', null);
                $mform->setType('category', PARAM_INT);
                $mform->setConstant('category', $course->category);
            }
        }

        $mform->addElement('text','fullname', get_string('fullnamecourse'),'maxlength="254" size="50"');
        $mform->addHelpButton('fullname', 'fullnamecourse');
        $mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client');
        $mform->setType('fullname', PARAM_MULTILANG);
        if (!empty($course->id) and !has_capability('moodle/course:changefullname', $coursecontext)) {
            $mform->hardFreeze('fullname');
            $mform->setConstant('fullname', $course->fullname);
        }

        $mform->addElement('text', 'shortname', get_string('shortnamecourse'), 'maxlength="100" size="20"');
        $mform->addHelpButton('shortname', 'shortnamecourse');
        $mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
        $mform->setType('shortname', PARAM_MULTILANG);
        if (!empty($course->id) and !has_capability('moodle/course:changeshortname', $coursecontext)) {
            $mform->hardFreeze('shortname');
            $mform->setConstant('shortname', $course->shortname);
        }

        $mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100"  size="10"');
        $mform->addHelpButton('idnumber', 'idnumbercourse');
        $mform->setType('idnumber', PARAM_RAW);
        if (!empty($course->id) and !has_capability('moodle/course:changeidnumber', $coursecontext)) {
            $mform->hardFreeze('idnumber');
            $mform->setConstants('idnumber', $course->idnumber);
        }


        $mform->addElement('editor','summary_editor', get_string('coursesummary'), null, $editoroptions);
        $mform->addHelpButton('summary_editor', 'coursesummary');
        $mform->setType('summary_editor', PARAM_RAW);

        if (!empty($course->id) and !has_capability('moodle/course:changesummary', $coursecontext)) {
            $mform->hardFreeze('summary_editor');
//.........这里部分代码省略.........
开发者ID:nottmoo,项目名称:moodle,代码行数:101,代码来源:edit_form.php


示例17: definition

 function definition()
 {
     global $USER, $CFG, $DB, $js_enabled;
     $courseconfig = get_config('moodlecourse');
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $completion = new completion_info($course);
     $params = array('course' => $course->id);
     /// form definition
     //--------------------------------------------------------------------------------
     // Check if there is existing criteria completions
     if ($completion->is_course_locked()) {
         $mform->addElement('header', '', get_string('completionsettingslocked', 'completion'));
         $mform->addElement('static', '', '', get_string('err_settingslocked', 'completion'));
         $mform->addElement('submit', 'settingsunlock', get_string('unlockcompletiondelete', 'completion'));
     }
     // Get array of all available aggregation methods
     $aggregation_methods = $completion->get_aggregation_methods();
     // Overall criteria aggregation
     $mform->addElement('header', 'overallcriteria', get_string('overallcriteriaaggregation', 'completion'));
     $mform->addElement('select', 'overall_aggregation', get_string('aggregationmethod', 'completion'), $aggregation_methods);
     $mform->setDefault('overall_aggregation', $completion->get_aggregation_method());
     // Course prerequisite completion criteria
     $mform->addElement('header', 'courseprerequisites', get_string('courseprerequisites', 'completion'));
     // Get applicable courses
     $courses = $DB->get_records_sql("\n                SELECT DISTINCT\n                    c.id,\n                    c.category,\n                    c.fullname,\n                    cc.id AS selected\n                FROM\n                    {course} c\n                LEFT JOIN\n                    {course_completion_criteria} cc\n                 ON cc.courseinstance = c.id\n                AND cc.course = {$course->id}\n                INNER JOIN\n                    {course_completion_criteria} ccc\n                 ON ccc.course = c.id\n                WHERE\n                    c.enablecompletion = " . COMPLETION_ENABLED . "\n                AND c.id <> {$course->id}\n            ");
     if (!empty($courses)) {
         if (count($courses) > 1) {
             $mform->addElement('select', 'course_aggregation', get_string('aggregationmethod', 'completion'), $aggregation_methods);
             $mform->setDefault('course_aggregation', $completion->get_aggregation_method(COMPLETION_CRITERIA_TYPE_COURSE));
         }
         // Get category list
         $list = array();
         $parents = array();
         make_categories_list($list, $parents);
         // Get course list for select box
         $selectbox = array();
         $selected = array();
         foreach ($courses as $c) {
             $selectbox[$c->id] = $list[$c->category] . ' / ' . s($c->fullname);
             // If already selected
             if ($c->selected) {
                 $selected[] = $c->id;
             }
         }
         // Show multiselect box
         $mform->addElement('select', 'criteria_course', get_string('coursesavailable', 'completion'), $selectbox, array('multiple' => 'multiple', 'size' => 6));
         // Select current criteria
         $mform->setDefault('criteria_course', $selected);
         // Explain list
         $mform->addElement('static', 'criteria_courses_explaination', '', get_string('coursesavailableexplaination', 'completion'));
     } else {
         $mform->addElement('static', 'nocourses', '', get_string('err_nocourses', 'completion'));
     }
     // Manual self completion
     $mform->addElement('header', 'manualselfcompletion', get_string('manualselfcompletion', 'completion'));
     $criteria = new completion_criteria_self($params);
     $criteria->config_form_display($mform);
     // Role completion criteria
     $mform->addElement('header', 'roles', get_string('manualcompletionby', 'completion'));
     $roles = get_roles_with_capability('moodle/course:markcomplete', CAP_ALLOW, get_context_instance(CONTEXT_COURSE, $course->id));
     if (!empty($roles)) {
         $mform->addElement('select', 'role_aggregation', get_string('aggregationmethod', 'completion'), $aggregation_methods);
         $mform->setDefault('role_aggregation', $completion->get_aggregation_method(COMPLETION_CRITERIA_TYPE_ROLE));
         foreach ($roles as $role) {
             $params_a = array('role' => $role->id);
             $criteria = new completion_criteria_role(array_merge($params, $params_a));
             $criteria->config_form_display($mform, $role);
         }
     } else {
         $mform->addElement('static', 'noroles', '', get_string('err_noroles', 'completion'));
     }
     // Activity completion criteria
     $mform->addElement('header', 'activitiescompleted', get_string('activitiescompleted', 'completion'));
     $activities = $completion->get_activities();
     if (!empty($activities)) {
         if (count($activities) > 1) {
             $mform->addElement('select', 'activity_aggregation', get_string('aggregationmethod', 'completion'), $aggregation_methods);
             $mform->setDefault('activity_aggregation', $completion->get_aggregation_method(COMPLETION_CRITERIA_TYPE_ACTIVITY));
         }
         foreach ($activities as $activity) {
             $params_a = array('moduleinstance' => $activity->id);
             $criteria = new completion_criteria_activity(array_merge($params, $params_a));
             $criteria->config_form_display($mform, $activity);
         }
     } else {
         $mform->addElement('static', 'noactivities', '', get_string('err_noactivities', 'completion'));
     }
     // Completion on date
     $mform->addElement('header', 'date', get_string('date'));
     $criteria = new completion_criteria_date($params);
     $criteria->config_form_display($mform);
     // Completion after enrolment duration
     $mform->addElement('header', 'duration', get_string('durationafterenrolment', 'completion'));
     $criteria = new completion_criteria_duration($params);
     $criteria->config_form_display($mform);
     // Completion on course grade
     $mform->addElement('header', 'grade', get_string('grade'));
     // Grade enable and passing grade
     $course_grade = $DB->get_field('grade_items', 'gradepass', array('courseid' => $course->id, 'itemtype' => 'course'));
//.........这里部分代码省略.........
开发者ID:vuchannguyen,项目名称:web,代码行数:101,代码来源:completion_form.php


示例18: turnitintooltwo_show_browser_new_course_form

/**
 * Show form to create a new moodle course from the existing Turnitin Course
 *
 * @global type $CFG
 * @global type $OUTPUT
 * @return html the form object to create a new course
 */
function turnitintooltwo_show_browser_new_course_form()
{
    global $OUTPUT, $CFG;
    $elements = array();
    $elements[] = array('header', 'create_course_fieldset', get_string('createcourse', 'turnitintooltwo'));
    $displaylist = array();
    $parentlist = array();
    require_once $CFG->dirroot . "/course/lib.php";
    if (file_exists($CFG->libdir . '/coursecatlib.php')) {
        require_once $CFG->libdir . '/coursecatlib.php';
        $displaylist = coursecat::make_categories_list('');
    } else {
        make_categories_list($displaylist, $parentlist, '');
    }
    $elements[] = array('select', 'coursecategory', get_string('category'), '', $displaylist);
    $elements[] = array('text', 'coursename', get_string('coursetitle', 'turnitintooltwo'), '');
    $elements[] = array('button', 'create_course', get_string('createcourse', 'turnitintooltwo'));
    $customdata["elements"] = $elements;
    $customdata["hide_submit"] = true;
    $customdata["disable_form_change_checker"] = true;
    $createcourseform = new turnitintooltwo_form('', $customdata);
    return $createcourseform->display();
}
开发者ID:aolley,项目名称:MoodleDirectV2,代码行数:30,代码来源:lib.php


示例19: admin_setting_configselect

        $settings->add(new admin_setting_configselect('enrol_ldap/opt_deref', get_string('opt_deref_key', 'enrol_ldap'), get_string('opt_deref', 'enrol_ldap'), 0, $options));
        $settings->add(new admin_setting_configtext_trim_lower('enrol_ldap/idnumber_attribute', get_string('idnumber_attribute_key', 'enrol_ldap'),  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP make_categories_options函数代码示例发布时间:2022-05-15
下一篇:
PHP make_cache_directory函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap