예제 #1
0
 protected function preFetchData(DataModel $controller, &$response)
 {
     $maxPerPage = $this->getOptionalModuleVar('MAX_RESULTS', 10);
     $controller->setStart(0);
     $controller->setLimit($maxPerPage);
     return parent::preFetchData($controller, $response);
 }
예제 #2
0
 protected function out($string, $newLine = true)
 {
     if ($this->verbose) {
         parent::out($string, $newLine);
     }
 }
예제 #3
0
 protected function dispatch()
 {
     if (isset($this->args[0])) {
         $shell = $this->args[0];
         $command = '';
         $this->shell = $shell;
         $this->shiftArgs();
         if (isset($this->args[0]) && $this->args[0]) {
             $command = $this->args[0];
         }
         $this->shellCommand = $command;
         $args = $this->getParams();
         $Kurogo = Kurogo::sharedInstance();
         $Kurogo->setRequest($shell, $command, $args);
         try {
             if ($module = ShellModule::factory($shell, $command, $args, $this)) {
                 if (!$command) {
                     $this->stop(ShellModule::SHELL_COMMAND_EMPTY);
                 }
                 $Kurogo->setCurrentModule($module);
                 return $module->executeCommand();
             }
         } catch (KurogoModuleNotFound $e) {
             $this->stop(ShellModule::SHELL_MODULE_NOT_FOUND);
         }
     }
     $this->stop(ShellModule::SHELL_NO_MODULE);
     /*
             $this->stderr(PHP_EOL . "Kurogo Console: ");
     	    $this->stderr(PHP_EOL . "Not found the shell module");
     $this->stop();
     */
 }
예제 #4
0
 public static function getAllModules()
 {
     $configFiles = glob(SITE_CONFIG_DIR . "/*/module.ini");
     $modules = array();
     foreach ($configFiles as $file) {
         if (preg_match("#" . preg_quote(SITE_CONFIG_DIR, "#") . "/([^/]+)/module.ini\$#", $file, $bits)) {
             $id = $bits[1];
             try {
                 if ($module = ShellModule::factory($id)) {
                     $modules[$id] = $module;
                 }
             } catch (KurogoException $e) {
             }
         }
     }
     ksort($modules);
     return $modules;
 }