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


PHP get_records_menu函数代码示例

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


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

示例1: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $strrequired = get_string('required');
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('name'), array('size' => '64'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     if (!($options = get_records_menu("survey", "template", 0, "name", "id, name"))) {
         error('No survey templates found!');
     }
     foreach ($options as $id => $name) {
         $options[$id] = get_string($name, "survey");
     }
     $options = array('' => get_string('choose') . '...') + $options;
     $mform->addElement('select', 'template', get_string("surveytype", "survey"), $options);
     $mform->addRule('template', $strrequired, 'required', null, 'client');
     $mform->setHelpButton('template', array('surveys', get_string('helpsurveys', 'survey')));
     $mform->addElement('textarea', 'intro', get_string('customintro', 'survey'), 'wrap="virtual" rows="20" cols="75"');
     $mform->setType('intro', PARAM_RAW);
     $features = new stdClass();
     $features->groups = true;
     $features->groupings = true;
     $features->groupmembersonly = true;
     $this->standard_coursemodule_elements($features);
     //-------------------------------------------------------------------------------
     // buttons
     $this->add_action_buttons();
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:mod_form.php

示例2: xmldb_ezproxy_upgrade

function xmldb_ezproxy_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    /// And upgrade begins here. For each one, you'll need one
    /// block of code similar to the next one. Please, delete
    /// this comment lines once this file start handling proper
    /// upgrade code.
    if ($result && $oldversion < 2009042403) {
        /// Rebuild the course cache of every course which uses one of these modules in it to get
        /// the new link.
        if ($courseids = get_records_menu('ezproxy', '', '', 'course ASC', 'id, course')) {
            /// Just get the unique course ID values.
            $courseids = array_unique(array_values($courseids));
            if (!empty($courseids)) {
                require_once $CFG->dirroot . '/course/lib.php';
                foreach ($courseids as $courseid) {
                    rebuild_course_cache($courseid);
                    // Does not return a bool
                }
            }
        }
    }
    if ($result && $oldversion < 2009042404) {
        $table = new XMLDBTable('ezproxy');
        $field = new XMLDBField('serverurl');
        $field->setAttributes(XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, '', 'name');
        $result = change_field_type($table, $field);
    }
    return $result;
}
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:31,代码来源:upgrade.php

示例3: data_preprocessing

 function data_preprocessing(&$default_values)
 {
     if (!empty($this->_instance) && ($options = get_records_menu('choice_options', 'choiceid', $this->_instance, 'id', 'id,text')) && ($options2 = get_records_menu('choice_options', 'choiceid', $this->_instance, 'id', 'id,maxanswers'))) {
         $choiceids = array_keys($options);
         $options = array_values($options);
         $options2 = array_values($options2);
         foreach (array_keys($options) as $key) {
             $default_values['option[' . $key . ']'] = $options[$key];
             $default_values['limit[' . $key . ']'] = $options2[$key];
             $default_values['optionid[' . $key . ']'] = $choiceids[$key];
         }
     }
     if (empty($default_values['timeopen'])) {
         $default_values['timerestrict'] = 0;
     } else {
         $default_values['timerestrict'] = 1;
     }
 }
开发者ID:veritech,项目名称:pare-project,代码行数:18,代码来源:mod_form.php

示例4: trusttext_prepare_edit

        trusttext_prepare_edit($toform->definition, $toform->format, can_use_html_editor(), $context);
        $toform->approved = $glossary->defaultapproval or has_capability('mod/glossary:approve', $context);
        $toform->usedynalink = $fromdb->usedynalink;
        $toform->casesensitive = $fromdb->casesensitive;
        $toform->fullmatch = $fromdb->fullmatch;
        $toform->aliases = '';
        $ineditperiod = time() - $fromdb->timecreated < $CFG->maxeditingtime || $glossary->editalways;
        if (!$ineditperiod || $USER->id != $fromdb->userid and !has_capability('mod/glossary:manageentries', $context)) {
            if ($USER->id != $fromdb->userid) {
                print_error('errcannoteditothers', 'glossary');
            } elseif (!$ineditperiod) {
                print_error('erredittimeexpired', 'glossary');
            }
            die;
        }
        if ($aliases = get_records_menu("glossary_alias", "entryid", $e, '', 'id, alias')) {
            $toform->aliases = implode("\n", $aliases) . "\n";
        }
        $mform->set_data($toform);
    }
}
$stredit = empty($e) ? get_string('addentry', 'glossary') : get_string("edit");
$navigation = build_navigation($stredit, $cm);
print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, "", navmenu($course, $cm));
print_heading(format_string($glossary->name));
/// Info box
///if ( $glossary->intro ) {
///    print_simple_box(format_text($glossary->intro), 'center', '70%', '', 5, 'generalbox', 'intro');
///}
/// Tabbed browsing sections
///$tab = GLOSSARY_ADDENTRY_VIEW;
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:edit.php

示例5: optional_param

