/** * * @return string */ public function getSortField() { if (empty($this->sortField)) { $this->sortField = \Simplify\Inflector::singularize($this->getTable()) . '_order'; } return $this->sortField; }
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; }
/** * 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; }
/** * * @return string */ public function getPrimaryKey() { if (empty($this->primaryKey)) { $this->primaryKey = Inflector::singularize($this->getTable()) . Form::ID; } return $this->primaryKey; }
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; }
/** * * @return string */ public function getRight() { if (empty($this->right)) { $this->right = \Simplify\Inflector::singularize($this->getTable()) . '_right'; } return $this->right; }
/** * * @return string */ public function getElementClass() { return Inflector::underscore(get_class($this)); }
/** * * @return string */ public function getForeignKeyColumn() { if (empty($this->foreignKeyColumn)) { $this->foreignKeyColumn = \Simplify\Inflector::singularize($this->getTable()) . '_' . $this->getReferenceColumn(); } return $this->foreignKeyColumn; }
protected function getTitle() { if (empty($this->title)) { $this->title = \Simplify\Inflector::titleize($this->getName()); } return $this->title; }
/** * Get the action title * * @return string */ public function getTitle() { if (empty($this->title)) { $this->title = Inflector::titleize($this->getName()); } return $this->title; }
/** * 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; }
/** * * @return string */ public function getValueField() { if (empty($this->valueField)) { $this->valueField = Inflector::singularize($this->getTable()) . '_value'; } return $this->valueField; }
/** * (non-PHPdoc) * @see Renderable::getTemplateFilename() */ public function getTemplateFilename() { return $this->getPath() . '/' . $this->getName() . '_' . \Simplify\Inflector::underscore($this->getAction()); }