Пример #1
0
 public function getWhiteLabelId()
 {
     if (ViewsTrack::isDev()) {
         return 3;
     }
     return parent::getWhiteLabelId();
 }
Пример #2
0
 public function actionSearch($searchtext = '')
 {
     if ($searchtext == '') {
         $this->actionIndex(0);
         return;
     }
     $categories = array();
     $listings = Listing::model()->searchFrontendListings($searchtext);
     ViewsTrack::addCategoryView(0);
     $this->render('index', array('categories' => $categories, 'listings' => $listings));
 }
Пример #3
0
 public function actionCoupon($id = '')
 {
     $id = $this->checkCorrectness($id);
     if ($id != 0) {
         $coupon = Coupon::model()->getFrontendCoupon($id);
     } else {
         $coupon = null;
     }
     if ($coupon == null) {
         $this->render('missing_coupon');
         return null;
     }
     Yii::app()->user->setLastCouponId($id);
     ViewsTrack::addCouponView($id);
     $listing = Listing::model()->getFrontendListing($coupon->listing_id);
     // render normal listing
     $this->render('coupon_detail', array('coupon' => $coupon, 'listing' => $listing, 'listingId' => $listing->listing_id));
 }
Пример #4
0
 public static function getAvgTimeOnPage()
 {
     $timeOnPage = 1;
     $currentTime = time();
     if (isset($_COOKIE['p_time']) && $_COOKIE['p_time'] != '') {
         $lastTime = $_COOKIE['p_time'];
         $timeOnPage = $currentTime - $lastTime;
     }
     // save new time to cookie
     $cookieDomain = ViewsTrack::getCookieDomain();
     $success = setcookie("p_time", $currentTime, time() + 60 * 30, "/", $cookieDomain);
     // 30 minutes expiration
     if (ViewsTrack::isDev()) {
         // I cannot use cookie domain on localhost, simuate without domain
         $success = false;
     }
     if (!$success) {
         // try it again without cookie domain
         $success = setcookie("p_time", $currentTime, time() + 60 * 30, "/");
         // 30 minutes expiration
     }
     return $timeOnPage;
 }