public function managecouponsAction() { $this->view->coupon = 'managecoupon'; $this->view->search = new FM_Forms_Register_Search(); //print_r($_POST);exit; $this->view->sidenav = $this->view->partial('root/parts/sidenavs/coupon.phtml', array('selected' => 'managecoupon')); if (array_key_exists('search', $_POST)) { $coupons = array(); $orgs = FM_Components_Organization::searchOrgs($_POST['search']); foreach ($orgs as $org) { $coupons[] = FM_Components_Coupon::getAllOrgCoupons($org['id']); } foreach ($coupons as $coupon) { foreach ($coupon as $c) { $rc[] = $c; } } $this->view->coupons = $rc; } else { if ($this->_getParam('orgid') == 999999999) { $this->view->coupons = $coupons = FM_Components_Coupon::getAllCoupons(); } else { $this->view->coupons = $coupons = FM_Components_Coupon::getAllOrgCoupons($this->_getParam('orgid')); } } $this->view->orglist = FM_Components_Business::getActiveRecords(); }