break;
        case 'B':
            echo data_entry_helper::checkbox(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
            break;
        case 'G':
            echo '<input type="hidden" name="' . $name . '" value="' . $attr['value'] . '" id="imp-geom"/>';
            echo '<label>' . $attr['caption'] . ':</label>';
            echo map_helper::map_panel(array('presetLayers' => array('osm'), 'editLayer' => true, 'clickForSpatialRef' => false, 'layers' => array(), 'initial_lat' => 55, 'initial_long' => -2, 'initial_zoom' => 4, 'width' => 870, 'height' => 400, 'standardControls' => array('panZoomBar', 'layerSwitcher', 'hoverFeatureHighlight', 'drawPolygon', 'modifyFeature', 'clearEditLayer')));
            break;
        default:
            echo data_entry_helper::text_input(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
    }
}
?>
 </ol>
 </fieldset>
<?php 
// some script to handle drawn polygons. Only allow 1 polygon on the layer
data_entry_helper::$javascript .= "mapInitialisationHooks.push(function(div) {\n  function featureChangeEvent(evt) {\n    var featuresToRemove=[];\n    \$.each(evt.feature.layer.features, function(idx, feature) {\n      if (feature.id !== evt.feature.id) {\n        featuresToRemove.push(feature);\n      }\n    });\n    evt.feature.layer.removeFeatures(featuresToRemove);\n    \$('#imp-geom').val(evt.feature.geometry.toString());\n  }\n  div.map.editLayer.events.on({'featureadded': featureChangeEvent, 'afterfeaturemodified': featureChangeEvent}); \n});\n";
echo html::form_buttons(html::initial_value($values, 'taxa_taxon_list:id') != null);
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::link_default_stylesheet();
echo data_entry_helper::dump_javascript();
?>
</form>
</div>


 <?php 
    foreach ($values['attributes'] as $attr) {
        $name = 'psnAttr:' . $attr['person_attribute_id'];
        // if this is an existing attribute, tag it with the attribute value record id so we can re-save it
        if ($attr['id']) {
            $name .= ':' . $attr['id'];
        }
        switch ($attr['data_type']) {
            case 'D':
            case 'V':
                echo data_entry_helper::date_picker(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            case 'L':
                echo data_entry_helper::select(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['raw_value'], 'lookupValues' => $values['terms_' . $attr['termlist_id']], 'blankText' => '<Please select>'));
                break;
            case 'B':
                echo data_entry_helper::checkbox(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            default:
                echo data_entry_helper::text_input(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
        }
    }
    ?>
 </ol>
 </fieldset>
<?php 
}
echo html::form_buttons(html::initial_value($values, 'person:id') != null);
?>
</form>
"
    <?php 
echo $enabled;
?>
 /> <?php 
echo html::error_message($model->getError('valid_max'));
?>
  </li>
  <li id="li_valid_date_in_past">
    <label class="narrow" for="valid_date_in_past">Date is in past</label><?php 
echo form::checkbox('valid_date_in_past', TRUE, isset($model->valid_date_in_past) and $model->valid_date_in_past == 't', 'class="vnarrow" ' . $enabled);
echo html::error_message($model->getError('valid_date_in_past'));
?>
  </li>
  <li id="li_valid_time"><label class="narrow" for="valid_integer">Time</label><?php 
echo form::checkbox('valid_time', TRUE, isset($model->valid_time) and $model->valid_time == 't', 'class="vnarrow" ' . $enabled);
?>
</li>
</ol>
</fieldset>
<?php 
// Output the view that lets this custom attribute associate with websites, surveys, checklists
// or whatever is appropriate for the attribute type.
$this->associationsView->other_data = $other_data;
$this->associationsView->model = $model;
echo $this->associationsView;
echo $metadata;
echo html::form_buttons(html::initial_value($values, $model->object_name . ':id') != null);
?>
</form>
            case 'L':
                echo data_entry_helper::select(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['raw_value'], 'lookupValues' => $values['terms_' . $attr['termlist_id']], 'blankText' => '<Please select>'));
                break;
            case 'B':
                echo data_entry_helper::checkbox(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            default:
                echo data_entry_helper::text_input(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
        }
    }
    ?>
