Flowchart Engine v0.1
-----------------------------------------------------
Written by Shannon Wynter (AKA: Freman)
Contact: http://fremnet.net/contact
-----------------------------------------------------
I'm sorry I'm not overly good at documentation folks
but I'll outline the class and it's function for you.
Description:
-------------------
A basic and simple engine for following a flowchart.
It handles Processes, and Descision making.
Features:
-------------------
Can follow multi-step questions
Can work with 1 to n responses
Supports 'goto' questions
Can end in multipul ways
Requirements:
-------------------
Built for PHP4 and MySQL, requires Smarty
Limitations:
-------------------
I started implementing support for back button and
refresh but it never got finished so, there's no
back/refresh support.
Other notes:
-------------------
Was written for an in-house helpdesk appliation
then adapted for open source distribution - if I
get the time I'll re-write it from scratch.
History:
-------------------
Where I work we had a flow chart that we followed
for helpdesk calls to get the users back online.
I was tasked with digitizing this flowchart so they
could outsource the helpdesk to a bunch of trained
monkeys.
Files:
-------------------
readme.txt - This file
FlowChart.class.php - Flowchart engine
example.php - Limited example of usage
sample.sql - The data for example.php
Data structire:
-------------------
The data structure is relativly simple...
FlowChartQuestions:
Level, Type, Step, Question, Template, Endpoint.
The Level field just grows like a tree, based on
the Options in the FlowChartOptions table (see below)
The Type field represents the type of question it
is. There are 3 supported types 'Goto', 'Next',
and 'Step'. These types can be changed and adjusted
by extending the FlowChart class
By default Goto's are 5 or 6, Next's are 0 or 3
and Step's are 2.
Type's flexable mostly for your reference.
EG: In the sample data I've provided Next0 is
used to step through the normal data, Next3 is
used as the last entry in a 'Step' sequence
EG: In the sample data I've provided Goto5 is
used in normal flow of data to jump to another
point in the flow. Goto6 is used as the last
entry in a sequence of 'Step's
There is no reason to use 3 or 6 accept for your own
reference.
The Step field is used to index the steps required
to complete a task. Type must be 'Step' to start with
and so long as type stays a 'Step' the steps will
progress through the index. Each step must be +1
the step before it.
The Question field is mostly for your reference,
but in the examplezs provided I use display it in
the template.
The Template field tells the script which template
to load and display for the question.
The EndPoint field is used to signify that this
is the end of the flowchart. When endpoint is flagged
'Type' is returned to the script for refrence.
I use type 1 to tell the calling script that the
issue was resolved and type 4 to tell it that the
issue needs to be looked into further.
FlowChartOptions:
Level, OptionNumber, OptionCaption, FlagLog
The Level field is used to associate the options
with a question from FlowChartQuestions.
The OptionNumber field should be unique for each
level and the number used here will be appended to
the current level to form the next level - I know
I could have used 'parent' and 'children' but this
is easier to follow and quicker to implement.
The OptionCaption field the the label of the button
that will be displayed.
The FlagLog field is completely unused by the
FlowChartOptions but it is used in our system for
other reasons - so I figured you might use it.
|