Conditional Subforms

From ARK
Jump to: navigation, search

As of v0.7 the option to configure conditional subforms has been implemented. This means that all previous modtype specific subforms will now be handled using the op_condition settings. It also allows for more specific conditions to be placed on subforms to control if/when they are to be displayed (by attribute, by user permissions, etc).

This involves the addition of a new op_condition to any subforms that will be using the new conditional options for subforms.

        'op_condition' => array(
		array(
			'func'=> 'chkFragPresence',
			'args'=> 'attr, classtype, id/nname'//the id/nname is option in args
		), //This array restricts the view depending on the presence of an attribute
		array(
			'func'=> 'chkModTypeCond',
			'args'=> '1'
		), //This array restricts the view depending on the modtype number (taken from mod_lut_modtype)
		array(
			'func'=> 'chkUserPerm',
			'args'=> array(
				84
			)
		), //This array restricts the view to an array of users based on user id (in this case 84, as taken from cor_tbl_users)
		array(
			'func'=> 'chkGroupPerm',
			'args'=> array(
				1
			)
		), //This array restricts the view to an array of groups based on group id (in this case 1, taken from cor_lvu_groups)
	),


Changes to be made to all existing mod_settings:

-detfrm for Data Entry- replace 'col_type => single_col' with 'col_type => primary_col' -change all modtype specific subforms to use new conditional subform options

In addition, the validations_fuctions.php and global_functions.php will need to be updated (although we would suggest upgrading all your php when moving to a new instance of ARK anyway rather than attempting a piecemeal patching of this new functionality).