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


PHP portfolio_instance函数代码示例

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


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

示例1: xmldb_portfolio_boxnet_upgrade

/**
 * Upgrade function.
 *
 * @param int $oldversion the version we are upgrading from.
 * @return bool result
 */
function xmldb_portfolio_boxnet_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2013110602) {
        require_once $CFG->libdir . '/portfoliolib.php';
        require_once $CFG->dirroot . '/portfolio/boxnet/db/upgradelib.php';
        $existing = $DB->get_record('portfolio_instance', array('plugin' => 'boxnet'), '*', IGNORE_MULTIPLE);
        if ($existing) {
            // Only disable or message the admins when the portfolio hasn't been set for APIv2.
            $instance = portfolio_instance($existing->id, $existing);
            if ($instance->get_config('clientid') === null && $instance->get_config('clientsecret') === null) {
                // Disable Box.net.
                $instance->set('visible', 0);
                $instance->save();
                // Message the admins.
                portfolio_boxnet_admin_upgrade_notification();
            }
        }
        upgrade_plugin_savepoint(true, 2013110602, 'portfolio', 'boxnet');
    }
    // Moodle v2.6.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.7.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.9.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:nadavkav,项目名称:moodle-accessibility,代码行数:37,代码来源:upgrade.php

示例2: portfolio_instance_sanity_check

