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


PHP portfolio_static_function函数代码示例

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


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

示例1: enable_plugin

 /**
  * Creates a new instance of the portfolio plugin
  *
  * @param string $name name of the instance
  * @param stdClass $data config data for the instance
  * @return portfolio_plugin_base
  */
 protected function enable_plugin($name = 'Instance name', $data = null)
 {
     $data = $data ?: new stdClass();
     $instance = portfolio_static_function($this->pluginname, 'create_instance', $this->pluginname, $name, $data);
     core_plugin_manager::reset_caches();
     return $instance;
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:14,代码来源:plugin_test.php

示例2: validation

 /**
  * Validate admin config form
  *
  * @param stdObject $data form data
  * @return array
  */
 public function validation($data)
 {
     global $DB;
     $errors = array();
     if ($DB->count_records('portfolio_instance', array('name' => $data['name'], 'plugin' => $data['plugin'])) > 1) {
         $errors = array('name' => get_string('err_uniquename', 'portfolio'));
     }
     $pluginerrors = array();
     if ($this->instance) {
         $pluginerrors = $this->instance->admin_config_validation($data);
     } else {
         $pluginerrors = portfolio_static_function($this->plugin, 'admin_config_validation', $data);
     }
     if (is_array($pluginerrors)) {
         $errors = array_merge($errors, $pluginerrors);
     }
     return $errors;
 }
开发者ID:nmicha,项目名称:moodle,代码行数:24,代码来源:forms.php

示例3: portfolio_plugin_sanity_check

/**
* helper function to check all the plugins for sanity and set any insane ones to invisible.
*
* @param array $plugins to check (if null, defaults to all)
*               one string will work too for a single plugin.
*
* @return array array of insane instances (keys= id, values = reasons (keys for plugin lang)
*/
function portfolio_plugin_sanity_check($plugins = null)
{
    global $DB;
    if (is_string($plugins)) {
        $plugins = array($plugins);
    } else {
        if (empty($plugins)) {
            $plugins = get_plugin_list('portfolio');
            $plugins = array_keys($plugins);
        }
    }
    $insane = array();
    foreach ($plugins as $plugin) {
        if ($result = portfolio_static_function($plugin, 'plugin_sanity_check')) {
            $insane[$plugin] = $result;
        }
    }
    if (empty($insane)) {
        return array();
    }
    list($where, $params) = $DB->get_in_or_equal(array_keys($insane));
    $where = ' plugin ' . $where;
    $DB->set_field_select('portfolio_instance', 'visible', 0, $where, $params);
    return $insane;
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:33,代码来源:portfoliolib.php

示例4: output_html

 /**
  * Builds XHTML to display the control
  *
  * @param string $data Unused
  * @param string $query
  * @return string XHTML to display the control
  */
 public function output_html($data, $query = '')
 {
     global $CFG, $OUTPUT;
     $output = $OUTPUT->box_start('generalbox');
     $namestr = get_string('name');
     $pluginstr = get_string('plugin', 'portfolio');
     $plugins = get_plugin_list('portfolio');
     $plugins = array_keys($plugins);
     $instances = portfolio_instances(false, false);
     $alreadyplugins = array();
     // to avoid notifications being sent out while admin is editing the page
     define('ADMIN_EDITING_PORTFOLIO', true);
     $insane = portfolio_plugin_sanity_check($plugins);
     $insaneinstances = portfolio_instance_sanity_check($instances);
     $output .= portfolio_report_insane($insane, null, true);
     $output .= portfolio_report_insane($insaneinstances, $instances, true);
     $table = new html_table();
     $table->head = array($namestr, $pluginstr, '');
     $table->data = array();
     foreach ($instances as $i) {
         $row = '';
         $row .= '<a href="' . $this->baseurl . '&edit=' . $i->get('id') . '"><img src="' . $OUTPUT->old_icon_url('t/edit') . '" alt="' . get_string('edit') . '" /></a>' . "\n";
         $row .= '<a href="' . $this->baseurl . '&delete=' . $i->get('id') . '"><img src="' . $OUTPUT->old_icon_url('t/delete') . '" alt="' . get_string('delete') . '" /></a>' . "\n";
         if (array_key_exists($i->get('plugin'), $insane) || array_key_exists($i->get('id'), $insaneinstances)) {
             $row .= '<img src="' . $OUTPUT->old_icon_url('t/show') . '" alt="' . get_string('hidden', 'portfolio') . '" />' . "\n";
         } else {
             $row .= ' <a href="' . $this->baseurl . '&hide=' . $i->get('id') . '"><img src="' . $OUTPUT->old_icon_url('t/' . ($i->get('visible') ? 'hide' : 'show')) . '" alt="' . get_string($i->get('visible') ? 'hide' : 'show') . '" /></a>' . "\n";
         }
         $table->data[] = array($i->get('name'), $i->get_name() . ' (' . $i->get('plugin') . ')', $row);
         if (!in_array($i->get('plugin'), $alreadyplugins)) {
             $alreadyplugins[] = $i->get('plugin');
         }
     }
     $output .= $OUTPUT->table($table);
     $instancehtml = '<br /><br />' . get_string('addnewportfolio', 'portfolio') . ': <br /><br />';
     $addable = 0;
     foreach ($plugins as $p) {
         if (!portfolio_static_function($p, 'allows_multiple') && in_array($p, $alreadyplugins)) {
             continue;
         }
         if (array_key_exists($p, $insane)) {
             continue;
         }
         $instancehtml .= '<a href="' . $this->baseurl . '&amp;new=' . $p . '">' . portfolio_static_function($p, 'get_name') . ' (' . s($p) . ')' . '</a><br />' . "\n";
         $addable++;
     }
     if ($addable) {
         $output .= $instancehtml;
     }
     $output .= $OUTPUT->box_end();
     return highlight($query, $output);
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:59,代码来源:adminlib.php

示例5: create_instance

 /**
  * This function creates a new instance of a plugin
  * saves it in the database, saves the config
  * and returns it.
  * You shouldn't need to override it
  * unless you're doing something really funky
  *
  * @param string $plugin portfolio plugin to create
  * @param string $name name of new instance
  * @param array $config what the admin config form returned
  * @return object subclass of portfolio_plugin_base
  */
 public static function create_instance($plugin, $name, $config)
 {
     global $DB, $CFG;
     $new = (object) array('plugin' => $plugin, 'name' => $name);
     if (!portfolio_static_function($plugin, 'allows_multiple_instances')) {
         // check we don't have one already
         if ($DB->record_exists('portfolio_instance', array('plugin' => $plugin))) {
             throw new portfolio_exception('multipleinstancesdisallowed', 'portfolio', '', $plugin);
         }
     }
     $newid = $DB->insert_record('portfolio_instance', $new);
     require_once $CFG->dirroot . '/portfolio/' . $plugin . '/lib.php';
     $classname = 'portfolio_plugin_' . $plugin;
     $obj = new $classname($newid);
     $obj->set_config($config);
     $obj->save();
     return $obj;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:30,代码来源:plugin.php

示例6: redirect

 // end setup, begin output
 if ($mform->is_cancelled()) {
     redirect($baseurl);
     exit;
 } else {
     if ($fromform = $mform->get_data()) {
         // unset whatever doesn't belong in fromform
         foreach (array('edit', 'new', 'plugin', 'sesskey', 'submitbutton') as $key) {
             unset($fromform->{$key});
         }
         //this branch is where you process validated data.
         if ($edit) {
             $instance->set_config($fromform);
             $instance->save();
         } else {
             portfolio_static_function($plugin, 'create_instance', $plugin, $fromform->name, $fromform);
         }
         $savedstr = get_string('instancesaved', 'portfolio');
         admin_externalpage_print_header();
         echo $OUTPUT->heading($savedstr);
         redirect($baseurl, $savedstr, 3);
         exit;
     } else {
         admin_externalpage_print_header();
         echo $OUTPUT->heading(get_string('configplugin', 'portfolio'));
         echo $OUTPUT->box_start();
         $mform->display();
         echo $OUTPUT->box_end();
         $return = false;
     }
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:portfolio.php

示例7: optional_param

$callbackcomponent = optional_param('callbackcomponent', null, PARAM_PATH);
// Callback component eg mod_forum - the component of the exporting content.
$callbackclass = optional_param('callbackclass', null, PARAM_ALPHAEXT);
// Callback class eg forum_portfolio_caller - the class to handle the exporting content.
$callerformats = optional_param('callerformats', null, PARAM_TAGLIST);
// Comma separated list of formats the specific place exporting content supports.
require_login();
// this is selectively called again with $course later when we know for sure which one we're in.
$PAGE->set_context(context_system::instance());
$PAGE->set_url('/portfolio/add.php', array('id' => $dataid, 'sesskey' => sesskey()));
$PAGE->set_pagelayout('admin');
$exporter = null;
if ($postcontrol && $type && !$dataid) {
    // we're returning from an external system that can't construct dynamic return urls
    // this is a special "one export of this type only per session" case
    if (portfolio_static_function($type, 'allows_multiple_exports')) {
        throw new portfolio_exception('multiplesingleresume', 'portfolio');
    }
    if (!($dataid = portfolio_export_type_to_id($type, $USER->id))) {
        throw new portfolio_exception('invalidtempid', 'portfolio');
    }
} else {
    // we can't do this in the above case, because we're redirecting straight back from an external system
    // this is not really ideal, but since we're in a "staged" wizard, the session key is checked in other stages.
    require_sesskey();
    // pretty much everything in this page is a write that could be hijacked, so just do this at the top here
}
// if we have a dataid, it means we're in the middle of an export,
// so rewaken it and continue.
if (!empty($dataid)) {
    try {
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:add.php

示例8: single_select

                    if (!portfolio_static_function($p, 'allows_multiple_instances') && in_array($p, $usedplugins)) {
                        continue;
                    }
                    // Check if it is misconfigured - if so store in array then display later
                    if (array_key_exists($p, $insane)) {
                        $insaneplugins[] = $p;
                    } else {
                        $select = new single_select(portfolio_action_url($p, 'pf'), 'action', $actionchoicesfornew, 'delete', null, 'applyto' . $p);
                        $select->set_label(get_string('action'), array('class' => 'accesshide'));
                        $table->data[] = array(portfolio_static_function($p, 'get_name'), $OUTPUT->render($select), '');
                    }
                }
            }
            // Loop through all the insane plugins
            if (!empty($insaneplugins)) {
                foreach ($insaneplugins as $p) {
                    $table->data[] = array(portfolio_static_function($p, 'get_name'), $strdelete . " " . $OUTPUT->help_icon($insane[$p], 'portfolio_' . $p), '');
                }
            }
            $output .= html_writer::table($table);
            $output .= $OUTPUT->box_end();
            echo $output;
            $return = false;
        }
    }
}
if ($return) {
    // Redirect to base
    redirect($baseurl);
}
echo $OUTPUT->footer();
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:portfolio.php

示例9: mnet_get_functions

/**
 * Parse a file to find out what functions/methods exist in it, and add entries
 * for the remote-call-enabled functions to the database.
 *
 * The path to a file, e.g. auth/mnet/auth.php can be thought of as
 * type/parentname/docname
 *
 * @param  string   $type           mod, auth or enrol
 * @param  string   $parentname     Implementation of type, e.g. 'mnet' in the
 *                                  case of auth/mnet/auth.php
 * @return bool                     True on success, else false
 */
function mnet_get_functions($type, $parentname)
{
    global $CFG, $DB;
    $dataobject = new stdClass();
    $docname = $type . '.php';
    $publishes = array();
    if ('mod' == $type) {
        $docname = 'rpclib.php';
        $relname = '/mod/' . $parentname . '/' . $docname;
        $filename = $CFG->dirroot . $relname;
        if (file_exists($filename)) {
            include_once $filename;
        }
        $mnet_publishes = $parentname . '_mnet_publishes';
        if (function_exists($mnet_publishes)) {
            (array) ($publishes = $mnet_publishes());
        }
    } else {
        if ('portfolio' == $type) {
            $docname = 'lib.php';
            $relname = '/portfolio/type/' . $parentname . '/' . $docname;
            $filename = $CFG->dirroot . $relname;
            require_once $CFG->libdir . '/portfoliolib.php';
            $publishes = (array) portfolio_static_function($parentname, 'mnet_publishes');
        } else {
            if ('repository' == $type) {
                $docname = 'repository.class.php';
                $relname = '/repository/' . $parentname . '/' . $docname;
                $filename = $CFG->dirroot . $relname;
                require_once $CFG->dirroot . '/repository/lib.php';
                $publishes = (array) repository::static_function($parentname, 'mnet_publishes');
            } else {
                // auth or enrol
                $relname = '/' . $type . '/' . $parentname . '/' . $docname;
                $filename = $CFG->dirroot . $relname;
                if (file_exists($filename)) {
                    include_once $filename;
                }
                $class = $type . ($type == 'enrol' ? 'ment' : '') . '_plugin_' . $parentname;
                if (class_exists($class)) {
                    $object = new $class();
                    if (method_exists($object, 'mnet_publishes')) {
                        (array) ($publishes = $object->mnet_publishes());
                    }
                }
            }
        }
    }
    $methodServiceArray = array();
    foreach ($publishes as $service) {
        if (is_array($service['methods'])) {
            foreach ($service['methods'] as $methodname) {
                $methodServiceArray[$methodname][] = $service;
            }
        }
    }
    // Disable functions that don't exist (any more) in the source
    // Should these be deleted? What about their permissions records?
    $rpcrecords = $DB->get_records('mnet_rpc', array('parent' => $parentname, 'parent_type' => $type), 'function_name ASC ');
    if (!empty($rpcrecords)) {
        foreach ($rpcrecords as $rpc) {
            if (!array_key_exists($rpc->function_name, $methodServiceArray)) {
                $rpc->enabled = 0;
                $DB->update_record('mnet_rpc', $rpc);
            }
        }
    }
    if (!file_exists($filename)) {
        return false;
    }
    if (extension_loaded('tokenizer')) {
        include_once "{$CFG->dirroot}/{$CFG->admin}/mnet/MethodTable.php";
        $functions = (array) MethodTable::create($filename, false);
    }
    foreach ($methodServiceArray as $method => $servicearray) {
        if (!empty($functions[$method])) {
            $details = $functions[$method];
            $profile = $details['arguments'];
            if (!isset($details['returns'])) {
                array_unshift($profile, array('type' => 'void', 'description' => 'No return value'));
            } else {
                array_unshift($profile, $details['returns']);
            }
            $dataobject->profile = serialize($profile);
            $dataobject->help = $details['description'];
        } else {
            $dataobject->profile = serialize(array(array('type' => 'void', 'description' => 'No return value')));
            $dataobject->help = '';
//.........这里部分代码省略.........
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:101,代码来源:adminlib.php


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