コード例 #1
0
 /**
  * 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)
 {
     // Future enhancement? manager user access right who can see all walks by all people, with a person filter drop down.
     // Future enhancement? Download list of surveys used as basis for calendar
     global $user;
     $logged_in = $user->uid > 0;
     if (!$logged_in) {
         return '<p>' . lang::get('Please log in before attempting to use this form.') . '</p>';
     }
     // can't really do this automatically: better to give warning
     if (isset($args['locationTypeFilter'])) {
         return '<p>' . lang::get('Please contact the site administrator. This version of the form uses a different method of specifying the location types.') . '</p>';
     }
     iform_load_helpers(array('report_helper'));
     $auth = report_helper::get_read_auth($args['website_id'], $args['password']);
     $grid = self::location_type_control($args, $auth, $node) . (isset($args['includeLocationFilter']) && $args['includeLocationFilter'] ? self::location_control($args, $auth, $node) : '');
     /* survey_id should be set in param_presets $args entry.  */
     $reportOptions = self::get_report_calendar_options($args, $auth);
     // get the grid output before outputting the download link, so we can check if the download link is needed.
     $reportOptions['id'] = 'calendar-grid-' . $node->nid;
     if (isset($_GET['year'])) {
         $reportOptions['year'] = $_GET['year'];
         $reportOptions['viewPreviousIfTooEarly'] = false;
     }
     $reportOptions['weekstart'] = $args['weekstart'];
     $reportOptions['includeWeekNumber'] = isset($args['includeWeekNumber']) && $args['includeWeekNumber'] == true;
     if (isset($args['weekOneContains'])) {
         $reportOptions['weekOneContains'] = $args['weekOneContains'];
     }
     if (isset($args['weekNumberFilter'])) {
         $reportOptions['weekNumberFilter'] = $args['weekNumberFilter'];
     }
     $reportOptions['buildLinkFunc'] = array('iform_report_calendar_grid', 'build_link');
     $siteUrlParams = self::get_site_url_params();
     $extensions = array($siteUrlParams[self::$URLExtensionKey]['value']);
     $reportOptions['existingURL'] = self::get_url($args['existingURL'], $extensions);
     if ($siteUrlParams[self::$locationKey]['value'] != null) {
         $reportOptions['siteIDFilter'] = $siteUrlParams[self::$locationKey]['value'];
         // this gets passed through to buildLinkFunc Callback
         $extensions[] = '&' . $args['newURLLocationParam'] . '=' . $siteUrlParams[self::$locationKey]['value'];
     } else {
         if ($siteUrlParams[self::$locationTypeKey]['value'] != null) {
             $extensions[] = '&' . $args['newURLLocationTypeParam'] . '=' . $siteUrlParams[self::$locationTypeKey]['value'];
         }
     }
     $reportOptions['newURL'] = self::get_url($args['newURL'], $extensions);
     if (isset($args['footer'])) {
         $reportOptions['footer'] = $args['footer'];
     }
     if (isset($args['first_year']) && $args['first_year'] != '') {
         $reportOptions['first_year'] = $args['first_year'];
     }
     $grid .= report_helper::report_calendar_grid($reportOptions);
     return $grid;
 }
コード例 #2
0
 /**
  * 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)
 {
     // Future enhancement? manager user access right who can see all walks by all people, with a person filter drop down.
     // Future enhancement? Download list of surveys used as basis for calendar
     // Future Enhancement? Restrict to location_type_id
     global $user;
     $logged_in = $user->uid > 0;
     if (!$logged_in) {
         return '<p>' . lang::get('Please log in before attempting to use this form.') . '</p>';
     }
     iform_load_helpers(array('report_helper'));
     $auth = report_helper::get_read_auth($args['website_id'], $args['password']);
     /* survey_id should be set in param_presets $args entry. This is then fetched by iform_report_get_report_options */
     $reportOptions = self::get_report_calendar_options($args, $auth);
     // get the grid output before outputting the download link, so we can check if the download link is needed.
     $reportOptions['id'] = 'calendar-grid-' . $node->nid;
     if (isset($_GET['year'])) {
         $reportOptions['year'] = $_GET['year'];
         $reportOptions['viewPreviousIfTooEarly'] = false;
     }
     $reportOptions['weekstart'] = $args['weekstart'];
     $reportOptions['includeWeekNumber'] = isset($args['includeWeekNumber']) && $args['includeWeekNumber'] == true;
     if (isset($args['weekOneContains'])) {
         $reportOptions['weekOneContains'] = $args['weekOneContains'];
     }
     if (isset($args['weekNumberFilter'])) {
         $reportOptions['weekNumberFilter'] = $args['weekNumberFilter'];
     }
     $reportOptions['newURL'] = $args['newURL'];
     $reportOptions['existingURL'] = $args['existingURL'];
     $reportOptions['buildLinkFunc'] = array('iform_report_calendar_grid', 'build_link');
     if (isset($_GET['location_id'])) {
         $reportOptions['siteIDFilter'] = $_GET['location_id'];
         // this gets passed through to buildLinkFunc Callback
         $reportOptions['newURL'] .= (strpos($reportOptions['newURL'], '?') === false ? '?' : '&') . $args['newURLLocationParam'] . '=' . $_GET['location_id'];
     }
     // note that we want to see samples entered on other days, so do not want to filter by the location_id.
     $grid = (isset($args['includeLocationFilter']) && $args['includeLocationFilter'] ? self::location_control($args, $auth, $node) : '') . report_helper::report_calendar_grid($reportOptions);
     return $grid;
 }