Skip to content

Administrative Module

yanickrochon edited this page Jun 6, 2012 · 2 revisions

Brainstorm draft.

Module name

  • Zfc-admin : would be part of the list of pluggable modules for the project. At the very least, SpeckCommerce could very well be a simple CMS, if stripped of all it's modules but the CMS one. Or a full blown e-Commerce one with an administrative area, etc. Then, SpeckCommerce could be the project foundation, with an install module (SpeckInstall?).
  • SpeckAdmin : inherent to SpeckCommerce, all modules may optionally register administrative services that could be picked up by the module, etc. There are obviously pros and cons in having this kind of module.

Access Control

Should the administrative area require some specific access rules via the zfc-acl module? or would any logged in user be able to access the area? Or even perhaps a hybrid method, where if no ACL is found, any logged in user may access, etc.?

Template Layout

Administrative controllers should a different template layout assigned to them instead of the default (layout/layout) one. This template could be layout/admin or layout/management.

Navigation

All modules' administrative routes should be returned by a widget or view helper so they can be used in the administrative template to access all the different administrative pages. For exemple, all routes starting with /admin may be filtered. The widget (or view helper) may return something like :

<ul>
    <li><strong>Application</strong>
        <ul>
            <li><a href="/admin">Dashboard</a></li>
            ....
        </ul>
    </li>
    <li><strong>Users</strong>
        <ul>
            <li><a href="/admin/user">User management</a></li>
            ....
        </ul>
    </li>
    ...
</ul>

Another idea would be to have all modules with administrative controllers implement an interface and register it to a given service so the navigation could be more configurable. Something like :

class AdministrativeLink {
    /**
     * @var string
     */
    private $_label;
    /**
     * @var string
     */
    private $_route;

    public function __construct($label, $route)
    {
        $this->_label = $label;
        $this->_route = $route;
    }

    public function getLabel()
    {
        return $this->_label;
    }

    public function getRoute()
    {
        return $this->_route;
    }
}

interface Administrable {
    /**
     * Return all administrative administrative menu items links
     *
     * @return array<AdministrativeLink>
    public function getNavigationItems();
}

This latter option could be used by modules to check the presence of an administrative module. This module could, then, also be extended and/or swapped by another administrative module registering the same service.