|
1 | 1 | # ZfcAdmin Module for Zend Framework 2 |
2 | | - |
3 | | -Version 0.0.1 Created by [Jurian Sluiman](http://juriansluiman.nl/en/) and [Martin Shwalbe](https://github.com/Hounddog) |
| 2 | +Version 0.1.0 created by [Jurian Sluiman](http://juriansluiman.nl/en) and [Martin Shwalbe](https://github.com/Hounddog). |
4 | 3 |
|
5 | 4 | ## Introduction |
6 | | - |
7 | | -soon to come |
| 5 | +ZfcAdmin is a minimal admin interface for generic administrative purposes. It is a common screen with navigation that hides behind authentication and authorization. |
8 | 6 |
|
9 | 7 | ## Installation |
| 8 | +ZfcAdmin is enabled to be installed via composer. Load `zf-commons/zfc-admin` in your `composer.json` file. You can specify its version (currently only 0.1.0 is recommended) or use `dev-master` to load the latest version from master. Enable ZfcAdmin in your `application.config.php` configuration file. |
10 | 9 |
|
11 | | -### Main Setup |
12 | | - |
13 | | -1. Clone this project into your `./vendor/` directory and enable it in your |
14 | | - `application.config.php` file. |
| 10 | +If you do not want to use composer, clone this project (either as a git submodule or not) into `./vendor/` directory. |
15 | 11 |
|
16 | 12 | ## Usage |
| 13 | +ZfcAdmin allows you to create routes under a single parent "admin" route. You can also use it to enable navigation in your admin layout. Furthermore integration of [BjyAuthorize](https://github.com/bjyoungblood/BjyAuthorize) and [ZfcRbac](https://github.com/spiffyjr/ZfcRbac) is provided. |
17 | 14 |
|
18 | | -### Add own Modules to admin path |
19 | | - |
20 | | -When creating your own modules you are required to register these with the zfcadmin path as child_routes |
21 | | - |
22 | | -In your module.config.php add the route as shown in the example |
23 | | - |
24 | | - 'router' => array( |
25 | | - 'routes' => array( |
26 | | - 'zfcadmin' => array( |
27 | | - 'child_routes' => array( |
28 | | - 'mymodule' => array( |
29 | | - 'type' => 'Literal', |
30 | | - 'options' => array( |
31 | | - 'route' => '/mymodule', |
32 | | - 'defaults' => array( |
33 | | - 'controller' => 'mycontroller', |
34 | | - 'action' => 'index', |
35 | | - ), |
36 | | - ), |
37 | | - 'child_routes' =>array( |
38 | | - 'mychildroute' => array( |
39 | | - 'type' => 'literal', |
40 | | - 'options' => array( |
41 | | - 'route' => '/', |
42 | | - 'defaults' => array( |
43 | | - 'controller' => 'mycontroller', |
44 | | - 'action' => 'myaction', |
45 | | - ), |
46 | | - ), |
47 | | - ), |
48 | | - ), |
49 | | - ), |
50 | | - ), |
51 | | - ), |
52 | | - ), |
53 | | - ), |
54 | | - |
55 | | - |
56 | | -### Add your routes to the Navigation |
57 | | - |
58 | | -You can inject your routes from your own modules into the admin navigation as shown below |
59 | | - |
60 | | - |
61 | | - 'navigation' => array( |
62 | | - 'admin' => array( |
63 | | - 'mynavigation' => array( |
64 | | - 'label' => 'My Module', |
65 | | - 'route' => 'zfcadmin/myroute', |
66 | | - ), |
67 | | - ), |
68 | | - ), |
69 | | - |
70 | | -## Enable Access restriction |
71 | | - |
72 | | -Restrict access to unauthorized Users. |
73 | | - |
74 | | -### Solution |
75 | | - |
76 | | -1. Install BjyAuthorize and enable in you application.config.php |
77 | | -2. Import data/data.sql into your database. |
78 | | -3. Create a user with ZfcUser and set the user_id and role_id in the database |
79 | | - (e.g. user_id = 1, role_id = admin) |
80 | | - |
81 | | -## How To override Admin Layout |
82 | | - |
83 | | -Override the built in admin layout with your custom layout |
84 | | - |
85 | | -### Solution |
86 | | - |
87 | | -1. In your module under the `view` directory create the folder `layout` |
88 | | -2. Create the override script `admin.phtml` |
89 | | - |
90 | | -## How to override Admin controller view |
91 | | - |
92 | | -Override the built in Controller view |
93 | | - |
94 | | -### Solution |
95 | | - |
96 | | -1. In your module, under the view directory, create the folder tree zfc-admin/admin |
97 | | -2. Create the necessary override view scripts, depending on which page(s) you want to change: |
98 | | - * Default page: zfc-admin/admin/index.phtml |
99 | | - |
100 | | - |
101 | | -NOTE: Your module must be loaded after ZfcAdmin or the overriding will not work. To do this, place your module after ZfcAdmin in the `modules` key of your application configuration (`config/application.config.php`). |
| 15 | +The complete configuration is flexible, so you can update the zfcadmin parent route, its children, the navigation and all default provided view scripts. Read more in the [documentation](docs/1.Introduction.md) about usage and customization of ZfcAdmin. |
102 | 16 |
|
| 17 | +## Development |
| 18 | +ZfcAdmin is currently under development. The authors feel ZfcAdmin is stable enough for production versions and you can always fix your ZfcAdmin version to a specific tag. Feel free to report bugs in the [issue tracker](https://github.com/ZF-Commons/ZfcAdmin/issues) or come by on IRC at the Freenode channel `#zftalk`. |
0 commit comments