Files
crmPRO/autoload/controls/class.Site.php
Jacek Pyziak f3be8e1025 feat: Refactor CRM and Finances modules
- Updated client-edit template to change 'Firma' to 'Nazwa' and added 'Nazwa firmy' input field.
- Modified main-view template to reflect the new naming conventions for clients.
- Enhanced finances main-view to display a list of clients with revenue details.
- Added client selection dropdown in operation-edit template.
- Improved work-time template by adding keyboard shortcut for task confirmation.
- Introduced CrmController for handling client-related actions.
- Created FinancesController to manage finance operations and categories.
- Implemented ClientRepository for client data management.
- Developed FinanceRepository for finance operations and data handling.
2026-02-14 21:30:02 +01:00

42 lines
1.2 KiB
PHP

<?php
namespace controls;
class Site
{
private static function snakeToCamel( $snake )
{
return lcfirst( str_replace( '_', '', ucwords( $snake, '_' ) ) );
}
public static function route()
{
global $user;
$module = \S::get( 'module' );
$action = \S::get( 'action' );
if ( !\controls\Users::permissions( $user['id'], $module ) )
return;
// New Controllers namespace (camelCase methods)
$controller_class = '\Controllers\\';
$parts = explode( '_', $module );
if ( is_array( $parts ) ) foreach ( $parts as $part )
$controller_class .= ucfirst( $part );
$controller_class .= 'Controller';
$camel_action = self::snakeToCamel( $action );
if ( class_exists( $controller_class ) and method_exists( $controller_class, $camel_action ) )
return call_user_func_array( array( $controller_class, $camel_action ), array() );
// Legacy controls namespace (snake_case methods)
$class = '\controls\\';
$parts = explode( '_', $module );
if ( is_array( $parts ) ) foreach ( $parts as $part )
$class .= ucfirst( $part );
if ( class_exists( $class ) and method_exists( new $class, $action ) )
return call_user_func_array( array( $class, $action ), array() );
}
}