本文整理汇总了PHP中midcom_connection::get_url方法的典型用法代码示例。如果您正苦于以下问题:PHP midcom_connection::get_url方法的具体用法?PHP midcom_connection::get_url怎么用?PHP midcom_connection::get_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类midcom_connection
的用法示例。
在下文中一共展示了midcom_connection::get_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _populate_toolbar
/**
* Populate the toolbar
*
* @param String $today_path Path to the today's calendar
*/
private function _populate_toolbar($path = null)
{
// 'New event' should always be in toolbar
$nap = new midcom_helper_nav();
$this_node = $nap->get_node($nap->get_current_node());
if ($this->_root_event->can_do('midgard:create')) {
$this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => '#', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create event'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new-event.png', MIDCOM_TOOLBAR_OPTIONS => array('rel' => 'directlink', 'onclick' => org_openpsa_calendar_interface::calendar_newevent_js($this_node))));
}
if (method_exists($this->_calendar, 'get_' . $path . '_start')) {
$previous = date('Y-m-d', call_user_func(array($this->_calendar, 'get_' . $path . '_start')) - 100);
$next = date('Y-m-d', call_user_func(array($this->_calendar, 'get_' . $path . '_end')) + 100);
$this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $path . '/' . $previous . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('previous'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/up.png'));
$this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $path . '/' . $next . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('next'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/down.png'));
}
if ($this->_topic->can_do('midgard:update') && $this->_topic->can_do('midcom:component_config')) {
$this->_node_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'config/', MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png'));
}
midcom_helper_datamanager2_widget_jsdate::add_head_elements();
midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . "/org.openpsa.calendar/navigation.js");
$prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
$default_date = date('Y-m-d', $this->_selected_time);
midcom::get('head')->add_jscript('
var org_openpsa_calendar_default_date = "' . $default_date . '",
org_openpsa_calendar_prefix = "' . $prefix . $path . '";
');
$this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => '#', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('go to'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_jump-to.png', MIDCOM_TOOLBAR_OPTIONS => array('rel' => 'directlink', 'id' => 'date-navigation')));
$this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$path}/" . $this->_get_datestring(time()) . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('today'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/web-calendar.png'));
$this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "filters/?org_openpsa_calendar_returnurl=" . midcom_connection::get_url('uri'), MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('choose calendars'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/preferences-desktop.png'));
}
示例2: run_handler
public function run_handler($topic, array $args = array())
{
if (is_object($topic)) {
$component = $topic->component;
} else {
$component = $topic;
$topic = $this->get_component_node($component);
}
$context = new midcom_core_context(null, $topic);
$context->set_current();
$context->set_key(MIDCOM_CONTEXT_URI, midcom_connection::get_url('self') . $topic->name . '/' . implode('/', $args) . '/');
// Parser Init: Generate arguments and instantiate it.
$context->parser = midcom::get('serviceloader')->load('midcom_core_service_urlparser');
$context->parser->parse($args);
$handler = $context->get_handler($topic);
$context->set_key(MIDCOM_CONTEXT_CONTENTTOPIC, $topic);
$this->assertTrue(is_a($handler, 'midcom_baseclasses_components_interface'), $component . ' found no handler for ./' . implode('/', $args) . '/');
$result = $handler->handle();
$this->assertTrue($result !== false, $component . ' handle returned false on ./' . implode('/', $args) . '/');
$data =& $handler->_context_data[$context->id]['handler']->_handler['handler'][0]->_request_data;
if (is_object($result) && $result instanceof midcom_response) {
$data['__openpsa_testcase_response'] = $result;
}
$data['__openpsa_testcase_handler'] = $handler->_context_data[$context->id]['handler']->_handler['handler'][0];
$data['__openpsa_testcase_handler_method'] = $handler->_context_data[$context->id]['handler']->_handler['handler'][1];
// added to simulate http uri composition
$_SERVER['REQUEST_URI'] = $context->get_key(MIDCOM_CONTEXT_URI);
return $data;
}
示例3: _handler_csv
public function _handler_csv($handler_id, array $args, array &$data)
{
midcom::get('auth')->require_valid_user();
midcom::get()->disable_limits();
$this->_load_datamanager($this->_load_schemadb($handler_id, $args, $data));
$this->_objects = $this->_load_data($handler_id, $args, $data);
if (!isset($args[0]) || empty($args[0])) {
//We do not have filename in URL, generate one and redirect
$fname = preg_replace('/[^a-z0-9-]/i', '_', strtolower($this->_topic->extra)) . '_' . date('Y-m-d') . '.csv';
if (strpos(midcom_connection::get_url('uri'), '/', strlen(midcom_connection::get_url('uri')) - 2)) {
return new midcom_response_relocate(midcom_connection::get_url('uri') . $fname);
} else {
return new midcom_response_relocate(midcom_connection::get_url('uri') . "/{$fname}");
}
}
if (!isset($data['filename']) || $data['filename'] == '') {
$data['filename'] = str_replace('.csv', '', $args[0]);
}
$this->_init_csv_variables();
midcom::get()->skip_page_style = true;
// FIXME: Use global configuration
//midcom::get('cache')->content->content_type($this->_config->get('csv_export_content_type'));
midcom::get('cache')->content->content_type('application/csv');
_midcom_header('Content-Disposition: filename=' . $data['filename']);
}
示例4: __construct
/**
* Read the configuration
*/
public function __construct($auth)
{
$this->_cookie_id .= $GLOBALS['midcom_config']['auth_backend_simple_cookie_id'];
$this->_cookie_path = $GLOBALS['midcom_config']['auth_backend_simple_cookie_path'];
if ($this->_cookie_path == 'auto') {
$this->_cookie_path = midcom_connection::get_url('self');
}
if (!empty($_SERVER['HTTPS']) && $GLOBALS['midcom_config']['auth_backend_simple_cookie_secure']) {
$this->_secure_cookie = true;
}
parent::__construct($auth);
}
示例5: _populate_post_toolbar
public function _populate_post_toolbar($comment)
{
$toolbar = new midcom_helper_toolbar();
if (midcom::get('auth')->user && $comment->status < net_nehmer_comments_comment::MODERATED) {
if (!$comment->can_do('net.nehmer.comments:moderation')) {
// Regular users can only report abuse
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "report/{$comment->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('report abuse'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_help-agent.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('mark' => 'abuse', 'return_url' => midcom_connection::get_url('uri'))));
} else {
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "report/{$comment->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('confirm abuse'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $comment->can_do('net.nehmer.comments:moderation'), MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('mark' => 'confirm_abuse', 'return_url' => midcom_connection::get_url('uri'))));
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "report/{$comment->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('confirm junk'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $comment->can_do('net.nehmer.comments:moderation'), MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('mark' => 'confirm_junk', 'return_url' => midcom_connection::get_url('uri'))));
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "report/{$comment->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('not abuse'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/ok.png', MIDCOM_TOOLBAR_ENABLED => $comment->can_do('net.nehmer.comments:moderation'), MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('mark' => 'not_abuse', 'return_url' => midcom_connection::get_url('uri'))));
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $_SERVER['REQUEST_URI'], MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/editdelete.png', MIDCOM_TOOLBAR_ENABLED => $comment->can_do('net.nehmer.comments:moderation'), MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('net_nehmer_comment_adminsubmit' => '1', 'guid' => $comment->guid, 'action_delete' => 'action_delete')));
}
}
return $toolbar;
}
示例6: _load_schemadb
function _load_schemadb($handler_id, &$args, &$data)
{
$data['session'] = new midcom_services_session('org_openpsa_products_csvexport');
if (!empty($_POST)) {
$data['session']->set('POST_data', $_POST);
}
$root_group_guid = $this->_config->get('root_group');
$group_name_to_filename = '';
if ($root_group_guid) {
$root_group = org_openpsa_products_product_group_dba::get_cached($root_group_guid);
$group_name_to_filename = strtolower(str_replace(' ', '_', $root_group->code)) . '_';
}
if (isset($args[0])) {
$data['schemadb_to_use'] = str_replace('.csv', '', $args[0]);
$data['filename'] = $group_name_to_filename . $data['schemadb_to_use'] . '_' . date('Y-m-d') . '.csv';
} else {
if (isset($_POST) && array_key_exists('org_openpsa_products_export_schema', $_POST)) {
//We do not have filename in URL, generate one and redirect
$schemaname = $_POST['org_openpsa_products_export_schema'];
if (strpos(midcom_connection::get_url('uri'), '/', strlen(midcom_connection::get_url('uri')) - 2)) {
midcom::get()->relocate(midcom_connection::get_url('uri') . "{$schemaname}");
} else {
midcom::get()->relocate(midcom_connection::get_url('uri') . "/{$schemaname}");
}
// This will exit
} else {
$this->_request_data['schemadb_to_use'] = $this->_config->get('csv_export_schema');
}
}
$this->_schema = $this->_config->get('csv_export_schema');
if (isset($this->_request_data['schemadb_product'][$this->_request_data['schemadb_to_use']])) {
$this->_schema = $this->_request_data['schemadb_to_use'];
}
$this->_schema_fields_to_skip = explode(',', $this->_config->get('export_skip_fields'));
return $this->_request_data['schemadb_product'];
}
示例7:
<?php
$prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
$page =& $data['wikipage'];
$history =& $data['history'];
$version_string = "<a href=\"{$prefix}__ais/rcs/preview/{$page->guid}/{$data['version']}\">{$data['version']}</a>";
$url = midcom_connection::get_url('self') . "midcom-permalink-{$page->guid}";
?>
<tr>
<td>
<a rel="note" class="subject url" href="&(url);">&(page.title);</a>
</td>
<td>
&(version_string:h);
</td>
<td class="revisor">
<?php
if ($history['user']) {
$user = midcom::get('auth')->get_user($history['user']);
if (is_object($user)) {
if (class_exists('org_openpsa_widgets_contact')) {
$user_card = org_openpsa_widgets_contact::get($user->guid);
$person_label = $user_card->show_inline();
} else {
$person = $user->get_storage();
$person_label = $person->name;
}
}
echo " {$person_label}\n";
} else {
if ($history['ip']) {
示例8: strftime
<span class="icon">&(data['icon']:h);</span>
<span class="title"><a href="&(data['document_url']);" target="document_&(document.guid);">&(document.title:h);</a></span>
<ul class="metadata">
<li class="time"><?php
echo strftime('%x', $document->metadata->created);
?>
</li>
<li class="file">
<?php
if (count($atts) == 0) {
echo midcom::get('i18n')->get_string('no files', 'org.openpsa.documents');
} else {
foreach ($atts as $file) {
// FIXME: This is a messy way of linking into DM-managed files
if ($file->parameter('midcom.helper.datamanager2.type.blobs', 'fieldname') == 'document') {
echo "<a target=\"document_{$document->guid}\" href=\"" . midcom_connection::get_url('self') . "midcom-serveattachmentguid-{$file->guid}/{$file->name}\">{$file->name}</a> (" . sprintf(midcom::get('i18n')->get_string('%s document', 'org.openpsa.documents'), midcom::get('i18n')->get_string($file->mimetype, 'org.openpsa.documents')) . ")";
}
}
}
?>
</li>
</ul>
<div id="org_openpsa_relatedto_details_&(document.guid);" class="details hidden" style="display: none;">
</div>
<?php
//TODO: get correct node and via it then handle details trough AHAH (and when we have node we can use proper link in document_url as well
org_openpsa_relatedto_handler_relatedto::render_line_controls($link, $data['other_obj']);
?>
</li>
示例9: _show_navigation
/**
*
* @param mixed $handler_id The ID of the handler.
* @param array &$data The local request data.
*/
public function _show_navigation($handler_id, array &$data)
{
$tree_array = array($this->_request_data['root_topic']->id => $this->_request_data['root_topic']);
$this->_tree_array_build($this->_request_data['topic_array'], $this->_request_data['root_topic'], $tree_array);
midcom_show_style("show-navigation-start");
$this->_show_navigation_tree($tree_array, midcom_connection::get_url('prefix'));
midcom_show_style("show-navigation-end");
}
示例10: get_url
public static function get_url($attachment)
{
if (is_string($attachment)) {
$guid = $attachment;
$mc = self::new_collector('guid', $guid);
$name = array_pop($mc->get_values('name'));
} else {
if (is_a($attachment, 'midcom_db_attachment')) {
$guid = $attachment->guid;
$name = $attachment->name;
} else {
throw new midcom_error('Invalid attachment identifier');
}
}
if ($GLOBALS['midcom_config']['attachment_cache_enabled']) {
$subdir = substr($guid, 0, 1);
if (file_exists($GLOBALS['midcom_config']['attachment_cache_root'] . '/' . $subdir . '/' . $guid . '_' . $name)) {
return $GLOBALS['midcom_config']['attachment_cache_url'] . '/' . $subdir . '/' . $guid . '_' . urlencode($name);
}
}
if (is_object($attachment)) {
$nap = new midcom_helper_nav();
$parent = $nap->resolve_guid($attachment->parentguid);
if (is_array($parent) && $parent[MIDCOM_NAV_TYPE] == 'node') {
//Serve from topic
return midcom_connection::get_url('self') . $parent[MIDCOM_NAV_RELATIVEURL] . urlencode($name);
}
}
// Use regular MidCOM attachment server
return midcom_connection::get_url('self') . 'midcom-serveattachmentguid-' . $guid . '/' . urlencode($name);
}
示例11: get_unique_host_name
public static function get_unique_host_name()
{
if (null === self::_get('config', 'unique_host_name')) {
self::$_data['config']['unique_host_name'] = str_replace(':', '_', $_SERVER['SERVER_NAME']) . '_' . str_replace('/', '_', midcom_connection::get_url('prefix'));
}
return self::$_data['config']['unique_host_name'];
}
示例12: _add_attachment
/**
* @todo This function does nothing (and would throw notices if it did)
*/
private function _add_attachment($att)
{
return false;
$attobj = $this->_article->create_attachment($att['name'], $att['name'], $att['mimetype']);
if (!$attobj) {
//Could not create attachment
debug_add("Could not create attachment '{$att['name']}', errstr: " . midcom_connection::get_error_string(), MIDCOM_LOG_ERROR);
continue;
}
$fp = @$attobj->open('w');
if (!$fp) {
//Could not open for writing, clean up and continue
debug_add("Could not open attachment {$attobj->guid} for writing, errstr: " . midcom_connection::get_error_string(), MIDCOM_LOG_ERROR);
$attobj->delete();
continue;
}
if (!fwrite($fp, $att['content'], strlen($att['content']))) {
//Could not write, clean up and continue
debug_add("Error when writing attachment {$attobj->guid}, errstr: " . midcom_connection::get_error_string(), MIDCOM_LOG_ERROR);
fclose($fp);
$attobj->delete();
continue;
}
fclose($fp);
if (isset($att['part']) && isset($att['part']->headers) && isset($att['part']->headers['content-id'])) {
//Attachment is embed, add tag to end of note
if (!$embeds_added) {
$this->_article->content .= "<p>";
$embeds_added = true;
}
$this->_article->content .= "<a href=\"" . midcom_connection::get_url('self') . "midcom-serveattachmentguid-{$attobj->guid}/{$attobj->name}\">{$attobj->title}</a><br />";
} else {
//Add normal attachments as links to end of note
if (!$attachments_added) {
//We hope the client handles these so that embeds come first and attachments then so we can avoid double pass over this array
$this->_article->content .= "\n\n";
$attachments_added = true;
}
$this->_article->content .= "[{$attobj->title}](" . midcom_connection::get_url('self') . "midcom-serveattachmentguid-{$attobj->guid}/{$attobj->name}), ";
}
}
示例13: _handler_emailimport
//.........这里部分代码省略.........
$title_format = $this->_config->get('emailimport_title_format');
$wikipage->title = sprintf($title_format, $decoder->subject, $from, strftime('%x', time()));
//Check for duplicate title(s)
$qb = net_nemein_wiki_wikipage::new_query_builder();
$qb->add_constraint('topic', '=', $wikipage->topic);
$qb->add_constraint('title', 'LIKE', $wikipage->title . '%');
$results = $qb->execute_unchecked();
if (($found = count($results)) > 0) {
foreach ($results as $foundpage) {
if ($foundpage->content == $wikipage->content) {
//Content exact duplicate, abort import
debug_print_r("duplicate content with page '{$wikipage->title}", $wikipage->content);
throw new midcom_error('Duplicate content with an existing page with similar title.');
}
}
//In theory this should be recursive but we'll leave it at this for now
$wikipage->title .= ' ' . ($found + 1);
}
//Figure out author
$author = $this->emailimport_find_person($from);
$wikipage->author = $author->id;
if (!$wikipage->author) {
//Default to first user in the db
$qb = midcom_db_person::new_query_builder();
$qb->add_constraint('username', '<>', '');
$results = $qb->execute_unchecked();
if (empty($results)) {
//No users found
throw new midcom_error('Cannot set any author for the wikipage');
}
$wikipage->author = $results[0]->id;
}
if (!$wikipage->create()) {
throw new midcom_error('wikipage->create returned failure, errstr: ' . midcom_connection::get_error_string());
}
//Mark as email
$wikipage->parameter('net.nemein.wiki:emailimport', 'is_email', time());
$embeds_added = false;
$attachments_added = false;
foreach ($decoder->attachments as $att) {
debug_add("processing attachment {$att['name']}");
$attobj = $wikipage->create_attachment($att['name'], $att['name'], $att['mimetype']);
if (!$attobj) {
//Could not create attachment
debug_add("Could not create attachment '{$att['name']}', errstr: " . midcom_connection::get_error_string(), MIDCOM_LOG_ERROR);
continue;
}
$fp = @$attobj->open('w');
if (!$fp) {
//Could not open for writing, clean up and continue
debug_add("Could not open attachment {$attobj->guid} for writing, errstr: " . midcom_connection::get_error_string(), MIDCOM_LOG_ERROR);
$attobj->delete();
continue;
}
if (!fwrite($fp, $att['content'], strlen($att['content']))) {
//Could not write, clean up and continue
debug_add("Error when writing attachment {$attobj->guid}, errstr: " . midcom_connection::get_error_string(), MIDCOM_LOG_ERROR);
fclose($fp);
$attobj->delete();
continue;
}
fclose($fp);
if (isset($att['part']) && isset($att['part']->headers) && isset($att['part']->headers['content-id'])) {
//Attachment is embed, add tag to end of note
if (!$embeds_added) {
$wikipage->content .= "\n\n";
$embeds_added = true;
}
$wikipage->content .= "![{$attobj->title}](" . midcom_connection::get_url('self') . "midcom-serveattachmentguid-{$attobj->guid}/{$attobj->name})\n\n";
} else {
//Add normal attachments as links to end of note
if (!$attachments_added) {
//We hope the client handles these so that embeds come first and attachments then so we can avoid double pass over this array
$wikipage->content .= "\n\n";
$attachments_added = true;
}
$wikipage->content .= "[{$attobj->title}](" . midcom_connection::get_url('self') . "midcom-serveattachmentguid-{$attobj->guid}/{$attobj->name}), ";
}
}
if ($embeds_added || $attachments_added) {
$wikipage->update();
}
// Store recipients of the email to the page for possible later use
reset($emails);
foreach ($emails as $email) {
$wikipage->parameter('net.nemein.wiki:emailimport_recipients', $email, time());
debug_add("Processing email address {$email} for related-to links");
$person = $this->emailimport_find_person($email);
if (!$person) {
$group = $this->emailimport_find_group($email);
if (!$group) {
debug_add("Could not find person or group for email {$email}, cannot link, storing email for future reference", MIDCOM_LOG_WARN);
$wikipage->parameter('net.nemein.wiki:emailimport_notlinked', $email, time());
continue;
}
continue;
}
}
midcom::get('auth')->drop_sudo();
}
示例14: bind_toolbar_to_object
/**
* Binds the a toolbar to a DBA object. This will append a number of globally available
* toolbar options. For example, expect Metadata- and Version Control-related options
* to be added.
*
* This call is available through convenience functions throughout the framework: The
* toolbar main class has a mapping for it (midcom_helper_toolbar::bind_to($object))
* and object toolbars created by this service will automatically be bound to the
* specified object.
*
* Repeated bind calls are intercepted, you can only bind a toolbar to a single object.
*
* @see midcom_helper_toolbar::bind_to()
* @see create_object_toolbar()
* @param &$toolbar
*/
function bind_toolbar_to_object(&$toolbar, &$object)
{
if (array_key_exists('midcom_services_toolbars_bound_to_object', $toolbar->customdata)) {
// We already processed this toolbar, skipping further adds.
return;
} else {
$toolbar->customdata['midcom_services_toolbars_bound_to_object'] = true;
}
$prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
if (!$prefix) {
debug_add("Toolbar for object {$object->guid} was called before topic prefix was available, skipping global items.", MIDCOM_LOG_WARN);
return;
}
$reflector = new midcom_helper_reflector($object);
$this->_view_toolbar_label = $reflector->get_class_label();
if ($GLOBALS['midcom_config']['metadata_approval'] && $object->can_do('midcom:approve')) {
$metadata = midcom_helper_metadata::retrieve($object);
if ($metadata && $metadata->is_approved()) {
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$prefix}__ais/folder/unapprove/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('unapprove', 'midcom'), MIDCOM_TOOLBAR_HELPTEXT => midcom::get('i18n')->get_string('approved', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/page-approved.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('guid' => $object->guid, 'return_to' => $_SERVER['REQUEST_URI']), MIDCOM_TOOLBAR_ACCESSKEY => 'u'));
} else {
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$prefix}__ais/folder/approve/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('approve', 'midcom'), MIDCOM_TOOLBAR_HELPTEXT => midcom::get('i18n')->get_string('unapproved', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/page-notapproved.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('guid' => $object->guid, 'return_to' => $_SERVER['REQUEST_URI']), MIDCOM_TOOLBAR_ACCESSKEY => 'a'));
}
}
if ($object->can_do('midgard:update')) {
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$prefix}__ais/folder/metadata/{$object->guid}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('edit metadata', 'midcom.admin.folder'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/metadata.png', MIDCOM_TOOLBAR_ACCESSKEY => 'm'));
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$prefix}__ais/folder/move/{$object->guid}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('move', 'midcom.admin.folder'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/save-as.png', MIDCOM_TOOLBAR_ENABLED => is_a($object, 'midcom_db_article')));
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => midcom_connection::get_url('self') . "__mfa/asgard/object/open/{$object->guid}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('manage object', 'midgard.admin.asgard'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard.admin.asgard:access', null, 'midgard_admin_asgard_plugin', 'midgard.admin.asgard') && midcom::get('auth')->can_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin')));
}
if ($GLOBALS['midcom_config']['midcom_services_rcs_enable'] && $object->can_do('midgard:update') && $object->_use_rcs) {
$toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$prefix}__ais/rcs/{$object->guid}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('show history', 'no.bergfald.rcs'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/history.png', MIDCOM_TOOLBAR_ACCESSKEY => 'v'));
}
}
示例15: add_database_head_elements
/**
* Include all text/css attachments of current style to MidCOM headers
*/
function add_database_head_elements()
{
static $called = false;
if ($called) {
return;
}
$style = $this->get_style();
$mc = midcom_db_attachment::new_collector('parentguid', $style->guid);
$mc->add_constraint('mimetype', '=', 'text/css');
$attachments = $mc->get_values('name');
foreach ($attachments as $filename) {
// TODO: Support media types
midcom::get('head')->add_stylesheet(midcom_connection::get_url('self') . "midcom-serveattachmentguid-{$guid}/{$filename}");
}
$called = true;
}