CRUD Class

php 5 Comments »

I have intention to complete my draft of a CRUD PHP-class. Don’t know what is it? Easy!

Imagine you have a site where users point some places at Google Maps framed at your page. As developer of this site you will have to create several admin pages:

  • a page to manage users: e.g. grant permissions to your friend or deactivate a gonzo user
  • another page to tune options of the map points: fix a typo or edit coordinates of points

Just two pages, but I bet you’d need at least 3-5 hours to make a small draft form to manage these entities. To make things worse, let me remind you of paging, client and server sides validation, date-picker dialogs or even data integrity checks.

So, to cut the long story short, CRUD class generates all this for you in a couple of lines of code. So you just define what database table you’d like to manage - drum-roll! - you get a ready-made interface! (I call it a Table Manager Class - it helps you to manage any table in your system)

By the way, CRUD stands for Create, Read, Update and Delete. So CRUD class allows to play with data you have.

As Petrovich said (a laboratory assistant in my university), “first check what others have done”.

So, I found a CRUD class and I remember about Symfony framework admin generator.

CRUD class

While the former is rather crude (it doesn’t work in some conditions, settings are embedded in PHP code), Symfony’s generator is quite nice: settings are separated from logic in a Yaml file and the code is being regenerated for you every time you make a change.The drawback of the latter is that you have to deal with huge Symfony framework to have this feature.

Symfony admin generator

So my idea is to prepare a stand-alone PHP class to make generation of admin inteface easier. I’m going to use an Ext.js JavaScript framework to beautify the interface.

Maybe someone has a better solution?

Andrisi suggests this to be like this:

A draft of CRUD

Mind-mapping in Fusebox

Fusebox, Mind-mapping 1 Comment »

In our fast-moving world visual designing tools become more and more popular, allowing to generate code snippets or whole projects from a graphical scretch. This article describes what a Fusebox developer can get from it.Circuits and fuses of a Fusebox project form a strict hierarchy, so we can draw the project schema as a tree. Is there any software to draw trees? Of course! There is an astonishing variety of tools to create mind-maps which we can adopt to our needs.

If you are not familiar with mind maps, let’s take a closer look on them:

A mind map is a diagram used to represent words, ideas, tasks or other items linked to and arranged radially around a central key word or idea. It is used to generate, visualize, structure and classify ideas, and as an aid in study, organization, problem solving, decision making, and writing [wikipedia].

Mind maps are a result of mind-mapping: a technique allowing to keep track of ideas generated while a brain-storm session (yes, it’s when people jot down as many ideas as they can and after that they “separate grains and tares” - choose the most brilliant ones). So, valuable thoughts are hierarchically organized as a tree. As any tree, mind map has nodes and leafs, i.e. nodes with no children.

mind map

Structural similarity between a mind map and a Fusebox project provides a basis for a conclusion that the former can be used to generate the latter (and vice versa). A glue between the two layers can be the XML format as most mind-mapping utilities can import from and export to it. A drawback of using XML is that almost every application has its own kind of the XML format our converter will have to deal with.

As long as mind-mapping utilities are concerned - there are a plenty of on-line tools and desktop applications (usually written in Java). We will decide in favour of Bubbl.us as the web site and FreeMind as example of a free desktop tool.

Bubbl.us is a web2.0 on-line application written in Flash, and it’s quite fun to work with it - for example, a deleting node can explode, so be aware! There is a feature of export to several graphical formats, so you can have a big glyph of your project on the wall. You can register if you want to save your masterpieces (so called ‘lazy registration’). Minus is that if you have too many items it could work a bit slower.

Preparing project structure at bubble.us. Export to XML feature is available in the right bottom

FreeMind is a Java tool so you can use it on many operating systems. It is not as fun as the previous one but it provides extensive export capabilities (XHTML format as well which allows a user to create a mapped image with links to a folding outline) and has some extra features - you can provide nodes with icons, lock nodes (protect with password) and search within a single branch.

Preparing a project structure in FreeMind. XML is available as .mm-file

Since Fusebox supports ColdFusion and PHP platforms, instruments for both platforms are available.

ColdFusion implementations can be found in the Tools part of the fusebox.org site. Among them are:

  • Fuseminder2 - Converts Mind Maps to Fusebox 3
  • Fuseminder - Generates a Fusebox 2.0 framework based on a mind mapping file
  • FuseminderPlus - Fuseminder for Fusebox 3
  • FuseminderFB4 - Fuseminder for Fusebox 4
  • MindFuser - Reads a Fusebox 2.0 application and generates an outline file

You can easily download them and give them a try.

There is not so many tools written in PHP. One of a kind is the Fusebox Manager supporting several XML formats. This package implements a code generator that takes project definition and generates PHP code to implement the Fusebox methodology. The generated code uses a run-time PHP framework also provided within the package to deploy projects using this methodology all in PHP. For now it works in only one direction - it generates a Fusebox application from a mind map, but it’s planned to add backward function, so that you could use it for existing Fusebox projects to manage them visually and then save back as a bunch of PHP files.

Fusebox Manager at work

All in all, the day when you would be able to create a whole project by several movements of your mouse is not as far as you may think.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Login