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


PHP profile_list_datatypes函数代码示例

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


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

示例1: test_default_constructor

 /**
  * Make sure that all profile fields can be initialised without arguments.
  */
 public function test_default_constructor()
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . '/user/profile/definelib.php';
     $datatypes = profile_list_datatypes();
     foreach ($datatypes as $datatype => $datatypename) {
         require_once $CFG->dirroot . '/user/profile/field/' . $datatype . '/field.class.php';
         $newfield = 'profile_field_' . $datatype;
         $formfield = new $newfield();
         $this->assertNotNull($formfield);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:profilelib_test.php

示例2: foreach

        foreach ($fields as $field) {
            $table->data[] = array(format_string($field->name), profile_field_icons($field));
        }
    }
    echo $OUTPUT->heading(format_string($category->name) . ' ' . profile_category_icons($category));
    if (count($table->data)) {
        echo html_writer::table($table);
    } else {
        echo $OUTPUT->notification($strnofields);
    }
}
// End of $categories foreach.
echo '<hr />';
echo '<div class="profileeditor">';
// Create a new field link.
$options = profile_list_datatypes();
$popupurl = new moodle_url('/user/profile/index.php?id=0&action=editfield');
echo $OUTPUT->single_select($popupurl, 'datatype', $options, '', array('' => $strcreatefield), 'newfieldform');
// Add a div with a class so themers can hide, style or reposition the text.
html_writer::start_tag('div', array('class' => 'adminuseractionhint'));
echo get_string('or', 'lesson');
html_writer::end_tag('div');
// Create a new category link.
$options = array('action' => 'editcategory');
echo $OUTPUT->single_button(new moodle_url('index.php', $options), get_string('profilecreatecategory', 'admin'));
echo '</div>';
echo $OUTPUT->footer();
die;
/***** Some functions relevant to this script *****/
/**
 * Create a string containing the editing icons for the user profile categories
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:index.php

示例3: profile_edit_field

function profile_edit_field($id, $datatype, $redirect)
{
    global $CFG, $DB, $OUTPUT, $PAGE;
    if (!($field = $DB->get_record('user_info_field', array('id' => $id)))) {
        $field = new stdClass();
        $field->datatype = $datatype;
        $field->description = '';
        $field->descriptionformat = FORMAT_HTML;
        $field->defaultdata = '';
        $field->defaultdataformat = FORMAT_HTML;
    }
    // Clean and prepare description for the editor
    $field->description = clean_text($field->description, $field->descriptionformat);
    $field->description = array('text' => $field->description, 'format' => $field->descriptionformat, 'itemid' => 0);
    require_once 'index_field_form.php';
    $fieldform = new field_form(null, $field->datatype);
    // Convert the data format for
    if (is_array($fieldform->editors())) {
        foreach ($fieldform->editors() as $editor) {
            if (isset($field->{$editor})) {
                $field->{$editor} = clean_text($field->{$editor}, $field->{$editor . 'format'});
                $field->{$editor} = array('text' => $field->{$editor}, 'format' => $field->{$editor . 'format'}, 'itemid' => 0);
            }
        }
    }
    $fieldform->set_data($field);
    if ($fieldform->is_cancelled()) {
        redirect($redirect);
    } else {
        if ($data = $fieldform->get_data()) {
            require_once $CFG->dirroot . '/user/profile/field/' . $datatype . '/define.class.php';
            $newfield = 'profile_define_' . $datatype;
            $formfield = new $newfield();
            // Collect the description and format back into the proper data structure from the editor
            // Note: This field will ALWAYS be an editor
            $data->descriptionformat = $data->description['format'];
            $data->description = $data->description['text'];
            // Check whether the default data is an editor, this is (currently) only the
            // textarea field type
            if (is_array($data->defaultdata) && array_key_exists('text', $data->defaultdata)) {
                // Collect the default data and format back into the proper data structure from the editor
                $data->defaultdataformat = $data->defaultdata['format'];
                $data->defaultdata = $data->defaultdata['text'];
            }
            // Convert the data format for
            if (is_array($fieldform->editors())) {
                foreach ($fieldform->editors() as $editor) {
                    if (isset($field->{$editor})) {
                        $field->{$editor . 'format'} = $field->{$editor}['format'];
                        $field->{$editor} = $field->{$editor}['text'];
                    }
                }
            }
            $formfield->define_save($data);
            profile_reorder_fields();
            profile_reorder_categories();
            redirect($redirect);
        }
        $datatypes = profile_list_datatypes();
        if (empty($id)) {
            $strheading = get_string('profilecreatenewfield', 'admin', $datatypes[$datatype]);
        } else {
            $strheading = get_string('profileeditfield', 'admin', $field->name);
        }
        /// Print the page
        $PAGE->navbar->add($strheading);
        echo $OUTPUT->header();
        echo $OUTPUT->heading($strheading);
        $fieldform->display();
        echo $OUTPUT->footer();
        die;
    }
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:73,代码来源:definelib.php

示例4: profile_edit_field

function profile_edit_field($id, $datatype, $redirect)
{
    global $CFG;
    if (!($field = get_record('user_info_field', 'id', $id))) {
        $field = new object();
        $field->datatype = $datatype;
    }
    require_once 'index_field_form.php';
    $fieldform = new field_form(null, $field->datatype);
    $fieldform->set_data($field);
    if ($fieldform->is_cancelled()) {
        redirect($redirect);
    } else {
        if ($data = $fieldform->get_data()) {
            require_once $CFG->dirroot . '/user/profile/field/' . $datatype . '/define.class.php';
            $newfield = 'profile_define_' . $datatype;
            $formfield = new $newfield();
            $formfield->define_save($data);
            profile_reorder_fields();
            profile_reorder_categories();
            redirect($redirect);
        }
        $datatypes = profile_list_datatypes();
        if (empty($id)) {
            $strheading = get_string('profilecreatenewfield', 'admin', $datatypes[$datatype]);
        } else {
            $strheading = get_string('profileeditfield', 'admin', $field->name);
        }
        /// Print the page
        admin_externalpage_print_header();
        print_heading($strheading);
        $fieldform->display();
        admin_externalpage_print_footer();
        die;
    }
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:36,代码来源:definelib.php


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