/**
* helper function to check all the instances for sanity and set any insane ones to invisible.
*
* @param array $instances to check (if null, defaults to all)
*              one instance or id will work too
*
* @return array array of insane instances (keys= id, values = reasons (keys for plugin lang)
*/
function portfolio_instance_sanity_check($instances = null)
{
    global $DB;
    if (empty($instances)) {
        $instances = portfolio_instances(false);
    } else {
        if (!is_array($instances)) {
            $instances = array($instances);
        }
    }
    $insane = array();
    foreach ($instances as $instance) {
        if (is_object($instance) && !$instance instanceof portfolio_plugin_base) {
            $instance = portfolio_instance($instance->id, $instance);
        } else {
            if (is_numeric($instance)) {
                $instance = portfolio_instance($instance);
            }
        }
        if (!$instance instanceof portfolio_plugin_base) {
            debugging('something weird passed to portfolio_instance_sanity_check, not subclass or id');
            continue;
        }
        if ($result = $instance->instance_sanity_check()) {
            $insane[$instance->get('id')] = $result;
        }
    }
    if (empty($insane)) {
        return array();
    }
    list($where, $params) = $DB->get_in_or_equal(array_keys($insane));
    $where = ' id ' . $where;
    $DB->set_field_select('portfolio_instance', 'visible', 0, $where, $params);
    portfolio_insane_notify_admins($insane, true);
    return $insane;
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:44,代码来源:portfoliolib.php

示例3: print_cleaned_export

 /**
  * Wrapper function to print a friendly error to users
  *
  * @param stdClass $log portfolio_log object
  * @param portfolio_plugin_base $instance portfolio instance
  * @uses exit
  */
 public static function print_cleaned_export($log, $instance = null)
 {
     global $CFG, $OUTPUT, $PAGE;
     if (empty($instance) || !$instance instanceof portfolio_plugin_base) {
         $instance = portfolio_instance($log->portfolio);
     }
     $title = get_string('exportalreadyfinished', 'portfolio');
     $PAGE->navbar->add($title);
     $PAGE->set_title($title);
     $PAGE->set_heading($title);
     echo $OUTPUT->header();
     echo $OUTPUT->notification(get_string('exportalreadyfinished', 'portfolio'));
     self::print_finish_info($log->returnurl, $instance->resolve_static_continue_url($log->continueurl));
     echo $OUTPUT->continue_button($CFG->wwwroot);
     echo $OUTPUT->footer();
     exit;
 }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:24,代码来源:exporter.php

示例4: redirect

            // This branch is where you process validated data.
            $instance->set_user_config($fromform, $USER->id);
            core_plugin_manager::reset_caches();
            redirect($baseurl, get_string('instancesaved', 'portfolio'), 3);
            exit;
        } else {
            echo $OUTPUT->heading(get_string('configplugin', 'portfolio'));
            echo $OUTPUT->box_start();
            $mform->display();
            echo $OUTPUT->box_end();
            $display = false;
        }
    }
} else {
    if (!empty($hide)) {
        $instance = portfolio_instance($hide);
        $instance->set_user_config(array('visible' => !$instance->get_user_config('visible', $USER->id)), $USER->id);
        core_plugin_manager::reset_caches();
    }
}
if ($display) {
    echo $OUTPUT->heading($configstr);
    echo $OUTPUT->box_start();
    if (!($instances = portfolio_instances(true, false))) {
        print_error('noinstances', 'portfolio', $CFG->wwwroot . '/user/view.php');
    }
    $table = new html_table();
    $table->head = array($namestr, $pluginstr, '');
    $table->data = array();
    foreach ($instances as $i) {
        $visible = $i->get_user_config('visible', $USER->id);
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:portfolio.php

示例5: array

 $logs = $DB->get_records('portfolio_log', array('userid' => $USER->id), 'time DESC', '*', $page * $perpage, $perpage);
 foreach ($logs as $log) {
     if (!empty($log->caller_file)) {
         portfolio_include_callback_file($log->caller_file);
     } else {
         if (!empty($log->caller_component)) {
             portfolio_include_callback_file($log->caller_component);
         } else {
             // Errrmahgerrrd - this should never happen. Skipping.
             continue;
         }
     }
     $class = $log->caller_class;
     $pluginname = '';
     try {
         $plugin = portfolio_instance($log->portfolio);
         $url = $plugin->resolve_static_continue_url($log->continueurl);
         if ($url) {
             $pluginname = '<a href="' . $url . '">' . $plugin->get('name') . '</a>';
         } else {
             $pluginname = $plugin->get('name');
         }
     } catch (portfolio_exception $e) {
         // May have been deleted.
         $pluginname = get_string('unknownplugin', 'portfolio');
     }
     $table->data[] = array($pluginname, '<a href="' . $log->returnurl . '">' . call_user_func(array($class, 'display_name')) . '</a>', userdate($log->time));
 }
 echo $OUTPUT->heading(get_string('logsummary', 'portfolio'));
 $pagingbar = new paging_bar($logcount, $page, $perpage, $CFG->wwwroot . '/user/portfoliologs.php?');
 echo $OUTPUT->render($pagingbar);
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:portfoliologs.php

示例6: print_error

 if (!empty($hide)) {
     if (!confirm_sesskey()) {
         print_error('confirmsesskeybad', '', $baseurl);
     }
     $instance = portfolio_instance($hide);
     $current = $instance->get('visible');
     if (empty($current) && $instance->instance_sanity_check()) {
         print_error('cannotsetvisible', 'portfolio', $baseurl);
     }
     $instance->set('visible', !$instance->get('visible'));
     $instance->save();
     $return = true;
 } else {
     if (!empty($delete)) {
         admin_externalpage_print_header();
         $instance = portfolio_instance($delete);
         if ($sure) {
             if (!confirm_sesskey()) {
                 print_error('confirmsesskeybad', '', $baseurl);
             }
             if ($instance->delete()) {
                 $deletedstr = get_string('instancedeleted', 'portfolio');
                 echo $OUTPUT->heading($deletedstr);
                 redirect($baseurl, $deletedstr, 3);
             } else {
                 print_error('instancenotdeleted', 'portfolio', $baseurl);
             }
             exit;
         }
         echo $OUTPUT->confirm(get_string('sure', 'portfolio', $instance->get('name')), $sesskeyurl . '&delete=' . $delete . '&sure=yes', $baseurl);
         $return = false;
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:portfolio.php

示例7: portfolio_export_pagesetup

            $exporter->save();
        }
    }
    portfolio_export_pagesetup($PAGE, $exporter->get('caller'));
    // this calls require_login($course) if it can..
    // completely new request, look to see what information we've been passed and set up the exporter object.
} else {
    // you cannot get here with no information for us, we must at least have the caller.
    if (empty($_GET) && empty($_POST)) {
        portfolio_exporter::print_expired_export();
    }
    // we'e just posted here for the first time and have might the instance already
    if ($instanceid) {
        // this can throw exceptions but there's no point catching and rethrowing here
        // as the exporter isn't created yet.
        $instance = portfolio_instance($instanceid);
        if ($broken = portfolio_instance_sanity_check($instance)) {
            throw new portfolio_exception($broken[$instance->get('id')], 'portfolio_' . $instance->get('plugin'));
        }
        $instance->set('user', $USER);
    } else {
        $instance = null;
    }
    // we must be passed this from the caller, we cannot start a new export
    // without knowing information about what part of moodle we come from.
    if (empty($callbackcomponent) || empty($callbackclass)) {
        debugging('no callback file or class');
        portfolio_exporter::print_expired_export();
    }
    // so each place in moodle can pass callback args here
    // process the entire request looking for ca_*
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:add.php

示例8: print_error

     $current = $instance->get('visible');
     if (empty($current) && $instance->instance_sanity_check()) {
         print_error('cannotsetvisible', 'portfolio', $baseurl);
     }
     if ($action == 'show') {
         $visible = 1;
     } else {
         $visible = 0;
     }
     $instance->set('visible', $visible);
     $instance->save();
     core_plugin_manager::reset_caches();
     $return = true;
 } else {
     if ($action == 'delete') {
         $instance = portfolio_instance($portfolio);
         if ($sure) {
             if (!confirm_sesskey()) {
                 print_error('confirmsesskeybad', '', $baseurl);
             }
             if ($instance->delete()) {
                 $deletedstr = get_string('instancedeleted', 'portfolio');
                 redirect($baseurl, $deletedstr, 1);
             } else {
                 print_error('instancenotdeleted', 'portfolio', $baseurl);
             }
             exit;
         } else {
             echo $OUTPUT->header();
             echo $OUTPUT->confirm(get_string('sure', 'portfolio', $instance->get('name')), $sesskeyurl . '&pf=' . $portfolio . '&action=delete&sure=yes', $baseurl);
             $return = false;
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:portfolio.php

示例9: is_enabled

 function is_enabled()
 {
     $instance = portfolio_instance($this->plugin);
     return $instance->get('visible');
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:5,代码来源:pluginscontrolslib.php


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