</ol>
</fieldset>
<?php 
}
echo html::form_buttons(html::initial_value($values, 'subject_observation:id') != null, false, false);
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'json';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::link_default_stylesheet();
echo data_entry_helper::dump_javascript();
?>
</form>
<?php 
if ($tabs) {
    ?>
</div>
<div id="occurrences">
TODO - filter occurrences list to display linked occurrences
</div>
if ($parent_id != null && array_key_exists('parent_website_id', $values) && $values['parent_website_id'] !== null) {
    $website_id = $values['parent_website_id'];
} else {
    $website_id = html::initial_value($values, 'taxon_list:website_id');
    if ($this->auth->logged_in('CoreAdmin') || !$website_id && $id !== null) {
        // Core admin can select Warehouse as owner. Other users can only have this option in the list if the
        // list is already assigned to the warehouse in which case the list is read only.
        echo '<option value="">&lt;Warehouse&gt;</option>';
    }
    foreach ($other_data['websites'] as $website) {
        echo '  <option value="' . $website->id . '" ';
        if ($website->id == $website_id) {
            echo 'selected="selected" ';
        }
        echo '>' . $website->title . '</option>';
    }
}
?>
</select>
<?php 
echo html::error_message($model->getError('taxon_list:website_id'));
?>
</li>
</ol>
</fieldset>
<?php 
echo html::form_buttons(html::initial_value($values, 'taxon_list:id') != null, $this->get_read_only($values));
?>
</form>
</div>
 *
 * @package	Core
 * @subpackage Views
 * @author	Indicia Team
 * @license	http://www.gnu.org/licenses/gpl.html GPL
 * @link 	http://code.google.com/p/indicia/
 */
require_once DOCROOT . 'client_helpers/data_entry_helper.php';
$readAuth = data_entry_helper::get_read_auth(0 - $_SESSION['auth_user']->id, kohana::config('indicia.private_key'));
?>
<form class="iform" action="<?php 
echo url::site() . 'trigger/save';
?>
" method="post">
<fieldset>
<legend>Enter the parameters for the trigger</legend>
<?php 
// dump out the previous page form's values
foreach ($_POST as $key => $value) {
    if ($key != 'submit' && substr($key, 0, 6) != 'param-') {
        echo "<input type=\"hidden\" name=\"{$key}\" value=\"{$value}\"/>\n";
    }
}
// Ask the report grid code to build us a parameters form.
echo data_entry_helper::report_grid(array('id' => 'params', 'paramsOnly' => true, 'dataSource' => $_POST['trigger:trigger_template_file'], 'readAuth' => $readAuth, 'ignoreParams' => array('date'), 'completeParamsForm' => false, 'paramDefaults' => $other_data['defaults']));
?>
 </fieldset>
 <?php 
echo html::form_buttons(true);
?>
 </form>
}
?>
 >
  <option value=''>&lt;Warehouse&gt;</option>
