/** * Returns the content of the the pager object */ public function get($return_blank_results = true) { $template = array(); if (empty($this->display_rows)) { $result = $this->initialize(); if (PHPWS_Error::isError($result)) { throw new \Exception($result->toString()); return $result; } } // Report ends the function call if ($this->report_type && $this->report_row) { $this->createReport(); exit; } if (!isset($this->module)) { return PHPWS_Error::get(DBPAGER_MODULE_NOT_SET, 'core', 'DBPager::get'); } if (!isset($this->template)) { return PHPWS_Error::get(DBPAGER_TEMPLATE_NOT_SET, 'core', 'DBPager::get'); } $rows = $this->getPageRows(); if (PHPWS_Error::isError($rows)) { throw new Exception($rows); return $rows; } if (isset($this->toggles)) { $max_tog = count($this->toggles); } $count = 0; $this->getNavigation($template); $this->getSortButtons($template); if (isset($rows)) { foreach ($rows as $rowitem) { if (isset($max_tog)) { if ($max_tog == 1) { if ($count % 2) { $rowitem['TOGGLE'] = $this->toggles[0]; } else { $rowitem['TOGGLE'] = null; } $count++; } else { $rowitem['TOGGLE'] = $this->toggles[$count]; $count++; if ($count >= $max_tog) { $count = 0; } } } else { $rowitem['TOGGLE'] = null; } $template['listrows'][] = $rowitem; } } elseif (!$return_blank_results) { return null; } else { $template['EMPTY_MESSAGE'] = $this->empty_message; } DBPager::plugPageTags($template); $this->final_template =& $template; return PHPWS_Template::process($template, $this->module, $this->template); }