* Copyright (c) 2002-2006 Platon Group, http://platon.sk/ * All rights reserved. * * See README file for more information about this software. * See COPYING file for license information. * * Download the latest version from * http://platon.sk/projects/phpMyEdit/ */ /* $Platon: phpMyEdit/extensions/phpMyEdit-report.class.php,v 1.11 2004/12/30 19:59:00 nepto Exp $ */ /* Extension TODO: - allow user to enable/disable particular field in reporting (maybe 'X' flag for indicating that field is forbidden is good idea) - support for ['help'] in select fields screen - make extension's option for selecting "Select fields" link or button */ require_once dirname(__FILE__).'/../phpMyEdit.class.php'; class phpMyEdit_report extends phpMyEdit { function phpMyEdit_report($opts) /* {{{ */ { $opts['options'] = 'L'; $execute = 1; isset($opts['execute']) && $execute = $opts['execute']; $opts['execute'] = 0; parent::phpMyEdit($opts); $execute && $this->execute(); } /* }}} */ function make_language_labels($language) /* {{{ */ { $ret = parent::make_language_labels($language); strlen($ret['Make report']) <= 0 && $ret['Make report'] = 'Make report'; strlen($ret['Select fields']) <= 0 && $ret['Select fields'] = 'Select fields'; strlen($ret['Records per screen']) <= 0 && $ret['Records per screen'] = 'Records per screen'; return $ret; } /* }}} */ function get_cgi_cookie_var($name, $default_value = null) /* {{{ */ { $ret = $this->get_cgi_var($name, null); if ($ret === null) { global $HTTP_COOKIE_VARS; $ret = @$HTTP_COOKIE_VARS[$name.'_'.$this->tb.'_cookie']; if (! isset($ret)) { $ret = $default_value; } } return $ret; } /* }}} */ function display_list_table_buttons($total_recs, $position) /* {{{ */ { /* This is mostly copy/paste from core class. */ $listall = $this->inc <= 0; // Are we doing a listall? echo '
| ',"\n"; echo ' '; // Note that fm > 0 && ! $listall) ? '' : ' disabled'; echo ' '; $disabled = ($this->fm + $this->inc < $total_recs && ! $listall) ? '' : ' disabled'; echo ''; // Message is now written here echo ' | ',"\n"; if (strlen(@$this->message) > 0) { echo '',"\n"; } // Display page and records statistics echo '',"\n"; if ($listall) { echo $this->labels['Page'],': 1 ',$this->labels['of'],' 1'; } else { echo $this->labels['Page'],': ',($this->fm / $this->inc) + 1; echo ' ',$this->labels['of'],' ',max(1, ceil($total_recs / abs($this->inc))); } echo ' ',$this->labels['Records'],': ',$total_recs; echo ' |
| ',"\n"; echo '',"\n"; echo ' |