protected static function getExtraGridModeTabs($retTabs, $readAuth, $args, $attributes)
    {
        // TBD add check for loctools
        global $indicia_templates;
        $isAdmin = user_access($args['edit_permission']);
        if (!$isAdmin) {
            return '';
        }
        if (!$retTabs) {
            return array('#downloads' => lang::get('Reports'), '#locations' => lang::get('LANG_Locations'));
        }
        $LocationTypeID = iform_mnhnl_getTermID(parent::$auth, 'indicia:location_types', $args['LocationTypeTerm']);
        $retVal = '<div id="downloads" >
    <p>' . lang::get('LANG_Data_Download') . '</p>
    <form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/mnhnl_butterflies2_sites_report.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv&filename=downloadsites">
      <input type="hidden" name="params" value=\'{"location_type_id":' . $LocationTypeID . '}\' />
      <label>' . lang::get('Sites report') . ':</label><input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('Download') . '">
    </form>
    <form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/mnhnl_butterflies2_conditions_report.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv&filename=downloadconditions">
      <input type="hidden" name="params" value=\'{"survey_id":' . $args['survey_id'] . '}\' />
      <label>' . lang::get('Conditions report') . ':</label><input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('Download') . '">
    </form>
	<form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/mnhnl_butterflies2_species_report.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv&filename=downloadoccurrences">
      <input type="hidden" name="params" value=\'{"survey_id":' . $args['survey_id'] . '}\' />
      <label>' . lang::get('Species report') . ':</label><input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('Download') . '">
    </form>
  </div>' . iform_mnhnl_locModTool(parent::$auth, $args, parent::$node);
        return $retVal;
    }
    protected static function getExtraGridModeTabs($retTabs, $readAuth, $args, $attributes)
    {
        if (!user_access($args['edit_permission'])) {
            return '';
        }
        $targetSpeciesAttr = iform_mnhnl_getAttr(parent::$auth, $args, 'sample', $args['targetSpeciesAttr']);
        if (!$targetSpeciesAttr) {
            return lang::get('This form must be used with a survey that has the ' . $args['targetSpeciesAttr'] . ' attribute associated with it.');
        }
        if (!$retTabs) {
            return array('#downloads' => lang::get('Reports'), '#locations' => lang::get('LANG_Locations'));
        }
        if ($args['LocationTypeTerm'] == '' && isset($args['loctoolsLocTypeID'])) {
            $args['LocationTypeTerm'] = $args['loctoolsLocTypeID'];
        }
        $primary = iform_mnhnl_getTermID(array('read' => $readAuth), 'indicia:location_types', $args['LocationTypeTerm']);
        data_entry_helper::$javascript .= "\r\njQuery('.downloadreportparams').val('{\"survey_id\":" . $args['survey_id'] . ", \"location_type_id\":" . $primary . ", \"taxon_list_id\":" . $args['extra_list_id'] . ", \"target_species_attr\":" . $targetSpeciesAttr['attributeId'] . ", \"target_species_termlist\":" . $targetSpeciesAttr['termlist_id'] . (isset($args['targetSpeciesAttrList']) ? ", \"target_species_attr_list\":\"" . $args['targetSpeciesAttrList'] . "\"" : "") . "}');\r\n";
        return '<div id="downloads" >
  <p>' . lang::get('LANG_Data_Download') . '</p>' . ($args['sites_download_report'] != '' ? '
  <form id="sitesReportRequestForm" method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=' . $args['sites_download_report'] . '.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . 'Sites">
    <input type="hidden" name="params" class="downloadreportparams" value="" />
    <label>' . lang::get('Sites report') . ':</label><input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('Download') . '">
  </form>' : '') . ($args['conditions_download_report'] != '' ? '
  <form id="conditionsReportRequestForm" method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=' . $args['conditions_download_report'] . '.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . 'Conditions">
    <input type="hidden" name="params" class="downloadreportparams" value="" />
    <label>' . lang::get('Conditions report') . ':</label><input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('Download') . '">
  </form>' : '') . '
  <form id="speciesReportRequestForm" method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=' . $args['species_download_report'] . '.xml&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . 'Species">
    <input type="hidden" name="params" class="downloadreportparams" value="" />
    <label>' . lang::get('Species report') . ':</label><input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('Download') . '">
  </form>
</div>' . iform_mnhnl_locModTool(parent::$auth, $args, parent::$node);
    }
