From 39a030281d598bea66d6d7bff9eab993f516531e Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Thu, 21 Aug 2014 00:56:37 +0300 Subject: [PATCH] move appByModel function to admin app --- ipf/admin/app.php | 9 +++++++++ ipf/admin/modelinline.php | 2 +- ipf/admin/models/AdminLog.php | 2 +- ipf/utils.php | 9 --------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ipf/admin/app.php b/ipf/admin/app.php index ae2e497..ba22f7b 100644 --- a/ipf/admin/app.php +++ b/ipf/admin/app.php @@ -59,6 +59,15 @@ class IPF_Admin_App extends IPF_Application return new IPF_HTTP_Response_Redirect(IPF_HTTP_URL::urlForView('IPF_Admin_Views_Login')); } + static function appByModel($model) + { + foreach (IPF_Project::getInstance()->appList() as $app) + foreach ($app->modelList() as $m) + if ($model == $m) + return $app; + return null; + } + static function GetAppModelFromSlugs($lapp, $lmodel) { foreach (IPF_Project::getInstance()->appList() as $app) { diff --git a/ipf/admin/modelinline.php b/ipf/admin/modelinline.php index cb0b823..42eb5d2 100644 --- a/ipf/admin/modelinline.php +++ b/ipf/admin/modelinline.php @@ -21,7 +21,7 @@ abstract class IPF_Admin_ModelInline public function getApplication() { - return IPF_Utils::appByModel($this->getModelName()); + return IPF_Admin_App::appByModel($this->getModelName()); } function getAddNum() diff --git a/ipf/admin/models/AdminLog.php b/ipf/admin/models/AdminLog.php index 1e70e61..c2c0adc 100644 --- a/ipf/admin/models/AdminLog.php +++ b/ipf/admin/models/AdminLog.php @@ -17,7 +17,7 @@ class AdminLog extends BaseAdminLog $log->object_repr = (string)$object; if (!$object_url) { - $app = IPF_Utils::appByModel($log->object_class); + $app = IPF_Admin_App::appByModel($log->object_class); if ($app) $object_url = IPF_HTTP_URL::urlForView('IPF_Admin_Views_EditItem', array($app->getSlug(), strtolower($log->object_class), $log->object_id)); } diff --git a/ipf/utils.php b/ipf/utils.php index b325505..c0ff2f1 100644 --- a/ipf/utils.php +++ b/ipf/utils.php @@ -132,15 +132,6 @@ class IPF_Utils return $date2 - $date1; } - static function appByModel($model) - { - foreach (IPF_Project::getInstance()->appList() as $app) - foreach ($app->modelList() as $m) - if ($model == $m) - return $app; - return null; - } - public static function insertDirectory($path, $directory) { $parts = pathinfo($path); -- 2.49.0