Adding Forms and Fields - ES

From IHRIS Wiki
Revision as of 11:59, 18 November 2013 by Sturlington (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Esto describe como agregar un módulo nuevo a iHRIS Manage para agregar dos nuevos formularios para rastrear el Desarrollo Profesional de un empleado. Estas instrucciones pueden ser modificadas para iHRIS Qualify con unos pequeños cambios. Habrá un formulario para Desarrollo Profesional para cursos a ser registrados por los empleados. Cualquier cantidad de estos formularios pueden ser asociados con un empleado. También habrá un link para Agregar Desarrollo Profesional Continuo. Solo uno de estos formularios estará asociado con un empleado. Puede ser utilizado para guardar las necesidades de capacitación actuales a petición de un empleado para su desarrollo profesional y personal.

Paso 1: Crear el Módulo

Vaya al directorio de módulos de su sitio y cree un nuevo directorio llamado ProfDevelopment y vaya a este directorio. Cree un directorio de plantillas y un directorio lib en el directorio ProfDevelopment. Cree y edite un nuevo archivo llamado ProfDevelopment.xml (en el directorio ProfDevelopment) con el siguiente contenido:

<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>

Paso 2: Crear la Clase del Módulo

Necesitamos crear una nueva clase en el directorio lib llamado iHRIS_Module_ProfDevelopment.php con el siguiente contenido. Esto es para que los formularios nuevos aparezcan en la página de visualización de persona. <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>

Copie el archivo plantilla view.html del directorio de plantillas de ihris-manage al directorio de plantillas del sitio. Haga los cambios siguientes. Los cambios están rodeados de comentarios. Esto debería estar en el sitio por si acaso módulos múltiples actualizan la plantilla view.html.

<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>

   
 

</source>

Copie el archivo plantilla menu_view_person.html del directorio de plantillas de ihris-manage templates al directorio de plantillas del sitio. Haga los cambios siguientes:

<source lang="html4strict">

  • <a href="#jump_qualification" onclick="if(prevAnchor) prevAnchor.className=; this.className='active'; prevAnchor=this;">Qualifications</a>
  • <a href="#jump_profdev" onclick="if(prevAnchor) prevAnchor.className=; this.className='active'; prevAnchor=this;">Professional Development</a>
  • </source>

    Paso 3: Agregar las plantillas de Desarrollo Profesional

    En el directorio de plantillas cree los archivos y contenido siguientes:

    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
    <tbody> </tbody>
    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>

    Paso 4: Habilitar el módulo en el archivo de configuración del sitio

    Edite su archivo de configuración del sitio y agregue la línea siguiente debajo de cualquier requerimiento y sobre las rutas:

    <source lang="xml"> <enable name="ProfDevelopment" /> </source>