To participate you must create an account on apostrophenow.org. If you have already done so, click Login.
Changeset 3783
- Timestamp:
- 06/21/11 11:23:18 (2 years ago)
- Author:
- wjohnald
- Message:
-
refactored some query getters
- Location:
- plugins/apostrophePeoplePlugin/trunk/lib/actions
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r3782
|
r3783
|
|
| 21 | 21 | { |
| 22 | 22 | // Set default categories for the people sidebar as a session variable |
| 23 | | $defaultCategories = array(); |
| 24 | 23 | if ($request->getParameter('aPeopleCategoryFilter')) |
| 25 | 24 | { |
| | 25 | $defaultCategories = array(); |
| 26 | 26 | $categoryFilter = $this->getRequest()->getParameter('aPeopleCategoryFilter'); |
| 27 | 27 | |
| … |
… |
|
| 63 | 63 | ->leftJoin('p.Categories c'); |
| 64 | 64 | |
| 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(); |
| 76 | 66 | if(count($ids)) |
| 77 | 67 | { |
| … |
… |
|
| 81 | 71 | return $query; |
| 82 | 72 | } |
| | 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 | } |
| 83 | 89 | |
| 84 | 90 | /** |
-
|
r3782
|
r3783
|
|
| 20 | 20 | public function executeSidebar(sfWebRequest $request) |
| 21 | 21 | { |
| | 22 | $this->form = new aPeopleCategoryForm($this->getFilterDefaults()); |
| | 23 | $this->actionUrl = url_for($request->getUri()); |
| | 24 | } |
| | 25 | |
| | 26 | protected function getFilterDefaults() |
| | 27 | { |
| 22 | 28 | $defaults = array(); |
| 23 | 29 | $defaults['categories'] = aPeopleTools::getAttribute('categories_filter', array()); |
| 24 | 30 | |
| 25 | | $this->form = new aPeopleCategoryForm($defaults); |
| 26 | | $this->actionUrl = url_for($request->getUri()); |
| | 31 | return $defaults; |
| 27 | 32 | } |
| 28 | 33 | |
Download in other formats: