public function paid() { if ($this->payment_sum == 0) { return null; } $curr = Wpjb_List_Currency::getCurrencySymbol($this->payment_currency); return $curr . $this->payment_paid; }
public function _injectMedia() { $dir = Wpjb_Project::getInstance()->media(); $include = array("css" => true, "js" => true); $include = apply_filters("wpjb_inject_media", $include); $css = trim($dir, "/") . "/style.css"; if ($include["css"]) { echo "\n" . '<link rel="stylesheet" href="' . $css . '" type="text/css" media="screen" />' . "\n"; } echo '<script type="text/javascript">'; $query = new Daq_Db_Query(); $listing = array(); $result = $query->select("*")->from("Wpjb_Model_Listing t")->where("is_active = 1")->execute(); foreach ($result as $l) { /* @var $l Wpjb_Model_Listing */ $temp = $l->toArray(); $temp['symbol'] = Wpjb_List_Currency::getCurrencySymbol($l->currency); $listing[] = $temp; } echo 'Wpjb.Listing = ' . json_encode($listing) . ';'; $class = new stdClass(); $class->Check = __("check", WPJB_DOMAIN); $class->SelectListingType = __("Select listing type", WPJB_DOMAIN); $class->ListingCost = __("Listing cost", WPJB_DOMAIN); $class->Discount = __("Discount", WPJB_DOMAIN); $class->Total = __("Total", WPJB_DOMAIN); $class->Remove = __("remove", WPJB_DOMAIN); $class->CurrencyMismatch = __("Cannot use selected coupon with this listing. Currencies does not match.", WPJB_DOMAIN); $class->ResetForm = __("Reset all form fields?", WPJB_DOMAIN); echo 'Wpjb.Lang = ' . json_encode($class) . ';'; echo 'Wpjb.Ajax = "' . admin_url("admin-ajax.php") . '";'; echo 'Wpjb.AjaxRequest = "' . esc_html(Wpjb_Project::getInstance()->getUrl() . "/plain/discount") . '";'; echo 'Wpjb.Protection = "' . esc_html(Wpjb_Project::getInstance()->conf("front_protection", "pr0t3ct1on")) . '";'; echo 'Wpjb.PerPage = 20;'; echo '</script>'; }
protected function _premiumRequest() { $object = Wpjb_Model_Employer::current(); $buy = (int) $this->_request->post("purchase", 0); $curr = Wpjb_List_Currency::getCurrencySymbol(Wpjb_Project::getInstance()->conf("cv_access_curr")); $this->view->payment = $curr . number_format(Wpjb_Project::getInstance()->conf("cv_access_cost"), 2); $this->view->active_until = $this->_activeUntil(); $this->view->purchase = 0; $this->view->form = new Wpjb_Form_Frontend_ResumesAccess(); if (!$this->isPost()) { return; } if (!$this->view->form->isValid($this->getRequest()->getAll())) { return; } $access = new Wpjb_Model_ResumesAccess(); $access->employer_id = Wpjb_Model_Employer::current()->getId(); $access->extend = Wpjb_Project::getInstance()->conf("cv_extend"); $access->created_at = date("Y-m-d H:i:s"); $access->save(); $payment = new Wpjb_Model_Payment(); $payment->object_type = Wpjb_Model_Payment::FOR_RESUMES; $payment->object_id = $access->getId(); $payment->user_id = $access->employer_id; $payment->engine = $this->view->form->getElement("payment_method")->getValue(); $payment->payment_currency = Wpjb_Project::getInstance()->conf("cv_access_curr"); $payment->payment_sum = Wpjb_Project::getInstance()->conf("cv_access_cost"); $payment->payment_paid = 0; $payment->save(); $paypal = Wpjb_Payment_Factory::factory($payment); $this->view->paypal = $paypal; $this->view->purchase = 1; }
protected function _premium() { $object = Wpjb_Model_Employer::current(); $buy = (int) $this->_request->get("purchase", 0); $curr = Wpjb_List_Currency::getCurrencySymbol(Wpjb_Project::getInstance()->conf("cv_access_curr")); $this->view->payment = $curr . number_format(Wpjb_Project::getInstance()->conf("cv_access_cost"), 2); $this->view->active_until = $this->_activeUntil(); if ($buy != 1) { return; } $access = new Wpjb_Model_ResumesAccess(); $access->employer_id = Wpjb_Model_Employer::current()->getId(); $access->extend = Wpjb_Project::getInstance()->conf("cv_extend"); $access->created_at = date("Y-m-d H:i:s"); $access->save(); $payment = new Wpjb_Model_Payment(); $payment->object_type = Wpjb_Model_Payment::FOR_RESUMES; $payment->object_id = $access->getId(); $payment->user_id = $access->employer_id; $payment->engine = "PayPal"; $payment->payment_currency = Wpjb_Project::getInstance()->conf("cv_access_curr"); $payment->payment_sum = Wpjb_Project::getInstance()->conf("cv_access_cost"); $payment->payment_paid = 0; $payment->save(); $paypal = new Wpjb_Payment_PayPal($payment); $this->view->paypal = $paypal; $this->view->purchase = 1; }
public function addScriptsFront() { if (!is_wpjb() && !is_wpjr()) { return; } wp_enqueue_script('wpjb-js', trim(site_url(), "/") . '/wp-content/plugins/wpjobboard/templates/js.js', array("jquery")); $listing = array(); if (is_wpjb() && $this->router()->isRoutedTo("addJob.add")) { $query = new Daq_Db_Query(); $result = $query->select("*")->from("Wpjb_Model_Listing t")->where("is_active = 1")->execute(); foreach ($result as $l) { /* @var $l Wpjb_Model_Listing */ $temp = $l->toArray(); $temp['symbol'] = Wpjb_List_Currency::getCurrencySymbol($l->currency); $listing[] = $temp; } wp_enqueue_script("wpjb-suggest"); } if (wpjb_is_routed_to(array("employer_new", "employer_edit"), "frontend")) { wp_enqueue_script("wpjb-suggest"); } $object = array("Listing" => $listing, "Lang" => json_encode(array("Check" => __("check", WPJB_DOMAIN), "SelectListingType" => __("Select listing type", WPJB_DOMAIN), "ListingCost" => __("Listing cost", WPJB_DOMAIN), "Discount" => __("Discount", WPJB_DOMAIN), "Total" => __("Total", WPJB_DOMAIN), "Remove" => __("remove", WPJB_DOMAIN), "CurrencyMismatch" => __("Cannot use selected coupon with this listing. Currencies does not match.", WPJB_DOMAIN), "ResetForm" => __("Reset all form fields?", WPJB_DOMAIN))), "Ajax" => admin_url("admin-ajax.php"), "AjaxRequest" => Wpjb_Project::getInstance()->getUrl() . "/plain/discount", "Protection" => Wpjb_Project::getInstance()->conf("front_protection", "pr0t3ct1on")); //wp_localize_script("wpjb-js", "Wpjb.Lang", $object); }
public function listingPrice() { $price = $this->payment_sum + $this->payment_discount; $curr = Wpjb_List_Currency::getCurrencySymbol($this->payment_currency); return $curr . number_format($price, 2); }
public function paymentAction() { $payment = $this->getObject(); $button = Wpjb_Payment_Factory::factory($payment); $this->_setTitle(__("Payment", WPJB_DOMAIN)); if ($payment->payment_sum == $payment->payment_paid) { $this->view->_flash->addInfo(__("This payment was already processed correctly.", WPJB_DOMAIN)); return false; } if ($payment->object_type == 1) { $this->view->job = new Wpjb_Model_Job($payment->object_id); } $this->view->payment = $payment; $this->view->button = $button; $this->view->currency = Wpjb_List_Currency::getCurrencySymbol($payment->payment_currency); }