本文整理汇总了PHP中Backend::addToUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Backend::addToUrl方法的具体用法?PHP Backend::addToUrl怎么用?PHP Backend::addToUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Backend
的用法示例。
在下文中一共展示了Backend::addToUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateRendererButton
/**
* Generate the metamodels renderer button.
*
* @param array $row Current row.
* @param string $href The button href.
* @param string $label The button label.
* @param string $title The button title.
* @param string $icon The button icon.
* @param string $attributes Optional attributes.
*
* @return string
*/
public function generateRendererButton($row, $href, $label, $title, $icon, $attributes)
{
if (empty($this->layers[$row['type']]['metamodels'])) {
return '';
}
return sprintf('<a href="%s" title="%s">%s</a> ', \Backend::addToUrl($href . '&id=' . $row['id']), $title, \Image::getHtml($icon, $label, $attributes));
}
示例2: generateButton
/**
* Generate the clear cache button.
*
* @param array $row The data row.
* @param string $href The link.
* @param string $label The label.
* @param string $title The title.
* @param string $icon The icon.
* @param string $attributes The attributes.
*
* @return string
*/
public function generateButton($row, $href, $label, $title, $icon, $attributes)
{
$count = $this->service()->countPageCacheEntries($row['id']);
if (!$count) {
return \Image::getHtml($icon, $label, 'style="opacity:0.5;filter: gray;-webkit-filter: grayscale(100%);"');
}
return sprintf('<a href="%s" title="%s"%s>%s</a> ', \Backend::addToUrl($href . '&id=' . $row['id']), $title . sprintf($GLOBALS['TL_LANG']['tl_page']['clearCacheCount'], $count), $attributes, \Image::getHtml($icon, $label));
}
示例3: callbackEditButton
/**
* Callback edit button
* @return string
*/
public function callbackEditButton($row, $href, $label, $title, $icon, $attributes, $strTable, $arrRootIds, $arrChildRecordIds, $blnCircularReference, $strPrevious, $strNext)
{
$return = '';
$strDcaKey = array_search($row['form'], $this->Formdata->arrFormsDcaKey);
if ($strDcaKey) {
$return .= '<a href="' . \Backend::addToUrl($href . '&do=fd_' . $strDcaKey . '&id=' . $row['id']) . '" title="' . specialchars($title) . '"' . $attributes . '>' . \Image::getHtml($icon, $label) . '</a> ';
}
return $return;
}
示例4: applyFilter
/**
* Apply a filter when looking at the history.
*
* @return void
*/
public function applyFilter()
{
if (\Input::get('providerName') && \Input::get('id')) {
$entityId = EntityId::fromProviderNameAndId(\Input::get('providerName'), \Input::get('id'));
$session = \Session::getInstance();
$filter = $session->get('filter');
$filter['tl_workflow_state'] = array('entityId' => (string) $entityId);
$session->set('filter', $filter);
\Backend::redirect(\Backend::addToUrl('providerName=', true, array('providerName', 'id')));
}
}
示例5: toggleIcon
/**
* Return the "toggle visibility" button
* @param array
* @param string
* @param string
* @param string
* @param string
* @param string
* @return string
*/
public function toggleIcon($row, $href, $label, $title, $icon, $attributes)
{
if (strlen(\Input::get('tid'))) {
$this->toggleVisibility(\Input::get('tid'), \Input::get('state') == 1, @func_get_arg(12) ?: null);
\Backend::redirect(\Controller::getReferer());
}
$href .= '&tid=' . $row['id'] . '&state=' . ($row['published'] ? '' : 1);
if (!$row['published']) {
$icon = 'invisible.gif';
}
return '<a href="' . \Backend::addToUrl($href) . '" title="' . specialchars($title) . '"' . $attributes . '>' . \Image::getHtml($icon, $label) . '</a> ';
}
示例6: redirect
/**
* Redirect to the content page when trying to access the content node.
*
* This fixes the edit links on the header.
*
* @return void
*/
public function redirect()
{
if ($this->input->get('table') === 'tl_content_node') {
$model = \ContentModel::findByPk($this->input->get('id'));
if (!$model) {
\Controller::log(sprintf('Content node "%s" not found', $this->input->get('id')), __METHOD__, TL_ERROR);
\Controller::redirect('contao/main.php?act=error');
}
$nodes = $model->ptable === 'tl_content_node' ? '1' : '';
$url = \Backend::addToUrl('table=tl_content&nodes=' . $nodes);
\Controller::redirect($url);
}
}
示例7: generate
/**
* Generate the wrapper.
*
* @return string
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function generate()
{
// backend mode
if (TL_MODE == 'BE') {
if (!$this->wrapper->isTypeOf(Wrapper\Helper::TYPE_START) && !$this->bootstrap_parentId) {
return sprintf('<a href="%s" class="bootstrap-wrapper-incomplete">%s</a>', \Backend::addToUrl('act=edit&bootstrap=parent&id=' . $this->id), $GLOBALS['TL_LANG']['tl_content']['fixBootstrapParent']);
}
if ($this->wrapper->isTypeOf(Wrapper\Helper::TYPE_STOP)) {
return '';
}
// do not display title if element is a wrapper element
if (version_compare(VERSION, '3.1', '<')) {
return sprintf('<strong class="title">%s</strong>', $this->type);
}
return '';
}
$this->wrapperType = $this->wrapper->getType();
return parent::generate();
}
示例8: pasteButton
public function pasteButton(\DataContainer $dc, $row, $table, $cr, $arrClipboard = null)
{
$html = '';
if ($row['id'] > 0) {
if ($row['pid'] > 0) {
$parentCondition = ConditionModel::findByPk($row['pid']);
$disabled = $parentCondition->type != 'or' && $parentCondition->type != 'and' && ($parentCondition->type != 'parent' || (bool) ConditionModel::findBy('pid', $row['id']));
} else {
$disabled = false;
}
if ($disabled) {
$html .= \Image::getHtml('pasteafter_.gif', sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id']));
} else {
$html .= sprintf('<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ', \Backend::addToUrl('act=' . $arrClipboard['mode'] . '&mode=1&pid=' . $row['id'] . (!is_array($arrClipboard['id']) ? '&id=' . $arrClipboard['id'] : '')), specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id'])), \Image::getHtml('pasteafter.gif', sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id'])));
}
}
if ($row['id'] == 0 || $row['type'] == 'or' || $row['type'] == 'and' || $row['type'] == 'parent' && !ConditionModel::findBy('pid', $row['id'])) {
$html .= sprintf('<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ', \Backend::addToUrl('act=' . $arrClipboard['mode'] . '&mode=2&pid=' . $row['id'] . (!is_array($arrClipboard['id']) ? '&id=' . $arrClipboard['id'] : '')), specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id'])), \Image::getHtml('pasteinto.gif', sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id'])));
} else {
$html .= \Image::getHtml('pasteinto_.gif', sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id']));
}
return $html;
}
示例9: renderDropdown
/**
* Render the versions dropdown menu
*
* @return string
*/
public function renderDropdown()
{
$objVersion = $this->Database->prepare("SELECT tstamp, version, username, active FROM tl_version WHERE fromTable=? AND pid=? ORDER BY version DESC")->execute($this->strTable, $this->intPid);
if ($objVersion->numRows < 2) {
return '';
}
$versions = '';
while ($objVersion->next()) {
$versions .= '
<option value="' . $objVersion->version . '"' . ($objVersion->active ? ' selected="selected"' : '') . '>' . $GLOBALS['TL_LANG']['MSC']['version'] . ' ' . $objVersion->version . ' (' . \Date::parse(\Config::get('datimFormat'), $objVersion->tstamp) . ') ' . $objVersion->username . '</option>';
}
return '
<div class="tl_version_panel">
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_version" class="tl_form" method="post">
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="tl_version">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<select name="version" class="tl_select">' . $versions . '
</select>
<input type="submit" name="showVersion" id="showVersion" class="tl_submit" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['restore']) . '">
<a href="' . \Backend::addToUrl('versions=1&popup=1') . '" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['showDifferences']) . '" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'' . specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MSC']['showDifferences'])) . '\',\'url\':this.href});return false">' . \Image::getHtml('diff.gif') . '</a>
</div>
</form>
</div>
';
}
示例10: _addToUrl
/**
* Add and remove parameters from the current url.
*
* @param string|array $parameters Array of parameters to set.
*
* @param bool $addRefererId Flag if the referer token shall be added to the url.
*
* @param array $unsetParameters Array of parameters that shall be unset.
*
* @return string
*
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* @codingStandardsIgnoreStart
*/
public function _addToUrl($parameters, $addRefererId = true, $unsetParameters = array())
{
if (is_array($parameters)) {
$parameters = http_build_query($parameters);
}
if (TL_MODE == 'BE') {
return \Backend::addToUrl($parameters, $addRefererId, $unsetParameters);
}
return \Controller::addToUrl($parameters, $addRefererId, $unsetParameters);
}
示例11: addNode
/**
* Add a node.
*
* @param int $nodeId The node id.
* @param string $label The label.
* @param string|null $class The class.
* @param bool $nodes The nodes.
*
* @return $this
*/
public function addNode($nodeId, $label, $class = null, $nodes = true)
{
$this->nodes[] = array('id' => $nodeId, 'label' => $label, 'class' => $class, 'link' => \Backend::addToUrl('id=' . $nodeId . '&nodes=' . (int) $nodes));
return $this;
}
示例12: renderGrouptree
/**
* Recursively render the grouptree
* @param integer
* @param integer
* @param boolean
* @return string
*/
protected function renderGrouptree($id, $intMargin, $blnNoRecursion = false)
{
$session = $this->Session->getData();
$flag = substr($this->strField, 0, 2) . 'g';
$node = 'tree_' . $this->strTable . '_' . $this->strField;
$xtnode = 'tree_' . $this->strTable . '_' . $this->strName;
// Get session data and toggle nodes
if (\Input::get($flag . 'tg')) {
$session[$node][\Input::get($flag . 'tg')] = isset($session[$node][\Input::get($flag . 'tg')]) && $session[$node][\Input::get($flag . 'tg')] == 1 ? 0 : 1;
$this->Session->setData($session);
\Controller::redirect(preg_replace('/(&(amp;)?|\\?)' . $flag . 'tg=[^& ]*/i', '', \Environment::get('request')));
}
$objGroup = \Database::getInstance()->prepare("SELECT * FROM tl_iso_group WHERE id=?")->execute($id);
// Return if there is no result
if ($objGroup->numRows < 1) {
return '';
}
$return = '';
$intSpacing = 20;
$childs = array();
// Check whether there are child records
if (!$blnNoRecursion) {
$objNodes = \Database::getInstance()->prepare("SELECT id FROM tl_iso_group WHERE pid=? ORDER BY sorting")->execute($id);
if ($objNodes->numRows) {
$childs = $objNodes->fetchEach('id');
}
}
$return .= "\n " . '<li class="tl_file" onmouseover="Theme.hoverDiv(this, 1);" onmouseout="Theme.hoverDiv(this, 0);" onclick="Theme.toggleSelect(this)"><div class="tl_left" style="padding-left:' . ($intMargin + $intSpacing) . 'px;">';
$folderAttribute = 'style="margin-left:20px;"';
$session[$node][$id] = is_numeric($session[$node][$id]) ? $session[$node][$id] : 0;
$level = $intMargin / $intSpacing + 1;
$blnIsOpen = $session[$node][$id] == 1 || in_array($id, $this->arrNodes);
if (!empty($childs)) {
$folderAttribute = '';
$img = $blnIsOpen ? 'folMinus.gif' : 'folPlus.gif';
$alt = $blnIsOpen ? $GLOBALS['TL_LANG']['MSC']['collapseNode'] : $GLOBALS['TL_LANG']['MSC']['expandNode'];
$return .= '<a href="' . \Backend::addToUrl($flag . 'tg=' . $id) . '" title="' . specialchars($alt) . '" onclick="Backend.getScrollOffset(); return Isotope.toggleProductGroupTree(this, \'' . $xtnode . '_' . $id . '\', \'' . $this->strField . '\', \'' . $this->strName . '\', ' . $level . ');">' . \Image::getHtml($img, '', 'style="margin-right:2px;"') . '</a>';
}
$callback = $GLOBALS['TL_DCA']['tl_iso_group']['list']['label']['label_callback'];
// Load the label_callback
if (is_array($callback) && !empty($callback)) {
$return .= static::importStatic($callback[0])->{$callback}[1]($objGroup->row(), $objGroup->name, null, $folderAttribute);
}
$return .= '</div> <div class="tl_right">';
// Add checkbox or radio button
switch ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['fieldType']) {
case 'checkbox':
$return .= '<input type="checkbox" name="' . $this->strName . '[]" id="' . $this->strName . '_' . $id . '" class="tl_tree_checkbox" value="' . specialchars($id) . '" onfocus="Backend.getScrollOffset()"' . static::optionChecked($id, $this->varValue) . '>';
break;
default:
case 'radio':
$return .= '<input type="radio" name="' . $this->strName . '" id="' . $this->strName . '_' . $id . '" class="tl_tree_radio" value="' . specialchars($id) . '" onfocus="Backend.getScrollOffset()"' . static::optionChecked($id, $this->varValue) . '>';
break;
}
$return .= '</div><div style="clear:both"></div></li>';
// Begin a new submenu
if (!empty($childs) && ($blnIsOpen || $this->Session->get('product_group_selector_search') != '')) {
$return .= '<li class="parent" id="' . $node . '_' . $id . '"><ul class="level_' . $level . '">';
for ($k = 0, $c = count($childs); $k < $c; $k++) {
$return .= $this->renderGrouptree($childs[$k], $intMargin + $intSpacing);
}
$return .= '</ul></li>';
}
return $return;
}
示例13: addButtons
/**
* Adds the buttons to the buttons bar and exports the data if it is an export button.
*
* @param array $arrButtons
*
* @return mixed
*/
public function addButtons($arrButtons)
{
$arrConfigs = \Database::getInstance()->prepare("SELECT id, name FROM tl_lead_export WHERE pid=? ORDER BY name")->execute(\Input::get('master'))->fetchAllAssoc();
// Run the export
if ('tl_select' === \Input::post('FORM_SUBMIT')) {
$arrIds = \Input::post('IDS');
if (empty($arrIds)) {
\Controller::reload();
}
if (\Input::post('notification')) {
\Controller::redirect(\Backend::addToUrl('key=notification'));
}
foreach ($arrConfigs as $config) {
if (\Input::post('export_' . $config['id'])) {
$this->exportAndCatchExceptions($config['id'], $arrIds);
}
}
}
\System::loadLanguageFile('tl_lead_export');
// Generate buttons
foreach ($arrConfigs as $config) {
$arrButtons['export_' . $config['id']] = '<input type="submit" name="export_' . $config['id'] . '" id="export_' . $config['id'] . '" class="tl_submit" value="' . specialchars($GLOBALS['TL_LANG']['tl_lead']['export'][0] . ' "' . $config['name'] . '"') . '">';
}
// Notification Center integration
if (\Leads\NotificationCenterIntegration::available(true)) {
$arrButtons['notification'] = '<input type="submit" name="notification" id="notification" class="tl_submit" value="' . specialchars($GLOBALS['TL_LANG']['tl_lead']['notification'][0]) . '">';
}
return $arrButtons;
}
示例14: generateButton
/**
* Generate a button.
*
* @param array $row Current row.
* @param string $href The button href.
* @param string $label The button label.
* @param string $title The button title.
* @param string $icon The button icon.
* @param string $attributes Optional attributes.
*
* @return string
*/
protected function generateButton($row, $href, $label, $title, $icon, $attributes)
{
return sprintf('<a href="%s" title="%s">%s</a> ', \Backend::addToUrl($href . '&id=' . $row['id']), $title, \Image::getHtml($icon, $label, $attributes));
}
示例15: listFileFor
/**
* List an file
*
* @param array
*
* @return string
*/
public function listFileFor($row, $layoutField = false)
{
switch ($row['type']) {
case 'code':
$label = $row['code_snippet_title'];
break;
case 'url':
$label = preg_replace('#/([^/]+)$#', '/<strong>$1</strong>', $row['url']);
break;
case 'file':
if ($row['filesource'] == $GLOBALS['TL_CONFIG']['uploadPath'] && version_compare(VERSION, '3', '>=')) {
$file = version_compare(VERSION, '3.2', '>=') ? \FilesModel::findByUuid($row['file']) : \FilesModel::findByPk($row['file']);
if ($file) {
$label = preg_replace('#/([^/]+)$#', '/<strong>$1</strong>', $file->path);
break;
}
} else {
$label = preg_replace('#([^/]+)$#', '<strong>$1</strong>', $row['file']);
break;
}
default:
$label = '?';
}
if ($row['inline']) {
\Controller::loadLanguageFile('tl_theme_plus_file');
$label = sprintf('<span title="%s">‹›</span> %s', htmlentities($GLOBALS['TL_LANG']['tl_theme_plus_file']['inline'], ENT_QUOTES, 'UTF-8'), $label);
} else {
if ($row['standalone']) {
\Controller::loadLanguageFile('tl_theme_plus_file');
$label = sprintf('<span title="%s">×</span> %s', htmlentities($GLOBALS['TL_LANG']['tl_theme_plus_file']['standalone'], ENT_QUOTES, 'UTF-8'), $label);
}
}
if (strlen($row['position'])) {
$label = '[' . strtoupper($row['position']) . '] ' . $label;
}
if (strlen($row['cc'])) {
$label .= ' <span style="padding-left: 3px; color: #B3B3B3;">[' . $row['cc'] . ']</span>';
}
$filterRules = static::renderFilterRules($row);
if ($filterRules) {
$label .= sprintf('<br><span style="margin-left: 20px; padding-left: 3px; color: #B3B3B3;">[%s]</span>', $filterRules);
}
if ($layoutField) {
$assignedLayouts = [];
$themes = \ThemeModel::findAll(['order' => 'name']);
foreach ($themes as $theme) {
$assignedThemeLayouts = [];
$layouts = \LayoutModel::findBy('pid', $theme->id, ['order' => 'name']);
foreach ($layouts as $layout) {
$files = deserialize($layout->{$layoutField}, true);
if (in_array($row['id'], $files)) {
$assignedThemeLayouts[$layout->id] = $layout->name;
}
}
if (count($assignedThemeLayouts)) {
$assignedLayouts[$theme->name] = $assignedThemeLayouts;
}
}
if (count($assignedLayouts)) {
$label .= '<ul style="margin-left: 20px; padding-left: 3px; color: #B3B3B3;">';
foreach ($assignedLayouts as $theme => $layouts) {
$label .= '<li>';
$label .= sprintf('<strong>%s</strong>', $theme);
$label .= '<ul>';
foreach ($layouts as $id => $layout) {
$label .= sprintf('<li> ↳ <a href="%s">%s</a></li>', \Backend::addToUrl('table=tl_layout&act=edit&id=' . $id), $layout);
}
$label .= '</ul>';
$label .= '</li>';
}
$label .= '</ul>';
}
}
$image = 'assets/theme-plus/images/' . $row['type'] . '.png';
return '<div>' . ($image ? $this->generateImage($image, $label, 'style="vertical-align:-3px"') . ' ' : '') . $label . "</div>\n";
}