$sort = optional_param('sort', 'username', PARAM_ALPHA);
$dir = optional_param('dir', 'ASC', PARAM_ALPHA);
$page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', 30, PARAM_INT);
$action = trim(strtolower(optional_param('action', '', PARAM_ALPHA)));
require_login();
admin_externalpage_setup('ssoaccesscontrol');
admin_externalpage_print_header();
if (!extension_loaded('openssl')) {
    print_error('requiresopenssl', 'mnet', '', NULL, true);
}
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
$sesskey = sesskey();
$formerror = array();
// grab the mnet hosts and remove the localhost
$mnethosts = get_records_menu('mnet_host', '', '', 'name', 'id, name');
if (array_key_exists($CFG->mnet_localhost_id, $mnethosts)) {
    unset($mnethosts[$CFG->mnet_localhost_id]);
}
// process actions
if (!empty($action) and confirm_sesskey()) {
    // boot if insufficient permission
    if (!has_capability('moodle/user:delete', $sitecontext)) {
        error(get_string('nomodifyacl', 'mnet'));
    }
    // fetch the record in question
    $id = required_param('id', PARAM_INT);
    if (!($idrec = get_record('mnet_sso_access_control', 'id', $id))) {
        error(get_string('recordnoexists', 'mnet'), "{$CFG->wwwroot}/{$CFG->admin}/mnet/access_control.php");
    }
    switch ($action) {
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:access_control.php

示例6: get_valid_iframe_html

 /**
  * Returns a block of HTML that the external video block can use to show the
  * sites for which iframes are allowed.
  */
 private static function get_valid_iframe_html()
 {
     $iframedomains = get_records_menu('iframe_source_icon', '', '', 'name');
     if (empty($iframedomains)) {
         return '';
     }
     $data = array();
     foreach ($iframedomains as $name => $host) {
         $data[$name] = array('name' => $name, 'url' => 'http://' . $host, 'icon' => favicon_display_url($host));
     }
     $smarty = smarty_core();
     $smarty->assign('data', $data);
     return $smarty->fetch('blocktype:externalvideo:sitelist.tpl');
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:18,代码来源:lib.php

示例7: array

if ($cancreatecontrolled) {
    $elements['hidden'] = array('type' => 'switchbox', 'title' => get_string('hiddengroup', 'group'), 'description' => get_string('hiddengroupdescription1', 'group'), 'defaultvalue' => $group_data->hidden);
    $elements['hidemembers'] = array('type' => 'switchbox', 'title' => get_string('hidemembers', 'group'), 'description' => get_string('hidemembersdescription', 'group'), 'defaultvalue' => $group_data->hidemembers || $group_data->hidemembersfrommembers, 'disabled' => $group_data->hidemembersfrommembers);
    $elements['hidemembersfrommembers'] = array('type' => 'switchbox', 'title' => get_string('hidemembersfrommembers', 'group'), 'description' => get_string('hidemembersfrommembersdescription1', 'group'), 'defaultvalue' => $group_data->hidemembersfrommembers);
} else {
    $form['elements']['hidden'] = array('type' => 'hidden', 'value' => $group_data->hidden);
    $form['elements']['hidemembers'] = array('type' => 'hidden', 'value' => $group_data->hidemembers || $group_data->hidemembersfrommembers);
    $form['elements']['hidemembersfrommembers'] = array('type' => 'hidden', 'value' => $group_data->hidemembersfrommembers);
}
$elements['groupparticipationreports'] = array('type' => 'switchbox', 'title' => get_string('groupparticipationreports', 'group'), 'description' => get_string('groupparticipationreportsdesc1', 'group'), 'defaultvalue' => $group_data->groupparticipationreports);
$elements['editability'] = array('type' => 'html', 'value' => '<h4>' . get_string('editability', 'group') . '</h4>');
$currentdate = getdate();
$elements['editwindowstart'] = array('type' => 'date', 'class' => 'five-across hide-label', 'title' => get_string('windowstart', 'group'), 'defaultvalue' => $group_data->editwindowstart, 'description' => get_string('windowstartdesc', 'group'), 'minyear' => $currentdate['year'], 'maxyear' => $currentdate['year'] + 20, 'time' => true);
$elements['editwindowend'] = array('type' => 'date', 'class' => 'five-across hide-label', 'title' => get_string('windowend', 'group'), 'defaultvalue' => $group_data->editwindowend, 'description' => get_string('windowenddesc', 'group'), 'minyear' => $currentdate['year'], 'maxyear' => $currentdate['year'] + 20, 'time' => true);
$elements['general'] = array('type' => 'html', 'value' => '<h4>' . get_string('general') . '</h4>');
if (get_config('allowgroupcategories') && ($groupcategories = get_records_menu('group_category', '', '', 'displayorder', 'id,title'))) {
    $elements['category'] = array('type' => 'select', 'title' => get_string('groupcategory', 'group'), 'options' => array('0' => get_string('nocategoryselected', 'group')) + $groupcategories, 'defaultvalue' => $group_data->category);
    // If it's a new group & the category was passed as a parameter, hide it in the form.
    $groupcategoryparam = param_integer('category', 0);
    if (!$id && isset($groupcategories[$groupcategoryparam])) {
        $form['elements']['category'] = array('type' => 'hidden', 'value' => $groupcategoryparam);
    }
}
$elements['usersautoadded'] = array('type' => 'switchbox', 'title' => get_string('usersautoadded', 'group'), 'description' => get_string('usersautoaddeddescription1', 'group'), 'defaultvalue' => $group_data->usersautoadded, 'help' => true, 'ignore' => !$USER->get('admin'));
$notifyroles = array(get_string('none', 'admin')) + group_get_editroles_options(true);
$elements['viewnotify'] = array('type' => 'select', 'title' => get_string('viewnotify', 'group'), 'options' => $notifyroles, 'description' => get_string('viewnotifydescription2', 'group'), 'defaultvalue' => $group_data->viewnotify);
$elements['feedbacknotify'] = array('type' => 'select', 'title' => get_string('feedbacknotify', 'group'), 'options' => $notifyroles, 'description' => get_string('feedbacknotifydescription1', 'group'), 'defaultvalue' => $group_data->feedbacknotify);
if ($cancreatecontrolled) {
    $elements['sendnow'] = array('type' => 'switchbox', 'title' => get_string('allowsendnow', 'group'), 'description' => get_string('allowsendnowdescription1', 'group'), 'defaultvalue' => $group_data->sendnow);
} else {
    $form['elements']['sendnow'] = array('type' => 'hidden', 'value' => $group_data->sendnow);
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:edit.php

示例8: get_instance_config_options

 public static function get_instance_config_options($institution, $instance = 0)
 {
     $peer = new Peer();
     // TODO : switch to getrecord
     // Get a list of applications and make a dropdown from it
     $applicationset = new ApplicationSet();
     $apparray = array();
     foreach ($applicationset as $app) {
         $apparray[$app->name] = $app->displayname;
     }
     /**
      * A parent authority for XML-RPC is the data-source that a remote XML-RPC service
      * communicates with to authenticate a user, for example, the XML-RPC server that
      * we connect to might be authorising users against an LDAP store. If this is the
      * case, and we know of the LDAP store, and our users are able to log on to our
      * system and be authenticated directly against the LDAP store, then we honor that
      * association.
      *
      * In this way, the unique relationship is between the username and the authority,
      * not the username and the institution. This allows an institution to have a user
      * 'donal' on server 'LDAP-1' and a different user 'donal' on server 'LDAP-2'.
      *
      * Get a list of auth instances for this institution, and eliminate those that
      * would not be valid parents (as they themselves require a parent). These are
      * eliminated only to provide a saner interface to the admin user. In theory, it's
      * ok to chain authorities.
      */
     $instances = auth_get_auth_instances_for_institution($institution);
     $options = array('None');
     if (is_array($instances)) {
         foreach ($instances as $someinstance) {
             if ($someinstance->requires_parent == 1 || $someinstance->authname == 'none') {
                 continue;
             }
             $options[$someinstance->id] = $someinstance->instancename;
         }
     }
     // Get the current data (if any exists) for this auth instance
     if ($instance > 0) {
         $default = get_record('auth_instance', 'id', $instance);
         if ($default == false) {
             throw new SystemException(get_string('nodataforinstance', 'auth') . $instance);
         }
         $current_config = get_records_menu('auth_instance_config', 'instance', $instance, '', 'field, value');
         if ($current_config == false) {
             throw new SystemException('No config data for instance: ' . $instance);
         }
         foreach (self::$default_config as $key => $value) {
             if (array_key_exists($key, $current_config)) {
                 self::$default_config[$key] = $current_config[$key];
                 // We can use the wwwroot to create a Peer object
                 if ('wwwroot' == $key) {
                     $peer->findByWwwroot($current_config[$key]);
                     self::$default_config['wwwroot_orig'] = $current_config[$key];
                 }
             } elseif (property_exists($default, $key)) {
                 self::$default_config[$key] = $default->{$key};
             }
         }
     } else {
         $max_priority = get_field('auth_instance', 'MAX(priority)', 'institution', $institution);
         self::$default_config['priority'] = ++$max_priority;
     }
     if (empty($peer->application->name)) {
         self::$default_config['appname'] = key(current($applicationset));
     } else {
         self::$default_config['appname'] = $peer->application->name;
     }
     $elements['instancename'] = array('type' => 'text', 'title' => get_string('authname', 'auth'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['instancename'], 'help' => true);
     $elements['instance'] = array('type' => 'hidden', 'value' => $instance);
     $elements['institution'] = array('type' => 'hidden', 'value' => $institution);
     $elements['deleted'] = array('type' => 'hidden', 'value' => $peer->deleted);
     $elements['authname'] = array('type' => 'hidden', 'value' => 'xmlrpc');
     $elements['wwwroot'] = array('type' => 'text', 'title' => get_string('wwwroot', 'auth'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['wwwroot'], 'help' => true);
     $elements['wwwroot_orig'] = array('type' => 'hidden', 'value' => self::$default_config['wwwroot_orig']);
     $elements['oldwwwroot'] = array('type' => 'hidden', 'value' => 'xmlrpc');
     if ($instance) {
         $elements['publickey'] = array('type' => 'textarea', 'title' => get_string('publickey', 'admin'), 'defaultvalue' => get_field('host', 'publickey', 'wwwroot', self::$default_config['wwwroot']), 'rules' => array('required' => true), 'rows' => 15, 'cols' => 70);
         $elements['publickeyexpires'] = array('type' => 'html', 'title' => get_string('publickeyexpires', 'admin'), 'value' => format_date(get_field('host', 'publickeyexpires', 'wwwroot', self::$default_config['wwwroot'])));
     }
     $elements['name'] = array('type' => 'text', 'title' => get_string('name', 'auth'), 'rules' => array('required' => true), 'defaultvalue' => $peer->name, 'help' => true);
     /**
      * empty($peer->appname) would ALWAYS return true, because the property doesn't really
      * exist. When we try to get $peer->appname, we're actually calling the peer class's
      * __get overloader. Unfortunately, the 'empty' function seems to just check for the
      * existence of the property - it doesn't call the overloader. Bug or feature?
      */
     $tmpappname = $peer->appname;
     $elements['appname'] = array('type' => 'select', 'title' => get_string('application', 'auth'), 'collapseifoneoption' => true, 'multiple' => false, 'options' => $apparray, 'defaultvalue' => empty($tmpappname) ? 'moodle' : $tmpappname, 'help' => true);
     $elements['parent'] = array('type' => 'select', 'title' => get_string('parent', 'auth'), 'collapseifoneoption' => false, 'options' => $options, 'defaultvalue' => self::$default_config['parent'], 'help' => true);
     $elements['authloginmsg'] = array('type' => 'wysiwyg', 'rows' => 10, 'cols' => 70, 'title' => '', 'description' => get_string('authloginmsg2', 'auth'), 'defaultvalue' => self::$default_config['authloginmsg'], 'help' => true);
     $elements['ssodirection'] = array('type' => 'select', 'title' => get_string('ssodirection', 'auth'), 'options' => array(0 => '--', 'theyssoin' => get_string('theyssoin', 'auth'), 'wessoout' => get_string('wessoout', 'auth')), 'defaultvalue' => self::$default_config['wessoout'] ? 'wessoout' : 'theyssoin', 'help' => true);
     $elements['updateuserinfoonlogin'] = array('type' => 'switchbox', 'title' => get_string('updateuserinfoonlogin', 'auth'), 'defaultvalue' => self::$default_config['updateuserinfoonlogin'], 'help' => true);
     $elements['weautocreateusers'] = array('type' => 'switchbox', 'title' => get_string('weautocreateusers', 'auth'), 'defaultvalue' => self::$default_config['weautocreateusers'], 'help' => true);
     $elements['theyautocreateusers'] = array('type' => 'switchbox', 'title' => get_string('theyautocreateusers', 'auth'), 'defaultvalue' => self::$default_config['theyautocreateusers'], 'help' => true);
     $elements['weimportcontent'] = array('type' => 'switchbox', 'title' => get_string('weimportcontent', 'auth'), 'defaultvalue' => self::$default_config['weimportcontent'], 'help' => true);
     return array('elements' => $elements, 'renderer' => 'div');
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:98,代码来源:lib.php

示例9: get_instance_config_options

 public static function get_instance_config_options($institution, $instance = 0)
 {
     global $CFG;
     // list of user_type
     $utopt = array();
     $utopt['edir'] = 'Novell Edirectory';
     $utopt['rfc2307'] = 'posixAccount (rfc2307)';
     $utopt['rfc2307bis'] = 'posixAccount (rfc2307bis)';
     $utopt['samba'] = 'sambaSamAccount (v.3.0.7)';
     $utopt['ad'] = 'MS ActiveDirectory';
     $utopt['default'] = 'default';
     $yesnoopt = array('yes' => 'Yes', 'no' => 'No');
     $versionopt = array('2' => '2', '3' => '3');
     if ($instance > 0) {
         $default = get_record('auth_instance', 'id', $instance);
         if ($default == false) {
             throw new SystemException('Could not find data for auth instance ' . $instance);
         }
         $current_config = get_records_menu('auth_instance_config', 'instance', $instance, '', 'field, value');
         if ($current_config == false) {
             $current_config = array();
         }
         foreach (self::$default_config as $key => $value) {
             if (array_key_exists($key, $current_config)) {
                 self::$default_config[$key] = $current_config[$key];
             }
         }
     } else {
         $default = new stdClass();
         $default->instancename = '';
     }
     require_once $CFG->docroot . 'lib/group.php';
     $grouptypeopt = group_get_grouptype_options(self::$default_config['syncgroupsgrouptype']);
     $elements = array('instancename' => array('type' => 'text', 'title' => get_string('authname', 'auth'), 'rules' => array('required' => true), 'defaultvalue' => $default->instancename), 'instance' => array('type' => 'hidden', 'value' => $instance), 'institution' => array('type' => 'hidden', 'value' => $institution), 'authname' => array('type' => 'hidden', 'value' => 'ldap'), 'host_url' => array('type' => 'text', 'title' => get_string('hosturl', 'auth.ldap'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['host_url'], 'help' => true), 'contexts' => array('type' => 'text', 'title' => get_string('contexts', 'auth.ldap'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['contexts'], 'help' => true), 'user_type' => array('type' => 'select', 'title' => get_string('usertype', 'auth.ldap'), 'options' => $utopt, 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['user_type'], 'help' => true), 'user_attribute' => array('type' => 'text', 'title' => get_string('userattribute', 'auth.ldap'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['user_attribute'], 'help' => true), 'search_sub' => array('type' => 'select', 'title' => get_string('searchsubcontexts', 'auth.ldap'), 'options' => $yesnoopt, 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['search_sub'], 'help' => true), 'bind_dn' => array('type' => 'text', 'title' => get_string('distinguishedname', 'auth.ldap'), 'defaultvalue' => self::$default_config['bind_dn'], 'help' => true), 'bind_pw' => array('type' => 'password', 'title' => get_string('password', 'auth.ldap'), 'defaultvalue' => self::$default_config['bind_pw'], 'help' => true), 'version' => array('type' => 'select', 'title' => get_string('ldapversion', 'auth.ldap'), 'options' => $versionopt, 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['version'], 'help' => true), 'starttls' => array('type' => 'checkbox', 'title' => get_string('starttls', 'auth.ldap'), 'defaultvalue' => self::$default_config['starttls']), 'updateuserinfoonlogin' => array('type' => 'checkbox', 'title' => get_string('updateuserinfoonlogin', 'auth.ldap'), 'defaultvalue' => self::$default_config['updateuserinfoonlogin'], 'help' => true), 'weautocreateusers' => array('type' => 'checkbox', 'title' => get_string('weautocreateusers', 'auth.ldap'), 'defaultvalue' => self::$default_config['weautocreateusers'], 'help' => true), 'firstnamefield' => array('type' => 'text', 'title' => get_string('ldapfieldforfirstname', 'auth.ldap'), 'defaultvalue' => self::$default_config['firstnamefield'], 'help' => true), 'surnamefield' => array('type' => 'text', 'title' => get_string('ldapfieldforsurname', 'auth.ldap'), 'defaultvalue' => self::$default_config['surnamefield'], 'help' => true), 'emailfield' => array('type' => 'text', 'title' => get_string('ldapfieldforemail', 'auth.ldap'), 'defaultvalue' => self::$default_config['emailfield'], 'help' => true), 'studentidfield' => array('type' => 'text', 'title' => get_string('ldapfieldforstudentid', 'auth.ldap'), 'defaultvalue' => self::$default_config['studentidfield'], 'help' => true), 'preferrednamefield' => array('type' => 'text', 'title' => get_string('ldapfieldforpreferredname', 'auth.ldap'), 'defaultvalue' => self::$default_config['preferrednamefield'], 'help' => true), 'syncuserscronset' => array('type' => 'fieldset', 'legend' => get_string('syncuserssettings', 'auth.ldap'), 'collapsible' => true, 'collapsed' => !self::$default_config['syncuserscron'], 'elements' => array('syncuserscron' => array('type' => 'checkbox', 'title' => get_string('syncuserscron', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncuserscron']), 'syncusersupdate' => array('type' => 'checkbox', 'title' => get_string('syncusersupdate', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncusersupdate']), 'syncuserscreate' => array('type' => 'checkbox', 'title' => get_string('syncuserscreate', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncuserscreate']), 'syncusersextrafilterattribute' => array('type' => 'text', 'title' => get_string('syncusersextrafilterattribute', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncusersextrafilterattribute']), 'syncusersgonefromldap' => array('type' => 'select', 'title' => get_string('syncusersgonefromldap', 'auth.ldap'), 'help' => true, 'options' => array('' => get_string('syncusersgonefromldapdonothing', 'auth.ldap'), 'suspend' => get_string('syncusersgonefromldapsuspend', 'auth.ldap'), 'delete' => get_string('syncusersgonefromldapdelete', 'auth.ldap')), 'defaultvalue' => self::$default_config['syncusersgonefromldap']))), 'syncgroupscronset' => array('type' => 'fieldset', 'legend' => get_string('syncgroupssettings', 'auth.ldap'), 'collapsible' => true, 'collapsed' => !self::$default_config['syncgroupscron'], 'elements' => array('syncgroupscron' => array('type' => 'checkbox', 'title' => get_string('syncgroupscron', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupscron']), 'syncgroupsautocreate' => array('type' => 'checkbox', 'title' => get_string('syncgroupsautocreate', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncgroupsautocreate']), 'syncgroupsgrouptype' => array('type' => 'select', 'title' => get_string('syncgroupsgrouptype', 'auth.ldap'), 'options' => $grouptypeopt, 'defaultvalue' => self::$default_config['syncgroupsgrouptype']), 'syncgroupsexcludelist' => array('type' => 'text', 'title' => get_string('syncgroupsexcludelist', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncgroupsexcludelist']), 'syncgroupsincludelist' => array('type' => 'text', 'title' => get_string('syncgroupsincludelist', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncgroupsincludelist']), 'syncgroupshr1' => array('type' => 'html', 'value' => '<hr />'), 'syncgroupsbyclass' => array('type' => 'checkbox', 'title' => get_string('syncgroupsbyclass', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsbyclass']), 'syncgroupsgroupclass' => array('type' => 'text', 'title' => get_string('syncgroupsgroupclass', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsgroupclass']), 'syncgroupsgroupattribute' => array('type' => 'text', 'title' => get_string('syncgroupsgroupattribute', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsgroupattribute']), 'syncgroupsmemberattribute' => array('type' => 'text', 'title' => get_string('syncgroupsmemberattribute', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsmemberattribute']), 'syncgroupsmemberattributeisdn' => array('type' => 'checkbox', 'title' => get_string('syncgroupsmemberattributeisdn', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsmemberattributeisdn']), 'syncgroupsnestedgroups' => array('type' => 'checkbox', 'title' => get_string('syncgroupsnestedgroups', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsnestedgroups']), 'syncgroupscontexts' => array('type' => 'text', 'title' => get_string('syncgroupscontexts', 'auth.ldap'), 'description' => get_string('syncgroupscontextsdesc', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupscontexts']), 'syncgroupssearchsub' => array('type' => 'select', 'title' => get_string('searchsubcontexts', 'auth.ldap'), 'options' => $yesnoopt, 'defaultvalue' => self::$default_config['syncgroupssearchsub']), 'syncgroupshr2' => array('type' => 'html', 'value' => '<hr />'), 'syncgroupsbyuserfield' => array('type' => 'checkbox', 'title' => get_string('syncgroupsbyuserfield', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsbyuserfield']), 'syncgroupsuserattribute' => array('type' => 'text', 'title' => get_string('syncgroupsuserattribute', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncgroupsuserattribute']), 'syncgroupsusergroupnames' => array('type' => 'text', 'title' => get_string('syncgroupsusergroupnames', 'auth.ldap'), 'description' => get_string('syncgroupsusergroupnamesdesc', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsusergroupnames']))));
     return array('elements' => $elements, 'renderer' => 'table');
 }
开发者ID:vohung96,项目名称:mahara,代码行数:36,代码来源:lib.php

示例10: required_param

* a controller for the play view
* 
* @package mod-poodllflashcard
* @category mod
* @author Valery Fremaux
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*
* @usecase add
* @usecase delete
* @usecase save
*/
/******************************** Add new blank fields *****************************/
if ($action == 'add') {
    $add = required_param('add', PARAM_INT);
    $card->flashcardid = $flashcard->id;
    $users = get_records_menu('poodllflashcard_card', 'flashcardid', $flashcard->id, '', 'DISTINCT userid, id');
    for ($i = 0; $i < $add; $i++) {
        if (!($newcardid = insert_record('poodllflashcard_deckdata', $card))) {
            error("Could not add card to deck");
        }
        if ($users) {
            foreach (array_keys($users) as $userid) {
                $deckcard->flashcardid = $flashcard->id;
                $deckcard->entryid = $newcardid;
                $deckcard->userid = $userid;
                $deckcard->lastaccessed = 0;
                $deckcard->deck = 1;
                $deckcard->accesscount = 0;
                if (!insert_record('poodllflashcard_card', $deckcard)) {
                    error("Could not bind card to user {$userid} deck");
                }
开发者ID:laiello,项目名称:poodll,代码行数:31,代码来源:editview.controller.php

示例11: get_instance_config_options

 public static function get_instance_config_options($institution, $instance = 0)
 {
     // list of user_type
     $utopt = array();
     $utopt['edir'] = 'Novell Edirectory';
     $utopt['rfc2307'] = 'posixAccount (rfc2307)';
     $utopt['rfc2307bis'] = 'posixAccount (rfc2307bis)';
     $utopt['samba'] = 'sambaSamAccount (v.3.0.7)';
     $utopt['ad'] = 'MS ActiveDirectory';
     $utopt['default'] = 'default';
     $yesnoopt = array('yes' => 'Yes', 'no' => 'No');
     $versionopt = array('2' => '2', '3' => '3');
     if ($instance > 0) {
         $default = get_record('auth_instance', 'id', $instance);
         if ($default == false) {
             throw new SystemException('Could not find data for auth instance ' . $instance);
         }
         $current_config = get_records_menu('auth_instance_config', 'instance', $instance, '', 'field, value');
         if ($current_config == false) {
             $current_config = array();
         }
         foreach (self::$default_config as $key => $value) {
             if (array_key_exists($key, $current_config)) {
                 self::$default_config[$key] = $current_config[$key];
             }
         }
     } else {
         $default = new stdClass();
         $default->instancename = '';
     }
     $elements = array('instancename' => array('type' => 'text', 'title' => get_string('authname', 'auth'), 'rules' => array('required' => true), 'defaultvalue' => $default->instancename), 'instance' => array('type' => 'hidden', 'value' => $instance), 'institution' => array('type' => 'hidden', 'value' => $institution), 'authname' => array('type' => 'hidden', 'value' => 'ldap'), 'host_url' => array('type' => 'text', 'title' => get_string('hosturl', 'auth.ldap'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['host_url'], 'help' => true), 'contexts' => array('type' => 'text', 'title' => get_string('contexts', 'auth.ldap'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['contexts'], 'help' => true), 'user_type' => array('type' => 'select', 'title' => get_string('usertype', 'auth.ldap'), 'options' => $utopt, 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['user_type'], 'help' => true), 'user_attribute' => array('type' => 'text', 'title' => get_string('userattribute', 'auth.ldap'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['user_attribute'], 'help' => true), 'search_sub' => array('type' => 'select', 'title' => get_string('searchsubcontexts', 'auth.ldap'), 'options' => $yesnoopt, 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['search_sub'], 'help' => true), 'bind_dn' => array('type' => 'text', 'title' => get_string('distinguishedname', 'auth.ldap'), 'defaultvalue' => self::$default_config['bind_dn'], 'help' => true), 'bind_pw' => array('type' => 'text', 'title' => get_string('password', 'auth.ldap'), 'defaultvalue' => self::$default_config['bind_pw'], 'help' => true), 'version' => array('type' => 'select', 'title' => get_string('ldapversion', 'auth.ldap'), 'options' => $versionopt, 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['version'], 'help' => true), 'weautocreateusers' => array('type' => 'checkbox', 'title' => get_string('weautocreateusers', 'auth.ldap'), 'defaultvalue' => self::$default_config['weautocreateusers'], 'help' => true), 'firstnamefield' => array('type' => 'text', 'title' => get_string('ldapfieldforfirstname', 'auth.ldap'), 'defaultvalue' => self::$default_config['firstnamefield'], 'help' => true), 'surnamefield' => array('type' => 'text', 'title' => get_string('ldapfieldforsurname', 'auth.ldap'), 'defaultvalue' => self::$default_config['surnamefield'], 'help' => true), 'emailfield' => array('type' => 'text', 'title' => get_string('ldapfieldforemail', 'auth.ldap'), 'defaultvalue' => self::$default_config['emailfield'], 'help' => true));
     return array('elements' => $elements, 'renderer' => 'table');
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:33,代码来源:lib.php

示例12: journal_grades

function journal_grades($journalid)
{
    /// Must return an array of grades, indexed by user, and a max grade.
    if (!($journal = get_record("journal", "id", $journalid))) {
        return NULL;
    }
    $grades = get_records_menu("journal_entries", "journal", $journal->id, "", "userid,rating");
    if ($journal->assessed > 0) {
        $return->grades = $grades;
        $return->maxgrade = $journal->assessed;
    } else {
        if ($journal->assessed == 0) {
            return NULL;
        } else {
            if ($scale = get_record("scale", "id", -$journal->assessed)) {
                $scalegrades = make_menu_from_list($scale->scale);
                if ($grades) {
                    foreach ($grades as $key => $grade) {
                        $grades[$key] = $scalegrades[$grade];
                    }
                }
            }
            $return->grades = $grades;
            $return->maxgrade = "";
        }
    }
    return $return;
}
开发者ID:r007,项目名称:PMoodle,代码行数:28,代码来源:lib.php

示例13: define

 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
 *
 */
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configextensions/iframesites');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'iframesites');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'upgrade.php';
define('TITLE', get_string('allowediframesites', 'admin'));
$iframesources = get_records_menu('iframe_source', '', '', 'name,prefix');
$iframedomains = get_records_menu('iframe_source_icon');
$newform = pieform(array('name' => 'newurl', 'elements' => array('url' => array('type' => 'text', 'title' => get_string('Site'), 'description' => get_string('iframeurldescription', 'admin'), 'rules' => array('minlength' => 4, 'maxlength' => 255, 'regex' => '/^[a-zA-Z0-9\\/\\._-]+$/')), 'name' => array('type' => 'text', 'title' => get_string('displayname'), 'description' => get_string('iframedisplaynamedescription', 'admin'), 'rules' => array('minlength' => 1, 'maxlength' => 100)), 'submit' => array('type' => 'submit', 'class' => 'btn-success', 'value' => get_string('add')))));
$editurls = array();
$i = 0;
foreach ($iframesources as $url => $name) {
    $elements = array('url' => array('type' => 'hidden', 'value' => $url), 'name' => array('type' => 'text', 'title' => get_string('displayname'), 'description' => get_string('iframedisplaynamedescription', 'admin'), 'defaultvalue' => $name), 'icon' => array('type' => 'text', 'title' => get_string('iframeiconhost', 'admin'), 'description' => get_string('iframeiconhostdescription', 'admin'), 'defaultvalue' => $iframedomains[$name], 'rules' => array('minlength' => 4, 'maxlength' => 253, 'regex' => '/^[a-zA-Z0-9-]{1,63}(\\.[a-zA-Z0-9-]{1,63})+$/')), 'submit' => array('type' => 'submit', 'class' => 'btn-primary btn-sm', 'value' => get_string('save')));
    $editurls[$i] = array('id' => $i, 'url' => $url, 'name' => $name, 'icon' => favicon_display_url($iframedomains[$name]), 'editform' => pieform(array('name' => 'editurl_' . $i, 'successcallback' => 'editurl_submit', 'elements' => $elements)), 'deleteform' => pieform(array('name' => 'deleteurl_' . $i, 'successcallback' => 'deleteurl_submit', 'renderer' => 'div', 'class' => 'form-inline form-as-button pull-left last', 'elements' => array('submit' => array('type' => 'button', 'class' => 'btn-default btn-sm', 'usebuttontag' => true, 'value' => '<span class="icon icon-trash icon-lg text-danger"></span><span class="sr-only">' . get_string('delete') . '</span>', 'confirm' => get_string('confirmdeletemenuitem', 'admin')), 'url' => array('type' => 'hidden', 'value' => $url)))));
    $i++;
}
function editurl_submit(Pieform $form, $values)
{
    global $iframesources, $iframedomains, $SESSION;
    if (isset($iframesources[$values['url']])) {
        $oldname = $iframesources[$values['url']];
        $newname = strip_tags($values['name']);
        $iframesources[$values['url']] = $newname;
开发者ID:rboyatt,项目名称:mahara,代码行数:31,代码来源:iframesites.php

示例14: populate

 protected function populate($result)
 {
     foreach (array_keys(self::$dbfields) as $fieldname) {
         $this->{$fieldname} = $result->{$fieldname};
     }
     $this->configs = get_records_menu('institution_config', 'institution', $result->name, 'field', 'field, value');
     if (!$this->configs) {
         $this->configs = array();
     }
     $this->verifyReady();
 }
开发者ID:kienv,项目名称:mahara,代码行数:11,代码来源:institution.php

示例15: upgrade_fix_incorrect_mnethostids

/**
 * This function will fix the status of the localhost/all records in the mnet_host table
 * checking they exist and adding them if missing + redefine CFG->mnet_localhost_id  and
 * CFG->mnet_all_hosts_id if needed + update all the users having non-existent mnethostid
 * to correct CFG->mnet_localhost_id
 *
 * Implemented because, at some point, specially in old installations upgraded along
 * multiple versions, sometimes the stuff above has ended being inconsistent, causing
 * problems here and there (noticeablely in backup/restore). MDL-16879
 */
function upgrade_fix_incorrect_mnethostids()
{
    global $CFG;
    /// Get current $CFG/mnet_host records
    $old_mnet_localhost_id = !empty($CFG->mnet_localhost_id) ? $CFG->mnet_localhost_id : 0;
    $old_mnet_all_hosts_id = !empty($CFG->mnet_all_hosts_id) ? $CFG->mnet_all_hosts_id : 0;
    $current_mnet_localhost_host = get_record('mnet_host', 'wwwroot', addslashes($CFG->wwwroot));
    /// By wwwroot
    $current_mnet_all_hosts_host = get_record_select('mnet_host', sql_isempty('mnet_host', 'wwwroot', false, false));
    /// By empty wwwroot
    if (!($moodleapplicationid = get_field('mnet_application', 'id', 'name', 'moodle'))) {
        $m = (object) array('name' => 'moodle', 'display_name' => 'Moodle', 'xmlrpc_server_url' => '/mnet/xmlrpc/server.php', 'sso_land_url' => '/auth/mnet/land.php', 'sso_jump_url' => '/auth/mnet/land.php');
        $moodleapplicationid = insert_record('mnet_application', $m);
    }
    /// Create localhost_host if necessary (pretty improbable but better to be 100% in the safe side)
    /// Code stolen from mnet_environment->init
    if (!$current_mnet_localhost_host) {
        $current_mnet_localhost_host = new stdClass();
        $current_mnet_localhost_host->wwwroot = $CFG->wwwroot;
        $current_mnet_localhost_host->ip_address = '';
        $current_mnet_localhost_host->public_key = '';
        $current_mnet_localhost_host->public_key_expires = 0;
        $current_mnet_localhost_host->last_connect_time = 0;
        $current_mnet_localhost_host->last_log_id = 0;
        $current_mnet_localhost_host->deleted = 0;
        $current_mnet_localhost_host->name = '';
        $current_mnet_localhost_host->applicationid = $moodleapplicationid;
        /// Get the ip of the server
        if (empty($_SERVER['SERVER_ADDR'])) {
            /// SERVER_ADDR is only returned by Apache-like webservers
            $count = preg_match("@^(?:http[s]?://)?([A-Z0-9\\-\\.]+).*@i", $current_mnet_localhost_host->wwwroot, $matches);
            $my_hostname = $count > 0 ? $matches[1] : false;
            $my_ip = gethostbyname($my_hostname);
            // Returns unmodified hostname on failure. DOH!
            if ($my_ip == $my_hostname) {
                $current_mnet_localhost_host->ip_address = 'UNKNOWN';
            } else {
                $current_mnet_localhost_host->ip_address = $my_ip;
            }
        } else {
            $current_mnet_localhost_host->ip_address = $_SERVER['SERVER_ADDR'];
        }
        $current_mnet_localhost_host->id = insert_record('mnet_host', $current_mnet_localhost_host, true);
    }
    /// Create all_hosts_host if necessary (pretty improbable but better to be 100% in the safe side)
    /// Code stolen from mnet_environment->init
    if (!$current_mnet_all_hosts_host) {
        $current_mnet_all_hosts_host = new stdClass();
        $current_mnet_all_hosts_host->wwwroot = '';
        $current_mnet_all_hosts_host->ip_address = '';
        $current_mnet_all_hosts_host->public_key = '';
        $current_mnet_all_hosts_host->public_key_expires = 0;
        $current_mnet_all_hosts_host->last_connect_time = 0;
        $current_mnet_all_hosts_host->last_log_id = 0;
        $current_mnet_all_hosts_host->deleted = 0;
        $current_mnet_all_hosts_host->name = 'All Hosts';
        $current_mnet_all_hosts_host->applicationid = $moodleapplicationid;
        $current_mnet_all_hosts_host->id = insert_record('mnet_host', $current_mnet_all_hosts_host, true);
    }
    /// Compare old_mnet_localhost_id and current_mnet_localhost_host
    if ($old_mnet_localhost_id != $current_mnet_localhost_host->id) {
        /// Different = problems
        /// Update $CFG->mnet_localhost_id to correct value
        set_config('mnet_localhost_id', $current_mnet_localhost_host->id);
        /// Delete $old_mnet_localhost_id if exists (users will be assigned to new one below)
        delete_records('mnet_host', 'id', $old_mnet_localhost_id);
    }
    /// Compare old_mnet_all_hosts_id and current_mnet_all_hosts_host
    if ($old_mnet_all_hosts_id != $current_mnet_all_hosts_host->id) {
        /// Different = problems
        /// Update $CFG->mnet_localhost_id to correct value
        set_config('mnet_all_hosts_id', $current_mnet_all_hosts_host->id);
        /// Delete $old_mnet_all_hosts_id if exists
        delete_records('mnet_host', 'id', $old_mnet_all_hosts_id);
    }
    /// Finally, update all the incorrect user->mnethostid to the correct CFG->mnet_localhost_id, preventing UIX dupes
    $hosts = get_records_menu('mnet_host', '', '', '', 'id, id AS id2');
    $hosts_str = implode(', ', $hosts);
    $sql = "SELECT id\n            FROM {$CFG->prefix}user u1\n            WHERE u1.mnethostid NOT IN ({$hosts_str})\n              AND NOT EXISTS (\n                  SELECT 'x'\n                    FROM {$CFG->prefix}user u2\n                   WHERE u2.username = u1.username\n                     AND u2.mnethostid = {$current_mnet_localhost_host->id})";
    $rs = get_recordset_sql($sql);
    while ($rec = rs_fetch_next_record($rs)) {
        set_field('user', 'mnethostid', $current_mnet_localhost_host->id, 'id', $rec->id);
    }
    rs_close($rs);
    // fix up any host records that have incorrect ids
    set_field_select('mnet_host', 'applicationid', $moodleapplicationid, "id = {$current_mnet_localhost_host->id} or id = {$current_mnet_all_hosts_host->id}");
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:97,代码来源:upgradelib.php


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