<?php 
if (!is_null($this->auth_filter)) {
    $websites = ORM::factory('website')->in('id', $this->auth_filter['values'])->orderby('title', 'asc')->find_all();
} else {
    $websites = ORM::factory('website')->orderby('title', 'asc')->find_all();
}
foreach ($websites as $website) {
    echo '	<option value="' . $website->id . '" ';
    if ($website->id == $website_id) {
        echo 'selected="selected" ';
    }
    echo '>' . $website->title . '</option>';
}
?>
</select>
<?php 
echo html::error_message($model->getError('termlist:website_id'));
?>
</li>
</ol>
</fieldset>
<?php 
echo html::form_buttons(html::initial_value($values, 'termlist:id') != null && html::initial_value($values, 'termlist:id') != '', false, false);
echo html::error_message($model->getError('deleted'));
?>
</form>
</div>
?>
" />
<legend>Taxon Group details</legend>
<ol>
<li>
<label for="title">Title</label>
<input id="title" name="taxon_group:title" value="<?php 
echo html::initial_value($values, 'taxon_group:title');
?>
" />
<?php 
echo html::error_message($model->getError('taxon_group:title'));
?>
</li>
<li>
<label for="title">External key</label>
<input id="title" name="taxon_group:external_key" value="<?php 
echo html::initial_value($values, 'taxon_group:external_key');
?>
" />
<?php 
echo html::error_message($model->getError('taxon_group:external_key'));
?>
</li>
</ol>
</fieldset>
<?php 
echo html::form_buttons(html::initial_value($values, 'taxon_group:id') != null);
?>
</form>
<input id="parent" name="termlists_term:parent" readonly="readonly" value="<?php 
$parent_id = html::initial_value($values, 'termlists_term:parent_id');
echo $parent_id != null ? html::specialchars(ORM::factory('termlists_term', $parent_id)->term->term) : '';
?>
" />
</li>
<li>
<label for="synonyms">Synonyms
<span class="ui-state-highlight ui-widget-content ui-corner-all" title="Enter synonyms one per line. Optionally follow each name by a | character then the 3 character code for the language, e.g. 'Countryside | eng'.">?</span></label>
<textarea rows="7" columns="40" id="synonyms" name="metaFields:synonyms"><?php 
echo html::initial_value($values, 'metaFields:synonyms');
?>
</textarea>
</li>
<li>
<label for="sort_order">Sort Order in List</label>
<input id="sort_order" name="termlists_term:sort_order" class="narrow" value="<?php 
echo html::initial_value($values, 'termlists_term:sort_order');
?>
" />
<?php 
echo html::error_message($model->getError('termlists_term:sort_order'));
?>
</li>
</fieldset>
<?php 
echo html::form_buttons(html::initial_value($values, 'termlists_term:id') != null);
echo html::error_message($model->getError('deleted'));
?>
</form>
Beispiel #10
0
    echo html::error_message($model->getError('user:password'));
}
?>
</ol>
</fieldset>
<fieldset>
<legend>Website Roles</legend>
<ol>
<?php 
foreach ($model->users_websites as $website) {
    echo '<li><label class="wide" for="' . $website['name'] . '">' . $website['title'] . '</label>';
    echo '  <select class="narrow" id="' . $website['name'] . '" name="' . $website['name'] . '">';
    echo '	<option>None</option>';
    $site_roles = ORM::factory('site_role')->orderby('title', 'asc')->find_all();
    foreach ($site_roles as $site_role) {
        echo '	<option value="' . $site_role->id . '" ';
        if ($site_role->id == $website['value']) {
            echo 'selected="selected" ';
        }
        echo '>' . $site_role->title . '</option>';
    }
    echo '</select></li>';
}
?>
</ol>
</fieldset>
<?php 
echo html::form_buttons($model->id != null);
?>
</form>
" />
<?php 
echo html::error_message($model->getError('taxon_relation_type:reverse_term'));
?>
</li>
<li>
<label for="relation_code">Relation Code</label>
<select id="data_type" name="taxon_relation_type:relation_code">
		<option value=''>&lt;Please Select&gt;</option>
		<?php 
$optionlist = array('0' => 'Mutually Exclusive', '1' => 'At Least Partial Overlap', '3' => 'Same or part of', '7' => 'The same as');
foreach ($optionlist as $key => $option) {
    echo '	<option value="' . $key . '" ';
    if ($key == html::initial_value($values, 'taxon_relation_type:relation_code')) {
        echo 'selected="selected" ';
    }
    echo '>' . $option . '</option>';
}
?>
	</select> <?php 
echo html::error_message($model->getError('taxon_relation_type:relation_code'));
?>
	</li>
</ol>
</fieldset>
<?php 
echo html::form_buttons(html::initial_value($values, 'taxon_relation_type:id') != null);
?>
</form>