Exemplo n.º 3
0
   protected static function getExtraGridModeTabsSub($retTabs, $readAuth, $args, $attributes, $rep1, $rep2, $rep3)
   {
       $isAdmin = isset($args['edit_permission']) && $args['edit_permission'] != "" && user_access($args['edit_permission']);
       if (!$isAdmin) {
           return '';
       }
       if (!$retTabs) {
           return array('#downloads' => lang::get('Reports'), '#locations' => lang::get('LANG_Locations'));
       }
       $confirmedLocationTypeID = iform_mnhnl_getTermID(parent::$auth, 'indicia:location_types', $args['SecondaryLocationTypeTerm']);
       $submittedLocationTypeID = iform_mnhnl_getTermID(parent::$auth, 'indicia:location_types', $args['LocationTypeTerm']);
       // When a location is created it is created as the Primary location type: this is the new Submitted location for bats.
       // When the location is checked by an admin, or is flagged as such in the initial upload, it is changed to the Secondary Location type: this is the old Confirmed type.
       $r = '<div id="downloads" ><p>' . lang::get('LANG_Data_Download') . '</p>
   <form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/' . $rep1 . '&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . 'sitesreport">
     <input type="hidden" name="params" value=\'{"website_id":' . $args['website_id'] . ', "survey_id":' . $args['survey_id'] . ', "primary_loc_type_id":' . $submittedLocationTypeID . ', "primary_name":"' . lang::get('LANG_Location_Type_Primary') . '", "secondary_loc_type_id":' . $confirmedLocationTypeID . ', "secondary_name":"' . lang::get('LANG_Location_Type_Secondary') . '"}\' />
     <label>' . lang::get('Sites report') . ':</label><input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('Download') . '">
   </form>
   <form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/' . $rep2 . '&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . 'conditionsreport">
     <input type="hidden" name="params" value=\'{"website_id":' . $args['website_id'] . ', "survey_id":' . $args['survey_id'] . ', "primary_loc_type_id":' . $submittedLocationTypeID . ', "primary_name":"' . lang::get('LANG_Location_Type_Primary') . '", "secondary_loc_type_id":' . $confirmedLocationTypeID . ', "secondary_name":"' . lang::get('LANG_Location_Type_Secondary') . '"}\' />
     <label>' . lang::get('Conditions report') . ':</label><input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('Download') . '">
   </form>
   <form method="post" action="' . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/' . $rep3 . '&reportSource=local&auth_token=' . $readAuth['auth_token'] . '&nonce=' . $readAuth['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . 'speciesreport">
     <input type="hidden" name="params" value=\'{"website_id":' . $args['website_id'] . ', "survey_id":' . $args['survey_id'] . ', "primary_loc_type_id":' . $submittedLocationTypeID . ', "primary_name":"' . lang::get('LANG_Location_Type_Primary') . '", "secondary_loc_type_id":' . $confirmedLocationTypeID . ', "secondary_name":"' . lang::get('LANG_Location_Type_Secondary') . '"}\' />
     <label>' . lang::get('Species report') . ':</label><input type="submit" class="ui-state-default ui-corner-all" value="' . lang::get('Download') . '">
   </form>
 </div>' . iform_mnhnl_locModTool(parent::$auth, $args, parent::$node);
       $r .= self::getSiteTypeJS(parent::$auth, $args);
       self::communeJS(parent::$auth, $args);
       self::set_code_functionality(parent::$auth, $args, true);
       return $r;
   }