public static function getMembersByOrgType($orgType = 0) { $orgs = array(); switch ($orgType) { case 2: $orgs = FM_Components_Business::getAll(); break; case 3: $orgs = FM_Components_NonProfit::getAll(); break; case 4: $orgs = FM_Components_Sports::getAll(); break; default: return FM_Components_Member::getAll(); } if (!count($orgs)) { return $orgs; } //no data send empty array $ids = array(); foreach ($orgs as $org) { $ids[] = $org->getId(); } $userOrgTable = new FM_Models_FM_UserOrg(); $users = $userOrgTable->getRecordsByDataSet('oid', $ids, 'uid'); $allUsers = array(); if (count($users)) { foreach ($users as $user) { $allUsers[$user['uid']] = new FM_Components_Member(array('id' => $user['uid'])); } return $allUsers; } else { return $users; //empty data set send empty array } return false; //everything failed }
public function ajaxupdateprofileAction() { if ($_POST['orgId'] && $_POST['ot']) { $result = false; switch ($_POST['ot']) { case 2: $result = FM_Components_Business::updateBusiness($_POST); break; case 3: $result = FM_Components_NonProfit::update($_POST); break; case 4: $result = FM_Components_Sports::update($_POST); break; } print $result ? '1' : '0'; exit; } }
public function ajaxgetclientAction() { if ($_POST) { switch ($_POST['clienttype']) { case 2: $client = new FM_Components_Business(array('id' => $_POST['id'])); print Zend_Json::encode($client->toArray()); break; case 3: $client = new FM_Components_NonProfit(array('id' => $_POST['id'])); print Zend_Json::encode($client->toArray()); break; case 4: $client = new FM_Components_Sports(array('id' => $_POST['id'])); print Zend_Json::encode($client->toArray()); break; } } exit; }