Beispiel #1
0
 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!');
     }
 }
Beispiel #2
0
             $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) {