当前位置: 首页>>代码示例>>PHP>>正文


PHP data_entry_helper类代码示例

本文整理汇总了PHP中data_entry_helper的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper类的具体用法?PHP data_entry_helper怎么用?PHP data_entry_helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了data_entry_helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: group_authorise_form

/**
 * List of methods that assist with handling recording groups.
 * @package Client
 * @subpackage PrebuiltForms.
 */
function group_authorise_form($args, $readAuth)
{
    if (!empty($args['limit_to_group_id']) && $args['limit_to_group_id'] !== (empty($_GET['group_id']) ? '' : $_GET['group_id'])) {
        // page owned by a different group, so throw them out
        hostsite_show_message(lang::get('This page is a private recording group page which you cannot access.'), 'alert');
        hostsite_goto_page('<front>');
    }
    if (!empty($_GET['group_id'])) {
        // loading data into a recording group. Are they a member or is the page public?
        // @todo: consider performance - 2 web services hits required to check permissions.
        if (hostsite_get_user_field('indicia_user_id')) {
            $gu = data_entry_helper::get_population_data(array('table' => 'groups_user', 'extraParams' => $readAuth + array('group_id' => $_GET['group_id'], 'user_id' => hostsite_get_user_field('indicia_user_id')), 'nocache' => true));
        } else {
            $gu = array();
        }
        $gp = data_entry_helper::get_population_data(array('table' => 'group_page', 'extraParams' => $readAuth + array('group_id' => $_GET['group_id'], 'path' => drupal_get_path_alias($_GET['q']))));
        if (count($gp) === 0) {
            hostsite_show_message(lang::get('You are trying to access a page which is not available for this group.'), 'alert');
            hostsite_goto_page('<front>');
        } elseif (count($gu) === 0 && $gp[0]['administrator'] !== NULL) {
            // not a group member, so throw them out
            hostsite_show_message(lang::get('You are trying to access a page for a group you do not belong to.'), 'alert');
            hostsite_goto_page('<front>');
        }
    }
}
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:31,代码来源:groups.php

