Add OK and Cancel button for grid editing
[phpmyadmin/arisferyanto.git] / libraries / schema / Export_Relation_Schema.class.php
blob7d650f766d8ce4b5864df21a9dd9fbd460e1ac49
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 class PMA_Export_Relation_Schema
15 private $_pageTitle;
16 public $showGrid;
17 public $showColor;
18 public $tableDimension;
19 public $sameWide;
20 public $withDoc;
21 public $showKeys;
22 public $orientation;
23 public $paper;
24 public $pageNumber;
26 /**
27 * Set Page Number
29 * @param integer $value Page Number of the document to be created
31 * @return void
33 * @access public
35 public function setPageNumber($value)
37 $this->pageNumber = isset($value) ? $value : 1;
40 /**
41 * Set Show Grid
43 * @param boolean $value show grid of the document or not
45 * @return void
47 * @access public
49 public function setShowGrid($value)
51 $this->showGrid = (isset($value) && $value == 'on') ? 1 : 0;
54 /**
55 * Sets showColor
57 * @param string $value 'on' to set the the variable
59 * @return nothing
61 public function setShowColor($value)
63 $this->showColor = (isset($value) && $value == 'on') ? 1 : 0;
66 /**
67 * Set Table Dimension
69 * @param boolean $value show table co-ordinates or not
71 * @return void
73 * @access public
75 public function setTableDimension($value)
77 $this->tableDimension = (isset($value) && $value == 'on') ? 1 : 0;
80 /**
81 * Set same width of All Tables
83 * @param boolean $value set same width of all tables or not
85 * @return void
87 * @access public
89 public function setAllTableSameWidth($value)
91 $this->sameWide = (isset($value) && $value == 'on') ? 1 : 0;
94 /**
95 * Set Data Dictionary
97 * @param boolean $value show selected database data dictionary or not
99 * @return void
101 * @access public
103 public function setWithDataDictionary($value)
105 $this->withDoc = (isset($value) && $value == 'on') ? 1 : 0;
109 * Set Show only keys
111 * @param boolean $value show only keys or not
113 * @return void
115 * @access public
117 public function setShowKeys($value)
119 $this->showKeys = (isset($value) && $value == 'on') ? 1 : 0;
123 * Set Orientation
125 * @param string $value Orientation will be portrait or landscape
127 * @return void
129 * @access public
131 public function setOrientation($value)
133 $this->orientation = (isset($value) && $value == 'P') ? 'P' : 'L';
137 * Set type of paper
139 * @param string $value paper type can be A4 etc
141 * @return void
143 * @access public
145 public function setPaper($value)
147 $this->paper = isset($value) ? $value : 'A4';
151 * Set title of the page
153 * @param string $title title of the page displayed at top of the document
155 * @return void
157 * @access public
159 public function setPageTitle($title)
161 $this->_pageTitle=$title;
165 * Set type of export relational schema
167 * @param string $value can be pdf,svg,dia,visio,eps etc
169 * @return void
171 * @access public
173 public function setExportType($value)
175 $this->exportType=$value;
179 * get all tables involved or included in page
181 * @param string $db name of the database
182 * @param integer $pageNumber page no. whose tables will be fetched in an array
184 * @return Array an array of tables
186 * @access public
188 public function getAllTables($db, $pageNumber)
190 global $cfgRelation;
191 // Get All tables
192 $tab_sql = 'SELECT table_name FROM '
193 . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
194 . PMA_backquote($cfgRelation['table_coords'])
195 . ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
196 . ' AND pdf_page_number = ' . $pageNumber;
198 $tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE);
199 if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) {
200 $this->dieSchema('', __('This page does not contain any tables!'));
202 while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) {
203 $alltables[] = PMA_sqlAddSlashes($curr_table['table_name']);
205 return $alltables;
209 * Displays an error message
211 * @param integer $pageNumber ID of the chosen page
212 * @param string $type Schema Type
213 * @param string $error_message The error mesage
215 * @global array the PMA configuration array
216 * @global string the current database name
218 * @access public
220 * @return void
222 function dieSchema($pageNumber, $type = '', $error_message = '')
224 global $cfg;
225 global $db;
227 include_once './libraries/header.inc.php';
228 echo "<p><strong>" . __("SCHEMA ERROR: ") . $type . "</strong></p>" . "\n";
229 if (!empty($error_message)) {
230 $error_message = htmlspecialchars($error_message);
232 echo '<p>' . "\n";
233 echo ' ' . $error_message . "\n";
234 echo '</p>' . "\n";
235 echo '<a href="schema_edit.php?' . PMA_generate_common_url($db)
236 . '&do=selectpage&chpage=' . $pageNumber . '&action_choose=0'
237 . '">' . __('Back') . '</a>';
238 echo "\n";
239 include_once './libraries/footer.inc.php';
240 exit();