From c3ffa7e3e721a03287235e617e16b08a0df9b458 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Tue, 26 Aug 2014 15:54:20 +0300 Subject: [PATCH] minor fixes --- ipf/admin/app.php | 9 --------- ipf/admin/commands/syncperms.php | 4 ++-- ipf/admin/legacymodel.php | 5 +++++ ipf/admin/model.php | 14 +++++--------- ipf/admin/views.php | 2 +- ipf/legacy_orm/modelform.php | 2 +- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/ipf/admin/app.php b/ipf/admin/app.php index 1f31bbe..802e0e8 100644 --- a/ipf/admin/app.php +++ b/ipf/admin/app.php @@ -95,15 +95,6 @@ class IPF_Admin_App extends IPF_Application return $component; } - static function appByModel($model) - { - foreach (IPF_Project::getInstance()->appList() as $app) - foreach (IPF_Legacy_ORM_App::appModelList($app) as $m) - if ($model == $m) - return $app; - return null; - } - public static function getApplicationBySlug($slug) { foreach (IPF_Project::getInstance()->appList() as $app) diff --git a/ipf/admin/commands/syncperms.php b/ipf/admin/commands/syncperms.php index 45f4413..5d468b6 100644 --- a/ipf/admin/commands/syncperms.php +++ b/ipf/admin/commands/syncperms.php @@ -3,11 +3,11 @@ class IPF_Admin_Command_SyncPerms { public $command = 'syncperms'; - public $description = 'Create/Update permissions from model classes'; + public $description = 'Create/Update permissions from admin components'; public function run($args=null) { - print "Create/Update permissions from model classes\n"; + print "Create/Update permissions from admin components\n"; print "COLLECTED PERMISSIONS:\n"; $permissions = array(); diff --git a/ipf/admin/legacymodel.php b/ipf/admin/legacymodel.php index bd66841..d447a17 100644 --- a/ipf/admin/legacymodel.php +++ b/ipf/admin/legacymodel.php @@ -9,6 +9,11 @@ class IPF_Admin_Model extends IPF_Admin_Component $this->modelName = $modelName; } + public function verbose_name() + { + return IPF_Utils::humanTitle($this->modelName); + } + public function slug() { return strtolower($this->modelName); diff --git a/ipf/admin/model.php b/ipf/admin/model.php index 679ecad..d371325 100644 --- a/ipf/admin/model.php +++ b/ipf/admin/model.php @@ -365,11 +365,6 @@ abstract class IPF_Admin_Component public $app = null, $request = null; - public function verbose_name() - { - return IPF_Utils::humanTitle($this->modelName); - } - public function slug() { $slug = get_class($this); @@ -380,6 +375,7 @@ abstract class IPF_Admin_Component return strtolower($slug); } + public abstract function verbose_name(); public function titleList() { return $this->verbose_name().' List'; } public function titleAdd() { return 'Add ' . $this->verbose_name(); } public function titleEdit() { return 'Edit ' . $this->verbose_name(); } @@ -544,14 +540,14 @@ abstract class IPF_Admin_Component protected abstract function _getForm($obj, $data); - protected function _getEditForm($model_obj, $data) + protected function _getEditForm($obj, $data) { - return $this->_getForm($model_obj, $data); + return $this->_getForm($obj, $data); } - protected function _getAddForm($model_obj, $data) + protected function _getAddForm($obj, $data) { - return $this->_getForm($model_obj, $data); + return $this->_getForm($obj, $data); } protected function _getListTemplate() diff --git a/ipf/admin/views.php b/ipf/admin/views.php index 6ebdc8e..b23a561 100644 --- a/ipf/admin/views.php +++ b/ipf/admin/views.php @@ -120,7 +120,7 @@ function IPF_Admin_Views_Impersonate($request, $match) $success_url = IPF_HTTP_URL::urlForView('IPF_Admin_Views_Index'); if (!$request->user->isAnonymous() && $request->user->is_superuser) { - $user = User::table()->findOneById($match[1]); + $user = User::find($match[1]); if (!$user) return new IPF_HTTP_Response_NotFound($request); IPF_Auth_App::login($request, $user); diff --git a/ipf/legacy_orm/modelform.php b/ipf/legacy_orm/modelform.php index e2fa258..89ffed1 100644 --- a/ipf/legacy_orm/modelform.php +++ b/ipf/legacy_orm/modelform.php @@ -16,7 +16,7 @@ class IPF_Form_Model extends IPF_Form $this->user_fields = $extra['user_fields']; $exclude = \PFF\Arr::get($extra, 'exclude', array()); - $fields = $this->suggestFields($this->model->getTable(), $this->fields(), $exclude, $this); + $fields = self::suggestFields($this->model->getTable(), $this->fields(), $exclude, $this); foreach ($fields as $field) { list($n, $f) = $field; $this->fields[$n] = $f; -- 2.49.0