Created
October 28, 2011 05:10
-
-
Save MrTrick/1321670 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
... | |
$select = new Zend_Db_Select($db=Zend_Db_Table::getDefaultAdapter()); | |
$select->from(array('a'=>'tutors_applicant_application')); | |
//Filter on area? | |
if (isset($query['area']) and $query['area']!='all') { | |
$area = $query['area']; | |
$select->where('area=?',$area); | |
} | |
//Filter on interest? | |
if (isset($query['interest']) and $query['interest']!='all') { | |
$interests = is_array($query['interest']) ? $query['interest'] : array($query['interest']); | |
$select->join(array('i'=>'tutors_applicant_application_interest'), 'a.id=i.application_id', array()); | |
foreach($interests as $interest) | |
$select->orWhere('interest = ?', $interest); | |
} | |
return new Tutors_Model_ApplicantApplication_Collection($db->fetchAll($select),$this); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment