public function tutorials()
 {
     $page_data = DruniqueAPI::call('page_blocks.json', array("tag" => "tutorials-page"), $this->Session->read('Config.language'));
     $all_data = DruniqueAPI::call('page_blocks.json', array("tag" => "all-page"), $this->Session->read('Config.language'));
     $page_data = array_merge($all_data, $page_data);
     $video_data = DruniqueAPI::call('video.json', array("type" => "tutorial_videos", "market" => $this->Session->read("market_id")), $this->Session->read('Config.language'));
     //var_dump($video_data);
     $this->set("video_data", $video_data);
     //$this->viewVars['page_data']);
     $this->viewVars['page_data'] = $page_data;
     $this->set('title', $page_data);
     $this->set("area", "wearit");
 }
 public function index()
 {
     if ($this->maintenanceMode == true) {
         $page_data = DruniqueAPI::call('page_blocks.json', array("tag" => "maintenance-page"), $this->Session->read('Config.language'));
         $this->viewVars['page_data'] = $page_data;
         $this->layout = "";
     } else {
         // Comment out the next 5 lines to put the site into maintenance mode
         if (!empty($this->request->params['siteurl'])) {
             $this->siteUrl = $this->request->params['siteurl'];
         }
         $this->redirect(array('controller' => 'business', 'action' => 'index'));
         exit;
     }
 }
 public function trip()
 {
     //$this->redirect(array("action"=>"tools")); // remove when it's time for the next trip incentive
     $this->requireLoggedInPresenter();
     $kudos_data = DruniqueAPI::call('kudos.json', array(), $this->Session->read('Config.language'));
     $this->set("faqlist", $kudos_data['2016 Incentive Trip - FAQ 3']['kudos_faq']);
     $this->set("registrationfaqlist", $kudos_data['2016 Incentive Trip - FAQ 4']['kudos_faq']);
     $this->set("showofficenav", true);
     try {
         $incentiveQualifiedParticipants = YouniqueAPI::call('promotion/dailyCount/');
     } catch (Exception $e) {
         $incentiveQualifiedParticipants = 0;
         // The API returns 0 by default but the YouniqueAPI objects throws exceptions when this happens
     }
     $this->set("qualifiedparticipants", $incentiveQualifiedParticipants);
 }
 /**
  * Get drupal data
  * $config = [
  *   'api_url' => 'page_data.json',
  *   'duration' => 'short',
  *   'caching'  => true,
  *   'locale'   => 'en_US
  * ];
  * @param $config
  * @param $data
  * @return null
  */
 public function getData($config, &$data)
 {
     if (empty($config)) {
         return null;
     }
     /**
      * Get defaults
      */
     $config = array_merge($this->getDefaultConfig(), $config);
     /**
      * Setup params
      */
     if (empty($config['params'])) {
         $config['params'] = ['tag' => $config['action'] . '-page'];
     }
     $data = DruniqueAPI::call($config['api_url'], $config['params'], $config['locale']);
 }
 private function getProductStoryPageContent($action, $sku)
 {
     $product_content = DruniqueAPI::call('product.json', array('sku' => $sku), $action->Session->read('Config.language'));
     $action->set('product_content', $product_content[0]);
 }
Example #6
0
 /**
  * Drunique content safety helper
  *
  * Arguments can be used with %s to pass in replace variables
  *
  * @param $title
  * @param $data
  * @param null $args
  * @return string
  */
 public static function content($title, $data, $args = null)
 {
     if (empty($title)) {
         return '';
     }
     $arguments = func_get_args();
     if (!empty($data) && !empty($data[$title]) && !empty($data[$title]['content'])) {
         return htmlspecialchars_decode(DruniqueAPI::parse($data[$title]['content'], array_slice($arguments, 2)));
     } else {
         return $title;
     }
 }
 public function claimparty()
 {
     $this->requireLoggedInUser();
     YouniqueAPI::call("/party/claim/" . $this->party->Party->id . "/" . $this->userId);
     //redir to view page
     $page_data = DruniqueAPI::call('page_blocks.json', array("tag" => "flash-page"), $this->Session->read('Config.language'));
     $this->Session->setFlash($page_data['you have successfully claimed the party']['content'], "default", array(), "claim_copy");
     $this->redirect(Router::url('/', true) . $this->party->Presenter->PresenterSite->site_url . "/party/" . $this->party->Party->id . "/view/");
 }
 public function cart()
 {
     $kudos_data = DruniqueAPI::call('kudos.json', array(), $this->Session->read('Config.language'));
     // CakeLog::debug(print_r($kudos_data, true));
     $this->viewVars['page_data'] = array_merge($kudos_data, $this->viewVars['page_data']);
     $this->set("hideshopnav", true);
     if (isset($this->request->query['year_month_override'])) {
         $this->set("server_year_month", $this->request->query['year_month_override']);
     } else {
         $this->set("server_year_month", date('Y-m'));
     }
     $params = array();
     $params['items'] = (array) $this->Session->read("shoppingcart");
     if (!empty($this->request->query['zipCode'])) {
         $params['zip'] = $this->request->query['zipCode'];
     } else {
         $params['zip'] = null;
     }
     $this->set("proceedToCheckoutFacebookUrl", $this->facebook->getLoginUrl(array("redirect_uri" => $this->generateUrl(array("action" => "checkout", "?" => array("zipCode" => $params['zip'])), true))));
     $this->set("items", json_encode($params['items']));
     if (!empty($this->partyId)) {
         $this->set("referlink", $this->generateUrl(array("controller" => "party", "partyid" => $this->partyId, "action" => "index"), true));
     } else {
         $this->set("referlink", $this->generateUrl(array("controller" => "products", "action" => "/"), true));
     }
     //set order limit element partial
     //market touch point
     switch ($this->marketId) {
         case 2:
             $this->set("order_limit_partial", "cart/order_limit_canada");
             break;
         case 3:
             $this->set("order_limit_partial", "cart/order_limit_australia");
             break;
         case 4:
             $this->set("order_limit_partial", "cart/order_limit_new_zealand");
             break;
         case 5:
             $this->set("order_limit_partial", "cart/order_limit_united_kingdom");
             break;
         case 6:
             $this->set("order_limit_partial", "cart/order_limit_mexico");
             break;
         case 7:
             $this->set("order_limit_partial", "cart/order_limit_germany");
             break;
         default:
             $this->set("order_limit_partial", "blank");
             break;
     }
     //limits of the item per order
     $this->limitedQuantities($params['items']);
     $this->set('consumption_check', $this->personalConsumptionCheck());
 }
 public function kudos_faq($title, $index, $args = null)
 {
     $kudos_faq;
     if (empty($title)) {
         $kudos_faq = '';
     }
     $viewVars = $this->_View->viewVars;
     if (array_key_exists('kudos_faq', $viewVars)) {
         $data = $viewVars['kudos_faq'];
     } else {
         $data = null;
     }
     if (!empty($data) && !empty($data[$title]) && !empty($data[$title]['kudos faq'][0])) {
         $kudos_faq = $data[$title]['kudos faq'];
     } else {
         $kudos_faq = $title;
     }
     if (!empty($kudos_faq) && isset($kudos_faq[$index])) {
         $kudos_faq = $kudos_faq[$index];
     } else {
         if (!empty($data)) {
             DruniqueAPI::log_error($data, $title);
         }
         return $title;
     }
     $arguments = func_get_args();
     return htmlspecialchars_decode(DruniqueAPI::parse($kudos_faq, array_slice($arguments, 3)));
 }