/[drupal]/contributions/modules/l10n_server/l10n_community/translate.inc
ViewVC logotype

Diff of /contributions/modules/l10n_server/l10n_community/translate.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.7.2.24, Fri Nov 6 15:29:48 2009 UTC revision 1.1.2.7.2.25, Fri Nov 6 16:00:57 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: translate.inc,v 1.1.2.7.2.23 2009/11/06 15:04:50 goba Exp $  // $Id: translate.inc,v 1.1.2.7.2.24 2009/11/06 15:29:48 goba Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 185  function l10n_community_filter_form_subm Line 185  function l10n_community_filter_form_subm
185    
186    if ($form_state['values']['op'] == t('Filter')) {    if ($form_state['values']['op'] == t('Filter')) {
187      $filters = l10n_community_build_filter_values($form_state['values']);      $filters = l10n_community_build_filter_values($form_state['values']);
     // Replace some values by their string representation.  
     foreach (array('project' => 'uri', 'author' => 'name') as $name => $key) {  
       if (!empty($filters[$name])) {  
         $filters[$name] = $filters[$name]->$key;  
       }  
     }  
   
188      // Redirect keeping the relevant filters intact in the URL.      // Redirect keeping the relevant filters intact in the URL.
189      $form_state['redirect'] = array($_GET['q'], $filters);      $form_state['redirect'] = array($_GET['q'], l10n_community_flat_filters($filters));
190    }    }
191  }  }
192    
# Line 267  function l10n_community_translate_form(& Line 260  function l10n_community_translate_form(&
260      // after submission, the same page can be shown.      // after submission, the same page can be shown.
261      $filters['page'] = (int) $_GET['page'];      $filters['page'] = (int) $_GET['page'];
262    }    }
   // Replace some values by their string representation for URL redirects.  
   foreach (array('project' => 'uri', 'author' => 'name') as $name => $key) {  
     if (!empty($filters[$name])) {  
       $filters[$name] = $filters[$name]->$key;  
     }  
   }  
263    
264    $form = array(    $form = array(
265      '#tree' => TRUE,      '#tree' => TRUE,
266      '#redirect' => array($_GET['q'], $filters)      '#redirect' => array($_GET['q'], l10n_community_flat_filters($filters))
267    );    );
268    $form['pager_top'] = array(    $form['pager_top'] = array(
269      '#weight' => -10,      '#weight' => -10,
# Line 767  function l10n_community_build_filter_val Line 754  function l10n_community_build_filter_val
754    }    }
755    return $filter;    return $filter;
756  }  }
757    
758    /**
759     * Replace complex data filters (objects or arrays) with string representations.
760     *
761     * @param $filters
762     *   Associative array with filters passed.
763     * @return
764     *   The modified filter array only containing string and number values.
765     */
766    function l10n_community_flat_filters($filters) {
767      foreach (array('project' => 'uri', 'author' => 'name') as $name => $key) {
768        if (!empty($filters[$name])) {
769          $filters[$name] = $filters[$name]->$key;
770        }
771      }
772      return $filters;
773    }

Legend:
Removed from v.1.1.2.7.2.24  
changed lines
  Added in v.1.1.2.7.2.25

  ViewVC Help
Powered by ViewVC 1.1.2