Beispiel #12
0
<form class="cmxform" action="<?php 
echo url::site() . 'title/save';
?>
" method="post">
<?php 
echo $metadata;
?>
<fieldset>
<legend>Title details</legend>
<input type="hidden" name="title:id" value="<?php 
echo html::initial_value($values, 'title:id');
?>
" />
<ol>
<li>
<label for="title">Title</label>
<input class="narrow" id="title" name="title:title" value="<?php 
echo html::initial_value($values, 'title:title');
?>
" />
<?php 
echo html::error_message($model->getError('title:title'));
?>
</li>
</ol>
</fieldset>
<?php 
echo html::form_buttons(html::initial_value($values, 'title:id') != null);
?>
</form>
<li>
<label for="password2">Retype Password</label>
<input type="password" id="password2" name="password2" value="<?php 
echo html::initial_value($values, 'password2');
?>
" />
<?php 
echo html::error_message($model->getError('website:password2'));
?>
</li>
<li>
<input type="hidden" name="website:verification_checks_enabled" value="f" />
<label for="verification_checks_enabled">Enable auto-verification checks:</label>
<?php 
$checked = html::initial_value($values, 'website:verification_checks_enabled') === 't' ? 'checked="checked"' : '';
?>
<input type="checkbox" id="verification_checks_enabled" name="website:verification_checks_enabled" <?php 
echo $checked;
?>
/>
<?php 
echo html::error_message($model->getError('website:verification_checks_enabled'));
?>
</li>
</ol>
</fieldset>
<?php 
echo html::form_buttons(html::initial_value($values, 'website:id') != null);
?>
</form>
        }
        switch ($attr['data_type']) {
            case 'D':
            case 'V':
                echo data_entry_helper::date_picker(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            case 'L':
                echo data_entry_helper::select(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['raw_value'], 'lookupValues' => $values['terms_' . $attr['termlist_id']], 'blankText' => '<Please select>'));
                break;
            case 'B':
                echo data_entry_helper::checkbox(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            default:
                echo data_entry_helper::text_input(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
        }
    }
    ?>
</ol>
</fieldset>
<?php 
}
echo html::form_buttons(html::initial_value($values, 'identifier:id') != null, false, false);
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'json';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::link_default_stylesheet();
echo data_entry_helper::dump_javascript();
?>
</form>
        switch ($attr['data_type']) {
            case 'D':
            case 'V':
                echo data_entry_helper::date_picker(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            case 'L':
                echo data_entry_helper::select(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['raw_value'], 'lookupValues' => $values['terms_' . $attr['termlist_id']], 'blankText' => '<Please select>'));
                break;
            case 'B':
                echo data_entry_helper::checkbox(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            default:
                echo data_entry_helper::text_input(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
        }
    }
    ?>
 </ol>
 </fieldset>
<?php 
}
echo html::form_buttons(html::initial_value($values, 'survey:id') != null);
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::enable_validation('survey-edit');
data_entry_helper::link_default_stylesheet();
data_entry_helper::$javascript .= "\n// ensure the parent lookup does not allow an inappropriate survey to be selected (i.e. self or wrong website)\nfunction setParentFilter() {  \n  var filter={\"query\":{}};\n  filter.query.notin=['id', [1]];\n  filter.query.where=['website_id', \$('#survey\\\\:website_id').val()];\n  filter.query=JSON.stringify(filter.query);\n  \$('#survey\\\\:parent_id\\\\:title').setExtraParams(filter);\n}\n\$('#survey\\\\:website_id').change(function() {\n  \$('#survey\\\\:parent_id\\\\:title').val('');\n  \$('#survey\\\\:parent_id').val('');\n  setParentFilter();\n});\nsetParentFilter();\n";
echo data_entry_helper::dump_javascript();
?>
</form>
echo data_entry_helper::text_input(array('label' => 'Period Start', 'fieldname' => 'summariser_definition:period_start', 'default' => html::initial_value($values, 'summariser_definition:period_start'), 'helpText' => 'Define the first day of each period. There are 2 options.<br/>' . "&nbsp;&nbsp;<strong>weekday=&lt;n&gt;</strong> where <strong>&lt;n&gt;</strong> is a number between 1 (for Monday) and 7 (for Sunday).<br/>" . "&nbsp;&nbsp;<strong>date=MMM/DD</strong> where <strong>MMM/DD</strong> is a month/day combination: e.g. choosing Apr-1 will start each week on the day of the week on which the 1st of April occurs.<br/>", 'validation' => 'required'));
echo data_entry_helper::text_input(array('label' => 'Period One Contains', 'fieldname' => 'summariser_definition:period_one_contains', 'default' => html::initial_value($values, 'summariser_definition:period_one_contains'), 'helpText' => 'Calculate week one as the week containing this date: value should be in the format <strong>MMM/DD</strong>, which is a month/day combination: e.g. choosing Apr-1 will mean week one contains the date of the 1st of April. Default is the Jan-01', 'validation' => 'required'));
echo data_entry_helper::select(array('label' => 'Attribute to Sum', 'fieldname' => 'summariser_definition:occurrence_attribute_id', 'lookupValues' => $other_data['occAttrs'], 'default' => html::initial_value($values, 'summariser_definition:occurrence_attribute_id'), 'helpText' => 'The occurrence attribute which is used as the count associated with the occurrence. If not provided then each occurrence has a count of one.'));
echo data_entry_helper::checkbox(array('label' => 'Calculate Estimates', 'fieldname' => 'summariser_definition:calculate_estimates', 'default' => html::initial_value($values, 'summariser_definition:calculate_estimates')));
?>
<fieldset><legend>Data Handling</legend>
<?php 
echo data_entry_helper::select(array('label' => 'Summary Data Combination method', 'fieldname' => 'summariser_definition:data_combination_method', 'lookupValues' => array('A' => 'Add all occurrences together', 'M' => 'Choose the value from the sample with the greatest count', 'L' => 'Average over all samples for that location during that period'), 'default' => html::initial_value($values, 'summariser_definition:data_combination_method'), 'helpText' => 'When data is aggregated for a location/period combination, this determines how.'));
echo data_entry_helper::select(array('label' => 'Data Rounding', 'fieldname' => 'summariser_definition:data_rounding_method', 'lookupValues' => array('N' => 'To the nearest integer, .5 rounds up', 'U' => 'Up: To the integer greater than or equal to the value', 'D' => 'Down: To the integer less than or equal to the value', 'X' => 'None (may result in non-integer values)'), 'default' => html::initial_value($values, 'summariser_definition:data_rounding_method'), 'helpText' => 'When data is averaged, this determines what rounding is carried out. Note that anything between 0 and 1 will be rounded up to 1.'));
?>
</fieldset><fieldset><legend>Estimate Generation</legend>
<p>Only one interpolation option (linear) available at the moment.</p>
<?php 
// Only one interpolation option at the moment. This may change in future. Keep hidden control until that point.
// 'L' = 'Linear interpolation'
echo data_entry_helper::hidden_text(array('fieldname' => 'summariser_definition:interpolation', 'default' => 'L'));
echo data_entry_helper::text_input(array('label' => 'Season Limits', 'fieldname' => 'summariser_definition:season_limits', 'default' => html::initial_value($values, 'summariser_definition:season_limits'), 'helpText' => 'This is a comma separated pair of the week numbers for the start and end of the season. When provided, and data is not entered for these weeks, the value is taken as zero, irrespective of the First/Last value processing. First/Last value processing is not carried out outwith these weeks.'));
echo data_entry_helper::select(array('label' => 'First Value Processing', 'fieldname' => 'summariser_definition:first_value', 'lookupValues' => array('X' => 'No special processing', 'H' => 'The entry for the previous week is half the entered value'), 'default' => html::initial_value($values, 'summariser_definition:first_value'), 'helpText' => 'When encountering the first entered value, this determines what happens.'));
echo data_entry_helper::select(array('label' => 'Last Value Processing', 'fieldname' => 'summariser_definition:last_value', 'lookupValues' => array('X' => 'No special processing', 'H' => 'The entry for the next week is half the entered value'), 'default' => html::initial_value($values, 'summariser_definition:last_value'), 'helpText' => 'When encountering the last entered value, this determines what happens.'));
?>
</fieldset>
<?php 
echo $metadata;
echo html::form_buttons($existing, false, false);
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
echo data_entry_helper::dump_javascript();
?>
</fieldset>
</form>
        switch ($attr['data_type']) {
            case 'D':
            case 'V':
                echo data_entry_helper::date_picker(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            case 'L':
                echo data_entry_helper::date_picker(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['raw_value'], 'lookupValues' => $values['terms_' . $attr['termlist_id']]));
                break;
            case 'B':
                echo data_entry_helper::checkbox(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            default:
                echo data_entry_helper::text_input(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
        }
    }
    ?>
   </ol>
   </fieldset>
</div>
<?php 
}
echo html::form_buttons(html::initial_value($values, 'location:id') != null, $disabled_input === 'YES');
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::enable_validation('location-edit');
data_entry_helper::link_default_stylesheet();
echo data_entry_helper::dump_javascript();
?>
</form>
  
