public function executeAdvancesearch() { $this->clearattrib(); $c = new Criteria(); $c->addAscendingOrderByColumn('name'); $branches = BranchPeer::doSelect($c); $options = array(); $options[] = 'Select'; foreach ($branches as $branch) { $options[$branch->getId()] = $branch->getName(); } $this->broptions = $options; //Year of graduation $options = array(); $options[] = 'Select'; for ($i = sfConfig::get('app_year_start'); $i <= sfConfig::get('app_year_end'); $i++) { $options[$i] = $i; } $this->yroptions = $options; //Chapter(s) affiliation $c = new Criteria(); $c->addAscendingOrderByColumn('name'); $chapters = ChapterPeer::doSelect($c); $options = array(); $options[] = 'Select'; foreach ($chapters as $chapter) { $options[$chapter->getId()] = $chapter->getName(); } $this->choptions = $options; //User type $options = array(); $options[0] = sfConfig::get('app_usertype_0'); $options[1] = sfConfig::get('app_usertype_1'); $options[2] = sfConfig::get('app_usertype_2'); $this->useroptions = $options; //Country $c = new Criteria(); $c->addAscendingOrderByColumn('name'); $countries = CountryPeer::doSelect($c); $options = array(); $options[] = 'Select'; foreach ($countries as $country) { $options[$country->getId()] = $country->getName(); //if($country->getName() === 'India'){ //$this->countryselected = $country->getId(); //} } $this->countryoptions = $options; $c = new Criteria(); $this->worktype = WorktypePeer::doSelect($c); }
private function getNationalites() { /* Get Nationalities */ $nationalityCrit = new Criteria(); $nationalityCrit->addAscendingOrderByColumn(CountryPeer::PRINTABLE_NAME); $nationalities = CountryPeer::doSelect($nationalityCrit); return $nationalities; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @return Country[] * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(CountryPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(CountryPeer::DATABASE_NAME); $criteria->add(CountryPeer::ID, $pks, Criteria::IN); $objs = CountryPeer::doSelect($criteria, $con); } return $objs; }
public function executeEdit() { //$userid = $this->getRequestParameter('id'); $username = $this->getUser()->getAttribute('username'); $c = new Criteria(); $c->add(UserPeer::USERNAME, $username); $user = UserPeer::doSelectOne($c); $userid = $user->getId(); $c = new Criteria(); $c->add(AddressPeer::USER_ID, $userid); $c->add(AddressPeer::TYPE, '0'); $this->address1 = AddressPeer::doSelectOne($c); if (!$this->address1) { $this->address1 = new Address(); } $c = new Criteria(); $c->add(AddressPeer::USER_ID, $userid); $c->add(AddressPeer::TYPE, '1'); $this->address2 = AddressPeer::doSelectOne($c); if (!$this->address2) { $this->address2 = new Address(); } $c = new Criteria(); $c->add(AddressPeer::USER_ID, $userid); $c->add(AddressPeer::TYPE, '2'); $this->address3 = AddressPeer::doSelectOne($c); if (!$this->address3) { $this->address3 = new Address(); } $this->userid = $userid; $this->privacyoptions = array('1' => 'Myself', '2' => 'Friends', '3' => 'IT BHU', '4' => 'Everyone'); //Country $c = new Criteria(); $c->addAscendingOrderByColumn('name'); $countries = CountryPeer::doSelect($c); $options = array(); $options[] = 'Select'; foreach ($countries as $country) { $options[$country->getId()] = $country->getName(); } $this->countryoptions = $options; }