Skip to content
Snippets Groups Projects
Select Git revision
  • 4ca257fc8d5b9857f31de767a8d65fe5401c6ffe
  • main default protected
  • studip-rector
  • ci-opt
  • course-members-export-as-word
  • data-vue-app
  • pipeline-improvements
  • webpack-optimizations
  • rector
  • icon-renewal
  • http-client-and-factories
  • jsonapi-atomic-operations
  • vueify-messages
  • tic-2341
  • 135-translatable-study-areas
  • extensible-sorm-action-parameters
  • sorm-configuration-trait
  • jsonapi-mvv-routes
  • docblocks-for-magic-methods
19 results

GlobalSearchCourses.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    approving.php 2.52 KiB
    <?php
    require_once 'app/controllers/plugin_controller.php';
    
    class ApprovingController extends PluginController {
    
        function before_filter(&$action, &$args)
        {
            parent::before_filter($action, $args);
            if (!$GLOBALS['perm']->have_perm("root")) {
                throw new AcessDeniedException("Kein Zutritt");
            }
    
            Navigation::activateItem("/pluginmarket/approving");
            $this->set_content_type('text/html;charset=windows-1252');
        }
    
        public function overview_action()
        {
            $this->plugins = MarketPlugin::findBySQL("approved = 0 AND publiclyvisible = 1 ORDER BY mkdate DESC");
        }
    
        public function review_action($plugin_id) {
            $this->marketplugin = new MarketPlugin($plugin_id);
            if ($this->marketplugin['approved']) {
                throw new Exception("Plugin ist schon reviewt.");
            }
            if (Request::isXhr()) {
                $this->response->add_header('X-Title', _("Review schreiben"));
                $this->set_layout(null);
            }
        }
    
        public function approve_action($plugin_id) {
            $this->marketplugin = new MarketPlugin($plugin_id);
            if ($this->marketplugin['approved']) {
                throw new Exception("Plugin ist schon reviewt.");
            }
            $this->marketplugin['approved'] = (int) Request::int("approved");
            if (!$this->marketplugin['approved']) {
                $this->marketplugin['publiclyvisible'] = 0;
            }
            if ($this->marketplugin['approved'] && $this->marketplugin['publiclyvisible']) {
                $this->marketplugin['published'] = time();
            }
            $this->marketplugin->store();
    
            $messaging = new messaging();
            $messaging->insert_message(
                sprintf(_("Ihr Plugin %s wurde reviewt:"), $this->marketplugin['name'])
                    ."\n\n"
                    .($this->marketplugin['approved'] ? _("Es ist in den Marktplatz aufgenommen worden!") : _("Es ist leider noch nicht in den Marktplatz aufgenommen."))
                    ."\n\n"
                    .(Request::get("review") ? _("Begrndung:")."\n\n".Request::get("review") : _("Ein ausfhrliches Review wurde nicht angegeben und muss bei Bedarf direkt angefragt werden.")),
                get_username($this->marketplugin['user_id']),
                '',
                '',
                '',
                '',
                '',
                _("Pluginreview"),
                true,
                'normal',
                "pluginreview"
            );
    
            PageLayout::postMessage(MessageBox::success(_("Review wurde gespeichert.")));
            $this->redirect('approving/overview');
        }
    
    }