<legend>Verification rule details</legend>
<?php 
data_entry_helper::link_default_stylesheet();
data_entry_helper::enable_validation('entry-form');
if (isset($values['verification_rule:id'])) {
    ?>
  <input type="hidden" name="verification_rule:id" value="<?php 
    echo html::initial_value($values, 'verification_rule:id');
    ?>
" />
<?php 
}
echo data_entry_helper::text_input(array('label' => 'Title', 'fieldname' => 'verification_rule:title', 'class' => 'control-width-4', 'validation' => array('required'), 'default' => html::initial_value($values, 'verification_rule:title')));
echo data_entry_helper::textarea(array('label' => 'Description', 'fieldname' => 'verification_rule:description', 'class' => 'control-width-6', 'default' => html::initial_value($values, 'verification_rule:description')));
echo data_entry_helper::text_input(array('label' => 'Test Type', 'fieldname' => 'verification_rule:test_type', 'class' => 'control-width-4', 'validation' => array('required'), 'default' => html::initial_value($values, 'verification_rule:test_type')));
echo data_entry_helper::text_input(array('label' => 'Source URL', 'fieldname' => 'verification_rule:source_url', 'class' => 'control-width-6', 'default' => html::initial_value($values, 'verification_rule:source_url'), 'helpText' => 'When this verification rule file was imported, this identifies the name of the file ' . 'it was imported from'));
echo data_entry_helper::text_input(array('label' => 'Source Filename', 'fieldname' => 'verification_rule:source_filename', 'class' => 'control-width-6', 'default' => html::initial_value($values, 'verification_rule:source_filename')));
echo data_entry_helper::text_input(array('label' => 'Error Message', 'fieldname' => 'verification_rule:error_message', 'class' => 'control-width-6', 'validation' => array('required'), 'default' => html::initial_value($values, 'verification_rule:error_message')));
echo data_entry_helper::checkbox(array('label' => 'Reverse Rule', 'fieldname' => 'verification_rule:reverse_rule', 'default' => html::initial_value($values, 'verification_rule:reverse_rule'), 'helpText' => 'Tick this box to reverse the rule logic - i.e. items that pass the test are flagged as failures.'));
echo data_entry_helper::textarea(array('label' => 'Metadata', 'fieldname' => 'metaFields:metadata', 'class' => 'control-width-6', 'default' => html::initial_value($values, 'metaFields:metadata'), 'helpText' => 'Additional settings from the header of the verification rule file, in parameter=value format with ' . 'one parameter per line'));
echo data_entry_helper::textarea(array('label' => 'Other Data', 'fieldname' => 'metaFields:data', 'class' => 'control-width-6', 'default' => html::initial_value($values, 'metaFields:data'), 'helpText' => 'Additional settings from the data part of the verification rule file, with blocks of data items ' . 'started by a header name in square brackets, followed by parameters in parameter=value format with ' . 'one parameter per line'));
echo $metadata;
echo html::form_buttons(html::initial_value($values, 'verification_rule:id') != null, false, false);
data_entry_helper::link_default_stylesheet();
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
echo data_entry_helper::dump_javascript();
?>
</fieldset>
</form>
        }
        switch ($attr['data_type']) {
            case 'D':
            case 'V':
                echo data_entry_helper::date_picker(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            case 'L':
                echo data_entry_helper::select(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['raw_value'], 'lookupValues' => $values['terms_' . $attr['termlist_id']], 'blankText' => '<Please select>'));
                break;
            case 'B':
                echo data_entry_helper::checkbox(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
                break;
            default:
                echo data_entry_helper::text_input(array('label' => $attr['caption'], 'fieldname' => $name, 'default' => $attr['value']));
        }
    }
    ?>
