Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026

Diff for phpMyEdit/phpMyEdit.class.php between version 1.206 and 1.207

version 1.206, 2007/09/22 13:24:30 version 1.207, 2007/09/22 13:52:49
Line 19 
Line 19 
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.204 2007-09-16 12:57:07 nepto Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.206 2007-09-22 13:24:30 michal Exp $ */
   
 /*  This is a generic table editing program. The table and fields to be  /*  This is a generic table editing program. The table and fields to be
         edited are defined in the calling program.          edited are defined in the calling program.
Line 539  class phpMyEdit
Line 539  class phpMyEdit
                 return $ret;                  return $ret;
         } /* }}} */          } /* }}} */
   
           function get_SQL_main_list_query_parts() /* {{{ */
           {
                   /*
                    * Prepare the SQL Query from the data definition file
                    */
                   $qparts['type']   = 'select';
                   $qparts['select'] = $this->get_SQL_column_list();
                   // Even if the key field isn't displayed, we still need its value
                   if ($select_recs) {
                           if (!in_array ($this->key, $this->fds)) {
                                   $qparts['select'] .= ','.$this->fqn($this->key);
                           }
                   }
                   $qparts['from']  = $this->get_SQL_join_clause();
                   $qparts['where'] = $this->get_SQL_where_from_query_opts();
                   // build up the ORDER BY clause
                   if (isset($this->sfn)) {
                           $sort_fields   = array();
                           $sort_fields_w = array();
                           foreach ($this->sfn as $field) {
                                   if ($field[0] == '-') {
                                           $field = substr($field, 1);
                                           $desc  = true;
                                   } else {
                                           $field = $field;
                                           $desc  = false;
                                   }
                                   $sort_field   = $this->fqn($field);
                                   $sort_field_w = $this->fdd[$field]['name'];
                                   $this->col_has_sql($field) && $sort_field_w .= ' (sql)';
                                   if ($desc) {
                                           $sort_field   .= ' DESC';
                                           $sort_field_w .= ' '.$this->labels['descending'];
                                   } else {
                                           $sort_field_w .= ' '.$this->labels['ascending'];
                                   }
                                   $sort_fields[]   = $sort_field;
                                   $sort_fields_w[] = $sort_field_w;
                           }
                           if (count($sort_fields) > 0) {
                                   $qparts['orderby'] = join(',', $sort_fields);
                           }
                   }
                   $qparts['limit'] = $listall ? '' : $this->sql_limit($this->fm,$this->inc);
                   $this->sort_fields_w = $sort_fields_w;
                   return $qparts;
           } /* }}} */
   
   
         function get_SQL_main_list_query($qparts) /* {{{ */          function get_SQL_main_list_query($qparts) /* {{{ */
         {          {
                 return $this->get_SQL_query($qparts);                  return $this->get_SQL_query($qparts);
Line 2018  function '.$this->js['prefix'].'filter_h
Line 2067  function '.$this->js['prefix'].'filter_h
                 $this->total_recs = $row[0];                  $this->total_recs = $row[0];
         } /* }}} */          } /* }}} */
   
         function filter_heading($sys_cols) /* {{{ */          function filter_heading() /* {{{ */
         {          {
         /* FILTER {{{          /* FILTER {{{
          *           *
Line 2049  function '.$this->js['prefix'].'filter_h
Line 2098  function '.$this->js['prefix'].'filter_h
         //if ($fields != false) {          //if ($fields != false) {
                 $css_class_name = $this->getCSSclass('filter');                  $css_class_name = $this->getCSSclass('filter');
                 echo '<tr class="',$css_class_name,'">',"\n";                  echo '<tr class="',$css_class_name,'">',"\n";
                 echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">';                  echo '<td class="',$css_class_name,'" colspan="',$this->sys_cols,'">';
                 echo $this->htmlSubmit('filter', 'Query', $this->getCSSclass('query'), false);                  echo $this->htmlSubmit('filter', 'Query', $this->getCSSclass('query'), false);
                 echo '</td>', "\n";                  echo '</td>', "\n";
                 for ($k = 0; $k < $this->num_fds; $k++) {                  for ($k = 0; $k < $this->num_fds; $k++) {
Line 2114  function '.$this->js['prefix'].'filter_h
Line 2163  function '.$this->js['prefix'].'filter_h
                 echo '</tr>',"\n";                  echo '</tr>',"\n";
                 //}                  //}
         } /* }}} */          } /* }}} */
           function display_sorting_sequence() /* {{{ */
           {
                   /*
                    * Display sorting sequence
                   */
                   $css_class_name = $this->getCSSclass('sortinfo');
                   echo '<tr class="',$css_class_name,'">',"\n";
                   echo '<td class="',$css_class_name,'" colspan="',$this->sys_cols,'">';
                   echo '<a class="',$css_class_name,'" href="';
                   echo htmlspecialchars($this->page_name
                                   .'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl
                                   .'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm
                                   .'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn)
                                   .$this->qfn.$this->cgi['persist']);
                   echo '">',$this->labels['Clear'],'</a></td>',"\n";
                   echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">';
                   echo $this->labels['Sorted By'],': ',join(', ', $this->sort_fields_w),'</td></tr>',"\n";
           } /* }}} */
   
           function display_current_query() /* {{{ */
           {
                   /*
                    * Display the current query
                    */
                   $text_query = $this->get_SQL_where_from_query_opts(null, true);
                   if ($text_query != '') {
                           $css_class_name = $this->getCSSclass('queryinfo');
                           echo '<tr class="',$css_class_name,'">',"\n";
                           echo '<td class="',$css_class_name,'" colspan="',$this->sys_cols,'">';
                           echo '<a class="',$css_class_name,'" href="';
                           echo htmlspecialchars($this->get_server_var('PHP_SELF')
                                           .'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl
                                           .'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm
                                           .'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn)
                                           .'&'.$this->get_sfn_cgi_vars().$this->cgi['persist']);
                           echo '">',$this->labels['Clear'],'</a></td>',"\n";
                           echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">';
                           echo $this->labels['Current Query'],': ',htmlspecialchars($text_query),'</td></tr>',"\n";
                   }
           } /* }}} */
   
         /*          /*
          * Table Page Listing           * Table Page Listing
          */           */
Line 2177  function '.$this->js['prefix'].'filter_h
Line 2267  function '.$this->js['prefix'].'filter_h
                 /*                  /*
                  * System (navigation, selection) columns counting                   * System (navigation, selection) columns counting
                  */                   */
                 $sys_cols  = 0;                  $this->sys_cols  = 0;
                 $sys_cols += intval($this->filter_enabled() || $select_recs);                  $this->sys_cols += intval($this->filter_enabled() || $select_recs);
                 if ($sys_cols > 0) {                  if ($this->sys_cols > 0) {
                         $sys_cols += intval($this->nav_buttons()                          $this->sys_cols += intval($this->nav_buttons()
                                         && ($this->nav_text_links() || $this->nav_graphic_links()));                                          && ($this->nav_text_links() || $this->nav_graphic_links()));
                 }                  }
                 /*                  /*
                  * We need an initial column(s) (sys columns)                   * We need an initial column(s) (sys columns)
                  * if we have filters, Changes or Deletes enabled                   * if we have filters, Changes or Deletes enabled
                  */                   */
                 if ($sys_cols) {                  if ($this->sys_cols) {
                         echo '<th class="',$this->getCSSclass('header'),'" colspan="',$sys_cols,'">';                          echo '<th class="',$this->getCSSclass('header'),'" colspan="',$this->sys_cols,'">';
                         if ($this->filter_enabled()) {                          if ($this->filter_enabled()) {
                                 if ($this->filter_operation()) {                                  if ($this->filter_operation()) {
                                         echo $this->htmlSubmit('sw', 'Hide', $this->getCSSclass('hide'), false);                                          echo $this->htmlSubmit('sw', 'Hide', $this->getCSSclass('hide'), false);
Line 2225  function '.$this->js['prefix'].'filter_h
Line 2315  function '.$this->js['prefix'].'filter_h
                         }                          }
                 }                  }
                 echo '</tr>',"\n";                  echo '</tr>',"\n";
   
                 /*  
                  * Prepare the SQL Query from the data definition file  
                  */  
                 $qparts['type']   = 'select';  
                 $qparts['select'] = $this->get_SQL_column_list();  
                 // Even if the key field isn't displayed, we still need its value  
                 if ($select_recs) {  
                         if (!in_array ($this->key, $this->fds)) {  
                                 $qparts['select'] .= ','.$this->fqn($this->key);  
                         }  
                 }  
                 $qparts['from']  = $this->get_SQL_join_clause();  
                 $qparts['where'] = $this->get_SQL_where_from_query_opts();  
                 // build up the ORDER BY clause  
                 if (isset($this->sfn)) {  
                         $sort_fields   = array();  
                         $sort_fields_w = array();  
                         foreach ($this->sfn as $field) {  
                                 if ($field[0] == '-') {  
                                         $field = substr($field, 1);  
                                         $desc  = true;  
                                 } else {  
                                         $field = $field;  
                                         $desc  = false;  
                                 }  
                                 $sort_field   = $this->fqn($field);  
                                 $sort_field_w = $this->fdd[$field]['name'];  
                                 $this->col_has_sql($field) && $sort_field_w .= ' (sql)';  
                                 if ($desc) {  
                                         $sort_field   .= ' DESC';  
                                         $sort_field_w .= ' '.$this->labels['descending'];  
                                 } else {  
                                         $sort_field_w .= ' '.$this->labels['ascending'];  
                                 }  
                                 $sort_fields[]   = $sort_field;  
                                 $sort_fields_w[] = $sort_field_w;  
                         }  
                         if (count($sort_fields) > 0) {  
                                 $qparts['orderby'] = join(',', $sort_fields);  
                         }  
                 }  
                 $qparts['limit'] = $listall ? '' : $this->sql_limit($this->fm,$this->inc);  
   
                 /*                  /*
                  * Main list_table() query                   * Main list_table() query
                  *                   *
Line 2277  function '.$this->js['prefix'].'filter_h
Line 2323  function '.$this->js['prefix'].'filter_h
                  * $this->sql_field_len() function. We will also fetch the first row to get                   * $this->sql_field_len() function. We will also fetch the first row to get
                  * the field names.                   * the field names.
                  */                   */
                   $qparts = $this->get_SQL_main_list_query_parts();
                 $query = $this->get_SQL_main_list_query($qparts);                  $query = $this->get_SQL_main_list_query($qparts);
                 $res   = $this->myquery($query, __LINE__);                  $res   = $this->myquery($query, __LINE__);
                 if ($res == false) {                  if ($res == false) {
Line 2286  function '.$this->js['prefix'].'filter_h
Line 2333  function '.$this->js['prefix'].'filter_h
                 $row = $this->sql_fetch($res);                  $row = $this->sql_fetch($res);
   
                 // filter                  // filter
                 if ($this->filter_operation()) $this->filter_heading($sys_cols);                  if ($this->filter_operation()) $this->filter_heading();
                 /*                  // Display sorting sequence
                  * Display sorting sequence                  if ($qparts['orderby'] && $this->display['sort']) $this->display_sorting_sequence();
                  */                  // Display the current query
                 if ($qparts['orderby'] && $this->display['sort']) {                  if($this->display['query']) $this->display_current_query();
                         $css_class_name = $this->getCSSclass('sortinfo');  
                         echo '<tr class="',$css_class_name,'">',"\n";  
                         echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">';  
                         echo '<a class="',$css_class_name,'" href="';  
                         echo htmlspecialchars($this->page_name  
                                         .'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl  
                                         .'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm  
                                         .'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn)  
                                         .$this->qfn.$this->cgi['persist']);  
                         echo '">',$this->labels['Clear'],'</a></td>',"\n";  
                         echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">';  
                         echo $this->labels['Sorted By'],': ',join(', ', $sort_fields_w),'</td></tr>',"\n";  
                 }  
   
                 /*  
                  * Display the current query  
                  */  
                 $text_query = $this->get_SQL_where_from_query_opts(null, true);  
                 if ($text_query != '' && $this->display['query']) {  
                         $css_class_name = $this->getCSSclass('queryinfo');  
                         echo '<tr class="',$css_class_name,'">',"\n";  
                         echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">';  
                         echo '<a class="',$css_class_name,'" href="';  
                         echo htmlspecialchars($this->get_server_var('PHP_SELF')  
                                         .'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl  
                                         .'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm  
                                         .'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn)  
                                         .'&'.$this->get_sfn_cgi_vars().$this->cgi['persist']);  
                         echo '">',$this->labels['Clear'],'</a></td>',"\n";  
                         echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">';  
                         echo $this->labels['Current Query'],': ',htmlspecialchars($text_query),'</td></tr>',"\n";  
                 }  
   
                 if ($this->nav_text_links() || $this->nav_graphic_links()) {                  if ($this->nav_text_links() || $this->nav_graphic_links()) {
                         $qstrparts = array();                          $qstrparts = array();
                         strlen($this->fl)             > 0 && $qstrparts[] = $this->cgi['prefix']['sys'].'fl'.'='.$this->fl;                          strlen($this->fl)             > 0 && $qstrparts[] = $this->cgi['prefix']['sys'].'fl'.'='.$this->fl;
Line 2352  function '.$this->js['prefix'].'filter_h
Line 2367  function '.$this->js['prefix'].'filter_h
                                 || ($fetched && $row != false)) {                                  || ($fetched && $row != false)) {
                         $fetched = false;                          $fetched = false;
                         echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";                          echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";
                         if ($sys_cols) { /* {{{ */                          if ($this->sys_cols) { /* {{{ */
                                 $key_rec     = $row['qf'.$this->key_num];                                  $key_rec     = $row['qf'.$this->key_num];
                                 $queryAppend = htmlspecialchars('&'.$this->cgi['prefix']['sys'].'rec'.'='.$key_rec);                                  $queryAppend = htmlspecialchars('&'.$this->cgi['prefix']['sys'].'rec'.'='.$key_rec);
                                 $viewQuery   = $qpviewStr   . $queryAppend;                                  $viewQuery   = $qpviewStr   . $queryAppend;
Line 2365  function '.$this->js['prefix'].'filter_h
Line 2380  function '.$this->js['prefix'].'filter_h
                                 $deleteTitle = htmlspecialchars($this->labels['Delete']);                                  $deleteTitle = htmlspecialchars($this->labels['Delete']);
                                 $css_class_name = $this->getCSSclass('navigation', null, true);                                  $css_class_name = $this->getCSSclass('navigation', null, true);
                                 if ($select_recs) {                                  if ($select_recs) {
                                         if (! $this->nav_buttons() || $sys_cols > 1) {                                          if (! $this->nav_buttons() || $this->sys_cols > 1) {
                                                 echo '<td class="',$css_class_name,'">';                                                  echo '<td class="',$css_class_name,'">';
                                         }                                          }
                                         if ($this->nav_graphic_links()) {                                          if ($this->nav_graphic_links()) {
Line 2427  function '.$this->js['prefix'].'filter_h
Line 2442  function '.$this->js['prefix'].'filter_h
                                                         echo '<a href="',$deleteQuery,'" title="',$deleteTitle,'" class="',$css_class_name,'">D</a>';                                                          echo '<a href="',$deleteQuery,'" title="',$deleteTitle,'" class="',$css_class_name,'">D</a>';
                                                 }                                                  }
                                         }                                          }
                                         if (! $this->nav_buttons() || $sys_cols > 1) {                                          if (! $this->nav_buttons() || $this->sys_cols > 1) {
                                                 echo '</td>',"\n";                                                  echo '</td>',"\n";
                                         }                                          }
                                         if ($this->nav_buttons()) {                                          if ($this->nav_buttons()) {
Line 2441  function '.$this->js['prefix'].'filter_h
Line 2456  function '.$this->js['prefix'].'filter_h
                                                 echo ' /></td>',"\n";                                                  echo ' /></td>',"\n";
                                         }                                          }
                                 } elseif ($this->filter_enabled()) {                                  } elseif ($this->filter_enabled()) {
                                         echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">&nbsp;</td>',"\n";                                          echo '<td class="',$css_class_name,'" colspan="',$this->sys_cols,'">&nbsp;</td>',"\n";
                                 }                                  }
                         } /* }}} */                          } /* }}} */
                         for ($k = 0; $k < $this->num_fds; $k++) { /* {{{ */                          for ($k = 0; $k < $this->num_fds; $k++) { /* {{{ */

Legend:
Removed from v.1.206  
changed lines
  Added in v.1.207

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top