Hi Surej,
please always reply to the components list - then others can benefit as
well.
Am Dienstag, 13. November 2007 schrieben Sie:
> Here is my work flow
>
> $workflow = new ezcWorkflow('Leave_Application');
>
> // for Team lead
> $input = new ezcWorkflowNodeInput( array( 'teamLead' => new
> ezcWorkflowConditionIsObject ) );
>
> $workflow->startNode->addOutNode( $input );
>
> $branch = new ezcWorkflowNodeExclusiveChoice;
> $branch->addInNode( $input);
>
> $tLapprovedNode = new ezcWorkflowNodeAction( 'Leave Approved' );
> $tLnotapprovedNode = new ezcWorkflowNodeAction( ' Leave NotApproved'
> );
>
> $branch->addConditionalOutNode(
> new ezcWorkflowConditionVariable('approval', new
> ezcWorkflowConditionIsTrue ), $tLapprovedNode );
>
>
> $branch->addConditionalOutNode(
> new ezcWorkflowConditionVariable('approval', new
> ezcWorkflowConditionIsFalse ), $tLnotapprovedNode );
>
>
> //-For project manager------------------------
> $input1 = new ezcWorkflowNodeInput( array( 'projectLead' => new
> ezcWorkflowConditionIsBool ) );
>
> $branch->addInNode( $input1 );
>
>
> $pMapprovedNode = new ezcWorkflowNodeAction( 'Leave Approved' );
> $pMnotapprovedNode = new ezcWorkflowNodeAction( ' Leave NotApproved'
> );
>
> $branch->addConditionalOutNode( new
> ezcWorkflowConditionVariable( 'publish',
> new ezcWorkflowConditionIsTrue ), $pMapprovedNode);
>
> $branch->addConditionalOutNode( new
> ezcWorkflowConditionVariable( 'publish',
> new ezcWorkflowConditionIsFalse ), $pMnotapprovedNode);
>
> $merge = new ezcWorkflowNodeSimpleMerge;
> $merge->addInNode( $tLapprovedNode);
> $merge->addInNode( $tLnotapprovedNode);
> $merge->addInNode( $pMapprovedNode);
> $merge->addInNode( $pMnotapprovedNode);
>
> $merge->addOutNode( $workflow->endNode );
>
> Thanks for the reply. I have defined a simple work flow scenario with
> my requirement. Did I make any mistake any where in defining the work
> flow
Did you try to load the workflow? And did it work? From looking at it,
I'm not sure if it is syntactically correct. (But at the moment I'm
very busy, so I did not invest that much time in understanding.) If it
loads correctly, it would be nice, if you could send a graph
visualization of the workflow - that's much easier to understand.
Also, I think, you are perhaps a little bit too complicated. (Or didn't
I get your idea?) Here's how I'd define it via XML (what I find much
more readable). Note: the XML is not valid - I do not have the syntax
in my head... Thus it's more or less pseudo XML definition of the
workflow. (You can find many XML examples in the test/data directory of
your component.)
<workflow>
<node id=1 type=start>
<outNode id=2 />
</node>
<node id=2 type=input>
<!-- that's where the personal can apply for a leave -->
<variable name="someLeaveVariable">
<condition type="IsString"/>
</variable>
<outNode id=3 />
</node>
<node id=3 type=input>
<!-- team leader approve -->
<variable name=teamLeaderApprove>
<condition type="IsBool" />
</variable>
<outNode id=4 />
</node>
<node id=4 type=ExclusiveChoice>
<condition type="Variable" name="teamLeaderApprove">
<condition type="IsFalse"/>
<outNode id="5"/>
</condition>
<condition type="Variable" name="teamLeaderApprove">
<condition type="IsTrue"/>
<outNode id="6"/>
</condition>
</node>
<!-- as it wasn't approved finish workflow here -->
<node id=5 type=End />
<node id=6 type=input>
<!-- project manager approve -->
<variable name=projectManagerApprove>
<condition type="IsBool" />
</variable>
<outNode id=7 />
</node>
<node id=7 type=ExclusiveChoice>
<condition type="Variable" name="projectManagerApprove">
<condition type="IsFalse"/>
<outNode id="8"/>
</condition>
<condition type="Variable" name="projectManagerApprove">
<condition type="IsTrue"/>
<outNode id="9"/>
</condition>
</node>
<node id=8 type=End />
<node id=9 type=End />
</workflow>
> .Please feel free to reply me if I am wrong some where.
> I am trying create a simple PHP application. With out MVC
> architecture using WorkflowDatabaseTiein..
> The doubts I am having is what happens if the team lead disapprove
> the leave request. Should I make workflow end that time.
Yes, that's how I did it. Via
$execution->getVariable( 'teamLeaderApproved' ) you can check if it was
approved or not. Then update the workflow_state table as mentioned in
my other mail.
> If he
> approves it should go to project manager. For this should I close the
> node before going to project manager and open again for PM? How will
> I define each hierarchy like this? I mean like when a TL is approved
> then only it should be shown in PL approval list so how will I get
> the current status of the leave application..
That's where you need the your own workflow_state table.
> 1. To fetch the request to a TL
> 2. Both the approve and disapprove process.( if approved approve I
> should change the status to approves but if he disapprove I should
> end the process. for this what I have to do)
> 3.How will I get the current status
Hope those questions are clear (together with my other mail).
> 4,What is the procedure for ending the process at last.(After PMs
> approvel )
If the workflow ends, the execution is removed from database
automatically. So you only need to implement your application specific
things.
Hope that helped
Thomas
> I think u r clear with what I mean.
>
> Please feel free to reply me
>
> On 11/13/07, Thomas Nunninger <[EMAIL PROTECTED]> wrote:
> > Hi Surej,
> >
> > > I am really interested in ezcomponents Workflow .I like to
> > > implement this work flow in my project. I have simple plan to
> > > implement it in a leave process. First a person applies for a
> > > leave …then the team leader approve it…then project manager
> > > approve it..Then the leave is granted. This is my needed work
> > > flow.
> > >
> > > Personal (Who applies for a leave)
> > >
> > > Team leader(Approve or disapprove)
> > >
> > > Project Manager(Approve or disapprove)
> >
> > This sounds like a straight forward workflow having several input
> > nodes. The first input gets the needed data from the user and all
> > the other input nodes get a boolean value like teamLeaderApproved.
> > After the approving you place an exclusive choice - if not approved
> > go to an end node, in the other case to the next input. Of course
> > this could be much more complex if needed.
> >
> > > I like to do this using WorkflowDatabaseTiein. So how can I start
> > > the work.. Do I have to save the flow in db before the process
> > > starts.
> >
> > As it is an interactive workflow you need to store the workflow
> > description and the execution states. For that you have the
> > database tie in.
> >
> > Personally, I prefer defining the workflow definition via XML
> > (easier to write if it's getting more complex in my opinion). But
> > in your case, defining via PHP should be ok as well.
> >
> > > Or only save data into DB when the person applies for a leave. I
> > > am trying to create simple application .
> >
> > In general I do it like this: store all necessary data in the
> > workflow execution (via workflow execution variables) and only
> > store it to the application (=leave) table, if the workflow ends
> > successfully. That way, you always have only approved data in the
> > table. - But there might be situations where you store some data in
> > the application's table during the workflow, e.g. we needed to
> > store a login name in the user table before finishing because of
> > unique user names.
> >
> > But I guess, you need a general table, where you store, which user
> > needs to trigger which workflow executions, e.g.:
> >
> > execution_id
> > next_user (team leader, project leader, ...)
> >
> > Then you can create a site for each user and fetch from that table,
> > which executions need approval from him. The user can choose a
> > workflow, gets a page with the necessary data and can approve or
> > reject.
> >
> > Hope that helps a little bit. Feel free to ask again, if you have
> > more questions...
> >
> > Have a nice day
> >
> > Thomas
> > --
> > Components mailing list
> > [email protected]
> > http://lists.ez.no/mailman/listinfo/components
--
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components