</ol>
</fieldset>
<?php 
}
echo html::form_buttons(html::initial_value($values, 'known_subject:id') != null, false, false);
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'json';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::link_default_stylesheet();
echo data_entry_helper::dump_javascript();
?>
</form>
        $name .= ':' . $attr['id'];
    }
    echo '<li><label for="">' . $attr['caption'] . "</label>\n";
    switch ($attr['data_type']) {
        case 'D':
            echo form::input($name, $attr['value'], 'class="date-picker"');
            break;
        case 'V':
            echo form::input($name, $attr['value'], 'class="vague-date-picker"');
            break;
        case 'L':
            echo form::dropdown($name, $values['terms_' . $attr['termlist_id']], $attr['raw_value']);
            break;
        case 'B':
            echo form::dropdown($name, array('' => '', '0' => 'false', '1' => 'true'), $attr['value']);
            break;
        default:
            echo form::input($name, $attr['value']);
    }
    echo '<br/>' . html::error_message($model->getError($name)) . '</li>';
}
?>
 </ol>
 </fieldset>
 
<?php 
echo html::form_buttons(html::initial_value($values, 'occurrence:id') != null, false, false);
?>
</form>

    echo form::checkbox('valid_time', TRUE, isset($model->valid_time) and $model->valid_time == 't', 'class="vnarrow" ');
    ?>
