本文整理汇总了PHP中generate_class_name函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_class_name函数的具体用法?PHP generate_class_name怎么用?PHP generate_class_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_class_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Convert a Mahara plugin template file path into a normal template file path with extra search paths.
*
* @param string $pluginfile The plugintype, name, and name of file, e.g. "blocktype:clippy:index.tpl"
* @param int $cacheTime Not used.
* @param int $cacheId Not used.
* @param int $compileId Not used.
* @param array $includePath The paths to look in.
* @throws MaharaException
*/
public function __construct($file, $cacheTime = null, $cacheId = null, $compileId = null, $includePath = null)
{
global $THEME;
$parts = explode(':', $file, 3);
if (count($parts) !== 3) {
throw new SystemException("Invalid template path \"{$file}\"");
}
// Keep the original string for logging purposes
$dwooref = $file;
list($plugintype, $pluginname, $file) = $parts;
// Since we use $plugintype as part of a file path, we should whitelist it
$plugintype = strtolower($plugintype);
if (!in_array($plugintype, plugin_types())) {
throw new SystemException("Invalid plugintype in Dwoo template \"{$dwooref}\"");
}
// Get the relative path for this particular plugin
require_once get_config('docroot') . $plugintype . '/lib.php';
$pluginpath = call_static_method(generate_class_name($plugintype), 'get_theme_path', $pluginname);
// Because this is a plugin template file, we don't want to include any accidental matches against
// core template files with the same name.
$includePath = array();
// First look for a local override.
$includePath[] = get_config('docroot') . "local/theme/{$pluginpath}/templates";
// Then look for files in a custom theme
foreach ($THEME->inheritance as $theme) {
$includePath[] = get_config('docroot') . "theme/{$theme}/{$pluginpath}/templates";
}
// Lastly look for files in the plugin itself
foreach ($THEME->inheritance as $theme) {
$includePath[] = get_config('docroot') . "{$pluginpath}/theme/{$theme}/templates";
// For legacy purposes also look for the template file loose under the theme directory.
$includePath[] = get_config('docroot') . "{$pluginpath}/theme/{$theme}";
}
// Now, we instantiate this as a standard Dwoo_Template_File class.
// We're passing in $file, which is the relative path to the file, and
// $includePath, which is an array of directories to search for $file in.
// We let Dwoo figure out which one actually has it.
parent::__construct($file, null, null, null, $includePath);
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:49,代码来源:Dwoo_Template_Mahara.php
示例2: release_submitted_view
/**
* Releases a submission to a remote host.
* @param int $id A view or collection id
* @param mixed $assessmentdata Assessment data from the remote host, for this assignment
* @param string $teacherusername The username of the teacher who is releasing the assignment
* @param boolean $iscollection Whether the $id is a view or a collection
*/
function release_submitted_view($id, $assessmentdata, $teacherusername, $iscollection = false)
{
global $REMOTEWWWROOT, $USER;
list($teacher, $authinstance) = find_remote_user($teacherusername, $REMOTEWWWROOT);
require_once 'view.php';
db_begin();
if ($iscollection) {
require_once 'collection.php';
$collection = new Collection($id);
$collection->release($teacher);
} else {
$view = new View($id);
View::_db_release(array($id), $view->get('owner'));
}
// Provide each artefact plugin the opportunity to handle the remote submission release
foreach (plugins_installed('artefact') as $plugin) {
safe_require('artefact', $plugin->name);
$classname = generate_class_name('artefact', $plugin->name);
if (is_callable($classname . '::view_release_external_data')) {
call_static_method($classname, 'view_release_external_data', $id, $assessmentdata, $teacher ? $teacher->id : 0, $iscollection);
}
}
// Release the view for editing
db_commit();
}
开发者ID:vohung96,项目名称:mahara,代码行数:32,代码来源:lib.php
示例3: get_search_plugins
function get_search_plugins()
{
$searchpluginoptions = array();
if ($searchplugins = plugins_installed('search')) {
foreach ($searchplugins as $plugin) {
safe_require_plugin('search', $plugin->name, 'lib.php');
if (!call_static_method(generate_class_name('search', $plugin->name), 'is_available_for_site_setting')) {
continue;
}
$searchpluginoptions[$plugin->name] = $plugin->name;
$config_path = get_config('docroot') . 'search/' . $plugin->name . '/version.php';
if (is_readable($config_path)) {
$config = new stdClass();
require_once $config_path;
if (isset($config->name)) {
$searchpluginoptions[$plugin->name] = $config->name;
}
}
}
}
return $searchpluginoptions;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:22,代码来源:searchlib.php
示例4: build_artefactchooser_data
/**
* Builds data for the artefact chooser.
*
* This builds three pieces of information:
*
* - HTML containing table rows
* - Pagination HTML and Javascript
* - The total number of artefacts found
* - Artefact fields to return
*/
public static function build_artefactchooser_data($data, $group = null, $institution = null)
{
global $USER;
// If lazyload is set, immediately return an empty resultset
// In the case of forms using lazyload, lazyload is set to false by subsequent requests via ajax,
// for example in views/artefactchooser.json.php, at which time the full resultset is returned.
if (isset($data['lazyload']) && $data['lazyload']) {
$result = '';
$pagination = build_pagination(array('id' => $data['name'] . '_pagination', 'class' => 'ac-pagination', 'url' => View::make_base_url() . (param_boolean('s') ? '&s=1' : ''), 'count' => 0, 'limit' => 0, 'offset' => 0, 'datatable' => $data['name'] . '_data', 'jsonscript' => 'view/artefactchooser.json.php', 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'extradata' => array('value' => $data['defaultvalue'], 'blocktype' => $data['blocktype'], 'group' => $group, 'institution' => $institution)));
return array($result, $pagination, 0, 0, array());
}
$search = '';
if (!empty($data['search']) && param_boolean('s')) {
$search = param_variable('search', '');
// Maybe later, depending on performance - don't search if there's
// not enough characters. Prompts should be added to the UI too.
//if (strlen($search) < 3) {
// $search = '';
//}
}
$data['search'] = $search;
$data['offset'] -= $data['offset'] % $data['limit'];
safe_require('blocktype', $data['blocktype']);
$blocktypeclass = generate_class_name('blocktype', $data['blocktype']);
$data['sortorder'] = array(array('fieldname' => 'title', 'order' => 'ASC'));
if (method_exists($blocktypeclass, 'artefactchooser_get_sort_order')) {
$data['sortorder'] = call_static_method($blocktypeclass, 'artefactchooser_get_sort_order');
}
list($artefacts, $totalartefacts) = self::get_artefactchooser_artefacts($data, $USER, $group, $institution);
$selectone = $data['selectone'];
$value = $data['defaultvalue'];
$elementname = $data['name'];
$template = $data['template'];
$returnfields = isset($data['returnfields']) ? $data['returnfields'] : null;
$returnartefacts = array();
$result = '';
if ($artefacts) {
if (!empty($data['ownerinfo'])) {
require_once get_config('docroot') . 'artefact/lib.php';
$userid = $group || $institution ? null : $USER->get('id');
foreach (artefact_get_owner_info(array_keys($artefacts)) as $k => $v) {
if ($artefacts[$k]->owner !== $userid || $artefacts[$k]->group !== $group || $artefacts[$k]->institution !== $institution) {
$artefacts[$k]->ownername = $v->name;
$artefacts[$k]->ownerurl = $v->url;
}
}
}
foreach ($artefacts as &$artefact) {
safe_require('artefact', get_field('artefact_installed_type', 'plugin', 'name', $artefact->artefacttype));
if (method_exists($blocktypeclass, 'artefactchooser_get_element_data')) {
$artefact = call_static_method($blocktypeclass, 'artefactchooser_get_element_data', $artefact);
}
// Build the radio button or checkbox for the artefact
$formcontrols = '';
if ($selectone) {
$formcontrols .= '<input type="radio" class="radio" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '" value="' . hsc($artefact->id) . '"';
if ($value == $artefact->id) {
$formcontrols .= ' checked="checked"';
}
$formcontrols .= '>';
} else {
$formcontrols .= '<input type="checkbox" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '[' . hsc($artefact->id) . ']"';
if ($value && in_array($artefact->id, $value)) {
$formcontrols .= ' checked="checked"';
}
$formcontrols .= ' class="artefactid-checkbox checkbox">';
$formcontrols .= '<input type="hidden" name="' . hsc($elementname) . '_onpage[]" value="' . hsc($artefact->id) . '" class="artefactid-onpage">';
}
$smarty = smarty_core();
$smarty->assign('artefact', $artefact);
$smarty->assign('elementname', $elementname);
$smarty->assign('formcontrols', $formcontrols);
$result .= $smarty->fetch($template) . "\n";
if ($returnfields) {
$returnartefacts[$artefact->id] = array();
foreach ($returnfields as $f) {
if ($f == 'safedescription') {
$returnartefacts[$artefact->id]['safedescription'] = clean_html($artefact->description);
continue;
}
if ($f == 'attachments') {
// Check if the artefact has attachments - we need to update the instance config form
// to have those attachments selected.
$attachment_ids = get_column('artefact_attachment', 'attachment', 'artefact', $artefact->id);
$returnartefacts[$artefact->id]['attachments'] = $attachment_ids;
continue;
}
$returnartefacts[$artefact->id][$f] = $artefact->{$f};
}
}
//.........这里部分代码省略.........
开发者ID:sarahjcotton,项目名称:mahara,代码行数:101,代码来源:view.php
示例5: install_blocktype_viewtypes_for_plugin
function install_blocktype_viewtypes_for_plugin($blocktype)
{
safe_require('blocktype', $blocktype);
$blocktype = blocktype_namespaced_to_single($blocktype);
db_begin();
delete_records('blocktype_installed_viewtype', 'blocktype', $blocktype);
if ($viewtypes = call_static_method(generate_class_name('blocktype', $blocktype), 'get_viewtypes')) {
foreach ($viewtypes as $vt) {
insert_record('blocktype_installed_viewtype', (object) array('blocktype' => $blocktype, 'viewtype' => $vt));
}
}
db_commit();
}
开发者ID:Br3nda,项目名称:mahara,代码行数:13,代码来源:upgrade.php
示例6: artefact_get_progressbar_metaartefacts
/**
* Dealing with things to count in progressbar that are not true artefacts
* and therefore are not countable by adding up how many instances exist in
* the artefact table. Or if you want to count an artefact differently.
* For example: Social -> Make a friend
*
* @param string $plugin name of artefact plugin
* @param array $onlythese (optional) An array of items from artefact_get_progressbar_items, indicating which to include
* @return array of objects each containing artefacttype, completed
* (where completed represents the number completed)
*/
function artefact_get_progressbar_metaartefacts($plugin, $onlythese = false)
{
$results = array();
$classname = generate_class_name('artefact', $plugin);
// Check the artefacttypes to see if they have a special metaartefact count
$names = call_static_method($classname, 'get_artefact_types');
foreach ($names as $name) {
if (!array_key_exists($name, $onlythese)) {
continue;
}
$is_metaartefact = call_static_method('ArtefactType' . ucfirst($name), 'is_metaartefact');
if ($is_metaartefact) {
$meta = call_user_func($classname . '::progressbar_metaartefact_count', $name);
if (is_object($meta)) {
array_push($results, $meta);
}
}
}
// Also check the special artefacts
if (is_array($specials = call_static_method($classname, 'progressbar_additional_items'))) {
foreach ($specials as $special) {
if (!array_key_exists($special->name, $onlythese)) {
continue;
}
if (empty($special->is_metaartefact)) {
// check to see if it can have mataartefact count
$special->is_metaartefact = call_static_method('ArtefactType' . ucfirst($special->name), 'is_metaartefact');
}
if (!empty($special->is_metaartefact)) {
// Now check if they have a special metaartefact count
$meta = call_user_func($classname . '::progressbar_metaartefact_count', $special->name);
if (is_object($meta)) {
array_push($results, $meta);
}
}
}
}
return $results;
}
开发者ID:kienv,项目名称:mahara,代码行数:50,代码来源:lib.php
示例7: header_search_form
/**
* Builds the pieform for the search field in the page header
*/
function header_search_form()
{
$plugin = get_config('searchplugin');
safe_require('search', $plugin);
return call_static_method(generate_class_name('search', $plugin), 'header_search_form');
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:9,代码来源:web.php
示例8: param_integer
$enable = param_integer('enable', 0);
$disable = param_integer('disable', 0);
if ($disable && !call_static_method(generate_class_name($plugintype, $pluginname), 'can_be_disabled')) {
throw new UserException("Plugin {$plugintype} {$pluginname} cannot be disabled");
}
if ($enable || $disable) {
require_once get_config('libroot') . 'upgrade.php';
clear_menu_cache();
activate_plugin_form($plugintype, get_record($plugintype . '_installed', 'name', $pluginname));
}
if ($plugintype == 'artefact') {
$type = param_alpha('type');
$classname = generate_artefact_class_name($type);
} else {
$type = '';
$classname = generate_class_name($plugintype, $pluginname);
}
if (!call_static_method($classname, 'has_config')) {
throw new InvalidArgumentException("{$classname} doesn't have config options available");
}
$form = call_static_method($classname, 'get_config_options');
$form['plugintype'] = $plugintype;
$form['pluginname'] = $pluginname;
$form['name'] = 'pluginconfig';
$form['class'] = 'panel panel-body';
$form['pluginconfigform'] = true;
$form['jsform'] = true;
$form['successcallback'] = 'pluginconfig_submit';
$form['validatecallback'] = 'pluginconfig_validate';
$form['elements']['plugintype'] = array('type' => 'hidden', 'value' => $plugintype);
$form['elements']['pluginname'] = array('type' => 'hidden', 'value' => $pluginname);
开发者ID:kienv,项目名称:mahara,代码行数:31,代码来源:pluginconfig.php
示例9: class_from_format
public static function class_from_format($format)
{
$format = trim($format);
if ($format == 'files') {
$format = 'file';
}
safe_require('import', $format);
return generate_class_name('import', $format);
}
开发者ID:Br3nda,项目名称:mahara,代码行数:9,代码来源:lib.php
示例10: get_portfolio_items_by_tag
function get_portfolio_items_by_tag($tag, $owner, $limit, $offset, $sort = 'name', $type = null, $returntags = true)
{
// For now, can only be used to search a user's portfolio
if (empty($owner->id) || empty($owner->type)) {
throw new SystemException('get_views_and_artefacts_by_tag: invalid owner');
}
if ($owner->type != 'user') {
throw new SystemException('get_views_and_artefacts_by_tag only implemented for users');
}
$types = get_portfolio_types_from_param($type);
$plugin = 'internal';
safe_require('search', $plugin);
$result = call_static_method(generate_class_name('search', $plugin), 'portfolio_search_by_tag', $tag, $owner, $limit, $offset, $sort, $types, $returntags);
$result->filter = $result->type = $type ? $type : 'all';
return $result;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:16,代码来源:searchlib.php
示例11: db_begin
$count = 0;
db_begin();
try {
foreach ($_GET as $k => $v) {
if (preg_match('/^delete\\-(\\d+)$/', $k, $m)) {
delete_records('notification_internal_activity', 'id', $m[1], 'usr', $USER->get('id'));
$count++;
}
}
} catch (Exception $e) {
db_rollback();
json_reply('local', get_string('failedtodeletenotifications', 'activity') . ': ' . $e->getMessage());
}
db_commit();
safe_require('notification', 'internal');
json_reply(false, array('message' => get_string('deletednotifications', 'activity', $count), 'count' => $count, 'newunreadcount' => call_static_method(generate_class_name('notification', 'internal'), 'unread_count', $USER->get('id'))));
}
}
// normal processing
$type = param_alphanum('type', 'all');
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$userid = $USER->get('id');
if ($type == 'all') {
$count = count_records('notification_internal_activity', 'usr', $userid);
$sql = 'SELECT a.*, at.name AS type,at.plugintype, at.pluginname FROM {notification_internal_activity} a
JOIN {activity_type} at ON a.type = at.id
WHERE a.usr = ? ORDER BY ctime DESC';
$records = get_records_sql_array($sql, array($userid), $offset, $limit);
} else {
if ($type == 'adminmessages' && $USER->get('admin')) {
开发者ID:Br3nda,项目名称:mahara,代码行数:31,代码来源:index.json.php
示例12: plugin_institution_prefs_submit
/**
* Submit plugin institution form values.
*
* @param Pieform $form
* @param array $values
* @param Institution $institution
* @return bool is page need to be refreshed
*/
function plugin_institution_prefs_submit(Pieform $form, $values, Institution $institution)
{
$elements = array();
$installed = plugin_all_installed();
foreach ($installed as $i) {
if (!safe_require_plugin($i->plugintype, $i->name)) {
continue;
}
call_static_method(generate_class_name($i->plugintype, $i->name), 'institutionprefs_submit', $form, $values, $institution);
}
}
开发者ID:kienv,项目名称:mahara,代码行数:19,代码来源:institution.php
示例13: build_artefactchooser_data
/**
* Builds data for the artefact chooser.
*
* This builds three pieces of information:
*
* - HTML containing table rows
* - Pagination HTML and Javascript
* - The total number of artefacts found
*/
public static function build_artefactchooser_data($data, $group = null, $institution = null)
{
global $USER;
$search = '';
if (!empty($data['search']) && param_boolean('s')) {
$search = param_variable('search', '');
// Maybe later, depending on performance - don't search if there's
// not enough characters. Prompts should be added to the UI too.
//if (strlen($search) < 3) {
// $search = '';
//}
}
$data['search'] = $search;
$data['offset'] -= $data['offset'] % $data['limit'];
safe_require('blocktype', $data['blocktype']);
$blocktypeclass = generate_class_name('blocktype', $data['blocktype']);
$data['sortorder'] = array(array('fieldname' => 'title', 'order' => 'ASC'));
if (method_exists($blocktypeclass, 'artefactchooser_get_sort_order')) {
$data['sortorder'] = call_static_method($blocktypeclass, 'artefactchooser_get_sort_order');
}
list($artefacts, $totalartefacts) = self::get_artefactchooser_artefacts($data, $USER, $group, $institution);
$selectone = $data['selectone'];
$value = $data['defaultvalue'];
$elementname = $data['name'];
$template = $data['template'];
$result = '';
if ($artefacts) {
foreach ($artefacts as &$artefact) {
safe_require('artefact', get_field('artefact_installed_type', 'plugin', 'name', $artefact->artefacttype));
if (method_exists($blocktypeclass, 'artefactchooser_get_element_data')) {
$artefact = call_static_method($blocktypeclass, 'artefactchooser_get_element_data', $artefact);
}
// Build the radio button or checkbox for the artefact
$formcontrols = '';
if ($selectone) {
$formcontrols .= '<input type="radio" class="radio" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '" value="' . hsc($artefact->id) . '"';
if ($value == $artefact->id) {
$formcontrols .= ' checked="checked"';
}
$formcontrols .= '>';
} else {
$formcontrols .= '<input type="checkbox" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '[' . hsc($artefact->id) . ']"';
if ($value && in_array($artefact->id, $value)) {
$formcontrols .= ' checked="checked"';
}
$formcontrols .= ' class="artefactid-checkbox checkbox">';
$formcontrols .= '<input type="hidden" name="' . hsc($elementname) . '_onpage[]" value="' . hsc($artefact->id) . '" class="artefactid-onpage">';
}
$smarty = smarty_core();
$smarty->assign('artefact', $artefact);
$smarty->assign('elementname', $elementname);
$smarty->assign('formcontrols', $formcontrols);
$result .= $smarty->fetch($template) . "\n";
}
}
$pagination = build_pagination(array('id' => $elementname . '_pagination', 'class' => 'ac-pagination', 'url' => View::make_base_url() . (param_boolean('s') ? '&s=1' : ''), 'count' => $totalartefacts, 'limit' => $data['limit'], 'offset' => $data['offset'], 'datatable' => $elementname . '_data', 'jsonscript' => 'view/artefactchooser.json.php', 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'extradata' => array('value' => $value, 'blocktype' => $data['blocktype'], 'group' => $group, 'institution' => $institution)));
return array($result, $pagination, $totalartefacts, $data['offset']);
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:67,代码来源:view.php
示例14: set_field_select
if ($ids) {
set_field_select('notification_internal_activity', 'read', 1, 'id IN (' . join(',', $ids) . ') AND usr = ?', array($USER->get('id')));
}
$message = get_string('markedasread', 'activity');
} else {
if ($delete) {
$ids = array();
foreach ($_GET as $k => $v) {
if (preg_match('/^delete\\-(\\d+)$/', $k, $m)) {
$ids[] = $m[1];
}
}
if ($ids) {
$strids = join(',', $ids);
$userid = $USER->get('id');
db_begin();
// Remove parent pointers to messages we're about to delete
// Use temp table in subselect for Mysql compat.
execute_sql("\n UPDATE {notification_internal_activity}\n SET parent = NULL\n WHERE parent IN (\n SELECT id\n FROM (\n SELECT id FROM {notification_internal_activity} WHERE id IN ({$strids}) AND usr = ?\n ) AS temp\n )", array($userid));
delete_records_select('notification_internal_activity', "id IN ({$strids}) AND usr = ?", array($userid));
db_commit();
}
$message = get_string('deletednotifications', 'activity', count($ids));
}
}
$newhtml = activitylist_html($type, $limit, $offset);
if ($message) {
safe_require('notification', 'internal');
$newhtml['newunreadcount'] = call_static_method(generate_class_name('notification', 'internal'), 'unread_count', $USER->get('id'));
}
json_reply(false, (object) array('message' => $message, 'data' => $newhtml));
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:index.json.php
示例15: rewrite_blockinstance_relationships
/**
* This method is called late in the import process, after views, collections, and artefacts have been set up, to give collections the opportunity
* to rewrite any references they have to old view, collection, or artefact IDs.
*
* Blocktypes that use this API should define an "import_rewrite_blockinstance_relationships_leap" method.
*/
private function rewrite_blockinstance_relationships()
{
foreach ($this->viewids as $entryid => $viewid) {
$records = get_records_array('block_instance', 'view', $viewid, 'view, id');
if ($records) {
foreach ($records as $blockrec) {
// Let blocktype plugin rewrite relationships now that all views and collections are set up
safe_require('blocktype', $blockrec->blocktype);
$classname = generate_class_name('blocktype', $blockrec->blocktype);
$method = 'import_rewrite_blockinstance_relationships_leap';
$blockinstance['config'] = call_static_method($classname, $method, $blockrec->id, $this);
}
}
}
}
开发者ID:agwells,项目名称:Mahara-1,代码行数:21,代码来源:lib.php
示例16: group_get_menu_tabs
/**
* Returns a datastructure describing the tabs that appear on a group page
*
* @param object $group Database record of group to get tabs for
* @return array
*/
function group_get_menu_tabs()
{
static $menu;
$group = group_current_group();
if (!$group) {
return null;
}
$role = group_user_access($group->id);
$menu = array('info' => array('path' => 'groups/info', 'url' => group_homepage_url($group, false), 'title' => get_string('About', 'group'), 'weight' => 20));
if (group_can_list_members($group, $role)) {
$menu['members'] = array('path' => 'groups/members', 'url' => 'group/members.php?id=' . $group->id, 'title' => get_string('Members', 'group'), 'weight' => 30);
}
if ($interactionplugins = plugins_installed('interaction')) {
foreach ($interactionplugins as $plugin) {
safe_require('interaction', $plugin->name);
$plugin_menu = call_static_method(generate_class_name('interaction', $plugin->name), 'group_menu_items', $group);
$menu = array_merge($menu, $plugin_menu);
}
}
$menu['views'] = array('path' => 'groups/views', 'url' => 'view/groupviews.php?group=' . $group->id, 'title' => get_string('Views', 'group'), 'weight' => 50);
$menu['collections'] = array('path' => 'groups/collections', 'url' => 'collection/index.php?group=' . $group->id, 'title' => get_string('Collections', 'group'), 'weight' => 60);
if (group_role_can_edit_views($group, $role)) {
$menu['share'] = array('path' => 'groups/share', 'url' => 'group/shareviews.php?group=' . $group->id, 'title' => get_string('share', 'view'), 'weight' => 70);
}
if ($role) {
safe_require('grouptype', $group->grouptype);
$artefactplugins = call_static_method('GroupType' . $group->grouptype, 'get_group_artefact_plugins');
if ($plugins = plugins_installed('artefact')) {
foreach ($plugins as &$plugin) {
if (!in_array($plugin->name, $artefactplugins)) {
continue;
}
safe_require('artefact', $plugin->name);
$plugin_menu = call_static_method(generate_class_name('artefact', $plugin->name), 'group_tabs', $group->id);
$menu = array_merge($menu, $plugin_menu);
}
}
}
if (group_role_can_access_report($group, $role)) {
$menu['report'] = array('path' => 'groups/report', 'url' => 'group/report.php?group=' . $group->id, 'title' => get_string('report', 'group'), 'weight' => 70);
}
if (defined('MENUITEM')) {
$key = substr(MENUITEM, strlen('groups/'));
if ($key && isset($menu[$key])) {
$menu[$key]['selected'] = true;
}
}
return $menu;
}
开发者ID:vohung96,项目名称:mahara,代码行数:55,代码来源:group.php
示例17: recalculate_quota
/**
* Cronjob to recalculate how much quota each user is using and update it as
* appropriate.
*
* This gives a backstop for the possibility that there is a bug elsewhere that
* has caused the quota count to get out of sync
*/
function recalculate_quota()
{
$plugins = plugins_installed('artefact', true);
$userquotas = array();
$groupquotas = array();
foreach ($plugins as $plugin) {
safe_require('artefact', $plugin->name);
$classname = generate_class_name('artefact', $plugin->name);
if (is_callable($classname . '::recalculate_quota')) {
$pluginuserquotas = call_static_method($classname, 'recalculate_quota');
foreach ($pluginuserquotas as $userid => $usage) {
if (!isset($userquotas[$userid])) {
$userquotas[$userid] = $usage;
} else {
$userquotas[$userid] += $usage;
}
}
}
if (is_callable($classname . '::recalculate_group_quota')) {
$plugingroupquotas = call_static_method($classname, 'recalculate_group_quota');
foreach ($plugingroupquotas as $groupid => $usage) {
if (!isset($groupquotas[$groupid])) {
$groupquotas[$groupid] = $usage;
} else {
$groupquotas[$groupid] += $usage;
}
}
}
}
foreach ($userquotas as $user => $quota) {
$data = (object) array('quotaused' => $quota);
$where = (object) array('id' => $user);
update_record('usr', $data, $where);
}
foreach ($groupquotas as $group => $quota) {
$data = (object) array('quotaused' => $quota);
$where = (object) array('id' => $group);
update_record('group', $data, $where);
}
}
开发者ID:kienv,项目名称:mahara,代码行数:47,代码来源:mahara.php
示例18: class_from_format
/**
* helper function to return the appropriate class name from an import format
* this will try and resolve inconsistencies (eg file/files, leap/leap2a etc
* and also pull in the class definition for you
*/
public static function class_from_format($format)
{
$format = trim($format);
$corr = array('files' => 'file', 'leap2a' => 'leap');
foreach ($corr as $bad => $good) {
if ($format == $bad) {
$format = $good;
break;
}
}
safe_require('import', $format);
return generate_class_name('import', $format);
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:18,代码来源:lib.php
示例19: interaction_sideblock
/**
* creates the information for the interaction_sideblock
*
* @param int $groupid the group the sideblock is for
* @param boolean (optional) $membership whether the user is a member
* @return array containing indices 'name', 'weight', 'data'
*/
function interaction_sideblock($groupid, $membership = true)
{
$interactiontypes = array_flip(array_map(create_function('$a', 'return $a->name;'), plugins_installed('interaction')));
if (!($interactions = get_records_select_array('interaction_instance', '"group" = ? AND deleted = ?', array($groupid, 0), 'plugin, ctime', 'id, plugin, title'))) {
$interactions = array();
}
foreach ($interactions as $i) {
if (!is_array($interactiontypes[$i->plugin])) {
$interactiontypes[$i->plugin] = array();
}
$interactiontypes[$i->plugin][] = $i;
}
// Sort them according to how the plugin wants them sorted
if ($interactiontypes) {
foreach ($interactiontypes as $plugin => &$interactions) {
safe_require('interaction', $plugin);
$classname = generate_class_name('interaction', $plugin);
if (method_exists($classname, 'sideblock_sort')) {
$interactions = call_static_method($classname, 'sideblock_sort', $interactions);
}
}
}
$data = array('group' => $groupid, 'interactiontypes' => $interactiontypes, 'membership' => $membership);
// Add a sideblock for group interactions
return array('name' => 'groupinteractions', 'weight' => -5, 'data' => $data);
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:33,代码来源:lib.php
示例20: release_submitted_view
function release_submitted_view($viewid, $assessmentdata, $teacherusername)
{
global $REMOTEWWWROOT, $USER;
require_once 'view.php';
$view = new View($viewid);
list($teacher, $authinstance) = find_remote_user($teacherusername, $REMOTEWWWROOT);
db_begin();
foreach (plugins_installed('artefact') as $plugin) {
safe_require('artefact', $plugin->name);
$classname = generate_class_name('artefact', $plugin->name);
if (is_callable($classname . '::view_release_external_data')) {
call_static_method($classname, 'view_release_external_data', $view, $assessmentdata, $teacher ? $teacher->id : 0);
}
}
// Release the view for editing
$view->set('submittedhost', null);
$view->set('submittedtime', null);
$view->commit();
db_commit();
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:20,代码来源:lib.php
注:本文中的generate_class_name函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论