本文整理汇总了PHP中OCP\Util::linkToRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::linkToRoute方法的具体用法?PHP Util::linkToRoute怎么用?PHP Util::linkToRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Util
的用法示例。
在下文中一共展示了Util::linkToRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Get the template for a specific activity-event in the activities
*
* @param array $activity An array with all the activity data in it
* @param return string
*/
public static function show($activity)
{
$tmpl = new \OCP\Template('activity', 'activity.box');
$tmpl->assign('formattedDate', \OCP\Util::formatDate($activity['timestamp']));
$tmpl->assign('formattedTimestamp', \OCP\relative_modified_date($activity['timestamp']));
$tmpl->assign('user', $activity['user']);
$tmpl->assign('displayName', \OCP\User::getDisplayName($activity['user']));
if ($activity['app'] === 'files') {
// We do not link the subject as we create links for the parameters instead
$activity['link'] = '';
}
$tmpl->assign('event', $activity);
if ($activity['file']) {
$rootView = new \OC\Files\View('');
$exist = $rootView->file_exists('/' . $activity['user'] . '/files' . $activity['file']);
$is_dir = $rootView->is_dir('/' . $activity['user'] . '/files' . $activity['file']);
unset($rootView);
// show a preview image if the file still exists
if (!$is_dir && $exist) {
$tmpl->assign('previewLink', \OCP\Util::linkTo('files', 'index.php', array('dir' => dirname($activity['file']))));
$tmpl->assign('previewImageLink', \OCP\Util::linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150)));
} else {
if ($exist) {
$tmpl->assign('previewLink', \OCP\Util::linkTo('files', 'index.php', array('dir' => $activity['file'])));
$tmpl->assign('previewImageLink', \OC_Helper::mimetypeIcon('dir'));
$tmpl->assign('previewLinkIsDir', true);
}
}
}
return $tmpl->fetchPage();
}
示例2: getPreviewUrl
private function getPreviewUrl($path)
{
$x = 200;
$y = 113;
$path = substr($path, 6);
return \OCP\Util::linkToRoute('core_ajax_preview', array('x' => $x, 'y' => $y, 'file' => urlencode($path)));
}
示例3: getUrl
/**
* @param $requestToken
* @return string
*/
public function getUrl($requestToken)
{
if (!$requestToken) {
throw new \RuntimeException('No request token given');
}
return \OCP\Util::linkToRoute('ocusagecharts.chart_api.load_chart', array('id' => $this->chart->getId(), 'requesttoken' => $requestToken));
}
示例4: show
/**
* Get the template for a specific activity-event in the activities
*
* @param array $activity An array with all the activity data in it
* @return string
*/
public static function show($activity)
{
$tmpl = new Template('activity', 'activity.box');
$tmpl->assign('formattedDate', Util::formatDate($activity['timestamp']));
$tmpl->assign('formattedTimestamp', \OCP\relative_modified_date($activity['timestamp']));
$tmpl->assign('user', $activity['user']);
$tmpl->assign('displayName', User::getDisplayName($activity['user']));
if (strpos($activity['subjectformatted']['markup']['trimmed'], '<a ') !== false) {
// We do not link the subject as we create links for the parameters instead
$activity['link'] = '';
}
$tmpl->assign('event', $activity);
if ($activity['file']) {
$rootView = new View('/' . $activity['affecteduser'] . '/files');
$exist = $rootView->file_exists($activity['file']);
$is_dir = $rootView->is_dir($activity['file']);
unset($rootView);
// show a preview image if the file still exists
$mimetype = \OC_Helper::getFileNameMimeType($activity['file']);
if (!$is_dir && \OC::$server->getPreviewManager()->isMimeSupported($mimetype) && $exist) {
$tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => dirname($activity['file']))));
$tmpl->assign('previewImageLink', Util::linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150)));
} else {
$tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => $activity['file'])));
$tmpl->assign('previewImageLink', \OC_Helper::mimetypeIcon($is_dir ? 'dir' : $mimetype));
$tmpl->assign('previewLinkIsDir', true);
}
}
return $tmpl->fetchPage();
}
示例5: search
public function search($query)
{
$unescape = function ($value) {
return strtr($value, array('\\,' => ',', '\\;' => ';'));
};
$searchresults = array();
$results = \OCP\Contacts::search($query, array('N', 'FN', 'EMAIL', 'NICKNAME', 'ORG'));
$l = new \OC_l10n('contacts');
foreach ($results as $result) {
$link = \OCP\Util::linkToRoute('contacts_index') . '#' . $result['id'];
$props = array();
$display = isset($result['FN']) && $result['FN'] ? $result['FN'] : null;
foreach (array('EMAIL', 'NICKNAME', 'ORG') as $searchvar) {
if (isset($result[$searchvar]) && $result[$searchvar]) {
if (is_array($result[$searchvar])) {
$result[$searchvar] = array_filter($result[$searchvar]);
}
$prop = is_array($result[$searchvar]) ? implode(',', $result[$searchvar]) : $result[$searchvar];
$props[] = $prop;
$display = $display ?: $result[$searchvar];
}
}
$props = array_map($unescape, $props);
$searchresults[] = new \OC_Search_Result($display, implode(', ', $props), $link, (string) $l->t('Contact'), null);
//$name,$text,$link,$type
}
return $searchresults;
}
示例6: __construct
/**
* Constructor
*
* @param array $data
* @return \OCA\Contacts\Search\Contact
*/
public function __construct(array $data = null)
{
$this->id = $data['id'];
$this->name = stripcslashes($data['FN']);
$this->link = \OCP\Util::linkToRoute('contacts_index') . '#' . $data['id'];
$this->address = $this->checkAndMerge($data, 'ADR');
$this->phone = $this->checkAndMerge($data, 'TEL');
$this->email = $this->checkAndMerge($data, 'EMAIL');
$this->nickname = $this->checkAndMerge($data, 'NICKNAME');
$this->organization = $this->checkAndMerge($data, 'ORG');
}
示例7: frontpage
/**
* Entry point for the chart system
*
* @NoCSRFRequired
* @NoAdminRequired
* @return TemplateResponse
*/
public function frontpage()
{
$charts = $this->configService->getCharts();
if (count($charts) == 0) {
$this->configService->createDefaultConfig();
$charts = $this->configService->getCharts();
}
$id = $charts[0]->getId();
$url = \OCP\Util::linkToRoute('ocusagecharts.chart.display_chart', array('id' => $id));
return new RedirectResponse($url);
}
示例8: checkForExpiredPasswords
private function checkForExpiredPasswords()
{
$sql = 'SELECT * FROM `*PREFIX*passman_items` where expire_time < ? AND expire_time > 0 ';
$expire_time = time() * 1000;
$query = $this->db->prepareQuery($sql);
$query->bindParam(1, $expire_time, \PDO::PARAM_INT);
$result = $query->execute();
$sendTime = time() - 1;
while ($row = $result->fetchRow()) {
$this->logger->info($row['label'] . ' is expired', array('app' => 'passman'));
$remoteUrl = \OCP\Util::linkToRoute('passman.page.index') . '#selectItem=' . $row['id'];
$this->notification->add('item_expired', array($row['label']), '', array(), $remoteUrl, $row['user_id'], 'passman_item_expired');
}
}
示例9: getWeatherData
private function getWeatherData($unit)
{
if ($this->city != "") {
$additionalParameter = "";
if ($unit == "c") {
$additionalParameter .= "&units=metric";
}
$url = $this->basicUrl . $this->city . $this->fixUrlParameter . $additionalParameter;
//OCP\Util::writeLog('ocDashboard',"openweather xml url: ".$url, \OCP\Util::DEBUG);
$reader = new XMLReader();
$reader->open($url);
$data = array();
while ($reader->read()) {
if ($reader->nodeType == XMLReader::ELEMENT) {
if (isset($this->xmlNodeAttributes[$reader->name])) {
$n = 0;
while (isset($data[$n][$reader->name])) {
$n++;
}
foreach ($this->xmlNodeAttributes[$reader->name] as $key) {
$data[$n][$reader->name][$key] = $reader->getAttribute($key);
}
if (in_array($reader->name, $this->xmlAddUnit)) {
$data[$n][$reader->name]['unit'] = $this->getUnit($reader->name, $unit);
}
} else {
if (isset($this->xmlNodeValueKeys[$reader->name])) {
$data[$reader->name] = $reader->readInnerXml();
}
}
}
}
$reader->close();
if (count($data) > 0) {
$this->weatherData = $data;
} else {
OCP\Util::writeLog('ocDashboard', "openweather - could not fetch data for " . $this->city, \OCP\Util::ERROR);
$this->errorMsg = $this->l->t("Could not fetch data for \"%s\".<br>Please try another value.<br><a href='%s'>» settings</a>", array($this->city, \OCP\Util::linkToRoute('settings_personal')));
}
}
}
示例10: search
function search($query)
{
$unescape = function ($value) {
return strtr($value, array('\\,' => ',', '\\;' => ';'));
};
$app = new App();
$searchresults = array();
$results = \OCP\Contacts::search($query, array('N', 'FN', 'EMAIL', 'NICKNAME', 'ORG'));
$l = new \OC_l10n('contacts');
foreach ($results as $result) {
$link = \OCP\Util::linkToRoute('contacts_index') . '#' . $result['id'];
$props = array();
foreach (array('EMAIL', 'NICKNAME', 'ORG') as $searchvar) {
if (isset($result[$searchvar]) && count($result[$searchvar]) > 0 && strlen($result[$searchvar][0]) > 3) {
$props = array_merge($props, $result[$searchvar]);
}
}
$props = array_map($unescape, $props);
$searchresults[] = new \OC_Search_Result($result['FN'], implode(', ', $props), $link, (string) $l->t('Contact'));
//$name,$text,$link,$type
}
return $searchresults;
}
示例11:
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
OCP\App::checkAppEnabled('ocusagecharts');
OCP\App::setActiveNavigationEntry('ocusagecharts');
OCP\App::addNavigationEntry(Array(
'id' => 'ocusagecharts',
'order' => 60,
'href' => \OCP\Util::linkToRoute('ocusagecharts.chart.frontpage'),
'icon' => OCP\Util::imagePath('ocusagecharts', 'iconchart.png'),
'name' => \OC_L10N::get('ocusagecharts')->t('ocUsageCharts')
));
\OCP\Util::addStyle('ocusagecharts', 'style');
\OCP\Backgroundjob::registerJob('OCA\ocUsageCharts\Command\UpdateUserStorageCommand');
示例12: enrichDownloadUrl
/**
* @param string $messageId
* @param $accountId
* @param $folderId
* @return callable
*/
private function enrichDownloadUrl($accountId, $folderId, $messageId, $attachment)
{
$downloadUrl = \OCP\Util::linkToRoute('mail.messages.downloadAttachment', ['accountId' => $accountId, 'folderId' => $folderId, 'messageId' => $messageId, 'attachmentId' => $attachment['id']]);
$downloadUrl = \OC::$server->getURLGenerator()->getAbsoluteURL($downloadUrl);
$attachment['downloadUrl'] = $downloadUrl;
$attachment['mimeUrl'] = \OC_Helper::mimetypeIcon($attachment['mime']);
return $attachment;
}
示例13: p
<h1><?php p($l->t($_['chart']->getConfig()->getChartType())); ?></h1>
<?php
echo '<div class="chart" id="chart"><div class="icon-loading" style="height: 60px;"></div></div>';
?>
<?php
$url = \OCP\Util::linkToRoute('ocusagecharts.chart_api.load_chart', array('id' => $_['chart']->getConfig()->getId(), 'requesttoken' => $_['requesttoken']));
?>
<div style="display: none;" data-url="<?php echo $url; ?>" id="defaultBar"></div>
示例14: p
type="file"
id="article-upload"
name="importarticle"
news-read-file="Settings.importArticles($fileContent)"/>
<button title="<?php p($l->t('Import')); ?>"
class="icon-upload svg button-icon-label"
ng-class="{'entry-loading': Settings.isArticlesImporting}"
ng-disabled=
"Settings.isOPMLImporting || Settings.isArticlesImporting"
news-trigger-click="#article-upload">
</button>
<a title="<?php p($l->t('Export')); ?>"
class="button icon-download svg button-icon-label"
href="<?php p(\OCP\Util::linkToRoute('news.export.articles')); ?>"
target="_blank"
ng-hide="App.isFirstRun()">
</a>
<button
class="icon-download svg button-icon-label"
title="<?php p($l->t('Export')); ?>"
ng-show="App.isFirstRun()"
disabled>
</button>
<p class="error" ng-show="Settings.articleImportError">
<?php p(
$l->t('Error when importing: file does not contain valid JSON')
); ?>
</p>
示例15: header
\OCP\App::checkAppEnabled('collaboration');
OCP\App::setActiveNavigationEntry('collaboration');
OCP\Util::addScript('collaboration', 'update_task');
OCP\Util::addScript('collaboration/3rdparty', 'jquery-ui-sliderAccess');
OCP\Util::addScript('collaboration/3rdparty', 'jquery-ui-timepicker-addon');
OCP\Util::addScript('collaboration/3rdparty', 'jquery-te');
OCP\Util::addStyle('collaboration/3rdparty', 'jquery-te');
OCP\Util::addStyle('collaboration/3rdparty', 'jquery-ui-timepicker-addon');
OCP\Util::addStyle('collaboration', 'content_header');
OCP\Util::addStyle('collaboration', 'tabs');
OCP\Util::addStyle('collaboration', 'update_task');
$l = OC_L10N::get('collaboration');
$tpl = new OCP\Template('collaboration', 'update_task', 'user');
$bol = OC_Collaboration_Project::isAdmin();
if ($bol == true) {
if (isset($_POST['tid'])) {
$tpl->assign('title', $l->t('Update Task'));
$tpl->assign('submit_btn_name', $l->t('Update'));
$tpl->assign('tid', $_POST['tid']);
$tpl->assign('task_details', OC_Collaboration_Task::readTask($_POST['tid']));
} else {
$tpl->assign('title', $l->t('Create Task'));
$tpl->assign('submit_btn_name', $l->t('Create'));
$tpl->assign('projects', OC_Collaboration_Project::getProjects(OC_User::getUser()));
}
$tpl->printPage();
} else {
header('Location: ' . \OCP\Util::linkToRoute('collaboration_route', array('rel_path' => 'dashboard')));
\OCP\Util::writeLog('collaboration', 'Permission denied for ' . OC_User::getUser() . ' to create task.', \OCP\Util::WARN);
exit;
}