Esempio n. 1
0
 /**
  * <p>Generates a flickr linked photo selector control. This requires a call to flickr_helper::auth
  * to have been made first and the user to have followed the login process to Flickr, otherwise a
  * normal image upload box will be displayed.<p>
  * <p>In order to get the flickr_select control working, you need to first obtain a Flickr API key from 
  * http://www.flickr.com/services/api/. When you register for the key you will also be given a 
  * "secret" - a second code that you need to supply to the Indicia data entry helpers. Once you 
  * have the keys, go to your client_helpers/helper_config.php file and enter them into the $flickr_api_key 
  * and $flickr_api_secret values.</p>
  * <p>In addition to specifying the api key and secret, you also need to tell Flickr where to 
  * link to on your website after authenticating the user (the callback URL). There is a ready-made 
  * PHP script in the Indicia code which you can use - client_helpers/flickr_auth.php. So, if your 
  * code is running on a page at http://www.example.com/data_entry.php, with your client helpers 
  * in a sub-folder, you will have a callback URL of http://www.example.com/client_helpers/flickr_auth.php. 
  * You can list your API keys at http://www.flickr.com/services/api/keys/, then click the Edit key 
  * details for the key you have registered. Now enter your callback URL in the respective field and 
  * then save the key.</p>
  *
  * @param string $div_id Name and id of the div element that is generated. Defaults to Flickr.
  * @return string HTML to insert into the web-page for the Flickr control.
  */
 public static function flickr_selector($div_id = 'flickr')
 {
     data_entry_helper::add_resource('flickr');
     if (array_key_exists('phpFlickr_auth_token', $_SESSION) && !empty($_SESSION['phpFlickr_auth_token'])) {
         data_entry_helper::$javascript .= "(function(\$) {\n          \$(document).ready(function(){\n            \$('div#{$div_id}').indiciaFlickr();\n          });\n        })(jQuery);\n";
         return '<div id="' . $div_id . '"></div>';
     } else {
         require_once 'data_entry_helper.php';
         // Flickr authentication failed. Output a normal image upload box.
         return "<label for='occurrence_image'>Image Upload:</label>\n" . data_entry_helper::image_upload('occurrence:image') . '<br/>';
     }
 }
echo $metadata;
?>
<fieldset>
<?php 
echo data_entry_helper::hidden_text(array('fieldname' => 'location_medium:id', 'default' => $id));
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';
Esempio n. 3
0
 private static function groupLogoControl($args)
 {
     if ($args['include_logo_controls']) {
         return data_entry_helper::image_upload(array('fieldname' => 'group:logo_path', 'label' => lang::get('Logo')));
     } else {
         return '';
     }
 }
 /**
  * Provides a control for inputting photos against the record, when in single
  * record mode.
  *
  * @param array $options Options array for the control.
  * @return string
  */
 protected static function occurrence_photo_input($options)
 {
     $defaults = array('fieldname' => 'occurrence:image', 'label' => lang::get('Species photos'));
     $opts = array_merge($defaults, $options);
     return data_entry_helper::image_upload($opts);
 }
<?php 
echo data_entry_helper::autocomplete(array('label' => 'Taxon', 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'extraParams' => $readAuth));
echo data_entry_helper::date_picker(array('label' => 'Date', 'fieldname' => 'sample:date'));
echo data_entry_helper::map();
echo data_entry_helper::text_input(array('label' => 'Locality Description', 'fieldname' => 'sample:location_name', 'class' => 'wide'));
echo data_entry_helper::select(array('label' => 'Survey', 'fieldname' => 'sample:survey_id', 'table' => 'survey', 'captionField' => 'title', 'valueField' => 'id', 'extraParams' => $readAuth));
?>
<br />
<label for='occurrence:determiner_id:caption'>Determiner:</label>
<?php 
echo data_entry_helper::autocomplete('occurrence:determiner_id', 'person', 'caption', 'id', $readAuth);
?>
<br />
<?php 
echo data_entry_helper::textarea(array('label' => 'Comment', 'fieldname' => 'sample:comment'));
echo data_entry_helper::image_upload(array('label' => 'Image Upload', 'fieldname' => 'occurrence:image'));
?>
<fieldset>
<legend>Occurrence attributes</legend>
<label for='<?php 
echo $config['dafor'];
?>
'>Abundance DAFOR:</label>
<?php 
echo data_entry_helper::select($config['dafor'], 'termlists_term', 'term', 'id', $readAuth + array('termlist_id' => $config['dafor_termlist']));
?>
<br />
<?php 
echo data_entry_helper::text_input(array('label' => 'Determination Date', 'fieldname' => $config['det_date']));
?>
</fieldset>