Adding Forms and Fields: Difference between revisions
(23 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
This will describe how to add a new module to iHRIS Manage to add in two new forms for tracking Professional Development for an employee. These instructions could be modified for iHRIS Qualify with a few minor changes. | This will describe how to add a new module to iHRIS Manage to add in two new forms for tracking Professional Development for an employee. These instructions could be modified for iHRIS Qualify with a few minor changes. There will be one form for Professional Development for courses to be logged for employees. Any number of these forms can be associated with an employee. There will also be a link to Add Continuous Professional Development. Only one of these forms will be associated with an employee. It can be used to save the current training needs requested by the employee for professional and personal development. | ||
== Step 1: Create the module == | == Step 1: Create the module == | ||
Change into your site's modules directory and create a new directory called ProfDevelopment and change into this directory. Create lib and templates directory in the | Change into your site's modules directory and create a new directory called ProfDevelopment and change into this directory. Create lib and templates directory in the ProfDevelopment directory. Create and edit a new file called ProfDevelopment.xml (in the ProfDevelopment directory) with the following contents: | ||
<source lang="xml"> | <source lang="xml"> | ||
Line 12: | Line 12: | ||
<metadata> | <metadata> | ||
<displayName>Professional Development</displayName> | <displayName>Professional Development</displayName> | ||
<category> | <className>iHRIS_Module_ProfDevelopment</className> | ||
<category>Site</category> | |||
<description>Adds in two new forms for tracking professional development</description> | <description>Adds in two new forms for tracking professional development</description> | ||
<version>3.1.4</version> | <version>3.1.4</version> | ||
Line 26: | Line 27: | ||
<configurationGroup name='ProfDevelopment' path='/I2CE'> | <configurationGroup name='ProfDevelopment' path='/I2CE'> | ||
<displayName>Professional Development</displayName> | <displayName>Professional Development</displayName> | ||
<configurationGroup name='tasks' path='/I2CE/tasks/task_description' locale='en_US'> | |||
<configuration name='person_can_view_child_form_person_profdev'> | |||
<value>Can view person_profdev child form of a person</value> | |||
</configuration> | |||
<configuration name='person_can_edit_child_form_person_profdev'> | |||
<value>Can edit person_profdev child forms of a person</value> | |||
</configuration> | |||
<configuration name='person_can_view_child_form_person_continuous_profdev'> | |||
<value>Can view person_continuous_profdev child form of a person</value> | |||
</configuration> | |||
<configuration name='person_can_edit_child_form_person_continuous_profdev'> | |||
<value>Can edit person_continuous_profdev child forms of a person</value> | |||
</configuration> | |||
</configurationGroup> | |||
<configurationGroup name='tasks_trickle_down' path='/I2CE/tasks/task_trickle_down/'> | |||
<configuration name='person_can_view_child_form_person_profdev' values='many'> | |||
<value>person_can_view</value> | |||
</configuration> | |||
<configuration name='person_can_edit_child_form_person_profdev' values='many'> | |||
<value>person_can_view_child_form_person_profdev</value> | |||
<value>person_can_view</value> | |||
</configuration> | |||
<configuration name='person_can_view_child_form_person_continuous_profdev' values='many'> | |||
<value>person_can_view</value> | |||
</configuration> | |||
<configuration name='person_can_edit_child_form_person_continuous_profdev' values='many'> | |||
<value>person_can_view_child_form_person_continuous_profdev</value> | |||
<value>person_can_view</value> | |||
</configuration> | |||
<configuration name='person_can_view_child_forms' values='many'> | |||
<value>person_can_view_child_form_person_profdev</value> | |||
<value>person_can_view_child_form_person_continuous_profdev</value> | |||
</configuration> | |||
<configuration name='person_can_edit_child_forms' values='many'> | |||
<value>person_can_edit_child_form_person_profdev</value> | |||
<value>person_can_edit_child_form_person_continuous_profdev</value> | |||
</configuration> | |||
</configurationGroup> | |||
<configurationGroup name='forms' path='/modules/forms'> | <configurationGroup name='forms' path='/modules/forms'> | ||
Line 246: | Line 288: | ||
<status>required:true</status> | <status>required:true</status> | ||
<!-- This section will create the person_profdev page so that new professional development | <!-- This section will create the person_profdev page so that new professional development | ||
Line 333: | Line 366: | ||
</source> | </source> | ||
== Step 2: Create the Module Class == | |||
== | We need to create a new class in the lib directory called iHRIS_Module_ProfDevelopment.php with the following content. This is so the new forms will show up on the view person page. | ||
<source lang="php"> | |||
<?php | |||
class iHRIS_Module_ProfDevelopment extends I2CE_Module { | |||
public static function getMethods() { | |||
return array( | |||
'iHRIS_PageView->action_person_profdev' => 'action_person_profdev' | |||
'iHRIS_PageView->action_person_continuous_profdev' => 'action_person_continuous_profdev' | |||
); | |||
} | |||
public function action_person_profdev($obj) { | |||
$ | if (!$obj instanceof iHRIS_PageView) { | ||
return; | |||
} | |||
return $obj->addChildForms('person_profdev', 'siteContent'); | |||
} | |||
public function action_person_continuous_profdev($obj) { | |||
$ | if (!$obj instanceof iHRIS_PageView) { | ||
return; | |||
} | |||
return $obj->addChildForms('person_continuous_profdev', 'siteContent'); | |||
} | |||
} | |||
?> | |||
</source> | </source> | ||
Copy the view.html template file from the ihris-manage templates directory to the site templates directory. Make the following changes. The changes are surround by comments. This should be in the site in case multiple modules update the view.html template. | |||
<source lang="html4strict"> | |||
<span task="person_can_edit_child_form_demographic" type="form" name="person:id" href="demographic?parent=" ifset="!demographic:id">Add Demographic Information</span> | |||
<!-- New professional development section for the Professional Development module --> | |||
<span type='module' name='ProfDevelopment' ifenabled='true'> | |||
<span task="person_can_edit_child_form_person_continuous_profdev" type="form" name="person:id" href="person_continuous_profdev?parent=" ifset="!person_continuous_profdev:id">Add Continuous Professional Development</span> | |||
</span> | |||
<!-- End of Professional Development additions --> | |||
</source> | </source> | ||
<source lang="html4strict"> | <source lang="html4strict"> | ||
Line 371: | Line 413: | ||
<span role='hr_staff' type="form" name="person:id" href="person_language?parent=" text="Add Language Proficiency"></span> | <span role='hr_staff' type="form" name="person:id" href="person_language?parent=" text="Add Language Proficiency"></span> | ||
<span type='module' name='simple-competency' ifenabled='true'> | <span type='module' name='simple-competency' ifenabled='true'> | ||
<span role='hr_staff' type="form" name="person:id" href="person_competency?parent=" | <span role='hr_staff' type="form" name="person:id" href="person_competency?parent=">Add Competency</span> | ||
<span role='hr_staff' type="form" name="person:id" href="person_competency_history?parent=" | <span role='hr_staff' type="form" name="person:id" href="person_competency_history?parent=">Competency Evaluations</span> | ||
</span> | </span> | ||
</p> | </p> | ||
Line 388: | Line 430: | ||
<!-- New professional development section for the Professional Development module --> | <!-- New professional development section for the Professional Development module --> | ||
<span type="module" name="ProfDevelopment" ifenabled="true"> | |||
<div class="recordsData"> | <div class="recordsData"> | ||
<h3><a name="jump_profdev">Professional Development</a></h3> | <h3><a name="jump_profdev">Professional Development</a></h3> | ||
<p class="editRecordsData" id="profdev_links"><a href="" class="hide" title="Hide" onclick="return hideDiv('profdev', this );">Hide</a> | <p class="editRecordsData" id="profdev_links"><a href="" class="hide" title="Hide" onclick="return hideDiv('profdev', this );">Hide</a> | ||
<span | <span task='person_can_edit_child_form_person_profdev' type="form" name="person:id" href="person_profdev?parent=">Add Professional Development</span> | ||
</p> | </p> | ||
Line 398: | Line 441: | ||
<br style="clear: both;" /> | <br style="clear: both;" /> | ||
</div> <!-- recordsData --> | </div> <!-- recordsData --> | ||
</span> | |||
<!-- End of Professional Development additions --> | <!-- End of Professional Development additions --> | ||
</source> | </source> | ||
Copy the menu_view_person.html template file from the ihris-manage templates directory to the | Copy the menu_view_person.html template file from the ihris-manage templates directory to the site templates directory. Make the following changes: | ||
<source lang="html4strict"> | <source lang="html4strict"> | ||
<li><a href="#jump_qualification" onclick="if(prevAnchor) prevAnchor.className=''; this.className='active'; prevAnchor=this;">Qualifications</a></li> | <li><a href="#jump_qualification" onclick="if(prevAnchor) prevAnchor.className=''; this.className='active'; prevAnchor=this;">Qualifications</a></li> | ||
<!-- Additions for the Professional Development module --> | <!-- Additions for the Professional Development module --> | ||
<li><a href="#jump_profdev" onclick="if(prevAnchor) prevAnchor.className=''; this.className='active'; prevAnchor=this;">Professional Development</a></li> | <span type="module" name="ProfDevelopment" ifenabled="true"> | ||
<li><a href="#jump_profdev" onclick="if(prevAnchor) prevAnchor.className=''; this.className='active'; prevAnchor=this;">Professional Development</a></li> | |||
</span> | |||
<!-- End of additions --> | <!-- End of additions --> | ||
</source> | </source> | ||
Line 421: | Line 467: | ||
<p>Edit This Information</p> | <p>Edit This Information</p> | ||
<ul> | <ul> | ||
<li | <li task='person_can_edit_child_form_person_profdev'><span type="form" name="person_profdev:id" href="person_profdev?id=" parent="true">Update this Information</span></li> | ||
</ul> | </ul> | ||
</div> <!-- editRecord --> | </div> <!-- editRecord --> | ||
Line 438: | Line 484: | ||
</div> | </div> | ||
</source> | </source> | ||
=== form_person_profdev.html === | === form_person_profdev.html === | ||
Line 466: | Line 511: | ||
<p>Edit This Information</p> | <p>Edit This Information</p> | ||
<ul> | <ul> | ||
<li role=' | <li role='person_can_edit_child_form_person_continuous_profdev'><span type="form" ifset="person_continuous_profdev:id" name="person_continuous_profdev:id" href="demographic?id=" parent="true">Update this Information</span></li> | ||
</ul> | </ul> | ||
</div> <!-- editRecord --> | </div> <!-- editRecord --> | ||
Line 491: | Line 536: | ||
</div> | </div> | ||
</source> | </source> | ||
=== form_person_continuous_profdev.html === | === form_person_continuous_profdev.html === | ||
Line 519: | Line 559: | ||
</tbody> | </tbody> | ||
</source> | </source> | ||
== Step 4: Enable the module in the site config file == | == Step 4: Enable the module in the site config file == | ||
Line 529: | Line 568: | ||
</source> | </source> | ||
[ | [[Category:Developer Resources]] |
Latest revision as of 20:27, 1 March 2019
This will describe how to add a new module to iHRIS Manage to add in two new forms for tracking Professional Development for an employee. These instructions could be modified for iHRIS Qualify with a few minor changes. There will be one form for Professional Development for courses to be logged for employees. Any number of these forms can be associated with an employee. There will also be a link to Add Continuous Professional Development. Only one of these forms will be associated with an employee. It can be used to save the current training needs requested by the employee for professional and personal development.
Step 1: Create the module
Change into your site's modules directory and create a new directory called ProfDevelopment and change into this directory. Create lib and templates directory in the ProfDevelopment directory. Create and edit a new file called ProfDevelopment.xml (in the ProfDevelopment directory) with the following contents:
<source lang="xml">
<?xml version="1.0"?> <!DOCTYPE I2CEConfiguration SYSTEM "I2CE_Configuration.dtd"> <I2CEConfiguration name='ProfDevelopment'>
<metadata> <displayName>Professional Development</displayName> <className>iHRIS_Module_ProfDevelopment</className> <category>Site</category> <description>Adds in two new forms for tracking professional development</description> <version>3.1.4</version> <path name='classes'> <value>./lib</value> </path> <path name='templates'> <value>./templates</value> </path> <priority>325</priority> </metadata> <configurationGroup name='ProfDevelopment' path='/I2CE'> <displayName>Professional Development</displayName>
<configurationGroup name='tasks' path='/I2CE/tasks/task_description' locale='en_US'> <configuration name='person_can_view_child_form_person_profdev'> <value>Can view person_profdev child form of a person</value> </configuration> <configuration name='person_can_edit_child_form_person_profdev'> <value>Can edit person_profdev child forms of a person</value> </configuration> <configuration name='person_can_view_child_form_person_continuous_profdev'> <value>Can view person_continuous_profdev child form of a person</value> </configuration> <configuration name='person_can_edit_child_form_person_continuous_profdev'> <value>Can edit person_continuous_profdev child forms of a person</value> </configuration> </configurationGroup> <configurationGroup name='tasks_trickle_down' path='/I2CE/tasks/task_trickle_down/'> <configuration name='person_can_view_child_form_person_profdev' values='many'> <value>person_can_view</value> </configuration> <configuration name='person_can_edit_child_form_person_profdev' values='many'> <value>person_can_view_child_form_person_profdev</value> <value>person_can_view</value> </configuration> <configuration name='person_can_view_child_form_person_continuous_profdev' values='many'> <value>person_can_view</value> </configuration> <configuration name='person_can_edit_child_form_person_continuous_profdev' values='many'> <value>person_can_view_child_form_person_continuous_profdev</value> <value>person_can_view</value> </configuration> <configuration name='person_can_view_child_forms' values='many'>
<value>person_can_view_child_form_person_profdev</value> <value>person_can_view_child_form_person_continuous_profdev</value>
</configuration> <configuration name='person_can_edit_child_forms' values='many'>
<value>person_can_edit_child_form_person_profdev</value>
<value>person_can_edit_child_form_person_continuous_profdev</value> </configuration> </configurationGroup>
<configurationGroup name='forms' path='/modules/forms'> <displayName>Forms</displayName> <description>Information about the forms made available by ProfDevelopment</description> <configurationGroup name='forms'> <displayName>Forms available to the form factory</displayName> <status>advanced:true</status> <status>required:true</status>
<configurationGroup name='person_profdev'> <displayName>Person Professional Development</displayName> <description>The Person Professional Development Form</description> <configuration name='class' values='single'> <displayName>Class Name</displayName> <description>The name of the class providing the form</description> <value>iHRIS_PersonProfDevelopment</value> </configuration> <configuration name='display' values='single'> <displayName>Display name</displayName> <description>The display name for this form</description> <value>Person Professional Development</value> </configuration> </configurationGroup>
<configurationGroup name='person_continuous_profdev'> <displayName>Person Continuous Professional Development</displayName> <description>The Person Continuous Professional Development Form</description> <configuration name='class' values='single'> <displayName>Class Name</displayName> <description>The name of the class providing the form</description> <value>iHRIS_PersonContinuousProfDev</value> </configuration> <configuration name='display' values='single'> <displayName>Display name</displayName> <description>The display name for this form</description> <value>Person Continuous Professional Development</value> </configuration> </configurationGroup>
<configurationGroup name='person_meta' path='/modules/forms/forms/person/meta'> <displayName>MetaData on the form</displayName> <configuration name='child_forms' values='many' > <status>uniquemerge:true</status> <displayName>Child Forms</displayName> <value>person_profdev</value> <value>person_continuous_profdev</value> </configuration> </configurationGroup> </configurationGroup> <configurationGroup name="formClasses" > <displayName>Form Class Configuration</displayName>
<configurationGroup name="iHRIS_PersonProfDevelopment"> <displayName>Configuration for the class 'iHRIS_PersonProfDevelopment'</displayName> <configuration name="extends"> <displayName>The class this form extends</displayName> <value>I2CE_Form</value> </configuration> <configurationGroup name="fields"> <displayName>The fields defined for this form.</displayName>
<configurationGroup name="year"> <displayName>The fields 'year'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>DATE_Y</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Year</value> </configuration> <configuration name="default_eval"> <displayName>The default value for this field as an eval() string</displayName> <value>I2CE_Date::now()</value> </configuration> </configurationGroup> <configurationGroup name="course"> <displayName>The fields 'course'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>STRING_LINE</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Course</value> </configuration> </configurationGroup> <configurationGroup name="duration"> <displayName>The fields 'duration'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>INT</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Duration (in Days)</value> </configuration> </configurationGroup> <configurationGroup name="certification"> <displayName>The fields 'certification'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>STRING_LINE</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Certification</value> </configuration> </configurationGroup>
</configurationGroup> </configurationGroup>
<configurationGroup name="iHRIS_PersonContinuousProfDev"> <displayName>Configuration for the class 'iHRIS_PersonContinuousProfDev'</displayName> <configuration name="extends"> <displayName>The class this form extends</displayName> <value>I2CE_Form</value> </configuration> <configurationGroup name="fields"> <displayName>The fields defined for this form.</displayName>
<configurationGroup name="work_training_1"> <displayName>The fields 'work_training_1'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>STRING_LINE</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Training Priority 1</value> </configuration> </configurationGroup> <configurationGroup name="work_training_2"> <displayName>The fields 'work_training_2'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>STRING_LINE</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Training Priority 2</value> </configuration> </configurationGroup> <configurationGroup name="work_training_3"> <displayName>The fields 'work_training_3'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>STRING_LINE</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Training Priority 3</value> </configuration> </configurationGroup>
<configurationGroup name="personal_training_1"> <displayName>The fields 'personal_training_1'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>STRING_LINE</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Priority 1</value> </configuration> </configurationGroup> <configurationGroup name="personal_training_2"> <displayName>The fields 'personal_training_2'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>STRING_LINE</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Priority 2</value> </configuration> </configurationGroup> <configurationGroup name="personal_training_3"> <displayName>The fields 'personal_training_3'</displayName> <configuration name="formfield"> <displayName>The form field type</displayName> <value>STRING_LINE</value> </configuration> <configuration name="headers" type="delimited"> <displayName>The headers for this field.</displayName> <value>default:Priority 3</value> </configuration> </configurationGroup>
</configurationGroup> </configurationGroup>
</configurationGroup> </configurationGroup> <configurationGroup name='page'> <displayName>Pages</displayName> <description>Information about various pages made available by the system</description> <status>required:true</status>
<configurationGroup name='person_profdev'> <displayName>Person Professional Development Page</displayName> <description> The page 'person_profdev' which has the action of: Add/Update Professional Development</description> <configuration name='class' values='single'> <displayName>Page Class</displayName> <description>The class responsible for displaying this page</description> <status>required:true</status> <value>iHRIS_PageFormParentPerson</value> </configuration> <configuration name='style' values='single'> <displayName>Page Style</displayName> <description>The Page Style</description> <value>ihris_common_page_form_parent_person</value> </configuration> <configurationGroup name='args'> <displayName>Page Options</displayName> <description>The options that control the access and display of all pages</description> <configuration name='title' values='single'> <displayName>Page Title</displayName> <description>Page Title</description> <status>required:true</status> <value>Add/Update Professional Development</value> </configuration> <configuration name='page_form' values='single'> <displayName>Form</displayName> <description>The form this page is using</description> <status>required:true</status> <value>person_profdev</value> </configuration> </configurationGroup> </configurationGroup>
<configurationGroup name='person_continuous_profdev'> <displayName>Person Continuous Professional Development Page</displayName> <description> The page 'person_continuous_profdev' which has the action of: Add/Update Continuous Professional Development</description> <configuration name='class' values='single'> <displayName>Page Class</displayName> <description>The class responsible for displaying this page</description> <status>required:true</status> <value>iHRIS_PageFormParentPerson</value> </configuration> <configuration name='style' values='single'> <displayName>Page Style</displayName> <description>The Page Style</description> <value>ihris_common_page_form_parent_person</value> </configuration> <configurationGroup name='args'> <displayName>Page Options</displayName> <description>The options that control the access and display of all pages</description> <configuration name='title' values='single'> <displayName>Page Title</displayName> <description>Page Title</description> <status>required:true</status> <value>Add/Update Continuous Professional Development</value> </configuration> <configuration name='page_form' values='single'> <displayName>Form</displayName> <description>The form this page is using</description> <status>required:true</status> <value>person_continuous_profdev</value> </configuration> </configurationGroup> </configurationGroup>
</configurationGroup> </configurationGroup>
</I2CEConfiguration>
</source>
Step 2: Create the Module Class
We need to create a new class in the lib directory called iHRIS_Module_ProfDevelopment.php with the following content. This is so the new forms will show up on the view person page. <source lang="php"> <?php class iHRIS_Module_ProfDevelopment extends I2CE_Module {
public static function getMethods() { return array( 'iHRIS_PageView->action_person_profdev' => 'action_person_profdev' 'iHRIS_PageView->action_person_continuous_profdev' => 'action_person_continuous_profdev' ); }
public function action_person_profdev($obj) { if (!$obj instanceof iHRIS_PageView) { return; } return $obj->addChildForms('person_profdev', 'siteContent'); } public function action_person_continuous_profdev($obj) { if (!$obj instanceof iHRIS_PageView) { return; } return $obj->addChildForms('person_continuous_profdev', 'siteContent'); }
} ?> </source>
Copy the view.html template file from the ihris-manage templates directory to the site templates directory. Make the following changes. The changes are surround by comments. This should be in the site in case multiple modules update the view.html template.
<source lang="html4strict">
Add Demographic Information Add Continuous Professional Development
</source>
<source lang="html4strict">
<a name="jump_qualification">Qualifications</a>
<a href="" class="hide" title="Hide" onclick="return hideDiv('qualification', this);">Hide</a> Add Competency Competency Evaluations
<a name="jump_profdev">Professional Development</a>
<a href="" class="hide" title="Hide" onclick="return hideDiv('profdev', this );">Hide</a> Add Professional Development
</source>
Copy the menu_view_person.html template file from the ihris-manage templates directory to the site templates directory. Make the following changes:
<source lang="html4strict">
Step 3: Add in the Professional Development templates
In the templates directory create the following files and contents:
view_person_profdev.html
<source lang="html4strict">
Edit This Information
- Update this Information
Other Training |
---|
</source>
form_person_profdev.html
<source lang="html4strict"> <tbody id="person_form">
Other Training (of more than 7 days)
</tbody> </source>
view_person_continuous_profdev.html
<source lang="html4strict">
Edit This Information
- Update this Information
Training needs that would improve everyday work | |
---|---|
Training needs for personal development |
</source>
form_person_continuous_profdev.html
<source lang="html4strict"> <tbody>
Training needs that would improve everyday work Training needs for personal development
</tbody> </source>
Step 4: Enable the module in the site config file
Edit your site configuration file and add in the following line below any requirements and above the paths:
<source lang="xml"> <enable name="ProfDevelopment" /> </source>