Class: Search_Controller

Source Location: /tinymvc/myapp/controllers/search.php

Class Overview [line 10]

AbstractController
   |
   --Search_Controller

Handles all site functionality except for login capabilities.

Author(s):

  • Monte Ohrt

Version:

Copyright:

Variables

Constants

Methods


Inherited Variables

Inherited Constants

Inherited Methods



Class Details

Handles all site functionality except for login capabilities.

Tags:

[ Top ]


Class Variables


Class Methods

index

void index( string $q, int $id, string $type, string $zipCode)

[line 33]

The default search page. This page provides all site functionality except for login capabilities.

In the following docs, a parameter with name $param refers to $_GET['param'] from the url parameters.

If $type is 'special' or 'recipe':

  • If $type and $q are both set, this page performs a search for all items matching $q.
  • If $type and $id are both set, this page shows information on recipe or special matching the $id.
If $type is 'favoritefood':
  • Searches for all specials matching the user's favorite foods.
  • No other parameters are required.
  • The user must be logged in.

Overrides AbstractController::index() (index)

Parameters:

  • string $q - GET variable. The query to search for, if $type is 'recipe' or 'special'.
  • int $id - GET variable. The recipe (if $type is 'recipe') or special (if $type is 'special') to view.
  • string $type - GET variable. Determines the page behavior. See above (method description) for details.
  • string $zipCode - GET variable. The zip code to use when viewing recipes, specials, etc. If not specified, defaults to the user's zipcode (stored from previous queries), or to a zipcode stored in session variables.

[ Top ]

_distinct

void _distinct( array $array, mixed $key)

[line 211]

Returns a list of the distinct values of $array based on $key.

I.e., guarantees no two $array[$key] have the same value.

Tags:

  • private -

Parameters:

  • array $array - The array from which to get distinct values
  • mixed $key - The key to use to get distinct values.

[ Top ]

_hasKeyVal

void _hasKeyVal( array $array, mixed $key, mixed $value)

[line 232]

Returns whether array has a key with the given value

Tags:

  • private -

Parameters:

  • array $array -
  • mixed $key - The key in $array to use when searching.
  • mixed $value - The value to search for using condition: ($array[$key] == $value).

[ Top ]

_mergeAssoc

void _mergeAssoc( array $array1, array $array2, mixed $key)

[line 197]

Merges array1 and array2 using the associative key 'key'.

Removes duplicate values.

Tags:

  • private -

Parameters:

  • array $array1 - The first array.
  • array $array2 - The second array.
  • mixed $key - The key to use when merging $array1 and $array2.

[ Top ]


Class Constants


Documentation generated on Tue, 26 May 2009 14:50:37 -0700 by phpDocumentor 1.4.1