Exemple #1
0
 function invokeView($target)
 {
     $namespace = core\ApplicationRegistry::getNamespaceRoot();
     $filePath = $_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR;
     $filePath .= $namespace . DIRECTORY_SEPARATOR;
     $filePath .= "view" . DIRECTORY_SEPARATOR;
     $filePath .= "{$target}.php";
     include $filePath;
 }
Exemple #2
0
 static function run()
 {
     $ini_array = parse_ini_file("config.ini");
     //print_r($ini_array);
     //echo __FILE__ . ": configfilepath = " .  $ini_array['configFilepath'].'<br>';
     $appHelper = ctrl\ApplicationHelper::instance();
     $appHelper->init($ini_array['siteRoot'] . DIRECTORY_SEPARATOR . $ini_array['configFilepath']);
     $registry = core\ApplicationRegistry::instance();
     $registry->flush();
     $appHelper->init($ini_array['siteRoot'] . DIRECTORY_SEPARATOR . $ini_array['configFilepath']);
 }
Exemple #3
0
 function resolveCommand($cmd)
 {
     $classroot = $this->controllerMap->getClassroot($cmd);
     $namespaceRoot = core\ApplicationRegistry::getNamespaceRoot();
     $filepath = core\HelperFunctions::replaceSlashes("{$namespaceRoot}/command/{$classroot}.php");
     $classname = "\\{$namespaceRoot}\\command\\{$classroot}";
     if (file_exists($filepath)) {
         require_once $filepath;
         if (class_exists($classname)) {
             $cmd_class = new \ReflectionClass($classname);
             if ($cmd_class->isSubClassOf(self::$base_cmd)) {
                 return $cmd_class->newInstance();
             }
         }
     }
     return null;
 }
Exemple #4
0
 function doExecute(ctrl\Request $req)
 {
     $appName = core\ApplicationRegistry::getAppName();
     $req->addFeedback("Welcome to {$appName}");
 }
 function doExecute(ctrl\Request $req)
 {
     $appName = core\ApplicationRegistry::getAppName();
     $req->addFeedback("Please, enter your {$appName} username and password.");
 }
Exemple #6
0
 static function getNamespaceRoot()
 {
     return core\ApplicationRegistry::getNamespaceRoot();
 }
Exemple #7
0
 private function registerControllerMap($conf)
 {
     $map = new ControllerMap();
     foreach ($conf->control->view as $default_view) {
         $stat_str = trim($default_view['status']);
         if (empty($stat_str)) {
             $stat_str = "CMD_DEFAULT";
         }
         $status = cmd\Command::statuses($stat_str);
         $map->addView('default', $status, (string) $default_view);
     }
     foreach ($conf->control->command as $command_view) {
         $command = trim((string) $command_view['name']);
         if ($command_view->classalias) {
             $classroot = trim((string) $command_view->classalias['name']);
             $map->addClassroot($command, $classroot);
         }
         if ($command_view->view) {
             $view = trim((string) $command_view->view);
             $forward = trim((string) $command_view->forward);
             $map->addView($command, 0, $view);
             if ($forward) {
                 $map->addForward($command, 0, $forward);
             }
             foreach ($command_view->status as $command_view_status) {
                 $view = trim((string) $command_view_status->view);
                 $forward = trim((string) $command_view_status->forward);
                 $stat_str = trim($command_view_status['value']);
                 $status = cmd\Command::statuses($stat_str);
                 if ($view) {
                     $map->addView($command, $status, $view);
                 }
                 if ($forward) {
                     $map->addForward($command, $status, $forward);
                 }
             }
         }
     }
     core\ApplicationRegistry::setControllerMap($map);
 }