2 /* vim: set expandtab sw=4 ts=4 sts=4: */
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
18 class PMA_Export_Relation_Schema
23 public $tableDimension;
34 * @param integer value Page Number of the document to be created
38 public function setPageNumber($value)
40 $this->pageNumber
= isset($value) ?
$value : 1;
46 * @param boolean value show grid of the document or not
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;
63 * @param boolean value show table co-ordinates or not
67 public function setTableDimension($value)
69 $this->tableDimension
= (isset($value) && $value == 'on') ?
1 : 0;
73 * Set same width of All Tables
75 * @param boolean value set same width of all tables or not
79 public function setAllTableSameWidth($value)
81 $this->sameWide
= (isset($value) && $value == 'on') ?
1 : 0;
87 * @param boolean value show selected database data dictionary or not
91 public function setWithDataDictionary($value)
93 $this->withDoc
= (isset($value) && $value == 'on') ?
1 : 0;
99 * @param boolean value show only keys or not
103 public function setShowKeys($value)
105 $this->showKeys
= (isset($value) && $value == 'on') ?
1 : 0;
111 * @param string value Orientation will be portrait or landscape
115 public function setOrientation($value)
117 $this->orientation
= (isset($value) && $value == 'P') ?
'P' : 'L';
123 * @param string value paper type can be A4 etc
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
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
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
164 public function getAllTables($db,$pageNumber)
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']);
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
200 function dieSchema($pageNumber, $type = '', $error_message = '')
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);
212 echo ' ' . $error_message . "\n";
214 echo '<a href="schema_edit.php?' . PMA_generate_common_url($db).'&do=selectpage&chpage='.$pageNumber.'&action_choose=0'
215 . '">' . __('Back') . '</a>';
217 require_once './libraries/footer.inc.php';