/**
  * Handles the construction of a submission array from a set of form values.
  * @param array $values Associative array of form data values. 
  * @param array $args iform parameters. 
  * @return array Submission structure.
  */
 public static function get_submission($values, $args)
 {
     // default for forms setup on old versions is grid - list of occurrences
     // Can't call getGridMode in this context as we might not have the $_GET value to indicate grid
     if (isset($values['gridmode'])) {
         $submission = data_entry_helper::build_sample_occurrences_list_submission($values);
     } else {
         $submission = data_entry_helper::build_sample_occurrence_submission($values);
     }
     return $submission;
 }
 /**
  * Handles the construction of a submission array from a set of form values.
  * @param array $values Associative array of form data values.
  * @param array $args iform parameters.
  * @return array Submission structure.
  */
 public static function get_submission($values, $args)
 {
     // Any remembered fields need to be made available to the hook function outside this class.
     global $remembered;
     $remembered = isset($args['remembered']) ? $args['remembered'] : '';
     // default for forms setup on old versions is grid - list of occurrences
     // Can't call getGridMode in this context as we might not have the $_GET value to indicate grid
     if (isset($values['speciesgridmapmode'])) {
         $submission = data_entry_helper::build_sample_subsamples_occurrences_submission($values);
     } else {
         if (isset($values['gridmode'])) {
             $submission = data_entry_helper::build_sample_occurrences_list_submission($values);
         } else {
             $submission = data_entry_helper::build_sample_occurrence_submission($values);
         }
     }
     return $submission;
 }
Beispiel #3
0
 /**
  * Handles the construction of a submission array from a set of form values.
  * @param array $values Associative array of form data values. 
  * @param array $args iform parameters. 
  * @return array Submission structure.
  */
 public static function get_submission($values, $args)
 {
     return data_entry_helper::build_sample_occurrence_submission($values);
 }
</head>
<body>
<div id="wrap">
<h1>Indicia Data entry test</h1>
<?php 
$readAuth = data_entry_helper::get_read_auth($config['website_id'], $config['password']);
// PHP to catch and submit the POST data from the form - we need to wrap
// some things manually in order to get the supermodel in.
if ($_POST) {
    // Replace the site usage array with a comma sep list
    if (array_key_exists($config['site_usage'], $_POST)) {
        if (is_array($_POST[$config['site_usage']])) {
            $_POST[$config['site_usage']] = implode(',', $_POST[$config['site_usage']]);
        }
    }
    $submission = data_entry_helper::build_sample_occurrence_submission($_POST);
    $response = data_entry_helper::forward_post_to('save', $submission);
    echo data_entry_helper::dump_errors($response);
} else {
    if ($_GET) {
        if (array_key_exists('id', $_GET)) {
            $url = 'http://localhost/indicia/index.php/services/data/occurrence/' . $_GET['id'];
            $url .= "?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"];
            $session = curl_init($url);
            curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
            $entity = json_decode(curl_exec($session), true);
            $entity_to_load = $entity[0];
        } else {
            $entity = null;
        }
    }
 /**
  * Handles the construction of a submission array from a set of form values.
  * @param array $values Associative array of form data values.
  * @param array $args iform parameters.
  * @return array Submission structure.
  */
 public static function get_submission($values, $args)
 {
     if (isset($values['sample:parent_id'])) {
         $sampleMod = data_entry_helper::build_sample_occurrence_submission($values);
     } else {
         $sampleMod = data_entry_helper::wrap_with_attrs($values, 'sample');
     }
     return $sampleMod;
 }
 /**
  * Handles the construction of a submission array from a set of form values.
  * @param array $values Associative array of form data values. 
  * @param array $args iform parameters. 
  * @return array Submission structure.
  */
 public static function get_submission($values, $args)
 {
     if (array_key_exists('newsample_parent_id', $_POST)) {
         // $mode = MODE_NEW_OCCURRENCE
         return null;
     }
     if (array_key_exists('sample:parent_id', $_POST)) {
         //  $mode = MODE_POST_OCCURRENCE;
         // Can't call getGridMode in this context as we might not have the $_GET value to indicate grid
         if (isset($values['gridmode'])) {
             return data_entry_helper::build_sample_occurrences_list_submission($values);
         } else {
             return data_entry_helper::build_sample_occurrence_submission($values);
         }
     } else {
         //  $mode = MODE_POST_SUPERSAMPLE;
         return submission_builder::build_submission($values, $structure = array('model' => 'sample'));
     }
 }