Sf assemblage

From ARK
Revision as of 10:46, 14 November 2008 by Andydufton (talk | contribs) (the sf_conf)

Jump to: navigation, search

These are some notes describing the sf_assemblage.

Description

sf_assemblage can be used for displaying and editing attributes that have numbers chained to them. As an example, this could be used for recording the numbers of a certain type of seed in a sample, or for attaching total numbers of findtypes.

Usage

This form should normally be used in conjunction with sf_attr_bytype. The attribute gets added to the item and then sf_assemblage will offer you the chance to add one or more numbers to that attribute.

Set-Up

sf_assemblage needs a number of different 'op' variables set in the sf_conf and also it will need some custom validation set up (to allow for the chains).

Examples

In this example, sf_assemblage is being used to chain coordinates to a projection system that is attached to the item.

Example Configuration

$conf_mcd_botanic =
    array(
        'view_state' => 'max',
        'edit_state' => 'view',
        'sf_title' => 'botanictype', //is used for getting the attributetype
        'sf_html_id' => 'smp_botanic', //the form id tag (must be unique)
        'sf_nav_type' => 'full',
        'script' => 'php/subforms/sf_assemblage.php',
        'op_label' => 'space',
        'op_input' => 'save',
        'op_assemblage_type' => 'botanictype',
        'op_chart' => TRUE,
        'fields' => array(
             $conf_field_total            
        )
);
  • 'op_assemblage_type' - this is the type of attribute (in cor_lut_attribute) that the fields will be chained to.

the fields

The fields that are sent to this form - are the numbers (or in fact txt) that you want to chain to the attribute. They will need some custom validation rules setup to ensure that the add routine works correctly.

 //set up some custom validation for the coordinate chains
$vd_chainkey = 
   array(
     'rq_func' => 'reqManual',
     'vd_func' => 'chkSet',
     'var_name' => 'itemkey',
     'force_var' => 'cor_tbl_attribute',
);
$vd_chainval =
   array(
     'rq_func' => 'reqMulti',
     'vd_func' => 'chkSet',
     'var_name' => 'itemval',
     'lv_name' => 'itemval',
     'var_locn' => 'request',
);
$conf_field_easting =
   array(
       'dataclass' => 'number',
       'classtype' => 'easting',
       'alias_tbl' => 'cor_lut_numbertype',
       'alias_col' => 'numbertype',
       'alias_src_key' => 'easting',
       'alias_type' => '1',
       'editable' => TRUE,
       'field_op_hidden' => FALSE,
       'add_validation' => $number_add_validation,
       'edt_validation' => $number_edt_validation
);
$conf_field_northing =
   array(
       'dataclass' => 'number',
       'classtype' => 'northing',
       'alias_tbl' => 'cor_lut_numbertype',
       'alias_col' => 'numbertype',
       'alias_src_key' => 'northing',
       'alias_type' => '1',
       'editable' => TRUE,
       'field_op_hidden' => FALSE,
       'add_validation' => $number_add_validation,
       'edt_validation' => $number_edt_validation
);
//add in the custom validation
$conf_field_easting['add_validation'][] = $vd_chainkey;
$conf_field_easting['add_validation'][] = $vd_chainval;
$conf_field_northing['add_validation'][] = $vd_chainkey;
$conf_field_northing['add_validation'][] = $vd_chainval;