Backend Plugin

The backend plugin adds an administration area to any website. It is shipped as a pluggable application.

This is a temporary tutorial to setup the backend. Some things may (and will probably) change before the release

Installation

The backend depends on the Db and Auth plugin. The Db plugin is alreay covered in the documentation. Download and install (copy their folder into your plugins folder) the three plugins.

You'll need to configure the Auth plugin to be able to login into the backend. There is two ways to define the users: using an array on using the database. The user must have the backend role to be able to access the backend

The first method is really simple:

Atomik::set('plugins/Auth/users', array(
  'admin' => array('password' => 'admin', 'roles' => array('backend'))
));

You can add as many users as you want.

The prefer way is of course using a database. To do so you must configure a model that will represent a user. The Auth plugin provides a base model for users which can be use as is. It simply define a username and password field. You can inherit this model to add more fields (for example create a User.php file in app/models with the User class which would subclass Atomik_Auth_User).

Atomik::set('plugins/Auth/model', 'Atomik_Auth_User' /* or User */);

Don't forget to created the associated database table. If you're using the Console plugin, you can use the db-create command:

php index.php db-create

No default user are created when using models. You'll need to manually create one inside the database. Don't forget to perform an MD5 encryption on the password field.

The backend

You can access the backend at /backend. This can be change by setting the plugins/Backend/route key (see pluggable app doc in the manual)

The backend has a fairly common interface.

Extending the backend

Each section in the backend is another pluggable application. Any plugin can add sections to the backend. Your application can also do so.

To access the backend actions of a plugin, use an url like: /backend/Plugin/action The Plugin part is the plugin name. The action part is an action provided by the plugin.

Plugins can define their backend actions in a backend subfolder inside the plugin folder. This folder acts as a full pluggable application.

The same goes for your backend actions. Create a pluggable app in the directory app/backend. It will be accessible from the backend using /backend/app/action

The backend plugins provides some helpers to ease the development of common tasks:

  • dataTable
  • formButtons
  • sidebarButton
  • sqlDate

The Db plugin has a backend section which can use as a good example on how to develop for the backend.

Plugins supporting the backend

As of mars 2010, some plugins alreay have a backend area:

  • Db
  • Auth
  • Config
 
tutorials/backendplugin.txt · Last modified: 2010/12/04 17:29 by laplix
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki