/** * Gibt eine Url zu einem Artikel zurück. * * @param int|null $id * @param int|null $clang SprachId des Artikels * @param array $params Array von Parametern * @param string $separator * * @return string * * @package redaxo\structure */ function rex_getUrl($id = null, $clang = null, array $params = [], $separator = '&') { $id = (int) $id; $clang = (int) $clang; // ----- get id if ($id == 0) { $id = rex::getProperty('article_id'); } // ----- get clang // Wenn eine rexExtension vorhanden ist, immer die clang mitgeben! // Die rexExtension muss selbst entscheiden was sie damit macht if (!rex_clang::exists($clang) && (rex_clang::count() > 1 || rex_extension::isRegistered('URL_REWRITE'))) { $clang = rex_clang::getCurrentId(); } // ----- EXTENSION POINT $url = rex_extension::registerPoint(new rex_extension_point('URL_REWRITE', '', ['id' => $id, 'clang' => $clang, 'params' => $params, 'separator' => $separator])); if ($url == '') { if (rex_clang::count() > 1) { $clang = $separator . 'clang=' . $clang; } else { $clang = ''; } $params = rex_string::buildQuery($params, $separator); $params = $params ? $separator . $params : ''; $url = rex_url::frontendController() . '?article_id=' . $id . $clang . $params; } return $url; }
/** * Gibt eine Url zu einem Artikel zurück. * * @param string $_id * @param int|string $_clang SprachId des Artikels * @param array|string $_params Array von Parametern * @param bool $escape Flag whether the argument separator "&" should be escaped (&) * * @return string * * @package redaxo\structure */ function rex_getUrl($_id = '', $_clang = '', $_params = '', $escape = true) { $id = (int) $_id; $clang = (int) $_clang; // ----- get id if ($id == 0) { $id = rex::getProperty('article_id'); } // ----- get clang // Wenn eine rexExtension vorhanden ist, immer die clang mitgeben! // Die rexExtension muss selbst entscheiden was sie damit macht if ($_clang === '' && (rex_clang::count() > 1 || rex_extension::isRegistered('URL_REWRITE'))) { $clang = rex_clang::getCurrentId(); } // ----- get params $param_string = rex_param_string($_params, $escape ? '&' : '&'); $name = 'NoName'; if ($id != 0) { $ooa = rex_article::get($id, $clang); if ($ooa) { $name = rex_parse_article_name($ooa->getName()); } } // ----- EXTENSION POINT $url = rex_extension::registerPoint(new rex_extension_point('URL_REWRITE', '', ['id' => $id, 'name' => $name, 'clang' => $clang, 'params' => $param_string, 'escape' => $escape])); if ($url == '') { $_clang = ''; if (rex_clang::count() > 1) { $_clang .= ($escape ? '&' : '&') . 'clang=' . $clang; } $url = rex_url::frontendController() . '?article_id=' . $id . $_clang . $param_string; } return $url; }
// ---------------------------- FUNKTIONEN FUER MODULE if ($function == 'delete') { $del = rex_sql::factory(); $del->setQuery('SELECT ' . rex::getTablePrefix() . 'article_slice.article_id, ' . rex::getTablePrefix() . 'article_slice.clang_id, ' . rex::getTablePrefix() . 'article_slice.ctype_id, ' . rex::getTablePrefix() . 'module.name FROM ' . rex::getTablePrefix() . 'article_slice LEFT JOIN ' . rex::getTablePrefix() . 'module ON ' . rex::getTablePrefix() . 'article_slice.module_id=' . rex::getTablePrefix() . 'module.id WHERE ' . rex::getTablePrefix() . "article_slice.module_id='{$module_id}' GROUP BY " . rex::getTablePrefix() . 'article_slice.article_id'); if ($del->getRows() > 0) { $module_in_use_message = ''; $modulname = htmlspecialchars($del->getValue(rex::getTablePrefix() . 'module.name')); for ($i = 0; $i < $del->getRows(); ++$i) { $aid = $del->getValue(rex::getTablePrefix() . 'article_slice.article_id'); $clang_id = $del->getValue(rex::getTablePrefix() . 'article_slice.clang_id'); $ctype = $del->getValue(rex::getTablePrefix() . 'article_slice.ctype_id'); $OOArt = rex_article::get($aid, $clang_id); $label = $OOArt->getName() . ' [' . $aid . ']'; if (rex_clang::count() > 1) { $label = '(' . rex_i18n::translate(rex_clang::get($clang_id)->getName()) . ') ' . $label; } $module_in_use_message .= '<li><a href="' . rex_url::backendPage('content', ['article_id' => $aid, 'clang' => $clang_id, 'ctype' => $ctype]) . '">' . htmlspecialchars($label) . '</a></li>'; $del->next(); } $error = rex_i18n::msg('module_cannot_be_deleted', $modulname); if ($module_in_use_message != '') { $error .= '<ul>' . $module_in_use_message . '</ul>'; } } else { $del->setQuery('DELETE FROM ' . rex::getTablePrefix() . "module WHERE id='{$module_id}'"); if ($del->getRows() > 0) { $del->setQuery('DELETE FROM ' . rex::getTablePrefix() . "module_action WHERE module_id='{$module_id}'"); $success = rex_i18n::msg('module_deleted'); } else {
<th class="rex-table-priority">' . rex_i18n::msg('clang_priority') . '</th> <th class="rex-table-action" colspan="2">' . rex_i18n::msg('clang_function') . '</th> </tr> </thead> <tbody> '; // Add form if ($func == 'addclang') { //ggf wiederanzeige des add forms, falls ungueltige id uebermittelt $content .= ' <tr class="mark"> <td class="rex-table-icon"><i class="rex-icon rex-icon-language"></i></td> <td class="rex-table-id" data-title="' . rex_i18n::msg('id') . '">–</td> <td data-title="' . rex_i18n::msg('clang_code') . '"><input class="form-control" type="text" id="rex-form-clang-code" name="clang_code" value="' . htmlspecialchars($clang_code) . '" autofocus /></td> <td data-title="' . rex_i18n::msg('clang_name') . '"><input class="form-control" type="text" id="rex-form-clang-name" name="clang_name" value="' . htmlspecialchars($clang_name) . '" /></td> <td class="rex-table-priority" data-title="' . rex_i18n::msg('clang_priority') . '"><input class="form-control" type="text" id="rex-form-clang-prio" name="clang_prio" value="' . ($clang_prio ?: rex_clang::count() + 1) . '" /></td> <td class="rex-table-action" colspan="2"><button class="btn btn-save" type="submit" name="add_clang_save"' . rex::getAccesskey(rex_i18n::msg('clang_add'), 'save') . ' value="1">' . rex_i18n::msg('clang_add') . '</button></td> </tr> '; } foreach (rex_clang::getAll() as $lang_id => $lang) { $add_td = '<td class="rex-table-id" data-title="' . rex_i18n::msg('id') . '">' . $lang_id . '</td>'; $delLink = rex_i18n::msg('delete'); if ($lang_id == rex_clang::getStartId()) { $delLink = '<span class="text-muted"><i class="rex-icon rex-icon-delete"></i> ' . $delLink . '</span>'; } else { $delLink = '<a href="' . rex_url::currentBackendPage(['func' => 'deleteclang', 'clang_id' => $lang_id]) . '" data-confirm="' . rex_i18n::msg('delete') . ' ?"><i class="rex-icon rex-icon-delete"></i> ' . $delLink . '</a>'; } // Edit form if ($func == 'editclang' && $clang_id == $lang_id) { $content .= '
/** * Returns a clang switch. * * @param rex_context $context * * @return string */ public static function clangSwitchAsDropdown(rex_context $context) { if (rex_clang::count() == 1) { return ''; } $button_label = ''; $items = []; foreach (rex_clang::getAll() as $id => $clang) { if (rex::getUser()->getComplexPerm('clang')->hasPerm($id)) { $item = []; $item['title'] = rex_i18n::translate($clang->getName()); $item['href'] = $context->getUrl(['clang' => $id]); if ($id == $context->getParam('clang')) { $item['active'] = true; $button_label = rex_i18n::translate($clang->getName()); } $items[] = $item; } } $fragment = new rex_fragment(); $fragment->setVar('class', 'rex-language'); $fragment->setVar('button_prefix', rex_i18n::msg('language')); $fragment->setVar('button_label', $button_label); $fragment->setVar('header', rex_i18n::msg('clang_select')); $fragment->setVar('items', $items, false); if (rex::getUser()->isAdmin()) { $fragment->setVar('footer', '<a href="' . rex_url::backendPage('system/lang') . '"><i class="fa fa-flag"></i> ' . rex_i18n::msg('languages_edit') . '</a>', false); } return $fragment->parse('core/dropdowns/dropdown.php'); }
$sql = 'SELECT * FROM ' . rex::getTable('yrewrite_domain') . ' where alias_domain = ""'; $list = rex_list::factory($sql, 100); $list->setColumnFormat('id', 'Id'); $list->addParam('page', 'yrewrite/domains'); $tdIcon = '<i class="fa fa-sitemap"></i>'; $thIcon = '<a href="' . $list->getUrl(['func' => 'add']) . '"' . rex::getAccesskey($this->i18n('add_domain'), 'add') . '><i class="rex-icon rex-icon-add"></i></a>'; $list->addColumn($thIcon, $tdIcon, 0, ['<th class="rex-table-icon">###VALUE###</th>', '<td class="rex-table-icon">###VALUE###</td>']); $list->setColumnParams($thIcon, ['func' => 'edit', 'data_id' => '###id###']); $list->setColumnParams('id', ['data_id' => '###id###', 'func' => 'edit']); $list->setColumnSortable('id'); $list->removeColumn('id'); $list->setColumnLabel('domain', $this->i18n('domain')); $list->setColumnLabel('mount_id', $this->i18n('mount_id')); $list->setColumnLabel('start_id', $this->i18n('start_id')); $list->setColumnLabel('notfound_id', $this->i18n('notfound_id')); if (rex_clang::count() > 0) { $list->setColumnLabel('clangs', $this->i18n('clangs')); $list->setColumnFormat('clangs', 'custom', function ($params) { $clangs = $params['subject']; if ($clangs == '') { $return = $this->i18n('alllangs'); } else { $return = []; foreach (explode(',', $clangs) as $clang) { $return[] = rex_clang::get($clang)->getName(); } if (count($return) > 1) { $return = implode(',', $return) . '<br />' . $this->i18n('clang_start') . ': ' . rex_clang::get($params['list']->getValue('clang_start'))->getName(); } else { $return = implode(',', $return); }
public function count() { return $this->hasAll() ? rex_clang::count() : count($this->perms); }