Example #1
0
 public function paid()
 {
     if ($this->payment_sum == 0) {
         return null;
     }
     $curr = Wpjb_List_Currency::getCurrencySymbol($this->payment_currency);
     return $curr . $this->payment_paid;
 }
Example #2
0
 protected function _currArr()
 {
     $list = array();
     foreach (Wpjb_List_Currency::getList() as $k => $arr) {
         $v = $arr['name'];
         if ($arr['symbol'] != null) {
             $v = $arr['symbol'] . ' ' . $v;
         }
         $list[] = array($k, $k, $v);
     }
     return $list;
 }
Example #3
0
 public function getTextPrice($format = null)
 {
     $currency = Wpjb_List_Currency::getCurrency($this->currency);
     $price = $this->price;
     if ($format) {
         $price = sprintf($format, $price);
     }
     if ($currency['symbol'] != null) {
         return $currency['symbol'] . $price;
     } else {
         return $currency['code'] . ' ' . $price;
     }
 }
Example #4
0
 public function getTextDiscount()
 {
     if ($this->type == 1) {
         return $this->discount . "%";
     } else {
         $currency = Wpjb_List_Currency::getCurrency($this->currency);
         $code = $currency['code'] . ' ';
         if ($currency['symbol'] != null) {
             $code = $currency['symbol'];
         }
         return $code . $this->discount;
     }
 }
Example #5
0
 public static function render()
 {
     $list = new Daq_Db_Query();
     $list->select("t.payment_currency as curr");
     $list->from("Wpjb_Model_Payment t");
     $list->where("payment_paid > 0");
     $list->group("payment_currency");
     $result = $list->fetchAll();
     $curr = array();
     foreach ($result as $r) {
         $c = Wpjb_List_Currency::getCurrency($r->curr);
         $curr[$r->curr] = $c["name"];
     }
     $view = Wpjb_Project::getInstance()->getAdmin()->getView();
     /* @var $view  Daq_View */
     $view->currency = $curr;
     $view->render("dashboard/stats.php");
 }
Example #6
0
 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>';
 }
Example #7
0
 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;
 }
Example #8
0
 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;
 }
Example #9
0
 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);
 }
Example #10
0
 public function listingPrice()
 {
     $price = $this->payment_sum + $this->payment_discount;
     $curr = Wpjb_List_Currency::getCurrencySymbol($this->payment_currency);
     return $curr . number_format($price, 2);
 }
Example #11
0
 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);
 }
Example #12
0
 private static function _init()
 {
     self::$_currency = Wpjb_List_Currency::getAll();
 }