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


PHP coursecat::make_categories_list方法代码示例

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


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

示例1: definition

 /**
  * Form definition
  */
 public function definition()
 {
     global $CFG, $DB, $PAGE;
     require_once $CFG->libdir . '/coursecatlib.php';
     $PAGE->requires->js_call_amd('tool_cat/form', 'init', array());
     $mform =& $this->_form;
     // Global update button.
     $mform->registerNoSubmitButton('updateform');
     $mform->addElement('submit', 'updateform', 'Update Form', array('class' => 'hidden'));
     // Select a category.
     $mform->addElement('header', 'info', 'Category');
     $catlist = \coursecat::make_categories_list('tool/cat:manage');
     $categories = array(0 => 'Please select a category');
     foreach ($catlist as $k => $v) {
         $categories[$k] = $v;
     }
     $mform->addElement('select', 'categoryid', 'Category', $categories);
     // Do we have a category?
     $category = optional_param('categoryid', false, PARAM_INT);
     if (!empty($category)) {
         $mform->setDefault('categoryid', $category);
         // Populate existing rules.
         $this->add_rule_fieldsets($category);
         // Print a blank rule-add row.
         $mform->addElement('header', 'rule_new', 'Add a new rule');
         $mform->setExpanded('rule_new');
         $this->add_rule_fieldset();
     }
     $this->add_action_buttons(true, 'Save rules');
 }
开发者ID:unikent,项目名称:moodle-tool_cat,代码行数:33,代码来源:category_rules.php

示例2: category_selector

 function category_selector($url)
 {
     global $OUTPUT;
     $str = '';
     $choice = optional_param('category', 0, PARAM_INT);
     $categories = coursecat::make_categories_list();
     $str .= $OUTPUT->single_select($url, 'category', $categories, $choice, array('' => get_string('all', 'enrol_delayedcohort')));
     return $str;
 }
开发者ID:vfremaux,项目名称:moodle-enrol_delayedcohort,代码行数:9,代码来源:renderer.php

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

示例4: get_category_options

 protected function get_category_options($currentcontextid)
 {
     global $CFG;
     require_once $CFG->libdir . '/coursecatlib.php';
     $displaylist = coursecat::make_categories_list('moodle/cohort:manage');
     $options = array();
     $syscontext = context_system::instance();
     if (has_capability('moodle/cohort:manage', $syscontext)) {
         $options[$syscontext->id] = $syscontext->get_context_name();
     }
     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 = context::instance_by_id($currentcontextid, MUST_EXIST);
         $options[$context->id] = $syscontext->get_context_name();
     }
     return $options;
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:21,代码来源:edit_form.php

示例5: 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 = coursecat::make_categories_list();
         $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:Jtgadbois,项目名称:Pedadida,代码行数:37,代码来源:request_form.php

示例6: get_courses

 public function get_courses(&$mform)
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     $buttonarray = array();
     // Get courses with enabled completion.
     $courses = $DB->get_records('course', array('enablecompletion' => COMPLETION_ENABLED));
     if (!empty($courses)) {
         require_once $CFG->libdir . '/coursecatlib.php';
         $list = coursecat::make_categories_list();
         $select = array();
         $selected = array();
         foreach ($courses as $c) {
             $select[$c->id] = $list[$c->category] . ' / ' . format_string($c->fullname, true, array('context' => context_course::instance($c->id)));
         }
         if ($this->id !== 0) {
             $selected = array_keys($this->params);
         }
         $settings = array('multiple' => 'multiple', 'size' => 20, 'style' => 'width:300px');
         $mform->addElement('select', 'courses', get_string('addcourse', 'badges'), $select, $settings);
         $mform->addRule('courses', get_string('requiredcourse', 'badges'), 'required');
         $mform->addHelpButton('courses', 'addcourse', 'badges');
         $buttonarray[] =& $mform->createElement('submit', 'submitcourse', get_string('addcourse', 'badges'));
         $buttonarray[] =& $mform->createElement('submit', 'cancel', get_string('cancel'));
         $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
         $mform->addElement('hidden', 'addcourse', 'addcourse');
         $mform->setType('addcourse', PARAM_TEXT);
         if ($this->id !== 0) {
             $mform->setDefault('courses', $selected);
         }
         $mform->setType('agg', PARAM_INT);
     } else {
         $mform->addElement('static', 'nocourses', '', get_string('error:nocourses', 'badges'));
         $buttonarray[] =& $mform->createElement('submit', 'cancel', get_string('continue'));
         $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
     }
 }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:37,代码来源:award_criteria_courseset.php

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

示例8: make_categories_options

