public function uploadcouponAction() { if ($this->_request->isPost()) { $_FILES['userfile']['name'] = $_POST['id'] . '_' . date('YmdHis', time()) . str_ireplace(array(' ', '_', '-'), '', strtolower($_FILES['userfile']['name'])); $fileHandler = new FM_Components_Util_UploadHandler($_FILES['userfile']); $folder = $fileHandler->setFolder('coupons'); if ($fileHandler->move()) { FM_Components_Coupon::updateCoupon(array('id' => $_POST['id']), array('file' => $_FILES['userfile']['name'])); print $_FILES['userfile']['name']; } else { print '0'; } } else { print '0'; } exit; }
public function ajaxtoggleb2bcouponAction() { if ($this->_user && ($this->_user->getOrgId() || $this->_user->isRoot())) { //user is admin for this group, show edit if ($_POST['id']) { if ($id = FM_Components_Coupon::updateCoupon(array('id' => $_POST['id']), array('b2b' => $_POST['b2b']))) { print '1'; } else { print '0'; } } } else { print '0'; } exit; }