]> git.andy128k.dev Git - ipf.git/commitdiff
minor fixes
authorAndrey Kutejko <aku@anahoret.com>
Tue, 26 Aug 2014 12:54:20 +0000 (15:54 +0300)
committerAndrey Kutejko <aku@anahoret.com>
Tue, 26 Aug 2014 12:54:20 +0000 (15:54 +0300)
ipf/admin/app.php
ipf/admin/commands/syncperms.php
ipf/admin/legacymodel.php
ipf/admin/model.php
ipf/admin/views.php
ipf/legacy_orm/modelform.php

index 1f31bbe5318be759ca250b99a87680d5bca692ec..802e0e806c855a47b289c6f61ab0205f1ce832b0 100644 (file)
@@ -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)
index 45f44137418db98f3198b7499a8d833a4694830e..5d468b6e16cae066ed7ea84774e7896a46c43f2e 100644 (file)
@@ -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();
index bd66841465335bbae1e78376441bf650275ecfc1..d447a173aabb065a0bfab8a144628494a2380b40 100644 (file)
@@ -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);
index 679ecad42df4ce42406d4ff8a4896b26cce91280..d371325c8a78d1c3ffc6a17d2c498d53b2bf5ce0 100644 (file)
@@ -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()
index 6ebdc8e41f2775aeae44c8c5037b73726e79e101..b23a56195db2c9c757c0df1c2e17be5ea5989b05 100644 (file)
@@ -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);
index e2fa25803b6dfca5396d0136cc682598b78765d9..89ffed1e25283dc549f85dc2999490b6715f4a54 100644 (file)
@@ -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;