/** * 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; }
public function setClang($value) { if (!rex_clang::exists($value)) { $value = rex_clang::getCurrentId(); } $this->clang = $value; }
/** * Löscht eine Clang. * * @param int $id Zu löschende ClangId * * @throws rex_exception */ public static function deleteCLang($id) { $startClang = rex_clang::getStartId(); if ($id == $startClang) { throw new rex_functional_exception(rex_i18n::msg('clang_error_startidcanotbedeleted', $startClang)); } if (!rex_clang::exists($id)) { throw new rex_functional_exception(rex_i18n::msg('clang_error_idcanotbedeleted', $id)); } $clang = rex_clang::get($id); $del = rex_sql::factory(); $del->setQuery('delete from ' . rex::getTablePrefix() . 'clang where id=?', [$id]); rex_sql_util::organizePriorities(rex::getTable('clang'), 'priority', '', 'priority'); rex_delete_cache(); // ----- EXTENSION POINT rex_extension::registerPoint(new rex_extension_point('CLANG_DELETED', '', ['id' => $clang->getId(), 'name' => $clang->getName(), 'clang' => $clang])); }
} // ----- add clang if ($add_clang_save || $edit_clang_save) { if ($clang_code == '') { $error = rex_i18n::msg('enter_code'); $func = $add_clang_save ? 'addclang' : 'editclang'; } elseif ($clang_name == '') { $error = rex_i18n::msg('enter_name'); $func = $add_clang_save ? 'addclang' : 'editclang'; } elseif ($add_clang_save) { $success = rex_i18n::msg('clang_created'); rex_clang_service::addCLang($clang_code, $clang_name, $clang_prio); unset($clang_id); $func = ''; } else { if (rex_clang::exists($clang_id)) { rex_clang_service::editCLang($clang_id, $clang_code, $clang_name, $clang_prio); $success = rex_i18n::msg('clang_edited'); $func = ''; unset($clang_id); } } } if ($success != '') { $message .= rex_view::success($success); } if ($error != '') { $message .= rex_view::error($error); } $content .= ' <table class="table table-striped table-hover">
* Verwaltung der Inhalte. EditierModul / Metadaten ... * * @package redaxo5 */ /* // TODOS: // - alles vereinfachen // - <?php ?> $ Problematik bei REX_ACTION */ $content = ''; $article_id = rex_request('article_id', 'int'); $clang = rex_request('clang', 'int'); $slice_id = rex_request('slice_id', 'int', ''); $function = rex_request('function', 'string'); $article_id = rex_article::get($article_id) ? $article_id : 0; $clang = rex_clang::exists($clang) ? $clang : rex_clang::getStartId(); $article_revision = 0; $slice_revision = 0; $template_attributes = []; $warning = ''; $global_warning = ''; $info = ''; $global_info = ''; $article = rex_sql::factory(); $article->setQuery(' SELECT article.*, template.attributes as template_attributes FROM ' . rex::getTablePrefix() . 'article as article LEFT JOIN ' . rex::getTablePrefix() . "template as template\n ON template.id=article.template_id\n WHERE\n article.id='{$article_id}'\n AND clang_id={$clang}"); if ($article->getRows() == 1) {