Array ACL plugin for CakePHP v1.3

What does this mean? It’s a simple and easy to use alternative to built in ACL component of CakePHP applications. I personally think that CakePHP’s built in Auth+ACL components are a bit unnecessarily complicated (but very versatile and powerful), and sometimes I just need a couple of users and groups, and an easy (opposed to all-purpose) way to implement what can each group member access. Thinking of just that I’ve created this plugin.

It’s main features are:

  • it’s installed and configured in 5 minutes
  • it’s powerful enough for simpler access management
  • access control lists are hard-coded in the application in a form of an array
  • it can be easily modified

At the moment of me starting to write this article the plugin was written for CakePHP v1.3, but before I actually published this article I ported it to CakePHP v2.0 (for which there will be another article soon).

Git repository can be found on github, here:

Or you can download Array ACL plugin for CakePHP 1.3 from here:

More on that simple ACL plugin for CakePHP 1.3…

CakePHP in place update (with jQuery) plugin

Recently I had a need for an “in-place-update” of some fields on a CakePHP project that used jQuery. I found a lot of articles, examples and helpers that ironically didn’t help as much as I would like them to do, so I decided to write myself a new one.

I found a great example, but it only worked if you wished to edit items in displayed in a list-style or table-style structure, and I needed to basically have a standard CakePHP view view (yes a view view that corresponds to a view action in the controller), on which I can edit the Post title or description without going to the edit view.

A few slight modifications of the provided example, and voilà, I have created a CakePHP plugin for “in place update”. You can download it from github:

CakePHP in place updater plugin

Installation and usage

Extract the plugin

Extract the contents of the pack to the app/plugins/inplace_updater folder.

Add helper to your controller

Include the inplace_updater helper in your controller or app controller like so:

var $helpers = array(... 'InplaceUpdater.InplaceUpdater' ...);

Download and include Jeditable jQuery plugin to your layout

In order for this plugin to work, you will need to include the contents of the Jeditable jQuery plugin. Probably the simplest solution is to save the minified version ( to your js folder, so the location of the file is “”.

Jeditable jQuery plugin is a plugin for jQuery, so oviously it cannot be run without jQuery. Download the latest jQuery and copy it to “appwebrootjsjquery.js”.

To include the required javascripts, add the following lines to your layout file (usually appviewslayoutsdefault.ctp):

    echo $javascript->link('jquery');
    echo $javascript->link('');

Add an in-place-updater control to your view

The updater helper allows you to add an “input” control to your views that will behave like the a div element (by default, or any other HTML element if you wish) on your view until you click/double-click/hover/etc on it, then it will appear as a text input, or a drop-down list, or any element supported by Jeditable jQuery plugin

echo $inplaceUpdater->input
        'value'         => $post['Post']['title'],
        'actionName'    => 'inPlaceUpdate',
        'type'          => 'text',
        'cancelText'    => 'Cancel',
        'submitText'    => 'Save',
        'toolTip'       => 'Click to edit Post Title',
        'containerType' => 'h2',

Add an action handler in your controller

When the save button is pressed after modifying the in-place-edit element, a post is made to the inPlaceUpdate (by default) controller action. You can add a function like this to handle the in-place-update action.

function inPlaceUpdate($id = null)
    if (!$id)

    if ($this->data)
        // get all the fields with its values (there should be only one, but anyway...)
        foreach($this->data['Post'] as $field => $value)
            // check if the provided field name is acceptable
                case 'title':
                case 'description':
                    $this->set('updated_value', '');

            $this->Post->id = $id;
            $this->Post->saveField($field, $value);

            $this->set('updated_value', $value);

Since you have a new action in your controller which is used for the in-place-update functionality, you will need to add the in_place_update view to your model’s views folder. And that view should display the updated result after save.

	echo $updated_value;

JQValidator – CakePHP Client Side Validation

CheckmarkJQValidator is a plugin for CakePHP used for a client side validation of a CakePHP model, written in jQuery. It’s main purpose is to validate the inserted information prior to their submit to the server, this both reduces the number server requests and makes your application faster and more user-friendly.

The plugin is still in an infant phase of the development, supporting validation for only the following data types:

  • notempty,
  • numeric
  • date

But with further development needs, I will update the plugin accordingly. Any help from anyone else is also appreciated.

JQValidator is available on github. For more information on the functionalities, installation and usage read the JQValidator plugin wiki.