/**
 * Returns full course categories trees to be used in html_writer::select()
 *
 * Calls {@link coursecat::make_categories_list()} to build the tree and
 * adds whitespace to denote nesting
 *
 * @return array array mapping coursecat id to the display name
 */
function make_categories_options()
{
    global $CFG;
    require_once $CFG->libdir . '/coursecatlib.php';
    $cats = coursecat::make_categories_list();
    foreach ($cats as $key => $value) {
        $cats[$key] = str_repeat(' ', coursecat::get($key)->depth - 1) . $value;
    }
    return $cats;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:18,代码来源:lib.php

示例9: optional_param

require_once $CFG->dirroot . '/course/lib.php';
require_once $CFG->libdir . '/coursecatlib.php';
$search = optional_param('search', '', PARAM_RAW);
// search words
$page = optional_param('page', 0, PARAM_INT);
// which page to show
$perpage = optional_param('perpage', '', PARAM_RAW);
// how many per page, may be integer or 'all'
$blocklist = optional_param('blocklist', 0, PARAM_INT);
$modulelist = optional_param('modulelist', '', PARAM_PLUGIN);
$tagid = optional_param('tagid', '', PARAM_INT);
// searches for courses tagged with this tag id
// List of minimum capabilities which user need to have for editing/moving course
$capabilities = array('moodle/course:create', 'moodle/category:manage');
// Populate usercatlist with list of category id's with course:create and category:manage capabilities.
$usercatlist = coursecat::make_categories_list($capabilities);
$search = trim(strip_tags($search));
// trim & clean raw searched string
$site = get_site();
$searchcriteria = array();
foreach (array('search', 'blocklist', 'modulelist', 'tagid') as $param) {
    if (!empty(${$param})) {
        $searchcriteria[$param] = ${$param};
    }
}
$urlparams = array();
if ($perpage !== 'all' && !($perpage = (int) $perpage)) {
    // default number of courses per page
    $perpage = $CFG->coursesperpage;
} else {
    $urlparams['perpage'] = $perpage;
开发者ID:janeklb,项目名称:moodle,代码行数:31,代码来源:search.php

示例10: course_category

 /**
  * Renders HTML to display particular course category - list of it's subcategories and courses
  *
  * Invoked from /course/index.php
  *
  * @param int|stdClass|coursecat $category
  */
 public function course_category($category)
 {
     global $CFG;
     require_once $CFG->libdir . '/coursecatlib.php';
     $coursecat = coursecat::get(is_object($category) ? $category->id : $category);
     $site = get_site();
     $output = '';
     if (can_edit_in_category($coursecat->id)) {
         // Add 'Manage' button if user has permissions to edit this category.
         $managebutton = $this->single_button(new moodle_url('/course/management.php', array('categoryid' => $coursecat->id)), get_string('managecourses'), 'get');
         $this->page->set_button($managebutton);
     }
     if (!$coursecat->id) {
         if (coursecat::count_all() == 1) {
             // There exists only one category in the system, do not display link to it
             $coursecat = coursecat::get_default();
             $strfulllistofcourses = get_string('fulllistofcourses');
             $this->page->set_title("{$site->shortname}: {$strfulllistofcourses}");
         } else {
             $strcategories = get_string('categories');
             $this->page->set_title("{$site->shortname}: {$strcategories}");
         }
     } else {
         $this->page->set_title("{$site->shortname}: " . $coursecat->get_formatted_name());
         // Print the category selector
         $output .= html_writer::start_tag('div', array('class' => 'categorypicker'));
         $select = new single_select(new moodle_url('/course/index.php'), 'categoryid', coursecat::make_categories_list(), $coursecat->id, null, 'switchcategory');
         $select->set_label(get_string('categories') . ':');
         $output .= $this->render($select);
         $output .= html_writer::end_tag('div');
         // .categorypicker
     }
     // Print current category description
     $chelper = new coursecat_helper();
     if ($description = $chelper->get_category_formatted_description($coursecat)) {
         $output .= $this->box($description, array('class' => 'generalbox info'));
     }
     // Prepare parameters for courses and categories lists in the tree
     $chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_AUTO)->set_attributes(array('class' => 'category-browse category-browse-' . $coursecat->id));
     $coursedisplayoptions = array();
     $catdisplayoptions = array();
     $browse = optional_param('browse', null, PARAM_ALPHA);
     $perpage = optional_param('perpage', $CFG->coursesperpage, PARAM_INT);
     $page = optional_param('page', 0, PARAM_INT);
     $baseurl = new moodle_url('/course/index.php');
     if ($coursecat->id) {
         $baseurl->param('categoryid', $coursecat->id);
     }
     if ($perpage != $CFG->coursesperpage) {
         $baseurl->param('perpage', $perpage);
     }
     $coursedisplayoptions['limit'] = $perpage;
     $catdisplayoptions['limit'] = $perpage;
     if ($browse === 'courses' || !$coursecat->has_children()) {
         $coursedisplayoptions['offset'] = $page * $perpage;
         $coursedisplayoptions['paginationurl'] = new moodle_url($baseurl, array('browse' => 'courses'));
         $catdisplayoptions['nodisplay'] = true;
         $catdisplayoptions['viewmoreurl'] = new moodle_url($baseurl, array('browse' => 'categories'));
         $catdisplayoptions['viewmoretext'] = new lang_string('viewallsubcategories');
     } else {
         if ($browse === 'categories' || !$coursecat->has_courses()) {
             $coursedisplayoptions['nodisplay'] = true;
             $catdisplayoptions['offset'] = $page * $perpage;
             $catdisplayoptions['paginationurl'] = new moodle_url($baseurl, array('browse' => 'categories'));
             $coursedisplayoptions['viewmoreurl'] = new moodle_url($baseurl, array('browse' => 'courses'));
             $coursedisplayoptions['viewmoretext'] = new lang_string('viewallcourses');
         } else {
             // we have a category that has both subcategories and courses, display pagination separately
             $coursedisplayoptions['viewmoreurl'] = new moodle_url($baseurl, array('browse' => 'courses', 'page' => 1));
             $catdisplayoptions['viewmoreurl'] = new moodle_url($baseurl, array('browse' => 'categories', 'page' => 1));
         }
     }
     $chelper->set_courses_display_options($coursedisplayoptions)->set_categories_display_options($catdisplayoptions);
     // Add course search form.
     $output .= $this->course_search_form();
     // Display course category tree.
     $output .= $this->coursecat_tree($chelper, $coursecat);
     // Add action buttons
     $output .= $this->container_start('buttons');
     $context = get_category_or_system_context($coursecat->id);
     if (has_capability('moodle/course:create', $context)) {
         // Print link to create a new course, for the 1st available category.
         if ($coursecat->id) {
             $url = new moodle_url('/course/edit.php', array('category' => $coursecat->id, 'returnto' => 'category'));
         } else {
             $url = new moodle_url('/course/edit.php', array('category' => $CFG->defaultrequestcategory, 'returnto' => 'topcat'));
         }
         $output .= $this->single_button($url, get_string('addnewcourse'), 'get');
     }
     ob_start();
     if (coursecat::count_all() == 1) {
         print_course_request_buttons(context_system::instance());
     } else {
//.........这里部分代码省略.........
开发者ID:rushi963,项目名称:moodle,代码行数:101,代码来源:renderer.php

示例11: make_categories_list

/**
 * This function recursively travels the categories, building up a nice list
 * for display. It also makes an array that list all the parents for each
 * category.
 *
 * For example, if you have a tree of categories like:
 *   Miscellaneous (id = 1)
 *      Subcategory (id = 2)
 *         Sub-subcategory (id = 4)
 *   Other category (id = 3)
 * Then after calling this function you will have
 * $list = array(1 => 'Miscellaneous', 2 => 'Miscellaneous / Subcategory',
 *      4 => 'Miscellaneous / Subcategory / Sub-subcategory',
 *      3 => 'Other category');
 * $parents = array(2 => array(1), 4 => array(1, 2));
 *
 * If you specify $requiredcapability, then only categories where the current
 * user has that capability will be added to $list, although all categories
 * will still be added to $parents, and if you only have $requiredcapability
 * in a child category, not the parent, then the child catgegory will still be
 * included.
 *
 * If you specify the option $excluded, then that category, and all its children,
 * are omitted from the tree. This is useful when you are doing something like
 * moving categories, where you do not want to allow people to move a category
 * to be the child of itself.
 *
 * This function is deprecated! For list of categories use
 * coursecat::make_all_categories($requiredcapability, $excludeid, $separator)
 * For parents of one particular category use
 * coursecat::get($id)->get_parents()
 *
 * @deprecated since 2.5
 *
 * @param array $list For output, accumulates an array categoryid => full category path name
 * @param array $parents For output, accumulates an array categoryid => list of parent category ids.
 * @param string/array $requiredcapability if given, only categories where the current
 *      user has this capability will be added to $list. Can also be an array of capabilities,
 *      in which case they are all required.
 * @param integer $excludeid Omit this category and its children from the lists built.
 * @param object $category Not used
 * @param string $path Not used
 */
function make_categories_list(&$list, &$parents, $requiredcapability = '', $excludeid = 0, $category = NULL, $path = "")
{
    global $CFG, $DB;
    require_once $CFG->libdir . '/coursecatlib.php';
    debugging('Global function make_categories_list() is deprecated. Please use ' . 'coursecat::make_categories_list() and coursecat::get_parents()', DEBUG_DEVELOPER);
    // For categories list use just this one function:
    if (empty($list)) {
        $list = array();
    }
    $list += coursecat::make_categories_list($requiredcapability, $excludeid);
    // Building the list of all parents of all categories in the system is highly undesirable and hardly ever needed.
    // Usually user needs only parents for one particular category, in which case should be used:
    // coursecat::get($categoryid)->get_parents()
    if (empty($parents)) {
        $parents = array();
    }
    $all = $DB->get_records_sql('SELECT id, parent FROM {course_categories} ORDER BY sortorder');
    foreach ($all as $record) {
        if ($record->parent) {
            $parents[$record->id] = array_merge($parents[$record->parent], array($record->parent));
        } else {
            $parents[$record->id] = array();
        }
    }
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:68,代码来源:deprecatedlib.php

示例12: foreach

foreach ($all as $record) {
    if ($record->parent) {
        $catparentlist[$record->id] = array_merge($catparentlist[$record->parent], array($record->parent));
    } else {
        $catparentlist[$record->id] = array();
    }
}
// Populate usercatlist with list of category id's with required capabilities.
$categories = cat_search_get_categories();
foreach ($categories as $category) {
    $context = context_coursecat::instance($category->id);
    if (has_all_capabilities($capabilities, $context)) {
        $usercatlist += coursecat::make_categories_list($capabilities, 0);
    }
    if (has_capability('local/contextadmin:viewcategories', $context)) {
        $usercatlist += coursecat::make_categories_list(array('local/contextadmin:viewcategories'), 0);
    }
}
$search = trim(strip_tags($search));
// Trim & clean raw searched string.
if ($search) {
    $searchterms = explode(" ", $search);
    // Search for words independently.
    foreach ($searchterms as $key => $searchterm) {
        if (strlen($searchterm) < 2) {
            unset($searchterms[$key]);
        }
    }
    $search = trim(implode(" ", $searchterms));
}
$site = get_site();
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:31,代码来源:cat_search.php

示例13: get_string

 $output .= html_writer::tag('h2', get_string('restorationheader', 'turnitintooltwo'));
 $output .= html_writer::tag('p', get_string('coursebrowserdesc', 'turnitintooltwo'));
 $coursesearchform = html_writer::label(get_string('coursetitle', 'turnitintooltwo') . ': ', 'search_course_title');
 $coursesearchform .= html_writer::empty_tag('input', array('type' => 'text', 'id' => 'search_course_title', 'name' => 'search_course_title'));
 $coursesearchform .= html_writer::label(get_string('integration', 'turnitintooltwo') . ': ', 'search_course_integration');
 $coursesearchform .= html_writer::select($tiiintegrationids, 'search_course_integration', '', array('' => 'choosedots'), array('id' => 'search_course_integration'));
 $coursesearchform .= html_writer::label(get_string('ced', 'turnitintooltwo') . ': ', 'search_course_end_date');
 $coursesearchform .= html_writer::empty_tag('input', array('type' => 'text', 'id' => 'search_course_end_date', 'name' => 'search_course_end_date'));
 $coursesearchform .= html_writer::tag('button', get_string('searchcourses', 'turnitintooltwo'), array("id" => "search_courses_button"));
 $output .= $OUTPUT->box($coursesearchform, 'generalbox', 'course_search_options');
 $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, '');
 }
 $categoryselectlabel = html_writer::label(get_string('selectcoursecategory', 'turnitintooltwo'), 'create_course_category');
 $categoryselect = html_writer::select($displaylist, 'create_course_category', '', array(), array('class' => 'create_course_category'));
 $createassigncheckbox = html_writer::checkbox('create_assign', 1, false, get_string('createmoodleassignments', 'turnitintooltwo'), array("class" => "create_assignment_checkbox"));
 $createassign = html_writer::tag('div', $createassigncheckbox, array("class" => "create_assign_checkbox_container"));
 $createbutton = html_writer::tag('button', get_string('createmoodlecourses', 'turnitintooltwo'), array("id" => "create_classes_button"));
 $output .= $OUTPUT->box($categoryselectlabel . " " . $categoryselect . $createassign . $createbutton, 'create_checkboxes navbar');
 $table = new html_table();
 $table->id = "courseBrowserTable";
 $rows = array();
 // Make up json array for drop down in table.
 $integrationidsjson = array();
 foreach ($tiiintegrationids as $k => $v) {
开发者ID:uofr,项目名称:moodle-mod_turnitintooltwo,代码行数:31,代码来源:extras.php

示例14: definition

 /**
  * Form definition.
  */
 function definition()
 {
     global $CFG, $PAGE;
     $mform = $this->_form;
     $PAGE->requires->yui_module('moodle-course-formatchooser', 'M.course.init_formatchooser', array(array('formid' => $mform->getAttribute('id'))));
     // recollim elements per configurar el formulari
     $course = $this->_customdata['course'];
     // this contains the data of this form
     $categorycontext = context_coursecat::instance(-1);
     //template
     if (!empty($course->id)) {
         $coursecontext = context_course::instance($course->id);
         $context = $coursecontext;
     } else {
         $coursecontext = null;
         $context = $categorycontext;
     }
     $this->course = $course;
     $this->context = $context;
     // Form definition ---------------------------------
     $mform->addElement('header', 'instance', get_string('general', 'form'));
     $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);
     if (!empty($course->id) and !has_capability('moodle/course:changefullname', $coursecontext)) {
         $mform->hardFreeze('fullname');
         $mform->setConstant('fullname', $course->fullname);
     }
     $mform->setDefault('fullname', $course->fullname . date('YY'));
     //short name
     $mform->addElement('hidden', 'shortname', get_string('shortnamecourse'));
     //category
     //$mform->addElement('hidden', 'category', 1);
     // Verify permissions to change course category or keep current.
     if (empty($course->id)) {
         if (has_capability('moodle/course:create', $categorycontext)) {
             $displaylist = coursecat::make_categories_list('moodle/course:create');
             $mform->addElement('select', 'category', get_string('coursecategory'), $displaylist);
             $mform->addHelpButton('category', 'coursecategory');
             $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 = coursecat::make_categories_list('moodle/course:create');
             if (!isset($displaylist[$course->category])) {
                 //always keep current
                 $displaylist[$course->category] = coursecat::get($course->category, MUST_EXIST, true)->get_formatted_name();
             }
             $mform->addElement('select', 'category', get_string('coursecategory'), $displaylist);
             $mform->addHelpButton('category', 'coursecategory');
         } else {
             //keep current
             $mform->addElement('hidden', 'category', null);
             $mform->setType('category', PARAM_INT);
             $mform->setConstant('category', $course->category);
         }
     }
     //start date
     $mform->addElement('date_selector', 'startdate', get_string('startdate'));
     $mform->setDefault('startdate', time());
     $days = count_course_days($course->id);
     //duration hint
     $mform->addHelpButton('duration', 'Rappelez-vous la dur&eacute;e des themes est de: ' . $days . ' jours');
     //end date proposada
     $mform->addElement('date_selector', 'enddate', 'Date de finalisation');
     $mform->setDefault('enddate', time() + $days * 24 * 3600);
     //make the course visible
     $mform->addElement('hidden', 'visible', 1);
     $this->add_action_buttons();
     $mform->addElement('hidden', 'format', 'topics');
     //we need to put an id, so we keep the old one, for the moment
     $mform->addElement('hidden', 'id', $course->id);
     $mform->setType('id', PARAM_INT);
     $this->set_data($course);
 }
开发者ID:helenagarcia90,项目名称:moodle-esi,代码行数:83,代码来源:edit_form.php

示例15: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $category = $this->_customdata['category'];
     $omega = new omega();
     //con esto se obtienen las unidades academicas de Omega
     $unidadesAcademicas = $omega->listarUnidadesAcademicas();
     $attributes = array('id' => 'unidad');
     $mform->addElement('select', 'idOmega', 'Unidad Académica', $unidadesAcademicas, $attributes);
     //con esto se obtienen los periodos acad�micos de Omega
     $periodosAcademicos = $omega->listarPeriodosAcademicos();
     $mform->addElement('select', 'idOmega', 'Periodo Académico', $periodosAcademicos);
     //lo siguiente permite desplegar una lista con todas las categorías de moodle anidadas
     $displaylist = coursecat::make_categories_list();
     $mform->addElement('select', 'category', 'Categoría Moodle', $displaylist);
     //Y finalmente un select simple para designar si está o no activo.
     $mform->addElement('select', 'activo', 'Activo', array(0 => 'Desactivar', 1 => 'Activar'));
     //Select para configurar si el campo está activo o no
     $this->add_action_buttons(true, 'Crear');
 }
开发者ID:jorgecabane93,项目名称:uai,代码行数:21,代码来源:locallib.php


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