From the __Select source__ dropdown, choose __start__.
|
|
First thing we want to do is set some text to be displayed on the screen. Enter this in the edit window.
|
- <?php
|
- $smarty->assign('display_text', 'Hello world!');
|
- $instance->complete();
|
- ?>
|
+{CODE()}<?php |
+ $gBitSmarty->assign('display_text', 'Hello world!'); |
+ |
+ if(isset($_REQUEST['save'])){ |
+ $instance->complete(); |
+ } |
+?>{CODE} |
You will notice that along the right side of the edit form are a number of links. These are coding shortcuts that allow you to quickly insert commonly used code.
|
|
-Let me explain these two lines.
|
-The first line ''$smarty->assign('display_text', 'Hello world!');'' is used to assign text to a ''variable'' which is used in __template__. Here we are assigning the variable ''display_text'' with the words '''Hello world!'''. You will see this used when we edit the template section.
|
+Let me explain these lines. |
+The first line ''$gBitSmarty->assign('display_text', 'Hello world!');'' is used to assign text to a ''variable'' which is used in __template__. Here we are assigning the variable ''display_text'' with the words '''Hello world!'''. You will see this used when we edit the template section. |
|
-The second line ''$instance->complete();'' is telling the workflow, that we have finished the activity and are ready to move to the next actitivity - in our case ''end''.
|
+The second line is an ''if'' statement checking if the __save__ button was pressed. If the button was pressed, the ''$instance->complete();'' function is executed telling the workflow, that we have finished the activity and are ready to move to the next actitivity - in our case ''end''. |
|
Press __save__ when finished editing. Press __template__ to edit the display template.
|
|
You will see a edit window with the start of a Smarty template.
|
- {*Smarty template*}
|
+{CODE()}{*Smarty template*}{CODE} |
|
Both ''{*'' and ''*}'' are used for comments in Smarty, so this first line is effectively ignored.
|
|
You will remember that in the previous PHP code, we ''assigned'' the variable ''display_text'' with some text. To display this variable, enter the following in the edit window.
|
- {*Smarty template*}
|
- Ready to display text: {$display_text}
|
-
|
+{CODE()}{*Smarty template*} |
+<form method="post"> |
+ Ready to display text: <b>{$display_text}</b><br> |
+ <input type=submit name="save" value="Ok"> |
+</form>{CODE} |
Anything surrounded by curly braces ''{'' and ''}'' are checked by Smarty and modified accordinly. Smarty provides many different functions using this method. Check the Smarty tutorial at the start of this document for more information. Agin you will notice that along the right side of the edit form are a number of links. These are Smarty shortcuts that allow you to quickly insert commonly used code.
|
|
Press __save__ when finished editing.
|
|
-Look at the toolbar, and you will see two new icons - a {img src=/Galaxia/icons/green_dot.gif} green __valid__ dot and an {img src=/Galaxia/icons/refresh2.gif} __activate__ icon. These indicate that all errors have been resolved and by clicking on the __activate__ icon, you will activate the process. Click the {img src=/Galaxia/icons/refresh2.gif} __activate__ icon.
|
-...page...
|
-(TODO: Starting an instance) |
+Look at the toolbar, and you will see two new icons - a {img src=/galaxia/icons/green_dot.gif} green __valid__ dot and an {img src=/galaxia/icons/refresh2.gif} __activate__ icon. These indicate that all errors have been resolved and by clicking on the __activate__ icon, you will activate the process. Click the {img src=/galaxia/icons/refresh2.gif} __activate__ icon. |
+!Starting an Instance |
+Click on __Admin Processes__ and you will see the two columns ''Active'' and ''Valid'' have now changed. These indicated that the workflow appears to be complete and is ready for execution. |
+-=User Processes=- |
+The __User Processes__ menu item shows all available processes, their number of activities and the number of current instances. |
+The user can use this screen to see all their available processes. As you can see currently we have one activity and no (zero) instances. |
+-=User Activities=- |
+The __User Activities__ menu item show all available activities. In our example, we have one item, the __start__ activity. |
+The {img src=/galaxia/icons/next.gif} arrow icon indicated that this activity can be started or ''instantiated''. |
+Click on the {img src=/galaxia/icons/next.gif} arrow to start our example process. |
+!Hello World! |
+When you start our example process, the screen changes to show the form we designed earlier. |
+^Ready to display text: __Hello world!__ |
+||Ok||^ |
+As you can see - our text that we set in our code has displayed in our form. |
+-=Saving your Process=- |
+If you'd like to save your process to an XML file for later restoration, this is how to do it. |
+ |
+Go to the __Admin Processes__ page and click the {img src=/galaxia/icons/export.gif} __export__ icon. Depending on your browser, you will either be prompted to save the file somewhere or it will be displayed in the browser window. If it display, select __File__ / __Save As__ to save it to a file. |
+ |
+!Hello World Process 1.1 - New Version |
+Click here to download the XML file of the process. |
+{attachment id=149} |
+ |
+So we are going to create a more complex version of workflow. In the __Admin Processes__ page, you can select ''new major'' or ''new minor'', to create a duplicate process. This allows you to begin testing a new version of process and eventually, replace the old version with the new one. |
+ |
+Click __new minor__ |
+ |
+You can see a duplicate Hello World Process, with a version number of __1.1__ in your list. |
+ |
+!New Activity |
+We will create a new activity to display our hello world information. |
+Click on the ''Activities'' icon and create a new activity called ''display''. |
+In __Add transitions from:__ list, select ''start'' and in the __Add transitions to:__ list, select ''end''. This places the activity between the two previous activities. |
+Check ''auto routed:'' and select ''testuser'' role for this activity. |
+ |
+ |
+As you can see a new error came up ^This process is invalid: |
+Activity display is interactive so it must use the $instance->complete() method^ |
+ |
+Another point to note is the graph of the process - click the {img src=/galaxia/icons/graph.gif} __graph__ icon. You can see the flow of the process is not right, as we want to start, then display and finally end. |
+ |
+Click on the ''start'' activity. |
+In the __Add transitions to:__ list, select ''display'' and click __Save__. This places the ''start'' activity at the beginning of the process. |
+Click the {img src=/galaxia/icons/graph.gif} __graph__ icon again to see the flow of the process. |
+ |
+!Inputting Data |
+Click the __template__ link on the ''start'' process. Edit the code, to display an INPUT TEXT field. |
+{CODE()}{*Smarty template*} |
+ |
+<form method="post"> |
+ Ready to display text: <b>{$display_text}</b><br> |
+ |
+ Please enter your name:<input type=text name="name"> |
+ |
+ <input type=submit name="save" value="Ok"> |
+</form>{CODE} |
+Click the __code__ button to switch to the PHP code window. Edit the code, to store the text from the INPUT TEXT field. |
+{CODE()}<?php |
+ $gBitSmarty->assign('display_text', 'Hello world!'); |
+ |
+ if(isset($_REQUEST['save'])){ |
+ |
+ $instance->set("name", $_REQUEST['name']); |
+ |
+ $instance->complete(); |
+ } |
+?>{CODE} |
+Drop down the __select source:__ list, and choose ''display''. Edit the code, to retrieve the stored text. |
+{CODE()}<?php |
+ $name = $instance->get("name"); |
+ $gBitSmarty->assign('name', $name); |
+ |
+ if(isset($_REQUEST['save'])){ |
+ $instance->complete(); |
+ } |
+?>{CODE} |
+Press the __template__ button and edit the template to display the retrieved value. |
+{CODE()}{*Smarty template*} |
+<form method="post"> |
+ Hello there <b>{$name}</b><br> |
+ Press <input type=submit name="save" value="Continue"> to finish. |
+</form>{CODE} |
+Click __save__ to finish coding. |
+ |
+Click the {img src=/galaxia/icons/refresh2.gif} __activate__ icon to activate the process. Go to ''User Activities and try version 1.1 of the Hello World Process. |
+ |
+ |
+ |