本文整理汇总了PHP中URLHelper::getURL方法的典型用法代码示例。如果您正苦于以下问题:PHP URLHelper::getURL方法的具体用法?PHP URLHelper::getURL怎么用?PHP URLHelper::getURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URLHelper
的用法示例。
在下文中一共展示了URLHelper::getURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterStoreCallback
public function afterStoreCallback()
{
if ($this->isDirty()) {
//add notification to writer of review
if (!$this->review['host_id'] && $this->review['user_id'] !== $this['user_id']) {
PersonalNotifications::add($this->review['user_id'], URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat einen Kommentar zu Ihrem Review geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
}
//add notification to all users of this servers who discussed this review but are neither the new
//commentor nor the writer of the review
$statement = DBManager::get()->prepare("\n SELECT user_id\n FROM lernmarktplatz_comments\n WHERE review_id = :review_id\n AND host_id IS NULL\n GROUP BY user_id\n ");
$statement->execute(array('review_id' => $this->review->getId()));
foreach ($statement->fetchAll(PDO::FETCH_COLUMN, 0) as $user_id) {
if (!in_array($user_id, array($this->review['user_id'], $this['user_id']))) {
PersonalNotifications::add($user_id, URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat auch einen Kommentar geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
}
}
//only push if the comment is from this server and the material-server is different
if (!$this['host_id']) {
$myHost = LernmarktplatzHost::thisOne();
$data = array();
$data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
$data['data'] = $this->toArray();
$data['data']['foreign_comment_id'] = $data['data']['comment_id'];
unset($data['data']['comment_id']);
unset($data['data']['id']);
unset($data['data']['user_id']);
unset($data['data']['host_id']);
$user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
if ($user_description_datafield) {
$datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
}
$data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
$statement = DBManager::get()->prepare("\n SELECT host_id\n FROM lernmarktplatz_comments\n WHERE review_id = :review_id\n AND host_id IS NOT NULL\n GROUP BY host_id\n ");
$statement->execute(array('review_id' => $this->review->getId()));
$hosts = $statement->fetchAll(PDO::FETCH_COLUMN, 0);
if ($this->review['host_id'] && !in_array($this->review['host_id'], $hosts)) {
$hosts[] = $this->review['host_id'];
}
if ($this->review->material['host_id'] && !in_array($this->review->material['host_id'], $hosts)) {
$hosts[] = $this->review->material['host_id'];
}
foreach ($hosts as $host_id) {
$remote = new LernmarktplatzHost($host_id);
if (!$remote->isMe()) {
$review_id = $this->review['foreign_review_id'] ?: $this->review->getId();
if ($this->review['foreign_review_id']) {
if ($this->review->host_id === $remote->getId()) {
$host_hash = null;
} else {
$host_hash = md5($this->review->host['public_key']);
}
} else {
$host_hash = md5($myHost['public_key']);
}
$remote->pushDataToEndpoint("add_comment/" . $review_id . "/" . $host_hash, $data);
}
}
}
}
}
示例2: testGetURL
public function testGetURL()
{
URLHelper::addLinkParam('null', NULL);
URLHelper::addLinkParam('empty', array());
URLHelper::addLinkParam('foo', 'bar');
$url = 'abc?a=b&c=d#top';
$expected = 'abc?foo=bar&a=b&c=d#top';
$this->assertEquals($expected, URLHelper::getURL($url));
$url = 'abc#top';
$params = array('a' => 'b', 'c' => 'd');
$expected = 'abc?foo=bar&a=b&c=d#top';
$this->assertEquals($expected, URLHelper::getURL($url, $params));
$url = 'abc?foo=test';
$expected = 'abc?foo=test';
$this->assertEquals($expected, URLHelper::getURL($url));
$url = 'abc';
$params = array('foo' => 'test');
$expected = 'abc?foo=test';
$this->assertEquals($expected, URLHelper::getURL($url, $params));
$url = 'abc?baz=on';
$params = array('baz' => 'off');
$expected = 'abc?foo=bar&baz=off';
$this->assertEquals($expected, URLHelper::getURL($url, $params));
$url = 'abc?foo=baz';
$params = array('foo' => 'test');
$expected = 'abc?foo=test';
$this->assertEquals($expected, URLHelper::getURL($url, $params));
}
示例3: afterStoreCallback
public function afterStoreCallback()
{
if (!$this->material['host_id'] && $this->material['user_id'] !== $GLOBALS['user']->id) {
PersonalNotifications::add($this->material['user_id'], URLHelper::getURL("plugins.php/lernmarktplatz/market/details/" . $this->material->getId() . "#review_" . $this->getId()), $this->isNew() ? sprintf(_("%s hat ein Review zu '%s' geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id']), $this->material['name']) : sprintf(_("%s hat ein Review zu '%s' verändert."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id']), $this->material['name']), "review_" . $this->getId(), Icon::create("support", "clickable"));
}
//only push if the comment is from this server and the material-server is different
if ($this->material['host_id'] && !$this['host_id'] && $this->isDirty()) {
$remote = new LernmarktplatzHost($this->material['host_id']);
$myHost = LernmarktplatzHost::thisOne();
$data = array();
$data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
$data['data'] = $this->toArray();
$data['data']['foreign_review_id'] = $data['data']['review_id'];
unset($data['data']['review_id']);
unset($data['data']['id']);
unset($data['data']['user_id']);
unset($data['data']['host_id']);
$user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
if ($user_description_datafield) {
$datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
}
$data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
if (!$remote->isMe()) {
$remote->pushDataToEndpoint("add_review/" . $this->material['foreign_material_id'], $data);
}
}
}
示例4: overview_action
public function overview_action()
{
Navigation::activateItem("/admin/locations/sem_classes");
if (count($_POST) && Request::submitted('delete') && Request::get("delete_sem_class")) {
$sem_class = $GLOBALS['SEM_CLASS'][Request::get("delete_sem_class")];
if ($sem_class->delete()) {
PageLayout::postMessage(MessageBox::success(_("Veranstaltungskategorie wurde gelöscht.")));
$GLOBALS['SEM_CLASS'] = SemClass::refreshClasses();
}
}
if (count($_POST) && Request::get("add_name")) {
$statement = DBManager::get()->prepare("SELECT 1 FROM sem_classes WHERE name = :name");
$statement->execute(array('name' => Request::get("add_name")));
$duplicate = $statement->fetchColumn();
if ($duplicate) {
$message = sprintf(_("Es existiert bereits eine Veranstaltungskategorie mit dem Namen \"%s\""), Request::get("add_name"));
PageLayout::postMessage(MessageBox::error($message));
$this->redirect('admin/sem_classes/overview');
} else {
$statement = DBManager::get()->prepare("INSERT INTO sem_classes SET name = :name, mkdate = UNIX_TIMESTAMP(), chdate = UNIX_TIMESTAMP() " . "");
$statement->execute(array('name' => Request::get("add_name")));
$id = DBManager::get()->lastInsertId();
if (Request::get("add_like")) {
$sem_class = clone $GLOBALS['SEM_CLASS'][Request::get("add_like")];
$sem_class->set('name', Request::get("add_name"));
$sem_class->set('id', $id);
$sem_class->store();
}
$this->redirect(URLHelper::getURL($this->url_for('admin/sem_classes/details'), array('id' => $id)));
PageLayout::postMessage(MessageBox::success(_("Veranstaltungskategorie wurde erstellt.")));
$GLOBALS['SEM_CLASS'] = SemClass::refreshClasses();
}
}
}
示例5: getIconNavigation
function getIconNavigation($course_id, $last_visit, $user_id)
{
if (get_config('SCM_ENABLE')) {
$navigation = new Navigation(_('Ablaufplan'), URLHelper::getURL("seminar_main.php", array('auswahl' => $course_id, 'redirect_to' => "dispatch.php/course/dates")));
$navigation->setImage(Icon::create('schedule', 'inactive'));
return $navigation;
} else {
return null;
}
}
示例6: loadContent
/**
* load help content from db
*/
public function loadContent()
{
$help_content = HelpContent::getContentByRoute();
foreach ($help_content as $row) {
$this->addPlainText($row['label'] ?: '', $this->interpolate($row['content'], $this->variables), $row['icon'] ? Icon::create($row['icon'], 'info_alt') : null, URLHelper::getURL('dispatch.php/help_content/edit/' . $row['content_id']), URLHelper::getURL('dispatch.php/help_content/delete/' . $row['content_id']));
}
if (!count($help_content) && $this->help_admin) {
$this->addPlainText('', '', null, null, null, URLHelper::getURL('dispatch.php/help_content/edit/new' . '?help_content_route=' . get_route()));
}
}
示例7: getURL
public function getURL($absolute_url = false)
{
if ($absolute_url) {
$old_base = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']);
}
$url = URLHelper::getURL("plugins.php/pluginmarket/presenting/image/" . $this->getId(), array(), true);
if ($absolute_url) {
URLHelper::setBaseURL($old_base);
}
return $url;
}
示例8: show_document_avatar
public function show_document_avatar($eventname, $search_item)
{
if ($search_item->type === "document") {
$db = DBManager::get();
$dokument = $db->query("SELECT * FROM dokumente WHERE dokument_id = " . $db->quote($search_item->entry_id))->fetch(PDO::FETCH_ASSOC);
$extension = strtolower(substr($dokument['name'], strrpos($dokument['name'], ".") + 1));
if (in_array($extension, array("jpg", "jpeg", "gif", "png", "bmp"))) {
$search_item->avatar = URLHelper::getURL("sendfile.php", array('type' => $dokument['url'] ? 6 : 0, 'file_id' => $search_item->entry_id, 'file_name' => $dokument['name']));
}
$search_item->tools[] = '<a href="' . URLHelper::getURL("sendfile.php", array('force_download' => 1, 'type' => $dokument['url'] ? 6 : 0, 'file_id' => $search_item->entry_id, 'file_name' => $name)) . '">' . Assets::img("icons/16/blue/download.png") . "</a>";
}
}
示例9: before_filter
/**
* Applikationsübergreifender before_filter mit Trick:
*
* Controller-Methoden, die mit "before" anfangen werden in
* Quellcode-Reihenfolge als weitere before_filter ausgeführt.
* Geben diese FALSE zurück, bricht Trails genau wie beim normalen
* before_filter ab.
*/
function before_filter(&$action, &$args)
{
$this->plugin_path = URLHelper::getURL($this->dispatcher->plugin->getPluginPath());
list($this->plugin_path) = explode("?cid=", $this->plugin_path);
# call before filters
foreach (get_class_methods($this) as $filter) {
if ($filter !== "before_filter" && !strncasecmp("before", $filter, 6)) {
if (FALSE === call_user_func(array($this, $filter), $action, $args)) {
return FALSE;
}
}
}
}
示例10: getURL
/**
* URL to given avatar, if there is a customized avatar. And for anonymous
* authors this geturns a url to gravatar.
* @param Avatar-sizes (constan, see there) $size
* @param string $ext
* @return string url
*/
function getURL($size, $ext = 'png')
{
$this->checkAvatarVisibility();
if ($this->is_customized()) {
return $this->getCustomAvatarUrl($size, $ext);
} else {
$contact = new BlubberExternalContact($this->user_id);
$email = $contact['mail_identifier'];
$email_hash = md5(strtolower(trim($email)));
$width = $this->getDimension($size);
return URLHelper::getURL("http://www.gravatar.com/avatar/" . $email_hash, array('s' => max(array($width[0], $width[1])), 'd' => $this->getNobody()->getCustomAvatarUrl($size, $ext)), true);
}
}
示例11: initSubNavigation
/**
* Initialize the subnavigation of this item. This method
* is called once before the first item is added or removed.
*/
public function initSubNavigation()
{
global $auth, $perm;
parent::initSubNavigation();
$username = $auth->auth['uname'];
// news
$navigation = new Navigation(_('Ankündigungen'), 'dispatch.php/news/admin_news');
$this->addSubNavigation('news', $navigation);
// votes and tests, evaluations
if (get_config('VOTE_ENABLE')) {
$navigation = new Navigation(_('Fragebögen'), URLHelper::getURL("dispatch.php/questionnaire/overview"));
$this->addSubNavigation('questionnaire', $navigation);
$navigation = new Navigation(_('Evaluationen'), 'admin_evaluation.php', array('rangeID' => $username));
$this->addSubNavigation('evaluation', $navigation);
}
// literature
if (get_config('LITERATURE_ENABLE')) {
if ($perm->have_perm('admin')) {
$navigation = new Navigation(_('Literaturübersicht'), 'admin_literatur_overview.php');
$this->addSubNavigation('literature', $navigation);
$navigation->addSubNavigation('overview', new Navigation(_('Literaturübersicht'), 'admin_literatur_overview.php'));
$navigation->addSubNavigation('edit_list', new Navigation(_('Literatur bearbeiten'), 'dispatch.php/literature/edit_list?_range_id=self'));
$navigation->addSubNavigation('search', new Navigation(_('Literatur suchen'), 'dispatch.php/literature/search?return_range=self'));
} elseif (get_config('LITERATURE_ENABLE')) {
$navigation = new Navigation(_('Literatur'), 'dispatch.php/literature/edit_list.php', array('_range_id' => 'self'));
$this->addSubNavigation('literature', $navigation);
$navigation->addSubNavigation('edit_list', new Navigation(_('Literatur bearbeiten'), 'dispatch.php/literature/edit_list?_range_id=self'));
$navigation->addSubNavigation('search', new Navigation(_('Literatur suchen'), 'dispatch.php/literature/search?return_range=self'));
}
}
// elearning
if (get_config('ELEARNING_INTERFACE_ENABLE')) {
$navigation = new Navigation(_('Lernmodule'), 'dispatch.php/elearning/my_accounts');
$this->addSubNavigation('my_elearning', $navigation);
}
// export
if (get_config('EXPORT_ENABLE') && $perm->have_perm('tutor')) {
$navigation = new Navigation(_('Export'), 'export.php');
$this->addSubNavigation('export', $navigation);
}
if ($perm->have_perm('admin') || $perm->have_perm('dozent') && get_config('ALLOW_DOZENT_COURSESET_ADMIN')) {
$navigation = new Navigation(_('Anmeldesets'), 'dispatch.php/admission/courseset/index');
$this->addSubNavigation('coursesets', $navigation);
$navigation->addSubNavigation('sets', new Navigation(_('Anmeldesets verwalten'), 'dispatch.php/admission/courseset/index'));
$navigation->addSubNavigation('userlists', new Navigation(_('Personenlisten'), 'dispatch.php/admission/userlist/index'));
$navigation->addSubNavigation('restricted_courses', new Navigation(_('teilnahmebeschränkte Veranstaltungen'), 'dispatch.php/admission/restricted_courses'));
}
}
示例12: before_filter
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$course_id = Request::option('cid');
if (isset($_SESSION['seminar_change_view_' . $course_id])) {
unset($_SESSION['seminar_change_view_' . $course_id]);
// Reset simulated view, redirect to administration page.
$this->redirect(URLHelper::getURL('dispatch.php/course/management'));
} elseif (get_object_type($course_id, array('sem')) && !SeminarCategories::GetBySeminarId($course_id)->studygroup_mode && in_array($GLOBALS['perm']->get_studip_perm($course_id), words('tutor dozent'))) {
// Set simulated view, redirect to overview page.
$_SESSION['seminar_change_view_' . $course_id] = 'autor';
$this->redirect(URLHelper::getURL('seminar_main.php'));
} else {
throw new Trails_Exception(400);
}
}
示例13: before_filter
/**
* common tasks for all actions
*/
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$this->course_id = $args[0];
if (!in_array($action, words('apply claim delete order_down order_up'))) {
$this->redirect($this->url_for('/apply/' . $action));
return false;
}
if (!get_object_type($this->course_id, array('sem'))) {
throw new Trails_Exception(400);
}
$course = Seminar::GetInstance($this->course_id);
$enrolment_info = $course->getEnrolmentInfo($GLOBALS['user']->id);
//Ist bereits Teilnehmer/Admin/freier Zugriff -> gleich weiter
if ($enrolment_info['enrolment_allowed'] && (in_array($enrolment_info['cause'], words('root courseadmin member')) || $enrolment_info['cause'] == 'free_access' && $GLOBALS['user']->id == 'nobody')) {
$redirect_url = UrlHelper::getUrl('seminar_main.php', array('auswahl' => $this->course_id));
if (Request::isXhr()) {
$this->response->add_header('X-Location', $redirect_url);
$this->render_nothing();
} else {
$this->redirect($redirect_url);
}
return false;
}
//Grundsätzlich verboten
if (!$enrolment_info['enrolment_allowed']) {
throw new AccessDeniedException($enrolment_info['description']);
}
PageLayout::setTitle($course->getFullname() . " - " . _("Veranstaltungsanmeldung"));
PageLayout::addSqueezePackage('enrolment');
if (Request::isXhr()) {
$this->set_layout(null);
$this->response->add_header('X-No-Buttons', 1);
$this->response->add_header('X-Title', PageLayout::getTitle());
$request = Request::getInstance();
foreach ($request as $key => $value) {
$request[$key] = studip_utf8decode($value);
}
} else {
$this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
}
$this->set_content_type('text/html;charset=windows-1252');
if (Request::submitted('cancel')) {
$this->redirect(URLHelper::getURL('dispatch.php/course/details/', array('sem_id' => $this->course_id)));
}
}
示例14: __construct
public function __construct()
{
$this->tour_data = HelpTour::getHelpbarTourData();
foreach ($this->tour_data['tours'] as $index => $tour) {
$element = new LinkElement($tour->name, URLHelper::getURL('?tour_id=' . $tour->tour_id));
$visit_state = HelpTourUser::find(array($tour->tour_id, $GLOBALS['user']->id));
if ($visit_state === null) {
$element->addClass('tour-new');
} elseif (!$visit_state->completed) {
$element->addClass('tour-paused');
} else {
$element->addClass('tour-completed');
}
$element->addClass('tour_link');
$element['id'] = $tour->tour_id;
$this->addElement($element);
}
}
示例15: ActionsWidget
<? endif; ?>
<?php
$sidebar = Sidebar::get();
$sidebar->setImage('sidebar/mail-sidebar.png');
$actions = new ActionsWidget();
$actions->addLink(_("Neue Nachricht schreiben"), $controller->url_for('messages/write'), Icon::create('mail+add', 'clickable'), array('data-dialog' => 'width=650;height=600'));
if (Navigation::getItem('/messaging/messages/inbox')->isActive() && $messages) {
$actions->addLink(_('Alle als gelesen markieren'), $controller->url_for('messages/overview', array('read_all' => 1)), Icon::create('accept', 'clickable'));
}
$actions->addLink(_('Ausgewählte Nachrichten löschen'), "#", Icon::create('trash', 'clickable'), array('onclick' => "if (window.confirm('Wirklich %s Nachrichten löschen?'.toLocaleString().replace('%s', jQuery('#bulk tbody :checked').length))) { jQuery('#bulk').submit(); } return false;"));
$sidebar->addWidget($actions);
$search = new SearchWidget(URLHelper::getLink('?'));
$search->addNeedle(_('Nachrichten durchsuchen'), 'search', true);
$search->addFilter(_('Betreff'), 'search_subject');
$search->addFilter(_('Inhalt'), 'search_content');
$search->addFilter(_('Autor/-in'), 'search_autor');
$sidebar->addWidget($search);
$folderwidget = new ViewsWidget();
$folderwidget->forceRendering();
$folderwidget->title = _('Schlagworte');
$folderwidget->id = 'messages-tags';
$folderwidget->addLink(_("Alle Nachrichten"), URLHelper::getURL("?"), null, array('class' => "tag"))->setActive(!Request::submitted("tag"));
if (empty($tags)) {
$folderwidget->style = 'display:none';
} else {
foreach ($tags as $tag) {
$folderwidget->addLink(ucfirst($tag), URLHelper::getURL("?", array('tag' => $tag)), null, array('class' => "tag"))->setActive(Request::get("tag") === $tag);
}
}
$sidebar->addWidget($folderwidget);