コード例 #1
0
ファイル: Sortable.php プロジェクト: rutkoski/simplify-form
 /**
  *
  * @return string
  */
 public function getSortField()
 {
     if (empty($this->sortField)) {
         $this->sortField = \Simplify\Inflector::singularize($this->getTable()) . '_order';
     }
     return $this->sortField;
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: rutkoski/simplify
 public function callAction($action, $params)
 {
     $this->beforeAction($action, $params);
     $method = strtolower(Simplify::request()->method());
     $Action = Inflector::variablize("{$method}_{$action}_action");
     if (!method_exists($this, $Action)) {
         $Action = Inflector::variablize("{$action}_action");
         if (!method_exists($this, $Action)) {
             throw new \Exception("Action <b>{$action}</b> not found in controller <b>{$this->getPath()}\\{$this->getName()}</b>");
         }
     }
     $this->action = $action;
     $func = array($this, $Action);
     $output = call_user_func_array($func, Dispatcher::sortCallbackParameters($func, $params));
     $this->afterAction($output);
     if ($output === Response::AUTO) {
         $output = $this->getView();
     }
     return $output;
 }
コード例 #3
0
 /**
  * Get the key on the related table. By default, it's the table's primary key (<table>_id).
  *
  * @return string
  */
 public function getForeignKey()
 {
     if (empty($this->foreignKey)) {
         $this->foreignKey = \Simplify\Inflector::singularize($this->getTable()) . '_id';
     }
     return $this->foreignKey;
 }
コード例 #4
0
ファイル: Form.php プロジェクト: rutkoski/simplify-form
 /**
  *
  * @return string
  */
 public function getPrimaryKey()
 {
     if (empty($this->primaryKey)) {
         $this->primaryKey = Inflector::singularize($this->getTable()) . Form::ID;
     }
     return $this->primaryKey;
 }
コード例 #5
0
ファイル: Modules.php プロジェクト: rutkoski/amplify
 public static function getAllModules()
 {
     $modules = array();
     $base = \Simplify::config()->get('app:dir') . 'modules';
     $path = '/';
     if (!is_dir($base . $path) && !mkdir($base . $path, 0655)) {
         throw new AmplifyException('Application modules dir not found and could not be created: ' . $base . $path);
     }
     $it = new \DirectoryIterator($base . $path);
     while ($it->valid()) {
         if (!$it->isDot()) {
             if ($it->isDir()) {
                 $filename = $path . $it->getFilename() . '/Module.php';
                 if (file_exists($base . $filename)) {
                     require_once $base . $filename;
                     $class = \Simplify\Inflector::camelize($it->getFilename()) . '\\Module';
                     if (class_exists($class) && is_subclass_of($class, '\\Amplify\\Module')) {
                         $modules[addslashes($class)] = new $class();
                         $modules[addslashes($class)]->active = \Amplify\Modules::isActive($class);
                     }
                 }
             }
             /*
              * elseif (strrpos($it->getFilename(), 'Module.php') !== false) {
              * $filename = $path . $it->getFilename();
              *
              * require_once ($base . $filename);
              *
              * $class = $it->getBasename('.php');
              *
              * if (class_exists($class) && is_subclass_of($class, '\Amplify\Module')) {
              * $modules[$filename] = new $class();
              * $modules[$filename]->active = \Amplify\Modules::isActive($filename);
              * }
              * }
              */
         }
         $it->next();
     }
     return $modules;
 }
コード例 #6
0
ファイル: Mptt.php プロジェクト: rutkoski/simplify-form
 /**
  *
  * @return string
  */
 public function getRight()
 {
     if (empty($this->right)) {
         $this->right = \Simplify\Inflector::singularize($this->getTable()) . '_right';
     }
     return $this->right;
 }
コード例 #7
0
ファイル: Element.php プロジェクト: rutkoski/simplify-form
 /**
  *
  * @return string
  */
 public function getElementClass()
 {
     return Inflector::underscore(get_class($this));
 }
コード例 #8
0
ファイル: HasOne.php プロジェクト: rutkoski/simplify-form
 /**
  *
  * @return string
  */
 public function getForeignKeyColumn()
 {
     if (empty($this->foreignKeyColumn)) {
         $this->foreignKeyColumn = \Simplify\Inflector::singularize($this->getTable()) . '_' . $this->getReferenceColumn();
     }
     return $this->foreignKeyColumn;
 }
コード例 #9
0
ファイル: ConfigController.php プロジェクト: rutkoski/amplify
 protected function getTitle()
 {
     if (empty($this->title)) {
         $this->title = \Simplify\Inflector::titleize($this->getName());
     }
     return $this->title;
 }
コード例 #10
0
ファイル: Action.php プロジェクト: rutkoski/simplify-form
 /**
  * Get the action title
  *
  * @return string
  */
 public function getTitle()
 {
     if (empty($this->title)) {
         $this->title = Inflector::titleize($this->getName());
     }
     return $this->title;
 }
コード例 #11
0
ファイル: Component.php プロジェクト: rutkoski/simplify-form
 /**
  * Get the label for the component.
  *
  * @return string
  */
 public function getLabel()
 {
     if (is_null($this->label)) {
         $this->label = Inflector::humanize($this->getName());
     }
     return $this->label;
 }
コード例 #12
0
ファイル: Config.php プロジェクト: rutkoski/simplify-form
 /**
  *
  * @return string
  */
 public function getValueField()
 {
     if (empty($this->valueField)) {
         $this->valueField = Inflector::singularize($this->getTable()) . '_value';
     }
     return $this->valueField;
 }
コード例 #13
0
ファイル: Controller.php プロジェクト: rutkoski/simplify
 /**
  * (non-PHPdoc)
  * @see Renderable::getTemplateFilename()
  */
 public function getTemplateFilename()
 {
     return $this->getPath() . '/' . $this->getName() . '_' . \Simplify\Inflector::underscore($this->getAction());
 }