To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Changeset 3783

Show
Ignore:
Timestamp:
06/21/11 11:23:18 (3 years ago)
Author:
wjohnald
Message:

refactored some query getters

Location:
plugins/apostrophePeoplePlugin/trunk/lib/actions
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostrophePeoplePlugin/trunk/lib/actions/PluginaPeopleActions.class.php

    r3782 r3783  
    2121  { 
    2222    // Set default categories for the people sidebar as a session variable 
    23     $defaultCategories = array(); 
    2423    if ($request->getParameter('aPeopleCategoryFilter')) 
    2524    { 
     25      $defaultCategories = array(); 
    2626      $categoryFilter = $this->getRequest()->getParameter('aPeopleCategoryFilter'); 
    2727 
     
    6363                        ->leftJoin('p.Categories c'); 
    6464 
    65                 $ids = array(); 
    66                 foreach($this->page->Categories as $category) 
    67                 { 
    68                         $ids[] = $category->id; 
    69                 } 
    70      
    71     foreach(aPeopleTools::getAttribute('categories_filter', array()) as $id) 
    72     { 
    73       $ids[] = $id; 
    74     } 
    75  
     65    $ids = $this->getQueryCategoryIds(); 
    7666    if(count($ids)) 
    7767                { 
     
    8171                return $query; 
    8272        } 
     73 
     74  protected function getQueryCategoryIds() 
     75  { 
     76    $ids = array(); 
     77                foreach($this->page->Categories as $category) 
     78                { 
     79                        $ids[] = $category->id; 
     80                } 
     81 
     82    foreach(aPeopleTools::getAttribute('categories_filter', array()) as $id) 
     83    { 
     84      $ids[] = $id; 
     85    } 
     86 
     87    return $ids; 
     88  } 
    8389 
    8490  /** 
  • plugins/apostrophePeoplePlugin/trunk/lib/actions/PluginaPeopleComponents.class.php

    r3782 r3783  
    2020  public function executeSidebar(sfWebRequest $request) 
    2121  { 
     22    $this->form = new aPeopleCategoryForm($this->getFilterDefaults()); 
     23    $this->actionUrl = url_for($request->getUri()); 
     24  } 
     25 
     26  protected function getFilterDefaults() 
     27  { 
    2228    $defaults = array(); 
    2329    $defaults['categories'] = aPeopleTools::getAttribute('categories_filter', array()); 
    2430 
    25     $this->form = new aPeopleCategoryForm($defaults); 
    26     $this->actionUrl = url_for($request->getUri()); 
     31    return $defaults; 
    2732  } 
    2833