/** * Perform any command line actions for the page * * The business method if this page is called from the commmand line * @param array $request_remainder the remainder of the request after the page specfication. * @param array $args the array of unix style command line arguments * Arguements are link that in: http://us3.php.net/manual/en/features.commandline.php#78651 * If we were called as: * index.php --page=/module/page/some/thing/else --long -AB 2 -C -D 'ostrich' --eggs==good * Then $request_remainder = array('some','thing','else') * and $args = array('long'=>true, 'A'=>true, 'B'=>2, 'C'=>true, 'D'=>'ostrich', 'eggs'=>'good') * @returns boolean. true on success */ public function actionCommandLine($args, $request_remainder) { parent::action(); if ($this->page === 'show') { $this->template->setAttribute("class", "active", "menuCustomReports", "a[@href='CustomReports/view/reportViews']"); return $this->actionShow($this->request_remainder); } else { if ($this->page === 'delete') { return $this->actionDelete(); } elseif ($this->page === 'generate') { if (!$this->actionGenerate(false)) { $msg = "Could not generate report"; I2CE::raiseError($msg); return false; } return true; } elseif ($this->page === 'generate_force') { if (!$this->actionGenerate(true)) { $msg = "Could not generate report"; I2CE::raiseError($msg); return false; } return true; } elseif ($this->page === 'flash_data') { $this->get('flash_data', true); //$this->actionView(); $view = array_shift($this->request_remainder); $displayObj = new I2CE_CustomReport_Display_PieChart($this, $view); $displayObj->display(null); } elseif ($this->page === 'generate_complete') { //generate caches. // This is no longer necessary because each report will cache the required forms // so this is just extra processing. /* $wrangler = new I2CE_Wrangler(); $cachedFormPage = $wrangler->getPage('CachedForms','cacheAll'); if ($cachedFormPage instanceof I2CE_Page) { I2CE::raiseError( "Forcing cache of all forms." ); $cachedFormPage->cacheAll( false ); } */ if (!$this->actionGenerate(true)) { I2CE::raiseError("Could not generate report"); return false; } return true; } } }
/** * Perform any command line actions for the page * * The business method if this page is called from the commmand line * @param array $request_remainder the remainder of the request after the page specfication. * @param array $args the array of unix style command line arguments * @returns boolean. true on success */ public function actionCommandLine($args, $request_remainder) { //parent::actionCommandLine( $args, $request_remainder ); if (count($this->request_remainder) == 0) { $msg = "You need to specify a report view"; $this->userMessage($msg); I2CE::raiseError($msg); return false; } reset($this->request_remainder); $view = current($this->request_remainder); if ($this->page === 'flash_data') { $this->get('flash_data', true); //$this->actionView(); $view = array_shift($this->request_remainder); $displayObj = new I2CE_CustomReport_Display_PieChart($this, $view); $displayObj->display(null); return true; } else { //$this->template->setAttribute( "class", "active", "menuCustomReports", "a[@href='CustomReports/view/reportViews']" ); return $this->actionShow($view); } }