</li>
<?php 
}
?>
</ol>
</fieldset>
<fieldset>
<legend>Other information</legend>
<?php 
$readAuth = data_entry_helper::get_read_auth(0 - $_SESSION['auth_user']->id, kohana::config('indicia.private_key'));
echo data_entry_helper::outputAttribute(array('caption' => 'Default value', 'data_type' => $dataType, 'fieldname' => 'default_value', 'id' => 'default_value', 'termlist_id' => $model->{$attrModelName}->termlist_id, 'default' => $model->default_value), array('extraParams' => $readAuth));
$controlTypeId = html::initial_value($values, $_GET['type'] . '_attributes_website:control_type_id');
$types = array('' => '<Not specified>');
foreach ($other_data['controlTypes'] as $controlType) {
    $types[$controlType->id] = $controlType->control;
}
echo data_entry_helper::select(array('label' => 'Default control type', 'fieldname' => $model->object_name . ':control_type_id', 'lookupValues' => $types, 'default' => $controlTypeId));
if ($_GET['type'] == 'location') {
    $terms = array('' => '<Not specified>') + $this->get_termlist_terms('indicia:location_types');
    echo data_entry_helper::select(array('label' => 'Location Type', 'fieldname' => 'location_attributes_website:restrict_to_location_type_id', 'lookupValues' => $terms, 'default' => html::initial_value($values, 'location_attributes_website:restrict_to_location_type_id'), 'helpText' => 'If you want this attribute to only apply for locations of a certain type, select the type here.'));
} elseif ($_GET['type'] == 'sample') {
    $terms = array('' => '<Not specified>') + $this->get_termlist_terms('indicia:sample_methods');
    echo data_entry_helper::select(array('label' => 'Sample Method', 'fieldname' => 'sample_attributes_website:restrict_to_sample_method_id', 'lookupValues' => $terms, 'default' => html::initial_value($values, 'sample_attributes_website:restrict_to_sample_method_id'), 'helpText' => 'If you want this attribute to only apply for samples of a certain method, select the method here.'));
}
echo $metadata;
echo html::form_buttons(html::initial_value($values, 'custom_attribute:id') != null, false, false);
?>
</fieldset></form>
//So to fix this, collect the existing filters from the database so we can compare the titles with the one we create and then
//do the validation manually.
$readAuth = data_entry_helper::get_read_auth(0 - $_SESSION['auth_user']->id, kohana::config('indicia.private_key'));
$existingFilterData = data_entry_helper::get_population_data(array('table' => 'filter', 'extraParams' => $readAuth, 'nocache' => true));
//When we save a milestone when we need to automatically set the filter title as there isn't a separate field
//to fill this in.
//Also hide the "who" filter as we don't need this for milestones as they can apply to all users
//Also manually do the unique milestone/filter title validation (see note above)
data_entry_helper::$javascript .= "\nvar existingFilterData=" . json_encode($existingFilterData) . ";  \n\$('#pane-filter_who').hide();\n\$('#milestones-form').submit(function() {\n  \$('#filter-title-val').val('" . 'Filter for milestone' . " ' + \$('#milestone\\\\:title').val());\n  for (var i = 0; i<existingFilterData.length;i++) {\n    //Note we must allow a duplicate title in the situaton where the duplicate title is for the already existing item\n    if (existingFilterData[i]['title']==\$('#filter-title-val').val() && existingFilterData[i]['id']!=\$('#filter\\\\:id').val()) {\n      alert('The filter title is generated from the milestone title you have entered and would cause a duplicate filter title, please choose a different title');\n      return false;\n    }\n  }\n  \$('#filter-def-val').val(JSON.stringify(indiciaData.filter.def));\n});\n";
$readAuth = data_entry_helper::get_read_auth(0 - $_SESSION['auth_user']->id, kohana::config('indicia.private_key'));
$filterPanelHTML = '<h3>Specify the filter used to define which records count</h3>';
$hiddenPopupDivs = '';
$filterPanelHTML .= report_filter_panel($readAuth, array('allowLoad' => false, 'allowSave' => false, 'embedInExistingForm' => true, 'runningOnWarehouse' => true, 'taxon_list_id' => kohana::config('cache_builder_variables.master_list_id'), 'website_id' => html::initial_value($values, 'milestone:website_id') ? html::initial_value($values, 'milestone:website_id') : $values['website_id']), $this->uri->argument(1), $hiddenStuff);
// fields to auto-create a filter record for this group's defined set of records
$filterPanelHTML .= data_entry_helper::hidden_text(array('fieldname' => 'filter:id', 'default' => html::initial_value($values, 'filter:id')));
$filterPanelHTML .= '<input type="hidden" name="filter:title" id="filter-title-val"/>';
$filterPanelHTML .= '<input type="hidden" name="filter:definition" id="filter-def-val"/>';
$filterPanelHTML .= '<input type="hidden" name="filter:sharing" value="R"/>';
echo $filterPanelHTML;
echo html::form_buttons(html::initial_value($values, 'milestone:id') != null, false, false);
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::enable_validation('milestones-form');
data_entry_helper::link_default_stylesheet();
echo data_entry_helper::dump_javascript();
?>
</fieldset>
</form>
<?php 
echo $hiddenStuff;
require_once DOCROOT . 'client_helpers/data_entry_helper.php';
if (isset($_POST)) {
    data_entry_helper::dump_errors(array('errors' => $this->model->getAllErrors()));
}
?>
<form class="iform" action="<?php 
echo url::site();
?>
taxon_designation/save" method="post">
<fieldset>
<legend>Taxon designation details</legend>
<?php 
data_entry_helper::link_default_stylesheet();
if (isset($values['taxon_designation:id'])) {
    ?>
  <input type="hidden" name="taxon_designation:id" value="<?php 
    echo html::initial_value($values, 'taxon_designation:id');
    ?>
" />
<?php 
}
echo data_entry_helper::text_input(array('label' => 'Title', 'fieldname' => 'taxon_designation:title', 'class' => 'control-width-4', 'default' => html::initial_value($values, 'taxon_designation:title')));
echo data_entry_helper::text_input(array('label' => 'Code', 'fieldname' => 'taxon_designation:code', 'class' => 'control-width-4', 'default' => html::initial_value($values, 'taxon_designation:code')));
echo data_entry_helper::textarea(array('label' => 'Description', 'fieldname' => 'taxon_designation:description', 'class' => 'control-width-6', 'default' => html::initial_value($values, 'taxon_designation:description')));
echo data_entry_helper::select(array('label' => 'Category', 'fieldname' => 'taxon_designation:category_id', 'lookupValues' => $other_data['category_terms'], 'default' => html::initial_value($values, 'taxon_designation:category_id')));
echo $metadata;
echo html::form_buttons(html::initial_value($values, 'taxon_designation:id') != null, false, false);
echo data_entry_helper::dump_javascript();
?>
</fieldset>
</form>
echo data_entry_helper::hidden_text(array('fieldname' => 'location_medium:location_id', 'default' => html::initial_value($values, 'location_medium:location_id')));
?>
<legend>Media file details</legend>
<?php 
$mediaTypeId = html::initial_value($values, 'location_medium:media_type_id');
$mediaType = $mediaTypeId ? $other_data['media_type_terms'][$mediaTypeId] : 'Image:Local';
if ($mediaType === 'Image:Local') {
    echo '<label>Image:</label>';
    echo html::sized_image(html::initial_value($values, 'occurrence_medium:path')) . '</br>';
    echo data_entry_helper::hidden_text(array('fieldname' => 'location_medium:path', 'default' => html::initial_value($values, 'location_medium:path')));
    echo data_entry_helper::image_upload(array('label' => 'Upload image file', 'fieldname' => 'image_upload', 'default' => html::initial_value($values, 'location_medium:path')));
} else {
    echo data_entry_helper::text_input(array('label' => 'Path or URL', 'fieldname' => 'location_medium:path', 'default' => html::initial_value($values, 'location_medium:path'), 'class' => 'control-width-5'));
}
echo data_entry_helper::text_input(array('label' => 'Caption', 'fieldname' => 'location_medium:caption', 'default' => html::initial_value($values, 'location_medium:caption'), 'class' => 'control-width-5'));
if ($mediaTypeId && $mediaType !== 'Image:Local') {
    echo data_entry_helper::select(array('label' => 'Media type', 'fieldname' => 'location_medium:media_type_id', 'default' => $mediaTypeId, 'lookupValues' => $other_data['media_type_terms'], 'blankText' => '<Please select>', 'class' => 'control-width-5'));
}
?>

</fieldset>
<?php 
echo html::form_buttons($id != null, false, false);
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::enable_validation('location-medium-edit');
data_entry_helper::link_default_stylesheet();
echo data_entry_helper::dump_javascript();
?>
</form>
<input type="hidden" name="language:id" value="<?php 
echo html::initial_value($values, 'language:id');
?>
" />
<label for="iso">ISO language code</label>
<input id="iso" name="language:iso" class="narrow" value="<?php 
echo html::initial_value($values, 'language:iso');
?>
"/>
<?php 
echo html::error_message($model->getError('language:iso'));
?>
</li>
<li>
<label for="language">Language</label>
<input id="language" name="language:language" value="<?php 
echo html::initial_value($values, 'language:language');
?>
" />
<?php 
echo html::error_message($model->getError('language:language'));
?>
</li>
</ol>
</fieldset>
<?php 
echo html::form_buttons(html::initial_value($values, 'language:id') != null);
?>
</form>