Hello,
I'd like to create some new functionnality for my modx installation, and I don't know how should I start writing code for it....
Here are my requirements:
- The new functionnality should use mysql tables for CRUD content (for example, table names are "uc","activities","levels",...)
- Some users should have complete access (eg: Admin1) to the content of these tables and a way (UI) to manage their content;
- Users should have a partial access to content depending on access controls (for example: User1 should have access to uc->center1 rows, but not uc->center2 rows and User2 should have access to uc->center2, but not center1)
- Users should be able to modify "activities" based on their preferences, inside the UI. (Activities being part of a specific "uc", belonging to a specific user. Example: Activity1 belongs to center1, which User1 should have access to...)
I know it's a little vague, but what I'm basically searching is a CRUD UI for some users, with relationships between tables, and ACLs.
Is there a best way to do it with MODx? I guess using xPDO is a good start for the mapping from table to objects, and (I guess) objects to CRUD.
But I don't know how to link it to modx, with the users (should I use web users or manager users?), and the ACLs.
Also, I don't know if I should use the 'web' context, or if I should create another context, or create a "custom manager" (for the help of the UI), etc.
I'm just searching for the best/quickest approach to it.
Just to be a little more complex, I'll later need to translate the UI into different languages...
Kind regards,
-
☆ A M B ☆
- 24,524 Posts
The translation requirement leads me to mention MyComponent, which now supports CMPs.
http://bobsguides.com/mycomponent-tutorial.html
The Example project that comes with MyComponent has a functioning CMP (based on modExt/ExtJS) somewhat like Batcher that has a lot of what you want.
MyComponent's LexiconHelper will save you a lot of time with the language strings.
The down side is that you'll have to learn MyComponent and ExtJS and set the tables up to work with xPDO:
http://bobsguides.com/custom-db-tables.html
Once it's all set up, though, I think it will be a lot easier to maintain going forward.
Yes, the .zip file is the current version.
CreateXpdoClasses may still helo to get you started, but you'll have to edit the schema file by hand before generating the class and map files to get what you want. Or, you can create the schema from scratch.
MODX does have objects with no 'id' field (e.g., modPluginEvent
http://bobsguides.com/modx-object-quick-reference.html#modPlugin) so it's definitely possible. Remove the 'id' field from the schema and be sure to extend xPDOObject instead of xPDOSimpleObject.
See the MODX schema at core\model\schema\modx.mysql.schema.xml for examples.
The information here will help too:
http://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/using-custom-database-tables-in-your-3rd-party-components
Also, this search has some info on using xPDO with innodb:
https://www.google.com/search?q=modx+xpdo+innodb&oq=modx+xpdo+innodb&aqs=chrome.0.69i57j69i62l2j69i64.5534j0&sourceid=chrome&ie=UTF-8