Beispiel #1
0
 /**
  */
 public function loadSettings()
 {
     // Get directory path of app
     $files = array_diff(scandir($this->path), array('..', '.'));
     foreach ($files as $file) {
         $string = new CamelCase(explode('.', $file)[0]);
         $key = $string->uncamelize();
         $this->add($key, include $this->path . DIRECTORY_SEPARATOR . $file);
     }
 }
Beispiel #2
0
 /**
  * Returns the name of this app.
  *
  * @param bool $uncamelize
  *            Set this flag to true to get the apps name in an uncamelized format
  *
  * @return string
  */
 public function getName(bool $uncamelize = false)
 {
     if ($uncamelize == true) {
         $string = new CamelCase($this->name);
         return $string->uncamelize();
     } else {
         return $this->name;
     }
 }
Beispiel #3
0
 /**
  * Shorthand method for a FormDesigner instance with auto attached model
  *
  * @return FormDesigner
  */
 protected function getFormDesigner($id = '')
 {
     /* @var $fd \Core\Html\FormDesigner\FormDesigner */
     $fd = new FormDesigner($this->app->getName(true));
     // Generate form id when id is not provided
     if (!$id) {
         $pieces = [];
         $string = new CamelCase($this->app->getName());
         $pieces[] = $string->uncamelize();
         $string->setString($this->name);
         $pieces[] = $string->uncamelize();
         // get calling method name
         $dbt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
         if (isset($dbt[1]['function'])) {
             $string->setString($dbt[1]['function']);
             $pieces[] = $string->uncamelize();
         }
         $id = implode('-', $pieces);
     }
     if ($id) {
         $fd->setId($id);
     }
     // Create forms eaction url
     if (isset($this->route)) {
         $fd->html->setAction($this->app->url($this->route, $this->params));
     }
     // Set session token
     $fd->setToken($this->di->get('core.security.form.token.name'), $this->di->get('core.security.form.token'));
     return $fd;
 }