display message when search returns zero rows
[phpmyadmin/dkf.git] / libraries / schema / Export_Relation_Schema.class.php
blob78f11dd302589cf83789455c5756189074f0bc00
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
8 /**
9 * This class is inherited by all schema classes
10 * It contains those methods which are common in them
11 * it works like factory pattern
13 * @name Export Relation Schema
14 * @copyright
15 * @license
18 class PMA_Export_Relation_Schema
20 private $_pageTitle;
21 public $showGrid;
22 public $showColor;
23 public $tableDimension;
24 public $sameWide;
25 public $withDoc;
26 public $showKeys;
27 public $orientation;
28 public $paper;
29 public $pageNumber;
31 /**
32 * Set Page Number
34 * @param integer value Page Number of the document to be created
35 * @return void
36 * @access public
38 public function setPageNumber($value)
40 $this->pageNumber = isset($value) ? $value : 1;
43 /**
44 * Set Show Grid
46 * @param boolean value show grid of the document or not
47 * @return void
48 * @access public
50 public function setShowGrid($value)
52 $this->showGrid = (isset($value) && $value == 'on') ? 1 : 0;
55 public function setShowColor($value)
57 $this->showColor = (isset($value) && $value == 'on') ? 1 : 0;
60 /**
61 * Set Table Dimension
63 * @param boolean value show table co-ordinates or not
64 * @return void
65 * @access public
67 public function setTableDimension($value)
69 $this->tableDimension = (isset($value) && $value == 'on') ? 1 : 0;
72 /**
73 * Set same width of All Tables
75 * @param boolean value set same width of all tables or not
76 * @return void
77 * @access public
79 public function setAllTableSameWidth($value)
81 $this->sameWide = (isset($value) && $value == 'on') ? 1 : 0;
84 /**
85 * Set Data Dictionary
87 * @param boolean value show selected database data dictionary or not
88 * @return void
89 * @access public
91 public function setWithDataDictionary($value)
93 $this->withDoc = (isset($value) && $value == 'on') ? 1 : 0;
96 /**
97 * Set Show only keys
99 * @param boolean value show only keys or not
100 * @return void
101 * @access public
103 public function setShowKeys($value)
105 $this->showKeys = (isset($value) && $value == 'on') ? 1 : 0;
109 * Set Orientation
111 * @param string value Orientation will be portrait or landscape
112 * @return void
113 * @access public
115 public function setOrientation($value)
117 $this->orientation = (isset($value) && $value == 'P') ? 'P' : 'L';
121 * Set type of paper
123 * @param string value paper type can be A4 etc
124 * @return void
125 * @access public
127 public function setPaper($value)
129 $this->paper = isset($value) ? $value : 'A4';
133 * Set title of the page
135 * @param string value title of the page displayed at top of the document
136 * @return void
137 * @access public
139 public function setPageTitle($title)
141 $this->_pageTitle=$title;
145 * Set type of export relational schema
147 * @param string value can be pdf,svg,dia,visio,eps etc
148 * @return void
149 * @access public
151 public function setExportType($value)
153 $this->exportType=$value;
157 * get all tables involved or included in page
159 * @param string db name of the database
160 * @param integer pageNumber page number whose tables will be fetched in an array
161 * @return Array an array of tables
162 * @access public
164 public function getAllTables($db,$pageNumber)
166 global $cfgRelation;
167 // Get All tables
168 $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
169 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
170 . ' AND pdf_page_number = ' . $pageNumber;
172 $tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE);
173 if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) {
174 $this->_die('',__('No tables'));
176 while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) {
177 $alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
179 return $alltables;
183 * Displays an error message
185 * @param integer pageNumber ID of the page choosen
186 * @param string type Schema Type
187 * @param string error_message the error mesage
188 * @global array the PMA configuration array
189 * @global integer the current server id
190 * @global string the current language
191 * @global string the charset to convert to
192 * @global string the current database name
193 * @global string the current charset
194 * @global string the current text direction
195 * @global string a localized string
196 * @global string an other localized string
197 * @access public
198 * @return void
200 function dieSchema($pageNumber, $type = '', $error_message = '')
202 global $cfg;
203 global $server, $lang, $convcharset, $db;
204 global $charset, $text_dir;
206 require_once './libraries/header.inc.php';
207 echo "<p><strong>" . __("SCHEMA ERROR: ") . $type ."</strong></p>" . "\n";
208 if (!empty($error_message)) {
209 $error_message = htmlspecialchars($error_message);
211 echo '<p>' . "\n";
212 echo ' ' . $error_message . "\n";
213 echo '</p>' . "\n";
214 echo '<a href="schema_edit.php?' . PMA_generate_common_url($db).'&do=selectpage&chpage='.$pageNumber.'&action_choose=0'
215 . '">' . __('Back') . '</a>';
216 echo "\n";
217 require_once './libraries/footer.inc.php';
218 exit();