Translation update done using Pootle.
[phpmyadmin/dkf.git] / libraries / schema / Export_Relation_Schema.class.php
blob87f80ba730248273157bdfbf4af0318d1ae5c232
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
9 /**
10 * This class is inherited by all schema classes
11 * It contains those methods which are common in them
12 * it works like factory pattern
14 * @name Export Relation Schema
15 * @copyright
16 * @license
19 class PMA_Export_Relation_Schema
21 private $_pageTitle;
22 public $showGrid;
23 public $showColor;
24 public $tableDimension;
25 public $sameWide;
26 public $withDoc;
27 public $showKeys;
28 public $orientation;
29 public $paper;
30 public $pageNumber;
32 /**
33 * Set Page Number
35 * @param integer value Page Number of the document to be created
36 * @return void
37 * @access public
39 public function setPageNumber($value)
41 $this->pageNumber = isset($value) ? $value : 1;
44 /**
45 * Set Show Grid
47 * @param boolean value show grid of the document or not
48 * @return void
49 * @access public
51 public function setShowGrid($value)
53 $this->showGrid = (isset($value) && $value == 'on') ? 1 : 0;
56 public function setShowColor($value)
58 $this->showColor = (isset($value) && $value == 'on') ? 1 : 0;
61 /**
62 * Set Table Dimension
64 * @param boolean value show table co-ordinates or not
65 * @return void
66 * @access public
68 public function setTableDimension($value)
70 $this->tableDimension = (isset($value) && $value == 'on') ? 1 : 0;
73 /**
74 * Set same width of All Tables
76 * @param boolean value set same width of all tables or not
77 * @return void
78 * @access public
80 public function setAllTableSameWidth($value)
82 $this->sameWide = (isset($value) && $value == 'on') ? 1 : 0;
85 /**
86 * Set Data Dictionary
88 * @param boolean value show selected database data dictionary or not
89 * @return void
90 * @access public
92 public function setWithDataDictionary($value)
94 $this->withDoc = (isset($value) && $value == 'on') ? 1 : 0;
97 /**
98 * Set Show only keys
100 * @param boolean value show only keys or not
101 * @return void
102 * @access public
104 public function setShowKeys($value)
106 $this->showKeys = (isset($value) && $value == 'on') ? 1 : 0;
110 * Set Orientation
112 * @param string value Orientation will be portrait or landscape
113 * @return void
114 * @access public
116 public function setOrientation($value)
118 $this->orientation = (isset($value) && $value == 'P') ? 'P' : 'L';
122 * Set type of paper
124 * @param string value paper type can be A4 etc
125 * @return void
126 * @access public
128 public function setPaper($value)
130 $this->paper = isset($value) ? $value : 'A4';
134 * Set title of the page
136 * @param string value title of the page displayed at top of the document
137 * @return void
138 * @access public
140 public function setPageTitle($title)
142 $this->_pageTitle=$title;
146 * Set type of export relational schema
148 * @param string value can be pdf,svg,dia,visio,eps etc
149 * @return void
150 * @access public
152 public function setExportType($value)
154 $this->exportType=$value;
158 * get all tables involved or included in page
160 * @param string db name of the database
161 * @param integer pageNumber page number whose tables will be fetched in an array
162 * @return Array an array of tables
163 * @access public
165 public function getAllTables($db,$pageNumber)
167 global $cfgRelation;
168 // Get All tables
169 $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
170 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
171 . ' AND pdf_page_number = ' . $pageNumber;
173 $tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE);
174 if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) {
175 $this->_die('',__('No tables'));
177 while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) {
178 $alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
180 return $alltables;
184 * Displays an error message
186 * @param integer pageNumber ID of the page choosen
187 * @param string type Schema Type
188 * @param string error_message the error mesage
189 * @global array the PMA configuration array
190 * @global integer the current server id
191 * @global string the current language
192 * @global string the charset to convert to
193 * @global string the current database name
194 * @global string the current charset
195 * @global string the current text direction
196 * @global string a localized string
197 * @global string an other localized string
198 * @access public
199 * @return void
201 function dieSchema($pageNumber, $type = '', $error_message = '')
203 global $cfg;
204 global $server, $lang, $convcharset, $db;
205 global $charset, $text_dir;
207 require_once './libraries/header.inc.php';
208 echo "<p><strong>" . __("SCHEMA ERROR: ") . $type ."</strong></p>" . "\n";
209 if (!empty($error_message)) {
210 $error_message = htmlspecialchars($error_message);
212 echo '<p>' . "\n";
213 echo ' ' . $error_message . "\n";
214 echo '</p>' . "\n";
215 echo '<a href="schema_edit.php?' . PMA_generate_common_url($db).'&do=selectpage&chpage='.$pageNumber.'&action_choose=0'
216 . '">' . __('Back') . '</a>';
217 echo "\n";
218 require_once './libraries/footer.inc.php';
219 exit();