示例2: link_to_parent

 public static function link_to_parent($auth, $args, $tabalias, $options, $path)
 {
     if (empty($_GET['table']) || $_GET['table'] !== 'sample' || empty($_GET['id'])) {
         throw new exception('paths_editor.link_to_parent control needs to be called from a form that saves a sample');
     }
     // construct a query to pull back the parent sample and any existing child samples in one go
     $samples = data_entry_helper::get_population_data(array('table' => 'sample', 'extraParams' => $auth['read'] + array('query' => json_encode(array('where' => array('id', $_GET['id']), 'orwhere' => array('parent_id', $_GET['id']))), 'view' => 'detail'), 'caching' => false));
     $childGeoms = array();
     $r = '';
     foreach ($samples as $sample) {
         if ($sample['id'] === $_GET['id']) {
             // found the parent sample. Send to JS so it can be shown on the map
             data_entry_helper::$javascript .= "indiciaData.showParentSampleGeom = '{$sample['geom']}';\n";
             $r = data_entry_helper::hidden_text(array('fieldname' => 'sample:date', 'default' => $sample['date_start']));
         } else {
             // found an already input child sample
             $childGeoms[] = "'{$sample['geom']}'";
         }
     }
     // Output some instructions to the user which will depend on whether we are on the first
     // child sample or not.
     if (!empty($options['outputInstructionsTo'])) {
         $instruct = empty($childGeoms) ? $options['firstInstructions'] : $options['otherInstructions'];
         data_entry_helper::$javascript .= "\$('#{$options['outputInstructionsTo']}').html('{$instruct}');\n";
     }
     $childGeoms = implode(',', $childGeoms);
     data_entry_helper::$javascript .= "indiciaData.showChildSampleGeoms = [{$childGeoms}];\n";
     $r .= data_entry_helper::hidden_text(array('fieldname' => 'sample:parent_id', 'default' => $_GET['id']));
     return $r;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:30,代码来源:paths_editor.php

示例3: get_form

 /**
  * Return the Indicia form code
  * @param array $args Input parameters.
  * @param array $node Drupal node object
  * @param array $response Response from Indicia services after posting a verification.
  * @return HTML string
  */
 public static function get_form($args, $node, $response)
 {
     $auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
     global $user;
     $r = '';
     $presetList = explode("\n", $args['param_presets']);
     $presets = array();
     foreach ($presetList as $param) {
         $tokens = explode('=', $param);
         if (count($tokens) == 2) {
             $presets[$tokens[0]] = $tokens[1];
         } else {
             $r .= '<div class="page-notice ui-widget ui-widget-content ui-corner-all ui-state-error">' . 'Some of the preset parameters defined for this page are not of the form param=value.</div>';
         }
     }
     $reportOptions = array('id' => 'report-grid', 'class' => '', 'thClass' => '', 'dataSource' => $args['report_name'], 'mode' => 'report', 'readAuth' => $auth['read'], 'columns' => array(), 'itemsPerPage' => 20, 'autoParamsForm' => $args['auto_params_form'], 'extraParams' => $presets);
     // Add a download link
     $r .= '<a href="' . data_entry_helper::get_report_data(array_merge($reportOptions, array('linkOnly' => true))) . '&mode=csv">Download this report</a>';
     // now the grid
     $r .= data_entry_helper::report_grid($reportOptions);
     // Set up a page refresh for dynamic update of the report at set intervals
     if ($args['refresh_timer'] !== 0 && is_numeric($args['refresh_timer'])) {
         // is_int prevents injection
         if (isset($args['load_on_refresh']) && !empty($args['load_on_refresh'])) {
             data_entry_helper::$javascript .= "setTimeout('window.location=\"" . $args['load_on_refresh'] . "\";', " . $args['refresh_timer'] . "*1000 );\n";
         } else {
             data_entry_helper::$javascript .= "setTimeout('window.location.reload( false );', " . $args['refresh_timer'] . "*1000 );\n";
         }
     }
     return $r;
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:38,代码来源:report_grid.php

示例4: site_description

 public static function site_description($auth, $args, $tabalias, $options, $path)
 {
     if (!empty($_GET[$options['urlParameter']])) {
         $locationCommentData = data_entry_helper::get_population_data(array('table' => 'location', 'extraParams' => $auth['read'] + array('id' => $_GET[$options['urlParameter']], 'view' => 'detail')));
         $r = '<div><h2>' . $locationCommentData[0]['name'] . '</h2><p>' . $locationCommentData[0]['comment'] . '</p></div>';
         return $r;
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:8,代码来源:shorewatch_extensions.php

示例5: get_form

 /**
  * Return the generated form output.
  * @return Form HTML.
  * @todo: Implement this method
  */
 public static function get_form($args)
 {
     global $user;
     $lang = isset($user) ? iform_lang_iso_639_2($user->lang) : 'eng';
     if (function_exists('iform_load_helpers')) {
         iform_load_helpers(array('map_helper'));
     } else {
         require_once dirname(dirname(__FILE__)) . '/map_helper.php';
     }
     $readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
     $r = '';
     // setup the map options
     $options = iform_map_get_map_options($args, $readAuth);
     $olOptions = iform_map_get_ol_options($args);
     if (array_key_exists('table', $_GET) && $_GET['table'] == 'sample') {
         // Use a cUrl request to get the data from Indicia which contains the value we need to filter against
         // Read the record that was just posted.
         $fetchOpts = array('dataSource' => 'reports_for_prebuilt_forms/my_dot_map/occurrences_list', 'mode' => 'report', 'readAuth' => $readAuth, 'extraParams' => array('sample_id' => $_GET['id'], 'language' => $lang));
         // @todo Error handling on the response
         $occurrence = data_entry_helper::get_report_data($fetchOpts);
         self::prepare_layer_titles($args, $occurrence);
         // Add the 3 distribution layers if present. Reverse the order so 1st layer is topmost
         $layerName = self::build_distribution_layer(3, $args, $occurrence);
         if ($layerName) {
             $options['layers'][] = $layerName;
         }
         $layerName = self::build_distribution_layer(2, $args, $occurrence);
         if ($layerName) {
             $options['layers'][] = $layerName;
         }
         $layerName = self::build_distribution_layer(1, $args, $occurrence);
         if ($layerName) {
             $options['layers'][] = $layerName;
         }
         if ($layerName) {
             $options['layers'][] = $layerName;
         }
         // This is not a map used for input
         $options['editLayer'] = false;
         if ($args['hide_grid'] == false) {
             // Now output a grid of the occurrences that were just saved.
             $r .= "<table class=\"submission\"><thead><tr><th>" . lang::get('Species') . "</th><th>" . lang::get('Latin Name') . "</th><th>" . lang::get('Date') . "</th><th>" . lang::get('Spatial Ref') . "</th></tr></thead>\n";
             $r .= "<tbody>\n";
             foreach ($occurrence as $record) {
                 $r .= '<tr class="biota"><td>' . $record['lt4_taxon'] . '</td><td class="binomial"><em>' . $record['lt7_taxon'] . '</em></td><td>' . $record['lt0_date_start'] . '</td><td>' . $record['lt0_entered_sref'] . "</td></tr>\n";
             }
             $r .= "</tbody></table>\n";
         }
     }
     $r .= '<div id="mapandlegend">';
     $r .= map_helper::layer_list(array('id' => 'legend', 'includeSwitchers' => false, 'includeHiddenLayers' => false, 'includeIcons' => true, 'layerTypes' => array('overlay')));
     $r .= map_helper::map_panel($options, $olOptions);
     $r .= '</div>';
     return $r;
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:60,代码来源:my_dot_map.php

示例6: flickr_selector

 /**
  * <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/>';
     }
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:33,代码来源:flickr_helper.php

示例7: get_control_sensitivity

 /**
  * Override the sensitivity control to create a simple select with default value 
  * set by user profile.
  */
 protected static function get_control_sensitivity($auth, $args, $tabAlias, $options)
 {
     // Obtain the default value for the user.
     global $user;
     $user = user_load($user->uid);
     $field_values = field_get_items('user', $user, 'field_icpveg_permission');
     $default_value = $field_values[0]['value'];
     if ($default_value == 0) {
         // Where Drupal stores 0, we want the Warehouse field to be NULL to indicate
         // no blurring of detail.
         $default_value = '';
     }
     return data_entry_helper::select(array_merge(array('fieldname' => 'occurrence:sensitivity_precision', 'label' => lang::get('ICPVeg Sensitivity'), 'lookupValues' => array('50000' => lang::get('ICPVeg Sensitivity 50km')), 'blankText' => lang::get('ICPVeg Sensitivity blankText'), 'default' => $default_value), $options));
 }
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:18,代码来源:icpveg_mobile.php

示例8: get_form

 /**
  * Return the generated form output.
  * @param array $args List of parameter values passed through to the form depending on how the form has been configured.
  * This array always contains a value for language.
  * @param object $node The Drupal node object.
  * @param array $response When this form is reloading after saving a submission, contains the response from the service call.
  * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data).
  * @return Form HTML.
  */
 public static function get_form($args, $node, $response = null)
 {
     if (empty($_GET['group_id'])) {
         return 'This page needs a group_id URL parameter.';
     }
     global $base_url;
     global $user;
     iform_load_helpers(array('data_entry_helper'));
     data_entry_helper::$javascript .= "indiciaData.nodeId=" . $node->nid . ";\n";
     data_entry_helper::$javascript .= "indiciaData.baseUrl='" . $base_url . "';\n";
     data_entry_helper::$javascript .= "indiciaData.currentUsername='" . $user->name . "';\n";
     //Translations for the comment that goes into occurrence_comments when a record is verified or rejected.
     data_entry_helper::$javascript .= 'indiciaData.verifiedTranslation = "' . lang::get('Verified') . "\";\n";
     data_entry_helper::$javascript .= 'indiciaData.rejectedTranslation = "' . lang::get('Rejected') . "\";\n";
     self::$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
     group_authorise_form($args, self::$auth['read']);
     $group = data_entry_helper::get_population_data(array('table' => 'group', 'extraParams' => self::$auth['read'] + array('id' => $_GET['group_id'], 'view' => 'detail')));
     $group = $group[0];
     hostsite_set_page_title("{$group['title']}: {$node->title}");
     $def = json_decode($group['filter_definition'], true);
     $defstring = '';
     // reconstruct this as a string to feed into dynamic report explorer
     foreach ($def as $key => $value) {
         if ($key) {
             $value = is_array($value) ? json_encode($value) : $value;
             $defstring .= "{$key}={$value}\n";
             if ($key === 'indexed_location_id' || $key === 'indexed_location_list' || $key === 'location_id' || $key === 'location_list') {
                 $args['location_boundary_id'] = $value;
             } elseif (($key === 'taxon_group_id' || $key === 'taxon_group_list') && strpos($value, ',') === FALSE) {
                 // if the report is locked to a single taxon group, then we don't need taxonomy columns.
                 $args['skipped_report_columns'] = array('taxon_group', 'taxonomy');
             }
         }
     }
     if (empty($_GET['implicit'])) {
         // no need for a group user filter
         $args['param_presets'] = implode("\n", array($args['param_presets'], $defstring));
     } else {
         // filter to group users - either implicitly, or only if they explicitly submitted to the group
         $prefix = $_GET['implicit'] === 'true' || $_GET['implicit'] === 't' ? 'implicit_' : '';
         // add the group parameters to the preset parameters passed to all reports on this page
         $args['param_presets'] = implode("\n", array($args['param_presets'], $defstring, "{$prefix}group_id=" . $_GET['group_id']));
     }
     $args['param_presets'] .= "\n";
     if (!empty($args['hide_standard_param_filter'])) {
         data_entry_helper::$javascript .= "\$('#standard-params').hide();\n";
     }
     return parent::get_form($args, $node);
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:58,代码来源:group_home.php

示例9: get_attribute_html

/**
 * List of methods that can be used for a prebuilt form control generation.
 * @package Client
 * @subpackage PrebuiltForms.
 * @param array $attributes
 * @param array $args
 * @param array $defAttrOptions
 * @param array $outerFilter
 * @param array $blockOptions Associative array of control names that have non-default options. Each entry
 * is keyed by the control name and has an array of the options and values to override.
 * @param array $idPrefix Optional prefix to give to IDs (e.g. for fieldsets) to allow you to ensure they remain unique.
 */
function get_attribute_html($attributes, $args, $defAttrOptions, $outerFilter = null, $blockOptions = null, $idPrefix = '')
{
    $lastOuterBlock = '';
    $lastInnerBlock = '';
    $r = '';
    foreach ($attributes as $attribute) {
        // Apply filter to only output 1 block at a time. Also hide controls that have already been handled.
        if (($outerFilter === null || strcasecmp($outerFilter, $attribute['outer_structure_block']) == 0) && !isset($attribute['handled'])) {
            if (empty($outerFilter) && $lastOuterBlock != $attribute['outer_structure_block']) {
                if (!empty($lastInnerBlock)) {
                    $r .= '</fieldset>';
                }
                if (!empty($lastOuterBlock)) {
                    $r .= '</fieldset>';
                }
                if (!empty($attribute['outer_structure_block'])) {
                    $r .= '<fieldset id="' . get_fieldset_id($attribute['outer_structure_block'], $idPrefix) . '"><legend>' . lang::get($attribute['outer_structure_block']) . '</legend>';
                }
                if (!empty($attribute['inner_structure_block'])) {
                    $r .= '<fieldset id="' . get_fieldset_id($attribute['outer_structure_block'], $attribute['inner_structure_block'], $idPrefix) . '"><legend>' . lang::get($attribute['inner_structure_block']) . '</legend>';
                }
            } elseif ($lastInnerBlock != $attribute['inner_structure_block']) {
                if (!empty($lastInnerBlock)) {
                    $r .= '</fieldset>';
                }
                if (!empty($attribute['inner_structure_block'])) {
                    $r .= '<fieldset id="' . get_fieldset_id($lastOuterBlock, $attribute['inner_structure_block'], $idPrefix) . '"><legend>' . lang::get($attribute['inner_structure_block']) . '</legend>';
                }
            }
            $lastInnerBlock = $attribute['inner_structure_block'];
            $lastOuterBlock = $attribute['outer_structure_block'];
            $options = $defAttrOptions + get_attr_validation($attribute, $args);
            if (isset($blockOptions[$attribute['fieldname']])) {
                $options = array_merge($options, $blockOptions[$attribute['fieldname']]);
            }
            $r .= data_entry_helper::outputAttribute($attribute, $options);
            $attribute['handled'] = true;
        }
    }
    if (!empty($lastInnerBlock)) {
        $r .= '</fieldset>';
    }
    if (!empty($lastOuterBlock) && strcasecmp($outerFilter, $lastOuterBlock) !== 0) {
        $r .= '</fieldset>';
    }
    return $r;
}
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:59,代码来源:form_generation.php

示例10: get_form

 /**
  * Return the Indicia form code
  * @param array $args Input parameters.
  * @param array $node Drupal node object
  * @param array $response Response from Indicia services after posting a verification.
  * @return HTML string
  */
 public static function get_form($args, $node, $response)
 {
     iform_load_helpers(array('import_helper'));
     $auth = import_helper::get_read_write_auth($args['website_id'], $args['password']);
     group_authorise_form($args, $auth['read']);
     if ($args['model'] == 'url') {
         if (!isset($_GET['type'])) {
             return "This form is configured so that it must be called with a type parameter in the URL";
         }
         $model = $_GET['type'];
     } else {
         $model = $args['model'];
     }
     if (isset($args['presetSettings'])) {
         $presets = get_options_array_with_user_data($args['presetSettings']);
         $presets = array_merge(array('website_id' => $args['website_id'], 'password' => $args['password']), $presets);
     } else {
         $presets = array('website_id' => $args['website_id'], 'password' => $args['password']);
     }
     if (!empty($_GET['group_id'])) {
         // loading data into a recording group.
         $group = data_entry_helper::get_population_data(array('table' => 'group', 'extraParams' => $auth['read'] + array('id' => $_GET['group_id'], 'view' => 'detail')));
         $group = $group[0];
         $presets['sample:group_id'] = $_GET['group_id'];
         hostsite_set_page_title(lang::get('Import data into the {1} group', $group['title']));
         // if a single survey specified for this group, then force the data into the correct survey
         $filterdef = json_decode($group['filter_definition'], true);
         if (!empty($filterdef['survey_list_op']) && $filterdef['survey_list_op'] === 'in' && !empty($filterdef['survey_list'])) {
             $surveys = explode(',', $filterdef['survey_list']);
             if (count($surveys) === 1) {
                 $presets['survey_id'] = $surveys[0];
             }
         }
     }
     try {
         $r = import_helper::importer(array('model' => $model, 'auth' => $auth, 'presetSettings' => $presets));
     } catch (Exception $e) {
         hostsite_show_message($e->getMessage(), 'warning');
         $reload = import_helper::get_reload_link_parts();
         unset($reload['params']['total']);
         unset($reload['params']['uploaded_csv']);
         $reloadpath = $reload['path'] . '?' . import_helper::array_to_query_string($reload['params']);
         $r = "<p>" . lang::get('Would you like to ') . "<a href=\"{$reloadpath}\">" . lang::get('import another file?') . "</a></p>";
     }
     return $r;
 }
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:53,代码来源:importer.php

示例11: register

 public function register()
 {
     try {
         $this->authenticate('write');
         self::string_validate_mandatory('email');
         self::string_validate_mandatory('surname');
         self::int_key_validate_mandatory('website_id');
         self::boolean_validate('alert_on_entry');
         self::boolean_validate('alert_on_verify');
         self::int_key_validate('location_id');
         if (!empty($_GET['user_id'])) {
             $userId = $_GET['user_id'];
         } else {
             // User was not logged in when subscribing, so use their details to find or create a warehouse user id.
             $emailIdentifierObject = new stdClass();
             $emailIdentifierObject->type = "email";
             $emailIdentifierObject->identifier = $_GET["email"];
             $userIdentificationData['identifiers'] = json_encode(array($emailIdentifierObject));
             //Also pass through these fields so if a new user is required then the system can fill in the database details
             $userIdentificationData['surname'] = $_GET["surname"];
             $userIdentificationData['first_name'] = $_GET["first_name"];
             //Call existing user identifier code that will either fetch an existing user for that email, or create a new one.
             $userDetails = user_identifier::get_user_id($userIdentificationData, $_GET["website_id"]);
             if (!empty($userDetails['userId'])) {
                 $userId = $userDetails['userId'];
             } else {
                 $userId = $userDetails['possibleMatches'][0]['user_id'];
             }
         }
         //Store the species alert for the user (which is either a new or existing user as determined by get_user_id)
         self::store_species_alert($userId);
         //Automatically register the user to receive email notifications if they have never had any settings at all
         try {
             $readAuth = data_entry_helper::get_read_auth(0 - $userId, kohana::config('indicia.private_key'));
             $freqSettingsData = data_entry_helper::get_report_data(array('dataSource' => 'library/user_email_notification_settings/user_email_notification_settings_inc_deleted', 'readAuth' => $readAuth, 'extraParams' => array('user_id' => $userId)));
             if (empty($freqSettingsData)) {
                 self::store_user_email_notification_setting($userId);
             }
         } catch (exception $e) {
             kohana::log('debug', "Unable to register user " . $userId . " for email notifications, perhaps that module is not installed?.");
         }
     } catch (Exception $e) {
         $this->handle_error($e);
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:45,代码来源:species_alerts.php

示例12: get_form

 /**
  * Return the generated form output.
  * @return Form HTML.
  */
 public static function get_form($args)
 {
     if (empty($_GET['occurrence_id'])) {
         return 'This form requires an occurrence_id parameter in the URL.';
     }
     $r = "<form method=\"post\">\n";
     // Get authorisation tokens to update and read from the Warehouse.
     $auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
     data_entry_helper::load_existing_record($auth['read'], 'occurrence', $_GET['occurrence_id']);
     data_entry_helper::load_existing_record($auth['read'], 'sample', data_entry_helper::$entity_to_load['occurrence:sample_id']);
     $r .= $auth['write'];
     $r .= "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
     $r .= "<input type=\"hidden\" id=\"occurrence:id\" name=\"occurrence:id\" value=\"" . $_GET['occurrence_id'] . "\" />\n";
     $r .= "<input type=\"hidden\" id=\"occurrence:sample_id\" name=\"occurrence:sample_id\" value=\"" . data_entry_helper::$entity_to_load['sample:id'] . "\" />\n";
     $r .= "<div id=\"controls\">\n";
     $r .= "<table>\n";
     $r .= "<tr><td><strong>Date</strong></td><td>" . data_entry_helper::$entity_to_load['sample:date'] . "</td></tr>\n";
     $r .= "<tr><td><strong>Spatial Reference</strong></td><td>" . data_entry_helper::$entity_to_load['sample:entered_sref'] . "</td></tr>\n";
     $siteLabels = array();
     if (!empty(data_entry_helper::$entity_to_load['sample:location'])) {
         $siteLabels[] = data_entry_helper::$entity_to_load['sample:location'];
     }
     if (!empty(data_entry_helper::$entity_to_load['sample:location_name'])) {
         $siteLabels[] = data_entry_helper::$entity_to_load['sample:location_name'];
     }
     $r .= "<tr><td><strong>Site</strong></td><td>" . implode(' | ', $siteLabels) . "</td></tr>\n";
     $smpAttrs = data_entry_helper::getAttributes(array('id' => data_entry_helper::$entity_to_load['sample:id'], 'valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'extraParams' => $auth['read'], 'survey_id' => data_entry_helper::$entity_to_load['occurrence:survey_id']));
     $occAttrs = data_entry_helper::getAttributes(array('id' => $_GET['occurrence_id'], 'valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'extraParams' => $auth['read'], 'survey_id' => data_entry_helper::$entity_to_load['occurrence:survey_id']));
     $attributes = array_merge($smpAttrs, $occAttrs);
     foreach ($attributes as $attr) {
         $r .= "<tr><td><strong>" . $attr['caption'] . "</strong></td><td>" . $attr['displayValue'] . "</td></tr>\n";
     }
     $extraParams = $auth['read'] + array('taxon_list_id' => $args['list_id']);
     if ($args['preferred']) {
         $extraParams += array('preferred' => 't');
     }
     $species_list_args = array('itemTemplate' => 'select_species', 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'extraParams' => $extraParams);
     // Dynamically generate the species selection control required.
     $r .= '<tr/><td><strong>Species</strong></td><td>' . call_user_func(array('data_entry_helper', $args['species_ctrl']), $species_list_args) . "</td></tr>\n";
     $r .= "</table>\n";
     $r .= "</div>\n";
     $r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"Save\" />\n";
     $r .= "</form>";
     return $r;
 }
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:49,代码来源:change_identification.php

示例13: breadcrumb

 public function breadcrumb($auth, $args, $tabalias, $options)
 {
     global $base_url;
     $breadCrumbLocationNamesArray = array();
     //The location ids to display in the breadcrumb are held in the URL if the user
     //is returning from another page.
     $breadCrumbLocationIdsArray = explode(',', $_GET['breadcrumb']);
     $locationRecords = data_entry_helper::get_population_data(array('table' => 'location', 'extraParams' => $auth['read'], 'nocache' => true));
     //Get the names associated with the ids
     foreach ($breadCrumbLocationIdsArray as $breadCrumbLocationId) {
         foreach ($locationRecords as $locationRecord) {
             if ($locationRecord['id'] === $breadCrumbLocationId) {
                 $breadCrumbLocationNamesArray[] = $locationRecord['name'];
             }
         }
     }
     $r = '';
     //Only display links to homepage if we have links to show
     if (!empty($breadCrumbLocationNamesArray)) {
         $r .= '<label><h4>Links to homepage</h4></label></br>';
         $r .= '<div>';
         $r .= '<ul id="homepage-breadcrumb">';
         //Loop through the links to show
         foreach ($breadCrumbLocationNamesArray as $num => $breadCrumbLocationName) {
             //For each link back to the homepage, we need to give the homepage some locations IDs to rebuild
             //its breadcrumb with. So we need to include ids of any locations that are "above" the location we are linking back with.
             //e.g. If the link is for Guildford, then we would need to supply the ids for Guildford, Surrey and South England
             //as well to the homepage can make a full breadcrumb trail to guildford.
             if (empty($breadCrumbParamToSendBack)) {
                 $breadCrumbParamToSendBack = 'breadcrumb=' . $breadCrumbLocationIdsArray[$num];
             } else {
                 $breadCrumbParamToSendBack .= ',' . $breadCrumbLocationIdsArray[$num];
             }
             $r .= '<li id="breadcrumb-part-"' . $num . '>';
             //The breadcrumb link is a name, with a url back to the homepage containing ids for the homepage
             //to show in its breadcrumb
             $r .= '<a href="' . $base_url . (variable_get('clean_url', 0) ? '' : '?q=') . $options['homepage_path'] . (variable_get('clean_url', 0) ? '?' : '&') . $breadCrumbParamToSendBack . '">' . $breadCrumbLocationName . '<a>';
             $r .= '</li>';
         }
         $r .= '</ul></div>';
     }
     return $r;
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:43,代码来源:cudi_breadcrumb.php

示例14: get_controls

 /**
  * Define the HTML required for this filter's UI panel.
  */
 public function get_controls()
 {
     $r = '<div class="context-instruct messages warning">' . lang::get('Please note, you cannnot change this setting because of your access permissions in this context.') . '</div>';
     $r .= data_entry_helper::checkbox(array('label' => lang::get('Only include my records'), 'fieldname' => 'my_records'));
     $vocabulary = taxonomy_vocabulary_machine_name_load('hubs');
     $terms = entity_load('taxonomy_term', FALSE, array('vid' => $vocabulary->vid));
     // the hub is driven by a user field, stored as tid.
     $r .= '<fieldset><legend>' . lang::get('Members of Hub:') . '</legend>';
     $r .= "<p id=\"who-hub-instruct\">" . lang::get('Please note that this converts each Hub into a list of users associated with the Hub, and fetches the data created by those users.') . "</p>\n";
     $hubList = array();
     foreach ($terms as $term) {
         $hubList[] = array($term->tid, $term->name);
         // TODO Cache
         $query = new EntityFieldQuery();
         $query->entityCondition('entity_type', 'user')->fieldCondition('field_preferred_training_hub', 'tid', $term->tid);
         $result = $query->execute();
         // This gives us the CMS user ID: now convert to
         $userIDList = array();
         if (count($result) == 0) {
             $userIDList = array(-1);
         } else {
             $cmsUserIDs = array_keys($result['user']);
             foreach ($cmsUserIDs as $cmsUserID) {
                 $user_data = user_load($cmsUserID);
                 // TODO Making assumption about language
                 if (!empty($user_data->field_indicia_user_id['und'][0]['value'])) {
                     $userIDList[] = $user_data->field_indicia_user_id['und'][0]['value'];
                 }
             }
             if (count($userIDList) == 0) {
                 $userIDList = array(-1);
             }
         }
         $userIDList = array_unique($userIDList);
         data_entry_helper::$javascript .= "indiciaData.hub" . $term->tid . " = '" . implode(',', $userIDList) . "';\n";
         $r .= data_entry_helper::checkbox(array('label' => $term->name, 'fieldname' => 'hub' . $term->tid, 'helpText' => ($userIDList[0] == -1 ? 'No' : count($userIDList)) . lang::get(' users.')));
     }
     data_entry_helper::$javascript .= "indiciaData.hubList = " . json_encode($hubList) . ";\n";
     $r .= '</fieldset>';
     return $r;
 }
开发者ID:Indicia-Team,项目名称:CoCoast,代码行数:44,代码来源:cocoast_dynamic_report_explorer.php

示例15: get_form

 /**
  * Return the generated form output.
  * @param array $args List of parameter values passed through to the form depending on how the form has been configured.
  * This array always contains a value for language.
  * @param object $node The Drupal node object.
  * @param array $response When this form is reloading after saving a submission, contains the response from the service call.
  * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data).
  * @return Form HTML.
  * @todo: Implement this method 
  */
 public static function get_form($args, $node, $response = null)
 {
     if (empty($_GET['group_id'])) {
         return 'This page needs a group_id URL parameter.';
     }
     self::$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
     $group = data_entry_helper::get_population_data(array('table' => 'group', 'extraParams' => self::$auth['read'] + array('id' => $_GET['group_id'])));
     $group = $group[0];
     hostsite_set_page_title($group['title']);
     $filter = data_entry_helper::get_population_data(array('table' => 'filter', 'extraParams' => self::$auth['read'] + array('id' => $group['filter_id'])));
     $filter = $filter[0];
     $def = json_decode($filter['definition'], true);
     $defstring = '';
     // reconstruct this as a string to feed into dynamic report explorer
     foreach ($def as $key => $value) {
         if ($key) {
             $defstring .= "{$key}={$value}\n";
         }
     }
     // add the group parameters to the preset parameters passed to all reports on this page
     $args['param_presets'] = implode("\n", array($args['param_presets'], $defstring, "group_id=" . $_GET['group_id']));
     return parent::get_form($args, $node);
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:33,代码来源:group_home.php


注:本文中的data_entry_helper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。