Example #1
0
 /**
  * This function will process the user defined pages
  * and tables which will be exported as Relational schema
  * you can set the table positions on the paper via scratchboard
  * for table positions, put the x,y co-ordinates
  *
  * $this->action tells what the Schema is supposed to do
  * create and select a page, generate schema etc
  *
  * @access public
  * @return void
  */
 public function processUserChoice()
 {
     global $action_choose, $db, $cfgRelation;
     if (isset($this->action)) {
         switch ($this->action) {
             case 'selectpage':
                 $this->chosenPage = $_REQUEST['chpage'];
                 if ($action_choose == "1") {
                     $this->deleteCoordinates($db, $cfgRelation, $this->chosenPage);
                     $this->deletePages($db, $cfgRelation, $this->chosenPage);
                     $this->chosenPage = 0;
                 }
                 break;
             case 'createpage':
                 $this->pageNumber = PMA_REL_create_page($_POST['newpage'], $cfgRelation, $db);
                 $this->autoLayoutForeign = isset($_POST['auto_layout_foreign']) ? "1" : null;
                 $this->autoLayoutInternal = isset($_POST['auto_layout_internal']) ? "1" : null;
                 $this->processRelations($db, $this->pageNumber, $cfgRelation);
                 break;
             case 'edcoord':
                 $this->chosenPage = $_POST['chpage'];
                 $this->c_table_rows = $_POST['c_table_rows'];
                 $this->_editCoordinates($db, $cfgRelation);
                 break;
             case 'delete_old_references':
                 $this->_deleteTableRows($_POST['delrow'], $cfgRelation, $db, $_POST['chpage']);
                 break;
             case 'process_export':
                 $this->_processExportSchema();
                 break;
         }
         // end switch
     }
     // end if (isset($do))
 }
Example #2
0
    $no_die_save_pos = 1;
    include_once 'pmd_save_pos.php';
}
if (isset($mode)) {
    if ('create_export' != $mode && empty($pdf_page_number)) {
        die("<script>alert('Pages not found!');history.go(-2);</script>");
    }
    $pmd_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']);
    $pma_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']);
    $scale_q = PMA_sqlAddslashes($scale);
    if ('create_export' == $mode) {
        /*
         * @see pdf_pages.php
         */
        $query_default_option = PMA_DBI_QUERY_STORE;
        $pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option);
        if ($pdf_page_number > 0) {
            $message = PMA_Message::success(__('Page has been created'));
            $mode = 'export';
        } else {
            $message = PMA_Message::error(__('Page creation failed'));
        }
    }
    $pdf_page_number_q = PMA_sqlAddslashes($pdf_page_number);
    if ('export' == $mode) {
        $sql = "REPLACE INTO " . $pma_table . " (db_name, table_name, pdf_page_number, x, y) SELECT db_name, table_name, " . $pdf_page_number_q . ", ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y FROM " . $pmd_table . " WHERE db_name = '" . PMA_sqlAddslashes($db) . "'";
        PMA_query_as_controluser($sql, TRUE, PMA_DBI_QUERY_STORE);
    }
    if ('import' == $mode) {
        PMA_query_as_controluser('UPDATE ' . $pma_table . ',' . $pmd_table . ' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * ' . $scale_q . ',
        ' . $pmd_table . '.`y`= ' . $pma_table . '.`y` * ' . $scale_q . '
Example #3
0
if (! isset($scale)) {
    $no_die_save_pos = 1;
    include_once 'pmd_save_pos.php';
}

if (isset($mode)) {
    if ('create_export' != $mode && empty($pdf_page_number)) {
        die("<script>alert('Pages not found!');history.go(-2);</script>");
    }

    $pmd_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']);
    $pma_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']);
    $scale_q = PMA_sqlAddSlashes($scale);

    if ('create_export' == $mode) {
        $pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db);
        if ($pdf_page_number > 0) {
            $message = PMA_Message::success(__('Page has been created'));
            $mode = 'export';
        } else {
            $message = PMA_Message::error(__('Page creation failed'));
        }
    }

    $pdf_page_number_q = PMA_sqlAddSlashes($pdf_page_number);

    if ('export' == $mode) {
        $sql = "REPLACE INTO " . $pma_table . " (db_name, table_name, pdf_page_number, x, y) SELECT db_name, table_name, " . $pdf_page_number_q . ", ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y FROM " . $pmd_table . " WHERE db_name = '" . PMA_sqlAddSlashes($db) . "'";

        PMA_query_as_controluser($sql, true, PMA_DBI_QUERY_STORE);
    }