public function execute() { // the category to move $catId = rex_request('category-id', 'int'); // the destination category in which the given category will be moved $newCatId = rex_request('new-category-id', 'int'); // a optional priority for the moved category $newPriority = rex_request('new-priority', 'int', 0); /** * @var rex_user */ $user = rex::getUser(); // check permissions if ($user->getComplexPerm('structure')->hasCategoryPerm($catId) && $user->getComplexPerm('structure')->hasCategoryPerm($newCatId)) { rex_category_service::moveCategory($catId, $newCatId); // doesnt matter which clang id $data['catpriority'] = $newPriority; rex_category_service::editCategory($catId, 0, $data); $result = new rex_api_result(true, rex_i18n::msg('category_status_updated')); return $result; } else { throw new rex_api_exception('user has no permission for this category!'); } }
/** * Konvertiert einen Artikel in eine Kategorie. * * @param int $art_id Artikel ID des Artikels, der in eine Kategorie umgewandelt werden soll * * @return bool TRUE bei Erfolg, sonst FALSE */ public static function article2category($art_id) { $sql = rex_sql::factory(); // LANG SCHLEIFE foreach (rex_clang::getAllIds() as $clang) { // artikel $sql->setQuery('select parent_id, name from ' . rex::getTablePrefix() . "article where id={$art_id} and startarticle=0 and clang_id={$clang}"); if (!isset($parent_id)) { $parent_id = $sql->getValue('parent_id'); } // artikel updaten $sql->setTable(rex::getTablePrefix() . 'article'); $sql->setWhere(['id' => $art_id, 'clang_id' => $clang]); $sql->setValue('startarticle', 1); $sql->setValue('catname', $sql->getValue('name')); $sql->setValue('catpriority', 100); $sql->update(); rex_category_service::newCatPrio($parent_id, $clang, 0, 100); } rex_article_cache::deleteLists($parent_id); rex_article_cache::delete($art_id); foreach (rex_clang::getAllIds() as $clang) { rex_extension::registerPoint(new rex_extension_point('ART_TO_CAT', '', ['id' => $art_id, 'clang' => $clang])); } return true; }
$info = rex_i18n::msg('content_articlecopied'); ob_end_clean(); rex_response::sendRedirect($context->getUrl(['page' => 'content/edit', 'article_id' => $new_id, 'info' => $info], false)); } else { $warning = rex_i18n::msg('content_errorcopyarticle'); } } else { $warning = rex_i18n::msg('no_rights_to_this_function'); } } // ------------------------------------------ END: COPY ARTICLE // ------------------------------------------ START: MOVE CATEGORY if (rex_post('movecategory', 'boolean')) { $category_id_new = rex_post('category_id_new', 'int'); if (rex::getUser()->hasPerm('moveCategory[]') && rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($article->getValue('parent_id')) && rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($category_id_new)) { if ($category_id != $category_id_new && rex_category_service::moveCategory($category_id, $category_id_new)) { $info = rex_i18n::msg('category_moved'); ob_end_clean(); rex_response::sendRedirect($context->getUrl(['page' => 'content/edit', 'info' => $info], false)); } else { $warning = rex_i18n::msg('content_error_movecategory'); } } else { $warning = rex_i18n::msg('no_rights_to_this_function'); } } // ------------------------------------------ END: MOVE CATEGORY // ------------------------------------------ START: CONTENT HEAD MENUE $editPage = rex_be_controller::getPageObject('content/edit'); $editPage->setHref($context->getUrl(['page' => 'content/edit'], false)); foreach ($ctypes as $key => $val) {
} } } else { $clang = rex_clang::getStartId(); } $context = new rex_context(['page' => 'structure', 'category_id' => $category_id, 'article_id' => $article_id, 'clang' => $clang]); // --------------------- Extension Point echo rex_extension::registerPoint(new rex_extension_point('PAGE_STRUCTURE_HEADER_PRE', '', ['context' => $context])); // --------------------------------------------- TITLE echo rex_view::title(rex_i18n::msg('title_structure')); // --------------------------------------------- Languages echo rex_view::clangSwitchAsButtons($context); // --------------------------------------------- Path require __DIR__ . '/../functions/function_rex_category.php'; // -------------- STATUS_TYPE Map $catStatusTypes = rex_category_service::statusTypes(); $artStatusTypes = rex_article_service::statusTypes(); // --------------------------------------------- API MESSAGES echo rex_api_function::getMessage(); // --------------------------------------------- KATEGORIE LISTE $cat_name = 'Homepage'; $category = rex_category::get($category_id, $clang); if ($category) { $cat_name = $category->getName(); } $add_category = ''; if ($KATPERM) { $add_category = '<a href="' . $context->getUrl(['function' => 'add_cat', 'catstart' => $catstart]) . '"' . rex::getAccesskey(rex_i18n::msg('add_category'), 'add') . '><i class="rex-icon rex-icon-add-category"></i></a>'; } $data_colspan = 5; // --------------------- Extension Point