Example #1
0
 public static function getMarkupForPrivateExchangePublisher($publisher_info_id, $config, $cached = true)
 {
     $PrivateExchangePublisherMarkupFactory = \_factory\PrivateExchangePublisherMarkup::get_instance();
     $params = array();
     $params["PublisherInfoID"] = $publisher_info_id;
     if ($cached === true) {
         $user_markup = $PrivateExchangePublisherMarkupFactory->get_row_cached($config, $params);
     } else {
         $user_markup = $PrivateExchangePublisherMarkupFactory->get_row($params);
     }
     return $user_markup;
 }
Example #2
0
 /**
  *
  * @return Ambigous <\Zend\Http\Response, \Zend\Stdlib\ResponseInterface>
  */
 public function changeprivateexchangepublishermarkupAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     if ($this->is_super_admin == false && $this->is_domain_admin == false) {
         die("You do not have permission to access this page");
     }
     $publisher_info_id = $this->getRequest()->getQuery('markuppublisherinfoid');
     $publisher_markup = $this->getRequest()->getQuery('private-exchange-publisher-markup');
     if ($this->is_super_admin == false && !\util\AuthHelper::domain_user_authorized_publisher($this->auth->getUserID(), $publisher_info_id)) {
         die("You are not authorized to perform this action: CODE 101");
     }
     $PrivateExchangePublisherMarkupFactory = \_factory\PrivateExchangePublisherMarkup::get_instance();
     $params = array();
     $params["PublisherInfoID"] = $publisher_info_id;
     $PrivateExchangePublisherMarkup = $PrivateExchangePublisherMarkupFactory->get_row($params);
     $publisher_markup = floatval($publisher_markup) / 100;
     if ($publisher_markup <= 0) {
         die("Publisher Markup can not be less than or equal to zero percent");
     }
     if ($publisher_markup >= 1) {
         die("Publisher Markup can not be greater than or equal to one hundred percent");
     }
     $publisher_markup = sprintf("%1.2f", $publisher_markup);
     $_PrivateExchangePublisherMarkup = new \model\PrivateExchangePublisherMarkup();
     $_PrivateExchangePublisherMarkup->PublisherInfoID = $publisher_info_id;
     $_PrivateExchangePublisherMarkup->MarkupRate = $publisher_markup;
     if ($PrivateExchangePublisherMarkup != null) {
         $PrivateExchangePublisherMarkupFactory->updatePrivateExchangePublisherMarkup($_PrivateExchangePublisherMarkup);
     } else {
         $PrivateExchangePublisherMarkupFactory->insertPrivateExchangePublisherMarkup($_PrivateExchangePublisherMarkup);
     }
     if ($this->is_domain_admin) {
         return $this->redirect()->toRoute('pxpublishers');
     } else {
         return $this->redirect()->toRoute('publisher');
     }
 }