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


PHP data_entry_helper::mergeParamsIntoTemplate方法代码示例

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


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

示例1: iform_mnhnl_lux5kgridControl


//.........这里部分代码省略.........
        }
        if ($args['siteNameTermListID'] == '') {
            $retVal .= "<label for=\"location-name\">" . $options['NameLabel'] . ":</label> <input type='text' id=\"location-name\" name=\"location:name\" class='required wide' value=\"" . htmlspecialchars(data_entry_helper::$entity_to_load['location:name']) . "\" /><span class='deh-required'>*</span><br/>";
        } else {
            $retVal .= data_entry_helper::select(array('label' => $options['NameLabel'], 'id' => 'location-name', 'fieldname' => 'location:name', 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'term', 'extraParams' => $auth['read'] + array('termlist_id' => $args['siteNameTermListID'], 'orderby' => 'id')));
        }
    } else {
        if ($args['locationMode'] == 'multi') {
            //TBD sort 2169 hardcode
            $retVal .= "<input type=\"hidden\" id=\"imp-sref-system\" name=\"location:centroid_sref_system\" value=\"2169\" >";
            // multiSite needs the location name.
            if ($args['siteNameTermListID'] == '') {
                $retVal .= "<label for=\"dummy-name\">" . $options['NameLabel'] . ":</label> <input type='text' id=\"dummy-name\" name=\"dummy:name\" class='wide' value=\"" . htmlspecialchars(data_entry_helper::$entity_to_load['location:name']) . "\" /><span class='deh-required'>*</span><br/>";
            } else {
                $retVal .= data_entry_helper::select(array('label' => $options['NameLabel'], 'id' => 'dummy-name', 'fieldname' => 'dummy:name', 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'term', 'blankText' => '', 'class' => 'checkGrid', 'extraParams' => $auth['read'] + array('termlist_id' => $args['siteNameTermListID'], 'orderby' => 'id')));
            }
            data_entry_helper::$javascript .= "\njQuery(\"#" . $options['ChooseParentFieldID'] . "\").change(function(){\n  if(typeof hook_mnhnl_parent_changed != 'undefined')\n    hook_mnhnl_parent_changed();\n  loadFeatures(this.value, '', {initial : false}, true, true, true, true, true);\n});\n";
        } else {
            if ($args['locationMode'] == 'single') {
                // no parent look up: actual name is a text entry field.
                $location_list_args = array('nocache' => true, 'includeCodeField' => true, 'label' => lang::get('LANG_CommonLocationNameLabel'), 'NameBlankText' => lang::get('LANG_Location_Name_Blank_Text'), 'fieldname' => 'location:id', 'id' => $options['MainFieldID'], 'columns' => 'id,name,code,location_type_id', 'extraParams' => array_merge(array('view' => 'detail', 'orderby' => 'name', 'website_id' => $args['website_id'], 'location_type_id' => $loctypeParam), $auth['read']), 'table' => 'location', 'template' => 'select', 'itemTemplate' => 'select_item', 'filterField' => 'parent_id', 'size' => 3);
                // Idea here is to get a list of all locations in order to build drop downs.
                $responseRecords = data_entry_helper::get_population_data($location_list_args);
                if (isset($responseRecords['error'])) {
                    return $responseRecords['error'];
                }
                iform_mnhnl_set_editable($auth, $args, $node, $responseRecords, 'conditional', $loctypeParam);
                $usedCodes = array();
                $maxCode = 0;
                $NameOpts = '';
                foreach ($responseRecords as $record) {
                    if ($record['name'] != '') {
                        $item = array('selected' => data_entry_helper::$entity_to_load['location:id'] == $record['id'] ? 'selected=\\"selected\\"' : '', 'value' => $record['id'], 'caption' => htmlspecialchars(utf8_decode($record['name'])));
                        $NameOpts .= data_entry_helper::mergeParamsIntoTemplate($item, $location_list_args['itemTemplate']);
                        if ($record['code'] != '') {
                            $usedCodes[] = "\"" . $record['code'] . "\"";
                            if ($maxCode < $record['code']) {
                                $maxCode = $record['code'];
                            }
                        }
                    }
                }
                data_entry_helper::$javascript .= "\nvar usedCodes = [" . implode(',', $usedCodes) . "];\nvar defaultCode = " . ($maxCode + 1) . ";\n";
                $retVal .= '<p>' . $options['Instructions2'] . '</p>' . ($options['AdminMode'] && (!isset($args['adminsCanCreate']) || !$args['adminsCanCreate']) ? '<p>' . lang::get('LANG_LocModTool_CantCreate') . '</p>' : '') . '<fieldset><legend>' . lang::get('Existing locations') . '</legend>';
                if ($NameOpts != '') {
                    $location_list_args['items'] = str_replace(array('{value}', '{caption}', '{selected}'), array('', htmlentities($location_list_args['NameBlankText']), ''), $indicia_templates[$location_list_args['itemTemplate']]) . $NameOpts;
                    $retVal .= data_entry_helper::apply_template($location_list_args['template'], $location_list_args);
                    if ($args['SecondaryLocationTypeTerm'] != '' && $options['AdminMode']) {
                        $retVal .= '<p>' . lang::get("LANG_Multiple_Location_Types") . '</p>';
                    }
                } else {
                    $retVal .= '<p>' . lang::get("LANG_NoSites") . '</p>';
                }
                $retVal .= "</fieldset><label for=\"location-name\">" . $options['NameLabel'] . ":</label> <input id=\"location-name\" name=\"location:name\" class='wide required' value=\"" . htmlspecialchars(data_entry_helper::$entity_to_load['location:name']) . "\"><span class=\"deh-required\">*</span><br />\n      <input type='hidden' id=\"sample-location-id\" name=\"sample:location_id\" value='" . data_entry_helper::$entity_to_load['sample:location_id'] . "' />";
            } else {
                // single location, filtered.
                data_entry_helper::$javascript .= "indiciaData.filterMode=true;\n";
                iform_mnhnl_set_editable($auth, $args, $node, array(), 'conditional', $loctypeParam);
                $retVal .= '<p>' . $options['Instructions2'] . '</p>' . ($options['AdminMode'] && (!isset($args['adminsCanCreate']) || !$args['adminsCanCreate']) ? '<p>' . lang::get('LANG_LocModTool_CantCreate') . '</p>' : '');
                $filterAttrs = explode(',', $args['filterAttrs']);
                // filter attributes are assumed to be text (could extend later)
                $attrArgs = array('valuetable' => 'location_attribute_value', 'attrtable' => 'location_attribute', 'key' => 'location_id', 'fieldprefix' => 'locAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id']);
                if (array_key_exists('location:id', data_entry_helper::$entity_to_load) && data_entry_helper::$entity_to_load['location:id'] != "") {
                    // if we have location Id to load, use it to get attribute values
                    $attrArgs['id'] = data_entry_helper::$entity_to_load['location:id'];
                }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:67,代码来源:mnhnl_common.php

示例2: mnhnl_reptiles_species_checklist

 public static function mnhnl_reptiles_species_checklist()
 {
     global $indicia_templates;
     $options = data_entry_helper::check_arguments(func_get_args(), array('listId', 'occAttrs', 'readAuth', 'extraParams', 'lookupListId'));
     $options = data_entry_helper::get_species_checklist_options($options);
     data_entry_helper::add_resource('json');
     data_entry_helper::add_resource('autocomplete');
     $occAttrControls = array();
     $occAttrs = array();
     // Load any existing sample's occurrence data into $entity_to_load
     $subSamples = array();
     if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
         data_entry_helper::preload_species_checklist_occurrences(data_entry_helper::$entity_to_load['sample:id'], $options['readAuth'], false, array(), $subSamples, false);
     }
     // load the full list of species for the grid, including the main checklist plus any additional species in the reloaded occurrences.
     $options['extraParams']['view'] = 'detail';
     $occList = self::get_species_checklist_occ_list($options);
     // If we managed to read the species list data we can proceed
     if (!array_key_exists('error', $occList)) {
         $attributes = data_entry_helper::getAttributes(array('id' => null, 'valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => "{fieldname}", 'extraParams' => $options['readAuth'], 'survey_id' => array_key_exists('survey_id', $options) ? $options['survey_id'] : null));
         // Get the attribute and control information required to build the custom occurrence attribute columns
         data_entry_helper::species_checklist_prepare_attributes($options, $attributes, $occAttrControls, $occAttrs);
         $grid = "<p>" . lang::get('LANG_SpeciesInstructions') . "</p>\n";
         if (isset($options['lookupListId'])) {
             $grid .= self::get_species_checklist_clonable_row($options, $occAttrControls, $attributes);
         }
         $grid .= '<table class="ui-widget ui-widget-content mnhnl-species-grid ' . $options['class'] . '" id="' . $options['id'] . '">';
         $grid .= self::get_species_checklist_header($options, $occAttrs);
         $rows = array();
         $rowIdx = 0;
         foreach ($occList as $occ) {
             $ttlid = $occ['taxon']['id'];
             $firstCell = data_entry_helper::mergeParamsIntoTemplate($occ['taxon'], 'taxon_label', false, true);
             if ($options['PHPtaxonLabel']) {
                 $firstCell = eval($firstCell);
             }
             $colspan = ' colspan="' . count($attributes) . '"';
             // assume always removeable and presence is hidden.
             $firstrow = '<td class="ui-state-default remove-row" style="width: 1%" rowspan="' . ($options['occurrenceComment'] ? "3" : "2") . '" >X</td>';
             $firstrow .= str_replace('{content}', $firstCell, str_replace('{colspan}', $colspan, $indicia_templates['taxon_label_cell']));
             $existing_record_id = $occ['id'];
             $hidden = $options['rowInclusionCheck'] == 'checkbox' ? '' : ' style="display:none"';
             if ($options['rowInclusionCheck'] == 'alwaysFixed' || $options['rowInclusionCheck'] == 'alwaysRemovable' || data_entry_helper::$entity_to_load != null && array_key_exists("sc:{$ttlid}:{$existing_record_id}:present", data_entry_helper::$entity_to_load)) {
                 $checked = ' checked="checked"';
             } else {
                 $checked = '';
             }
             $secondrow = "<td class=\"scPresenceCell\"{$hidden}>" . ($options['rowInclusionCheck'] != 'hasData' ? "<input type=\"hidden\" class=\"scPresence\" name=\"sc:{$ttlid}:{$existing_record_id}:present\" value=\"0\"/><input type=\"checkbox\" class=\"scPresence\" name=\"sc:{$ttlid}:{$existing_record_id}:present\" {$checked} />" : '') . "</td>";
             foreach ($occAttrControls as $attrId => $control) {
                 if ($existing_record_id) {
                     $search = preg_grep("/^sc:" . $ttlid . "[_[0-9]*]?:{$existing_record_id}:occAttr:{$attrId}" . '[:[0-9]*]?$/', array_keys(data_entry_helper::$entity_to_load));
                     $ctrlId = count($search) === 1 ? implode('', $search) : "sc:{$ttlid}:{$existing_record_id}:occAttr:{$attrId}";
                 } else {
                     $ctrlId = "sc:{$ttlid}:x{$rowIdx}:occAttr:{$attrId}";
                 }
                 if (isset(data_entry_helper::$entity_to_load[$ctrlId])) {
                     $existing_value = data_entry_helper::$entity_to_load[$ctrlId];
                 } elseif (array_key_exists('default', $attributes[$attrId])) {
                     $existing_value = $attributes[$attrId]['default'];
                 } else {
                     $existing_value = '';
                 }
                 $oc = str_replace('{fieldname}', $ctrlId, $control);
                 if (!empty($existing_value)) {
                     // For select controls, specify which option is selected from the existing value
                     if (substr($oc, 0, 7) == '<select') {
                         $oc = str_replace('value="' . $existing_value . '"', 'value="' . $existing_value . '" selected="selected"', $oc);
                     } else {
                         if (strpos($oc, 'checkbox') !== false) {
                             if ($existing_value == "1") {
                                 $oc = str_replace('type="checkbox"', 'type="checkbox" checked="checked"', $oc);
                             }
                         } else {
                             $oc = str_replace('value=""', 'value="' . $existing_value . '"', $oc);
                         }
                     }
                     // assume all error handling/validation done client side
                 }
                 $secondrow .= str_replace(array('{label}', '{content}'), array(lang::get($attributes[$attrId]['caption']), $oc), $indicia_templates[$options['attrCellTemplate']]);
             }
             $thirdrow = "";
             if ($options['occurrenceComment']) {
                 $thirdrow .= "\n<td class=\"ui-widget-content scCommentCell\" {$colspan}><label for=\"sc:{$ttlid}:{$existing_record_id}:occurrence:comment\" class=\"auto-width\" >" . lang::get("Comment") . " : </label><input class=\"scComment\" type=\"text\" name=\"sc:{$ttlid}:{$existing_record_id}:occurrence:comment\" " . "id=\"sc:{$ttlid}:{$existing_record_id}:occurrence:comment\" value=\"" . htmlspecialchars(data_entry_helper::$entity_to_load["sc:{$ttlid}:{$existing_record_id}:occurrence:comment"]) . "\" /></td>";
             }
             $rows[] = '<tr>' . $firstrow . '</tr>';
             $rows[] = '<tr class="scMeaning-' . $occ['taxon']['taxon_meaning_id'] . ' scDataRow">' . $secondrow . '</tr>';
             // no images.
             if ($thirdrow != "") {
                 $rows[] = '<tr class="scMeaning-' . $occ['taxon']['taxon_meaning_id'] . ' scDataRow">' . $thirdrow . '</tr>';
             }
             // no images.
             $rowIdx++;
         }
         $grid .= "\n<tbody>\n";
         if (count($rows) > 0) {
             $grid .= implode("\n", $rows) . "\n";
         } else {
             $grid .= "<tr style=\"display: none\"><td></td></tr>\n";
         }
         $grid .= "</tbody>\n</table>\n";
//.........这里部分代码省略.........
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:101,代码来源:mnhnl_reptiles.php

示例3: mnhnl_bats2_species_checklist

 public static function mnhnl_bats2_species_checklist($args, $options)
 {
     global $indicia_templates;
     //    $options = data_entry_helper::check_arguments($options, array('listId', 'occAttrs', 'readAuth', 'extraParams', 'lookupListId'));
     $options = data_entry_helper::get_species_checklist_options($options);
     data_entry_helper::add_resource('json');
     data_entry_helper::add_resource('autocomplete');
     $occAttrControls = array();
     $occAttrs = array();
     $retVal = '';
     // Load any existing sample's occurrence data into $entity_to_load: first have to load the survey method subsamples.
     if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
         $subSamplesAttrs = array();
         $smpOptions = array('table' => 'sample', 'nocache' => true, 'extraParams' => $options['readAuth'] + array('view' => 'detail', 'parent_id' => data_entry_helper::$entity_to_load['sample:id']));
         $subSamples = data_entry_helper::get_population_data($smpOptions);
         foreach ($subSamples as $sample) {
             $subSamplesAttrs[$sample['id']] = data_entry_helper::getAttributes(array('attrtable' => 'sample_attribute', 'valuetable' => 'sample_attribute_value', 'id' => $sample['id'], 'key' => 'sample_id', 'fieldprefix' => '{MyPrefix}:smpAttr', 'extraParams' => $options['readAuth'], 'survey_id' => $args['survey_id']), true);
             $subSamplesAttrs[$sample['id']][$visitAttr]['validation_rules'] = 'required';
         }
         foreach ($options['surveyMethods'] as $i => $method) {
             $smpID = false;
             foreach ($subSamples as $subSample) {
                 foreach ($subSamplesAttrs[$subSample['id']] as $attr) {
                     if ($attr['attributeId'] == $options['surveyMethodAttrId'] && $attr['default'] == $method['meaning_id']) {
                         $smpID = $subSample['id'];
                         $options['surveyMethods'][$i]['smpID'] = $smpID;
                     }
                 }
             }
             if ($smpID) {
                 self::preload_species_checklist_occurrences($smpID, $method['meaning_id'], $options['readAuth']);
             }
         }
     }
     // load the full list of species for the grid, including the main checklist plus any additional species in the reloaded occurrences.
     $options['extraParams']['view'] = 'detail';
     $occList = self::get_species_checklist_occ_list($options);
     // If we managed to read the species list data we can proceed
     if (!array_key_exists('error', $occList)) {
         $attributes = data_entry_helper::getAttributes(array('id' => null, 'valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => "{fieldname}", 'extraParams' => $options['readAuth'], 'survey_id' => array_key_exists('survey_id', $options) ? $options['survey_id'] : null));
         foreach ($attributes as $idx => $attr) {
             $attributes[$idx]['class'] = "scCheckTaxon";
         }
         // this allows extra validation
         // Get the attribute and control information required to build the custom occurrence attribute columns
         self::species_checklist_prepare_attributes($options, $attributes, $occAttrControls, $occAttrs);
         $retVal = "<p>" . lang::get('LANG_SpeciesInstructions') . "</p>\n";
         if (isset($options['lookupListId'])) {
             self::$cloneableTable = self::get_species_checklist_clonable_row($options, $occAttrControls, $attributes);
         }
         $retVal .= '<table class="ui-widget ui-widget-content mnhnl-species-grid ' . $options['class'] . '" id="' . $options['id'] . '">';
         $retVal .= self::get_species_checklist_header($options, $attributes) . '<tbody>';
         $attrsPerRow = array();
         foreach ($attributes as $attrId => $attr) {
             $row = substr($attr['inner_structure_block'], 3);
             if (!isset($attrsPerRow[$row])) {
                 $attrsPerRow[$row] = array();
             }
             $attrsPerRow[$row][] = $attr["attributeId"];
         }
         $rows = array();
         $rowIdx = 0;
         // each row grouping is driven by the ttlid, not the occurrence, as there is a different occurrence for each survey method.
         // that said we want it to be in general occurrence order so it matches the order in which the occurrences are created
         // i.e. in order of first occurrence in ttl group
         $ttlidList = array();
         $ttlList = array();
         foreach ($occList as $occ) {
             $ttlid = $occ['taxon']['id'];
             if (!in_array($ttlid, $ttlidList)) {
                 $ttlidList[] = $ttlid;
                 $ttlList[$ttlid] = $occ['taxon'];
             }
         }
         foreach ($ttlidList as $ttlid) {
             $id = 1;
             foreach ($options['surveyMethods'] as $method) {
                 $existing_record_id = '';
                 foreach ($occList as $occIt) {
                     // get the occurrence for this method/ttl combination
                     if ($occIt['taxon']['id'] == $ttlid && $occIt['method'] == $method['meaning_id']) {
                         $occ = $occIt;
                         $existing_record_id = $occ['id'];
                     }
                 }
                 $retVal .= '<tr class="scMeaning-' . $ttlList[$ttlid]['taxon_meaning_id'] . ' scDataRow sg-tr-' . $method['meaning_id'] . ' ' . ($id == '1' ? 'scFirstRow' : '') . '">';
                 if ($id == '1') {
                     $firstCell = data_entry_helper::mergeParamsIntoTemplate($ttlList[$ttlid], 'taxon_label', false, true);
                     if ($options['PHPtaxonLabel']) {
                         $firstCell = eval($firstCell);
                     }
                     // assume always removeable and scPresence is hidden.
                     $retVal .= '<td class="ui-state-default remove-row" style="width: 1%" rowspan="' . count($attrsPerRow) . '">X</td>';
                     $retVal .= str_replace('{content}', $firstCell, str_replace('{colspan}', 'rowspan="' . count($attrsPerRow) . '"', $indicia_templates['taxon_label_cell']));
                 }
                 $ctrlId = "sc:" . $method['meaning_id'] . ":{$ttlid}:" . ($existing_record_id ? $existing_record_id : "x" . $rowIdx) . ":present";
                 $retVal .= '<td>' . $method['term'] . ':</td><td class="scPresenceCell" style="display:none"><input type="hidden" class="scPresence" name="' . $ctrlId . '" value="1" /></td><td><span>';
                 foreach ($attrsPerRow[$id] as $attrId) {
                     // no complex values in checkboxes as the controls are vanilla
                     if ($existing_record_id) {
//.........这里部分代码省略.........
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:101,代码来源:mnhnl_bats2.php

示例4: species_checklist

 public static function species_checklist($options)
 {
     global $indicia_templates;
     //    $options = data_entry_helper::check_arguments(func_get_args(), array('speciesListID', 'occAttrs', 'readAuth', 'extraParams'));
     $options = self::get_species_checklist_options($options);
     data_entry_helper::add_resource('json');
     data_entry_helper::add_resource('autocomplete');
     $occAttrControls = array();
     $occAttrCaptions = array();
     $occAttrs = array();
     // Load any existing sample's occurrence data into $entity_to_load
     if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
         self::preload_species_checklist_occurrences(data_entry_helper::$entity_to_load['sample:id'], $options['readAuth'], $options);
     }
     // at this point we are only dealing with occurrence attributes.
     $attributes = data_entry_helper::getAttributes(array('valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => "{fieldname}", 'extraParams' => $options['readAuth'], 'survey_id' => array_key_exists('survey_id', $options) ? $options['survey_id'] : null));
     $numRows = 0;
     $maxCellsPerRow = $i = 1;
     do {
         $foundRows = false;
         $attrsPerRow = 0;
         foreach ($attributes as $attribute) {
             if ($attribute["inner_structure_block"] == "Row" . $i) {
                 $numRows = $i;
                 $foundRows = true;
                 $attrsPerRow++;
             }
         }
         $i++;
         $maxCellsPerRow = max($maxCellsPerRow, $attrsPerRow);
     } while ($foundRows);
     if ($numRows) {
         $foundRows = true;
     } else {
         $numRows = 1;
         $maxCellsPerRow = count($attributes);
     }
     $options['extraParams']['view'] = 'detail';
     $options['numRows'] = 1 + ($options['includeSubSample'] ? 1 : 0) + $numRows * ($options['useCaptionsInPreRow'] ? 2 : 1) + ($options['includeOccurrenceComment'] ? 1 : 0);
     $recordList = self::get_species_checklist_record_list($options);
     $grid = "";
     $precision = false;
     if ($options['includeSubSample']) {
         $grid .= "<input type='hidden' name='includeSubSample' id='includeSubSample' value='true' >";
         $smpattributes = data_entry_helper::getAttributes(array('valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => "smpAttr", 'extraParams' => $options['readAuth'] + array("untranslatedCaption" => "Precision"), 'survey_id' => array_key_exists('survey_id', $options) ? $options['survey_id'] : null, 'sample_method_id' => $options['subsample_method_id']), false);
         $precision = count($smpattributes) > 0 ? $smpattributes[0] : false;
         $maxCellsPerRow = max($maxCellsPerRow, 2 + ($options['displaySampleDate'] ? 1 : 0) + ($precision ? 1 : 0));
     }
     // If we managed to read the species list data we can proceed
     if (!array_key_exists('error', $recordList)) {
         // Get the attribute and control information required to build the custom occurrence attribute columns
         self::species_checklist_prepare_attributes($options, $attributes, $occAttrControls, $occAttrCaptions, $occAttrs);
         $grid .= self::get_species_checklist_clonable_row($options, $occAttrControls, $occAttrCaptions, $attributes, $precision);
         $grid .= '<table class="ui-widget ui-widget-content mnhnl-species-grid ' . $options['class'] . '" id="' . $options['id'] . '">';
         $grid .= self::get_species_checklist_header($options, $occAttrs);
         $rows = array();
         $rowIdx = 1;
         /*
          * fieldnames: SC:<RowGroup>:<sampleID>:<ttlID>:<occurrenceID>:[present|sample:[date|etc]|occAttr:<attrID>[:<valueID>]]
          */
         foreach ($recordList as $rec) {
             $ttlid = $rec['taxon']['id'];
             $occ_existing_record_id = $rec['occurrence']['id'];
             $smp_existing_record_id = $options['includeSubSample'] ? $rec['sample']['id'] : '';
             $firstCell = data_entry_helper::mergeParamsIntoTemplate($rec['taxon'], 'taxon_label', false, true);
             $prefix = "sc:{$rowIdx}:{$smp_existing_record_id}:{$ttlid}:{$occ_existing_record_id}";
             if ($options['PHPtaxonLabel']) {
                 $firstCell = eval($firstCell);
             }
             $colspan = ' colspan="' . $maxCellsPerRow . '"';
             // assume always removeable and presence is hidden.
             $row = "<td class='ui-state-default remove-row' rowspan='" . $options['numRows'] . "' >X</td>";
             $row .= str_replace('{content}', $firstCell, str_replace('{colspan}', $colspan, $indicia_templates['taxon_label_cell']));
             $row .= "<td class='scPresenceCell' style='display:none'><input type='hidden' class='scPresence' name='{$prefix}:present' value='true'/></td>";
             $rows[] = '<tr class="scMeaning-' . $rec['taxon']['taxon_meaning_id'] . ' first scOcc-' . $occ_existing_record_id . '">' . $row . '</tr>';
             if ($options['includeSubSample']) {
                 $row = '<tr class="scMeaning-' . $rec['taxon']['taxon_meaning_id'] . ' scDataRow">';
                 if ($options['displaySampleDate']) {
                     $ctrlID = $ctrlName = $prefix . ":sample:date";
                     self::_getCtrlNames($ctrlName, $oldCtrlName, false);
                     // TBD need to attach a date control
                     $row .= "<td class='ui-widget-content'><label class='auto-width' for='{$ctrlID}'>" . lang::get('LANG_Date') . ":</label> <input type='text' id='{$ctrlID}' class='date' name='{$ctrlName}' value='" . data_entry_helper::$entity_to_load[$oldCtrlName] . "' /></td>";
                 }
                 $ctrlName = $prefix . ":sample:geom";
                 self::_getCtrlNames($ctrlName, $oldCtrlName, false);
                 $row .= "<td class='ui-widget-content'><input type='hidden' id='{$prefix}:imp-geom' name='{$ctrlName}' value='" . data_entry_helper::$entity_to_load[$oldCtrlName] . "' />";
                 $ctrlName = $prefix . ":sample:entered_sref";
                 self::_getCtrlNames($ctrlName, $oldCtrlName, false);
                 $row .= "<input type='hidden' id='{$prefix}:imp-sref' name='{$ctrlName}' value='" . data_entry_helper::$entity_to_load[$oldCtrlName] . "' />";
                 if (isset(data_entry_helper::$entity_to_load[$oldCtrlName]) && data_entry_helper::$entity_to_load[$oldCtrlName] != "") {
                     $parts = explode(' ', data_entry_helper::$entity_to_load[$oldCtrlName]);
                     $parts[0] = explode(',', $parts[0]);
                     $parts[0] = $parts[0][0];
                 } else {
                     $parts = array('', '');
                 }
                 // for existing samples, don't need to specify sample_method, as it won't change.
                 $row .= "<label class='auto-width' for='{$prefix}:imp-srefX'>" . lang::get('LANG_Species_X_Label') . ":</label> <input type='text' id='{$prefix}:imp-srefX' class='imp-srefX required integer' name='dummy:srefX' value='{$parts['0']}' /><span class='deh-required'>*</span></td>\n<td class='ui-widget-content'><label class='auto-width' for='{$prefix}:imp-srefY'>" . lang::get('LANG_Species_Y_Label') . ":</label> <input type='text' id='{$prefix}:imp-srefY' class='imp-srefY required integer' name='dummy:srefY' value='{$parts['1']}'/><span class='deh-required'>*</span>\n</td>";
                 if ($precision) {
                     //  'sc::'.$smp.':'.$occurrence['taxa_taxon_list_id'].':'.$occurrence['id'].':'.$sampleAttr['fieldname']] = $sampleAttr['default'];
//.........这里部分代码省略.........
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:101,代码来源:mnhnl_dynamic_2.php

示例5: dump_one_row

 private function dump_one_row($txIdx, $rowIds, $taxalist, $taxonRows, $occAttrControls, $attributes, $options)
 {
     global $indicia_templates;
     $ttlId = $rowIds['ttlId'];
     $colIdx = (int) floor($rowIdx / count($taxonRows));
     // Find the taxon in our preloaded list data that we want to output for this row
     $taxonIdx = 0;
     while ($taxonIdx < count($taxalist) && $taxalist[$taxonIdx]['id'] != $ttlId) {
         $taxonIdx += 1;
     }
     if ($taxonIdx >= count($taxalist)) {
         return '';
     }
     // next taxon, as this one was not found in the list
     $taxon = $taxalist[$taxonIdx];
     $firstColumnTaxon = $taxon;
     // map field names if using a cached lookup
     if ($options['cacheLookup']) {
         $firstColumnTaxon = $firstColumnTaxon + array('preferred_name' => $firstColumnTaxon['preferred_taxon'], 'common' => $firstColumnTaxon['default_common_name']);
     }
     $firstColumnTaxon['taxonComp'] = preg_replace('/\\s+|\\//', '-', strtolower($firstColumnTaxon['taxon']));
     // Get the cell content from the taxon_label template
     $firstCell = data_entry_helper::mergeParamsIntoTemplate($firstColumnTaxon, 'taxon_label');
     // Now create the table cell to contain this.
     $row = '';
     $row .= str_replace(array('{content}', '{colspan}', '{tableId}', '{idx}'), array($firstCell, '', $options['id'], $colIdx), $indicia_templates['taxon_label_cell']);
     $row .= "\n<td class=\"scPresenceCell\" headers=\"{$options['id']}-present-{$colIdx}\" style=\"display:none\">";
     $fieldname = "sc:{$options['id']}-{$txIdx}:{$existing_record_id}:present";
     $row .= "<input type=\"hidden\" name=\"{$fieldname}\" id=\"{$fieldname}\" value=\"{$taxon['id']}\"/>";
     $row .= "</td>";
     $idx = 0;
     foreach ($occAttrControls as $attrId => $control) {
         $existing_value = '';
         $valId = false;
         // no existing record, so use a default control ID which excludes the existing record ID.
         $ctrlId = str_replace('-idx-', "{$options['id']}-{$txIdx}", $attributes[$attrId]['fieldname']);
         $loadedCtrlFieldName = '-';
         if ($existing_value === '' && array_key_exists('default', $attributes[$attrId])) {
             // this case happens when reloading an existing record
             $existing_value = $attributes[$attrId]['default'];
         }
         // inject the field name into the control HTML
         $oc = str_replace('{fieldname}', $ctrlId, $control);
         if ($existing_value != "") {
             // For select controls, specify which option is selected from the existing value
             if (substr($oc, 0, 7) == '<select') {
                 $oc = str_replace('value="' . $existing_value . '"', 'value="' . $existing_value . '" selected="selected"', $oc);
             } else {
                 if (strpos($oc, 'checkbox') !== false) {
                     if ($existing_value == "1") {
                         $oc = str_replace('type="checkbox"', 'type="checkbox" checked="checked"', $oc);
                     }
                 } else {
                     $oc = str_replace('value=""', 'value="' . $existing_value . '"', $oc);
                 }
             }
         }
         $errorField = "occAttr:{$attrId}" . ($valId ? ":{$valId}" : '');
         $error = data_entry_helper::check_errors($errorField);
         if ($error) {
             $oc = str_replace("class='", "class='ui-state-error ", $oc);
             $oc .= $error;
         }
         $headers = $options['id'] . "-attr{$attrId}-{$colIdx}";
         $class = self::species_checklist_occ_attr_class($options, $idx, $attributes[$attrId]['untranslatedCaption']);
         $class = $class . 'Cell';
         $row .= str_replace(array('{label}', '{class}', '{content}', '{headers}'), array(lang::get($attributes[$attrId]['caption']), $class, $oc, $headers), $indicia_templates[$options['attrCellTemplate']]);
         $idx++;
     }
     return $row;
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:71,代码来源:ofs_pollinator_2013.php

示例6: dump_one_row

 private function dump_one_row($txIdx, $rowIds, $taxalist, $taxonRows, $occAttrControls, $attributes, $options)
 {
     global $indicia_templates;
     $ttlId = $rowIds['ttlId'];
     // Find the taxon in our preloaded list data that we want to output for this row
     $taxonIdx = 0;
     while ($taxonIdx < count($taxalist) && $taxalist[$taxonIdx]['id'] != $ttlId) {
         $taxonIdx += 1;
     }
     if ($taxonIdx >= count($taxalist)) {
         return '';
     }
     // next taxon, as this one was not found in the list
     $taxon = $taxalist[$taxonIdx];
     $firstColumnTaxon = $taxon;
     // map field names if using a cached lookup
     if ($options['cacheLookup']) {
         $firstColumnTaxon = $firstColumnTaxon + array('preferred_name' => $firstColumnTaxon['preferred_taxon'], 'common' => $firstColumnTaxon['default_common_name']);
     }
     $firstColumnTaxon['taxonComp'] = preg_replace('/\\s+|\\//', '-', strtolower($firstColumnTaxon['taxon']));
     // Get the cell content from the taxon_label template
     $firstCell = data_entry_helper::mergeParamsIntoTemplate($firstColumnTaxon, 'taxon_label');
     // Now create the table cell to contain this.
     $row = '';
     $row .= str_replace(array('{content}', '{colspan}', '{tableId}', '{idx}'), array($firstCell, '', $options['id'], $txIdx), $indicia_templates['taxon_label_cell']);
     $row .= "\n<td class=\"scPresenceCell\" headers=\"{$options['id']}-present-{$txIdx}\" style=\"display:none\">";
     $fieldname = "sc:{$options['id']}-{$txIdx}:{$existing_record_id}:present";
     $row .= "<input type=\"hidden\" name=\"{$fieldname}\" id=\"{$fieldname}\" value=\"{$taxon['id']}\"/>";
     $row .= "</td>";
     $row .= self::addAttributeCols($occAttrControls, $attributes, $options, $txIdx);
     return $row;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:32,代码来源:ofs_pollinator_2013.php


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