Code Monkey home page Code Monkey logo

kohana-admin's Introduction

Kohana Admin module

Dependencies

Conventions

Controllers

All admin controller classes must start with Controller_Admin_ and extend (at least) Controller_Admin in order for ACL and templating to work.

In case you want a CRUD controller, you must only extend Controller_Admin_CRUD. Example:

class Controller_Admin_Topic extends Controller_Admin_CRUD {
	
	protected $_model = 'post';
	
}

$_model must be specified in CRUD controllers.

Views

All views must extend View_Admin_Layout in order to inherit Bootstrap templating capabilities. For CRUD operations, extend the related View:

  • View_Admin_Index (list of records)
  • View_Admin_Create (create new record)
  • View_Admin_Read (viewing single record)
  • View_Admin_Update (update single record)
  • View_Admin_Delete (delete single record)
  • View_Admin_DeleteMultiple (delete multiple records)

Usage

By default you don't need to add anything additionaly for direct model CRUD, just create the controller and that's it. Link will be automatically added to the header using Reflection.

If you need to add some custom actions, you will have to create a view model and template for them as well.

Permissions

This module relies on default Auth module to provide ACL (roles_users) but you can override this by extending the Controller_Admin::check_permissions() method in your child controller, e.g.

public static function check_permissions(Request $request)
{
	if ( ! something_wrong())
		throw new HTTP_Exception_403('Access denied.');
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.