示例#1
0
 /**
  * Admin UI for workflow management
  */
 public function get_admin_index(array $args)
 {
     $this->mvc->authorization->require_admin();
     $this->data['workflows']['open'] = $this->get_open_workflows();
     $this->data['workflows']['closed'] = $this->get_closed_workflows();
     $this->data['repositories'] = com_meego_packages_controllers_repository::get_all_repositories();
 }
 /**
  * Checks some stuff based on submitted GET args
  * @param array
  */
 private function check_args(array $args)
 {
     $os = $args['os'];
     $os_version = $args['version'];
     $ux = $args['ux'];
     // check if OS is valid
     // this would be cheaper if we check the configuration, not the DB..
     if (!com_meego_packages_controllers_repository::os_exists($args['os'], $args['version'])) {
         $os = $this->mvc->configuration->default['os'];
         $os_version = $this->mvc->configuration->latest[$os]['version'];
         $ux = $this->mvc->configuration->latest[$os]['ux'];
         self::redirect($os, $os_version, $ux);
     }
     // check from the configuration if ux is valid
     if (!array_key_exists($args['ux'], $this->mvc->configuration->os_ux[$os])) {
         $found = false;
         // check for base category, perhaps the user wants that
         foreach ($basecategories as $basecategory) {
             if (self::tidy_up($basecategory->name) == self::tidy_up($args['ux'])) {
                 $found = true;
             }
         }
         if (!$found) {
             //if no such base category then complain
             //throw new midgardmvc_exception_notfound($this->mvc->i18n->get("title_no_ux_or_basecategory", null, array('item' => $args['ux'])), 404);
             // redirect to basecategory index using default OS,  UX and versions
             $ux = $this->mvc->configuration->latest[$os]['ux'];
             self::redirect($os, $os_version, $ux);
         } else {
             //if no such base category then complain
             throw new midgardmvc_exception_notfound('get_basecategories_by_ux todo', 404);
             #$this->mvc->head->relocate($this->get_url_browse_basecategory($args['ux'], false));
             // @todo: redirect to that particular category index
         }
     }
 }