protected function displayExistingReports($contentNode, $transientOptions, $action) { $categories = $this->getReportsByCategory(); //now display the reports by category $catsNode = $this->template->appendFileById('customReports_reports_categories.html', 'div', 'existing_reports', false, $contentNode); if (!$catsNode instanceof DOMNode) { I2CE::raiseError("Could not add report categories template"); return false; } foreach ($categories as $cat => $reports) { $catNode = $this->template->appendFileById('customReports_reports_category.html', 'div', 'existing_reports_categories', false, $catsNode); if (!$catNode instanceof DOMNode) { I2CE::raiseError("Could not add report category template"); return false; } if (strlen($cat) == 0) { $cat = 'Uncategorized'; } $this->template->setDisplayDataImmediate('report_category', $cat, $catNode); foreach ($reports as $shortname) { $swissReport = $this->getChild($shortname); if (!$swissReport instanceof I2CE_Swiss_CustomReports_Report) { continue; } $name = $swissReport->getDisplayName(); $desc = $swissReport->getDescription(); if (!$name) { $name = $shortname; } $repNode = $this->template->appendFileById('customReports_reports_category_report.html', 'li', 'existing_reports_category', false, $catNode); if (!$repNode instanceof DOMNode) { I2CE::raiseError("Could not add report category template"); return false; } $reportStatus = I2CE_CustomReport::getStatus($shortname); if ($reportStatus == 'generated') { $reportLastGenerated = strftime("%c", I2CE_CustomReport::getLastGenerationTime($shortname)); } else { $reportLastGenerated = ''; } $reportHoomanStatus = I2CE_CustomReport::getStatus($shortname, true); $this->template->setDisplayDataImmediate('report_edit_link', $this->getURLRoot($action) . '/' . $shortname, $repNode); $this->template->setDisplayDataImmediate('report_save_link', $this->getURLRoot('export') . '/../' . $shortname . '?pipe=2', $repNode); $this->template->setDisplayDataImmediate('report_delete_link', $this->getURLRoot('delete') . '/../' . $shortname, $repNode); $this->template->setDisplayDataImmediate('report_generate_link', $this->getURLRoot('generate') . '/../' . $shortname, $repNode); $this->template->setDisplayDataImmediate('report_generate_force_link', $this->getURLRoot('generate_force') . '/../' . $shortname, $repNode); $this->template->setDisplayDataImmediate('report_name', $name, $repNode); $this->template->setDisplayDataImmediate('report_description', $desc, $repNode); $this->template->setDisplayDataImmediate('report_status', $reportHoomanStatus, $repNode); $this->template->setDisplayDataImmediate('report_last_generated', $reportLastGenerated, $repNode); } } return true; }
protected function displayMetaInfo($contentNode) { if (!$this->template instanceof I2CE_Template) { //this is not a web page -- maybe its xml i.e. only an instanceof I2CE_TemplateMeister I2CE::raiseError("Unexpected template type " . get_class($this->template)); return false; } $form = $this->template->query(".//*[@id='limit_form']", $contentNode); if ($form->length == 1) { //$form = $form->item(0)->setAttribute('action',$this->getBasePage() . "/show/{$this->view}/{$this->display}"); // The above was causing problems with having /show/show in the URL so I took it out. $form = $form->item(0)->setAttribute('action', $this->getBasePage() . "/{$this->view}/{$this->display}"); } else { I2CE::raiseError("Could not form node"); return false; } $formWormOptions = array('optionsMenuPositionVert' => 'mouse_above'); $this->template->addFormWorm('limit_form', $formWormOptions); $fileSearch = I2CE::getFileSearch(); if ($fileSearch->search('CSS', "customReports_display.css")) { $this->template->addHeaderLink("customReports_display.css"); } if ($fileSearch->search('CSS', "customReports_display_{$this->display}.css")) { $this->template->addHeaderLink("customReports_display_{$this->display}.css"); } $this->template->setDisplayDataImmediate('report_view_display_name', $this->config->display_name, $contentNode); $this->template->setDisplayDataImmediate('report_view_description', $this->config->description, $contentNode); $this->template->setDisplayDataImmediate('limit_paginated', $this->defaultOptions['limit_paginated'], $contentNode); $this->template->setDisplayDataImmediate('limit_page', $this->defaultOptions['limit_page'], $contentNode); $this->template->setDisplayDataImmediate('limit_per_page', $this->defaultOptions['limit_per_page'], $contentNode); $this->template->setDisplayDataImmediate('limit_offset', $this->defaultOptions['limit_offset'], $contentNode); $this->template->setDisplayDataImmediate('limit_amount', $this->defaultOptions['limit_amount'], $contentNode); $this->template->setDisplayDataImmediate('sort_order', $this->defaultOptions['sort_order'], $contentNode); $time = I2CE_CustomReport::getLastGenerationTime($this->config->report); if ($time) { $cache_msg = "Report was generated at: " . strftime("%c", $time); } else { $cache_msg = "Report has not been generated"; } $this->template->setDisplayDataImmediate('report_time', $cache_msg); $has_relations = ''; if ($this->config->setIfIsSet($related_views, 'related_views')) { $related_views = explode(',', $related_views); $related = array(); foreach ($related_views as $related_view) { if (!I2CE_MagicDataNode::checkKey($related_view)) { continue; } if (!$this->config->is_parent("../{$related_view}")) { continue; } $view_name = $related_view; $this->config->setIfIsSet($view_name, "../{$related_view}/display_name"); $disabled = false; $this->config->setIfIsSet($disabled, "../{$related_view}/disable"); if ($disabled) { continue; } $related[$related_view] = $view_name; } if (count($related) > 0 && ($node = $this->template->getElementById('related_views_list', $contentNode)) instanceof DOMNode) { $has_relations = 1; foreach ($related as $related_view => $view_name) { $liNode = $this->template->createElement('li'); $linkNode = $this->template->createElement('a', array('href' => "CustomReports/show/{$related_view}"), $view_name); $liNode->appendChild($linkNode); $node->appendChild($liNode); } } } $this->template->setDisplayDataImmediate('related_views', $has_relations, $contentNode); return true; }