本文整理汇总了PHP中portfolio_instances函数的典型用法代码示例。如果您正苦于以下问题:PHP portfolio_instances函数的具体用法?PHP portfolio_instances怎么用?PHP portfolio_instances使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了portfolio_instances函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition
function definition()
{
global $CFG;
$mform =& $this->_form;
$mform->addElement('header', 'notice', get_string('chooseexportformat', 'data'));
$choices = csv_import_reader::get_delimiter_list();
$key = array_search(';', $choices);
if (!$key === FALSE) {
// array $choices contains the semicolon -> drop it (because its encrypted form also contains a semicolon):
unset($choices[$key]);
}
$typesarray = array();
$typesarray[] =& MoodleQuickForm::createElement('radio', 'exporttype', null, get_string('csvwithselecteddelimiter', 'data') . ' ', 'csv');
$typesarray[] =& MoodleQuickForm::createElement('select', 'delimiter_name', null, $choices);
$typesarray[] =& MoodleQuickForm::createElement('radio', 'exporttype', null, get_string('excel', 'data'), 'xls');
$typesarray[] =& MoodleQuickForm::createElement('radio', 'exporttype', null, get_string('ods', 'data'), 'ods');
$mform->addGroup($typesarray, 'exportar', '', array(''), false);
$mform->addRule('exportar', null, 'required');
$mform->setDefault('exporttype', 'csv');
if (array_key_exists('cfg', $choices)) {
$mform->setDefault('delimiter_name', 'cfg');
} else {
if (get_string('listsep') == ';') {
$mform->setDefault('delimiter_name', 'semicolon');
} else {
$mform->setDefault('delimiter_name', 'comma');
}
}
$mform->addElement('header', 'notice', get_string('chooseexportfields', 'data'));
foreach ($this->_datafields as $field) {
if ($field->text_export_supported()) {
$mform->addElement('advcheckbox', 'field_' . $field->field->id, '<div title="' . s($field->field->description) . '">' . $field->field->name . '</div>', ' (' . $field->name() . ')', array('group' => 1));
$mform->setDefault('field_' . $field->field->id, 1);
} else {
$a = new object();
$a->fieldtype = $field->name();
$mform->addElement('static', 'unsupported' . $field->field->id, $field->field->name, get_string('unsupportedexport', 'data', $a));
}
}
$this->add_checkbox_controller(1, null, null, 1);
require_once $CFG->libdir . '/portfoliolib.php';
if (has_capability('mod/data:exportallentries', get_context_instance(CONTEXT_MODULE, $this->_cm->id))) {
if ($portfoliooptions = portfolio_instance_select(portfolio_instances(), call_user_func(array('data_portfolio_caller', 'supported_formats')), 'data_portfolio_caller', '', true, true)) {
$mform->addElement('header', 'notice', get_string('portfolionotfile', 'data') . ':');
$portfoliooptions[0] = get_string('none');
ksort($portfoliooptions);
$mform->addElement('select', 'portfolio', get_string('portfolio', 'portfolio'), $portfoliooptions);
}
}
$this->add_action_buttons(true, get_string('exportdatabaserecords', 'data'));
}
示例2: should_display
public function should_display($discussion)
{
global $CFG;
//check are portfolios enabled
if (!$CFG->enableportfolios) {
return false;
}
//check at there's at least one enabled and visible portfolio plugin
require_once $CFG->libdir . '/portfoliolib.php';
$instances = portfolio_instances();
if (empty($instances)) {
return false;
}
return true;
}
示例3: generate_user_settings
//.........这里部分代码省略.........
$url = new moodle_url('/user/editadvanced.php', array('id' => $user->id, 'course' => $course->id));
$usersetting->add(get_string('editmyprofile'), $url, self::TYPE_SETTING);
} else {
if (has_capability('moodle/user:editprofile', $usercontext) && !is_siteadmin($user) || $currentuser && has_capability('moodle/user:editownprofile', $systemcontext)) {
if ($userauthplugin && $userauthplugin->can_edit_profile()) {
$url = $userauthplugin->edit_profile_url();
if (empty($url)) {
$url = new moodle_url('/user/edit.php', array('id' => $user->id, 'course' => $course->id));
}
$usersetting->add(get_string('editmyprofile'), $url, self::TYPE_SETTING);
}
}
}
}
// Change password link
if ($userauthplugin && $currentuser && !session_is_loggedinas() && !isguestuser() && has_capability('moodle/user:changeownpassword', $systemcontext) && $userauthplugin->can_change_password()) {
$passwordchangeurl = $userauthplugin->change_password_url();
if (empty($passwordchangeurl)) {
$passwordchangeurl = new moodle_url('/login/change_password.php', array('id' => $course->id));
}
$usersetting->add(get_string("changepassword"), $passwordchangeurl, self::TYPE_SETTING);
}
// View the roles settings
if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override', 'moodle/role:manage'), $usercontext)) {
$roles = $usersetting->add(get_string('roles'), null, self::TYPE_SETTING);
$url = new moodle_url('/admin/roles/usersroles.php', array('userid' => $user->id, 'courseid' => $course->id));
$roles->add(get_string('thisusersroles', 'role'), $url, self::TYPE_SETTING);
$assignableroles = get_assignable_roles($usercontext, ROLENAME_BOTH);
if (!empty($assignableroles)) {
$url = new moodle_url('/admin/roles/assign.php', array('contextid' => $usercontext->id, 'userid' => $user->id, 'courseid' => $course->id));
$roles->add(get_string('assignrolesrelativetothisuser', 'role'), $url, self::TYPE_SETTING);
}
if (has_capability('moodle/role:review', $usercontext) || count(get_overridable_roles($usercontext, ROLENAME_BOTH)) > 0) {
$url = new moodle_url('/admin/roles/permissions.php', array('contextid' => $usercontext->id, 'userid' => $user->id, 'courseid' => $course->id));
$roles->add(get_string('permissions', 'role'), $url, self::TYPE_SETTING);
}
$url = new moodle_url('/admin/roles/check.php', array('contextid' => $usercontext->id, 'userid' => $user->id, 'courseid' => $course->id));
$roles->add(get_string('checkpermissions', 'role'), $url, self::TYPE_SETTING);
}
// Portfolio
if ($currentuser && !empty($CFG->enableportfolios) && has_capability('moodle/portfolio:export', $systemcontext)) {
require_once $CFG->libdir . '/portfoliolib.php';
if (portfolio_instances(true, false)) {
$portfolio = $usersetting->add(get_string('portfolios', 'portfolio'), null, self::TYPE_SETTING);
$url = new moodle_url('/user/portfolio.php', array('courseid' => $course->id));
$portfolio->add(get_string('configure', 'portfolio'), $url, self::TYPE_SETTING);
$url = new moodle_url('/user/portfoliologs.php', array('courseid' => $course->id));
$portfolio->add(get_string('logs', 'portfolio'), $url, self::TYPE_SETTING);
}
}
$enablemanagetokens = false;
if (!empty($CFG->enablerssfeeds)) {
$enablemanagetokens = true;
} else {
if (!is_siteadmin($USER->id) && !empty($CFG->enablewebservices) && has_capability('moodle/webservice:createtoken', get_system_context())) {
$enablemanagetokens = true;
}
}
// Security keys
if ($currentuser && $enablemanagetokens) {
$url = new moodle_url('/user/managetoken.php', array('sesskey' => sesskey()));
$usersetting->add(get_string('securitykeys', 'webservice'), $url, self::TYPE_SETTING);
}
// Repository
if (!$currentuser && $usercontext->contextlevel == CONTEXT_USER) {
if (!$this->cache->cached('contexthasrepos' . $usercontext->id)) {
require_once $CFG->dirroot . '/repository/lib.php';
$editabletypes = repository::get_editable_types($usercontext);
$haseditabletypes = !empty($editabletypes);
unset($editabletypes);
$this->cache->set('contexthasrepos' . $usercontext->id, $haseditabletypes);
} else {
$haseditabletypes = $this->cache->{'contexthasrepos' . $usercontext->id};
}
if ($haseditabletypes) {
$url = new moodle_url('/repository/manage_instances.php', array('contextid' => $usercontext->id));
$usersetting->add(get_string('repositories', 'repository'), $url, self::TYPE_SETTING);
}
}
// Messaging
if ($currentuser && has_capability('moodle/user:editownmessageprofile', $systemcontext) || !isguestuser($user) && has_capability('moodle/user:editmessageprofile', $usercontext) && !is_primary_admin($user->id)) {
$url = new moodle_url('/message/edit.php', array('id' => $user->id));
$usersetting->add(get_string('editmymessage', 'message'), $url, self::TYPE_SETTING);
}
// Blogs
if ($currentuser && !empty($CFG->bloglevel)) {
$blog = $usersetting->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER, null, 'blogs');
$blog->add(get_string('preferences', 'blog'), new moodle_url('/blog/preferences.php'), navigation_node::TYPE_SETTING);
if (!empty($CFG->useexternalblogs) && $CFG->maxexternalblogsperuser > 0 && has_capability('moodle/blog:manageexternal', get_context_instance(CONTEXT_SYSTEM))) {
$blog->add(get_string('externalblogs', 'blog'), new moodle_url('/blog/external_blogs.php'), navigation_node::TYPE_SETTING);
$blog->add(get_string('addnewexternalblog', 'blog'), new moodle_url('/blog/external_blog_edit.php'), navigation_node::TYPE_SETTING);
}
}
// Login as ...
if (!$user->deleted and !$currentuser && !session_is_loggedinas() && has_capability('moodle/user:loginas', $coursecontext) && !is_siteadmin($user->id)) {
$url = new moodle_url('/course/loginas.php', array('id' => $course->id, 'user' => $user->id, 'sesskey' => sesskey()));
$usersetting->add(get_string('loginas'), $url, self::TYPE_SETTING);
}
return $usersetting;
}
示例4: admin_settingpage
$temp = new admin_settingpage('manageportfolios', get_string('manageportfolios', 'portfolio'));
$temp->add(new admin_setting_heading('manageportfolios', get_string('activeportfolios', 'portfolio'), ''));
$temp->add(new admin_setting_manageportfolio());
$temp->add(new admin_setting_heading('manageportfolioscommon', get_string('commonsettings', 'admin'), get_string('commonsettingsdesc', 'portfolio')));
$fileinfo = portfolio_filesize_info();
// make sure this is defined in one place since its used inside portfolio too to detect insane settings
$fileoptions = $fileinfo['options'];
$temp->add(new admin_setting_configselect('portfolio_moderate_filesize_threshold', get_string('moderatefilesizethreshold', 'portfolio'), get_string('moderatefilesizethresholddesc', 'portfolio'), $fileinfo['moderate'], $fileoptions));
$temp->add(new admin_setting_configselect('portfolio_high_filesize_threshold', get_string('highfilesizethreshold', 'portfolio'), get_string('highfilesizethresholddesc', 'portfolio'), $fileinfo['high'], $fileoptions));
$temp->add(new admin_setting_configtext('portfolio_moderate_db_threshold', get_string('moderatedbsizethreshold', 'portfolio'), get_string('moderatedbsizethresholddesc', 'portfolio'), 20, PARAM_INTEGER, 3));
$temp->add(new admin_setting_configtext('portfolio_high_db_threshold', get_string('highdbsizethreshold', 'portfolio'), get_string('highdbsizethresholddesc', 'portfolio'), 50, PARAM_INTEGER, 3));
$ADMIN->add('portfoliosettings', $temp);
$ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', get_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url);
$ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', get_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url);
$ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', get_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true), '', $url);
foreach (portfolio_instances(false, false) as $portfolio) {
require_once $CFG->dirroot . '/portfolio/type/' . $portfolio->get('plugin') . '/lib.php';
$classname = 'portfolio_plugin_' . $portfolio->get('plugin');
$ADMIN->add('portfoliosettings', new admin_externalpage('portfoliosettings' . $portfolio->get('id'), $portfolio->get('name'), $url . '?edit=' . $portfolio->get('id'), 'moodle/site:config', !$portfolio->get('visible')), $portfolio->get('name'), $url . ' ?edit=' . $portfolio->get('id'));
}
// repository setting
require_once "{$CFG->dirroot}/repository/lib.php";
$catname = get_string('repositories', 'repository');
$managerepo = get_string('manage', 'repository');
$url = $CFG->wwwroot . '/' . $CFG->admin . '/repository.php';
$ADMIN->add('modules', new admin_category('repositorysettings', $catname));
$temp = new admin_settingpage('managerepositories', $managerepo);
$temp->add(new admin_setting_heading('managerepositories', get_string('activerepository', 'repository'), ''));
$temp->add(new admin_setting_managerepository());
$temp->add(new admin_setting_heading('managerepositoriescommonheading', get_string('commonsettings', 'admin'), ''));
$temp->add(new admin_setting_configtext('repositorycacheexpire', get_string('cacheexpire', 'repository'), get_string('configcacheexpire', 'repository'), 120));
示例5: search
/**
* Searches page for the specified string.
* @param string $query The string to search for
* @return bool True if it is found on this page
*/
public function search($query)
{
global $CFG;
if ($result = parent::search($query)) {
return $result;
}
$found = false;
$textlib = textlib_get_instance();
$portfolios = get_plugin_list('portfolio');
foreach ($portfolios as $p => $dir) {
if (strpos($p, $query) !== false) {
$found = true;
break;
}
}
if (!$found) {
foreach (portfolio_instances(false, false) as $instance) {
$title = $instance->get('name');
if (strpos($textlib->strtolower($title), $query) !== false) {
$found = true;
break;
}
}
}
if ($found) {
$result = new stdClass();
$result->page = $this;
$result->settings = array();
return array($this->name => $result);
} else {
return array();
}
}
示例6: __construct
/**
* constructor. either pass the options here or set them using the helper methods.
* generally the code will be clearer if you use the helper methods.
*
* @param array $options keyed array of options:
* key 'callbackclass': name of the caller class (eg forum_portfolio_caller')
* key 'callbackargs': the array of callback arguments your caller class wants passed to it in the constructor
* key 'callbackfile': the file containing the class definition of your caller class.
* See set_callback_options for more information on these three.
* key 'formats': an array of PORTFOLIO_FORMATS this caller will support
* See set_formats or set_format_by_file for more information on this.
*/
public function __construct($options = null)
{
global $SESSION, $CFG;
if (empty($CFG->enableportfolios)) {
debugging('Building portfolio add button while portfolios is disabled. This code can be optimised.', DEBUG_DEVELOPER);
}
$this->instances = portfolio_instances();
if (empty($options)) {
return true;
}
$constructoroptions = array('callbackclass', 'callbackargs', 'callbackfile', 'formats');
foreach ((array) $options as $key => $value) {
if (!in_array($key, $constructoroptions)) {
throw new portfolio_button_exception('invalidbuttonproperty', 'portfolio', $key);
}
$this->{$key} = $value;
}
}
示例7: __construct
/**
* constructor. either pass the options here or set them using the helper methods.
* generally the code will be clearer if you use the helper methods.
*
* @param array $options keyed array of options:
* key 'callbackclass': name of the caller class (eg forum_portfolio_caller')
* key 'callbackargs': the array of callback arguments your caller class wants passed to it in the constructor
* key 'callbackfile': the file containing the class definition of your caller class.
* See set_callback_options for more information on these three.
* key 'formats': an array of PORTFOLIO_FORMATS this caller will support
* See set_formats or set_format_by_file for more information on this.
*/
public function __construct($options = null)
{
global $SESSION, $CFG;
$this->instances = portfolio_instances();
if (empty($options)) {
return true;
}
$constructoroptions = array('callbackclass', 'callbackargs', 'callbackfile', 'formats');
foreach ((array) $options as $key => $value) {
if (!in_array($key, $constructoroptions)) {
throw new portfolio_button_exception('invalidbuttonproperty', 'portfolio', $key);
}
$this->{$key} = $value;
}
}
示例8: __construct
/**
* constructor. either pass the options here or set them using the helper methods.
* generally the code will be clearer if you use the helper methods.
*
* @param array $options keyed array of options:
* key 'callbackclass': name of the caller class (eg forum_portfolio_caller')
* key 'callbackargs': the array of callback arguments your caller class wants passed to it in the constructor
* key 'callbackfile': the file containing the class definition of your caller class.
* See set_callback_options for more information on these three.
* key 'formats': an array of PORTFOLIO_FORMATS this caller will support
* See set_formats for more information on this.
*/
public function __construct($options = null)
{
global $SESSION, $CFG;
if (isset($SESSION->portfolioexport)) {
$this->alreadyexporting = true;
return;
}
$this->instances = portfolio_instances();
if (empty($options)) {
return true;
}
foreach ((array) $options as $key => $value) {
if (!in_array($key, $constructoroptions)) {
throw new portfolio_button_exception('invalidbuttonproperty', 'portfolio', $key);
}
$this->{$key} = $value;
}
}
示例9: portfolio_instance
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);
$table->data[] = array($i->get('name'), $i->get('plugin'), ($i->has_user_config() ? '<a href="' . $baseurl . '?config=' . $i->get('id') . '"><img src="' . $OUTPUT->pix_url('t/edit') . '" alt="' . get_string('configure') . '" /></a>' : '') . ' <a href="' . $baseurl . '?hide=' . $i->get('id') . '"><img src="' . $OUTPUT->pix_url('t/' . ($visible ? 'hide' : 'show')) . '" alt="' . get_string($visible ? 'hide' : 'show') . '" /></a><br />');
}
echo html_writer::table($table);
echo $OUTPUT->box_end();
}
echo $OUTPUT->footer();
示例10: 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 . '&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);
}
示例11: tabobject
$secondrow[] = new tabobject('usersroles', $CFG->wwwroot . '/' . $CFG->admin . '/roles/usersroles.php?userid=' . $user->id . '&courseid=' . $course->id, get_string('thisusersroles', 'role'));
if (!empty($assignableroles) || $currenttab == 'assign') {
$secondrow[] = new tabobject('assign', $CFG->wwwroot . '/' . $CFG->admin . '/roles/assign.php?contextid=' . $usercontext->id . '&userid=' . $user->id . '&courseid=' . $course->id, get_string('assignrolesrelativetothisuser', 'role'), '', true);
}
if (!empty($overridableroles) || $currenttab == 'override') {
$secondrow[] = new tabobject('override', $CFG->wwwroot . '/' . $CFG->admin . '/roles/override.php?contextid=' . $usercontext->id . '&userid=' . $user->id . '&courseid=' . $course->id, get_string('overridepermissions', 'role'), '', true);
}
if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override', 'moodle/role:assign'), $usercontext)) {
$secondrow[] = new tabobject('check', $CFG->wwwroot . '/' . $CFG->admin . '/roles/check.php?contextid=' . $usercontext->id . '&userid=' . $user->id . '&courseid=' . $course->id, get_string('checkpermissions', 'role'));
}
}
}
}
if (!empty($user) and empty($userindexpage) && $user->id == $USER->id && !empty($CFG->enableportfolios) && has_capability('moodle/portfolio:export', get_system_context())) {
/// Portfolio tab
if (portfolio_instances(true, false)) {
$toprow[] = new tabobject('portfolios', $CFG->wwwroot . '/user/portfolio.php', get_string('portfolios', 'portfolio'));
if (in_array($currenttab, array('portfolioconf', 'portfoliologs'))) {
$inactive = array('portfolios');
$activetwo = array('portfolios');
$secondrow = array();
$secondrow[] = new tabobject('portfolioconf', $CFG->wwwroot . '/user/portfolio.php', get_string('configure', 'portfolio'));
$secondrow[] = new tabobject('portfoliologs', $CFG->wwwroot . '/user/portfoliologs.php', get_string('logs', 'portfolio'));
}
}
}
// Repository Tab
if (!empty($user) and $user->id == $USER->id) {
require_once $CFG->dirroot . '/repository/lib.php';
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
$editabletypes = repository::get_editable_types($usercontext);
示例12: portfolio_export_pagesetup
portfolio_export_pagesetup($PAGE, $caller);
// this calls require_login($course) if it can..
// finally! set up the exporter object with the portfolio instance, and caller information elements
$exporter = new portfolio_exporter($instance, $caller, $callbackcomponent);
// set the export-specific variables, and save.
$exporter->set('user', $USER);
$exporter->save();
}
if (!$exporter->get('instance')) {
// we've just arrived but have no instance
// in this case the exporter object and the caller object have been set up above
// so just make a little form to select the portfolio plugin instance,
// which is the last thing to do before starting the export.
//
// first check to make sure there is actually a point
$options = portfolio_instance_select(portfolio_instances(), $exporter->get('caller')->supported_formats(), get_class($exporter->get('caller')), $exporter->get('caller')->get_mimetype(), 'instance', true, true);
if (empty($options)) {
throw new portfolio_export_exception($exporter, 'noavailableplugins', 'portfolio');
} else {
if (count($options) == 1) {
// no point displaying a form, just redirect.
$optionskeys = array_keys($options);
$instance = array_shift($optionskeys);
redirect($CFG->wwwroot . '/portfolio/add.php?id= ' . $exporter->get('id') . '&instance=' . $instance . '&sesskey=' . sesskey());
}
}
// be very selective about not including this unless we really need to
require_once $CFG->libdir . '/portfolio/forms.php';
$mform = new portfolio_instance_select('', array('id' => $exporter->get('id'), 'caller' => $exporter->get('caller'), 'options' => $options));
if ($mform->is_cancelled()) {
$exporter->cancel_request();
示例13: get_string
}
} else {
// If page is loaded directly
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('manageportfolios', 'portfolio'));
// Get strings that are used
$strshow = get_string('on', 'portfolio');
$strhide = get_string('off', 'portfolio');
$strdelete = get_string('disabledinstance', 'portfolio');
$strsettings = get_string('settings');
$actionchoicesforexisting = array('show' => $strshow, 'hide' => $strhide, 'delete' => $strdelete);
$actionchoicesfornew = array('newon' => $strshow, 'newoff' => $strhide, 'delete' => $strdelete);
$output = $OUTPUT->box_start('generalbox');
$plugins = core_component::get_plugin_list('portfolio');
$plugins = array_keys($plugins);
$instances = portfolio_instances(false, false);
$usedplugins = 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);
$table = new html_table();
$table->head = array(get_string('plugin', 'portfolio'), '', '');
$table->data = array();
foreach ($instances as $i) {
$settings = '<a href="' . $sesskeyurl . '&action=edit&pf=' . $i->get('id') . '">' . $strsettings . '</a>';
// Set some commonly used variables
$pluginid = $i->get('id');
$plugin = $i->get('plugin');
$pluginname = $i->get('name');
// Check if the instance is misconfigured
示例14: definition
function definition()
{
$this->caller = $this->_customdata['caller'];
$options = portfolio_instance_select(portfolio_instances(), $this->caller->supported_formats($this->caller), get_class($this->caller), 'instance', true, true);
if (empty($options)) {
debugging('noavailableplugins', 'portfolio');
return false;
}
$mform =& $this->_form;
$mform->addElement('select', 'instance', get_string('selectplugin', 'portfolio'), $options);
$this->add_action_buttons(true, get_string('next'));
}
示例15: portfolio_exporter
$exporter = new portfolio_exporter($instance, $caller, $callbackcomponent);
// set the export-specific variables, and save.
$exporter->set('user', $USER);
$exporter->save();
}
if (!$exporter->get('instance')) {
// we've just arrived but have no instance
// in this case the exporter object and the caller object have been set up above
// so just make a little form to select the portfolio plugin instance,
// which is the last thing to do before starting the export.
//
// first check to make sure there is actually a point
$options = portfolio_instance_select(
portfolio_instances(),
$exporter->get('caller')->supported_formats(),
get_class($exporter->get('caller')),
$exporter->get('caller')->get_mimetype(),
'instance',
true,
true
);
if (empty($options)) {
throw new portfolio_export_exception($exporter, 'noavailableplugins', 'portfolio');
} else if (count($options) == 1) {
// no point displaying a form, just redirect.
$optionskeys = array_keys($options);
$instance = array_shift($optionskeys);
redirect($CFG->wwwroot . '/portfolio/add.php?id= ' . $exporter->get('id') . '&instance=' . $instance . '&sesskey=' . sesskey());
}