Exemple #1
0
 public static function create($controller, $method, $args = null, $project = null, $absolute = false)
 {
     $link = "/{$controller}/{$method}";
     if (is_array($args)) {
         $app_params = array();
         $get_params = array();
         $arg_indexes = array_keys($args);
         foreach ($arg_indexes as $i => $key) {
             if ($key == (string) $i) {
                 //numerical index
                 //App param
                 $app_params[] = $args[$key];
             } else {
                 //associative index
                 //GET Param
                 $get_params[$key] = $args[$key];
             }
         }
         if (count($app_params) > 0) {
             $link .= '/' . implode('/', $app_params);
         }
         if (count($get_params) > 0) {
             $link .= '?' . http_build_query($get_params);
         }
     }
     if ($project) {
         $link = "/~{$project}" . $link;
     } else {
         if ($absolute) {
             $link = "/~" . Runtime::currentProject()->name . $link;
         }
     }
     return '/' . trim(trim(self::base(), '/') . "{$link}", '/');
 }
Exemple #2
0
 private function modelName()
 {
     $index = -1;
     $modelPath = $this->model($index);
     switch ($index) {
         case 0:
             $modelName = ucfirst($this->navigation->controllerName) . ucfirst($this->navigation->methodName) . 'Model';
             break;
         case 1:
             $modelName = ucfirst($this->navigation->controllerName) . 'Model';
             break;
         case 2:
             $modelName = ucfirst(Runtime::currentProject()->name) . 'Model';
             break;
         case 3:
             $modelName = 'BongAppModel';
             break;
         default:
             //TODO Handle Error
     }
     return $modelName;
 }
Exemple #3
0
 /**
  * evaluate path in Current Project scope
  * @internal concats current project Name with : and then appends $path to it. Then treat it as usual Path 
  * @param string $path
  * @return string
  */
 public function currentProject($path)
 {
     if (!Runtime::currentProject()) {
         /*Project not Set Yet Who is Calling ?*/
         debug_print_backtrace();
     }
     return $this->evaluate(':' . Runtime::currentProject()->name . '.' . $path);
 }