Пример #1
0
 public function executeNo_domain_user(sfWebRequest $request)
 {
     $lDomains = DomainProfileTable::retrieveVerifiedForUser($this->getUser()->getGuardUser());
     $this->pCountDomains = true;
     //var_dump($lDomains);die();
     if (count($lDomains) == 0) {
         $this->pCountDomains = false;
     }
 }
Пример #2
0
 public function getVerifiedDomainObjects()
 {
     $verifiedDomains = array();
     $verifiedDomainProfiles = DomainProfileTable::retrieveVerifiedForUser($this->getGuardUser());
     if ($verifiedDomainProfiles != null && count($verifiedDomainProfiles) > 0) {
         $verifiedDomains = $verifiedDomainProfiles->getData();
     }
     return $verifiedDomains;
 }
Пример #3
0
 /**
  * set the needed request-params
  *
  * @author KM
  *
  * @param $context
  * @param $module
  * @param $action
  */
 public function initialize($context, $module, $action)
 {
     $parentRet = parent::initialize($context, $module, $action);
     $request = $context->getRequest();
     $this->pVerifiedDomains = DomainProfileTable::retrieveVerifiedForUser($this->getUser()->getGuardUser());
     $this->pHostId = $request->getParameter('host_id', $this->pVerifiedDomains[0]->getId());
     $this->pAggregation = $request->getParameter('aggregation', 'daily');
     $this->pDateFrom = $request->getParameter('date-from', date('Y-m-d', strtotime("6 days ago")));
     $this->pDateTo = $request->getParameter('date-to', date('Y-m-d'));
     return $parentRet;
 }
 public function configure()
 {
     $lI18n = sfContext::getInstance()->getI18N();
     $lVerifiedDomains = DomainProfileTable::retrieveVerifiedForUser(sfContext::getInstance()->getUser()->getGuardUser());
     $lUrls = array();
     foreach ($lVerifiedDomains as $lDomain) {
         $lUrls[$lDomain->getId()] = $lDomain->getUrl();
     }
     $this->setWidgets(array('id' => new sfWidgetFormSelect(array('choices' => $lUrls))));
     $this->setValidators(array('id' => new sfValidatorInteger(array('required' => true))));
     //$this->embedRelation('Deals', 'DealForm');
     //    $this->widgetSchema->setNameFormat('domainprofile[%s]');
 }
Пример #5
0
 public function executeCreate_deal_form(sfWebRequest $request)
 {
     $lI18n = sfContext::getInstance()->getI18N();
     $lDealId = $this->pDealId;
     $lDeal = null;
     if ($lDealId) {
         $lDeal = DealTable::getInstance()->find($lDealId);
         $lDealForm = new DealForm($lDeal);
         $lFirstDomain = DomainProfileTable::getInstance()->find($lDeal->getDomainProfileId());
         $this->pFirstDomain = $lFirstDomain;
     } else {
         $lDealForm = new DealForm();
         $lVerifiedDomains = DomainProfileTable::retrieveVerifiedForUser($this->getUser()->getGuardUser());
         $lFirstDomain = $lVerifiedDomains[1];
     }
     $this->pAddtags = 'addnotags';
     if ($lDeal) {
         $this->pCouponType = $lDeal->getCouponType();
         $this->pCouponQuantity = $lDeal->getCouponQuantity();
         $this->pTags = $lDeal->getTags();
         if ($this->pTags != null && $this->pTags != '') {
             $this->pAddtags = 'addtags';
         }
         $this->pDeal = $lDeal;
         $lDealForm->setDefaults(array('id' => $lDeal->getId(), 'terms_of_deal' => $lDeal->getTermsOfDeal(), 'button_wording' => $lDeal->getButtonWording(), 'summary' => $lDeal->getSummary(), 'description' => $lDeal->getDescription(), 'terms_of_deal' => $lDeal->getTermsOfDeal(), 'start_date' => $lDeal->getStartDate(), 'end_date' => $lDeal->getEndDate(), 'coupon_quantity' => $lDeal->getCouponQuantity(), 'coupon_type' => $this->pCouponType, 'redeem_url' => $lDeal->getRedeemUrl(), 'tos_accepted' => $lDeal->getTosAccepted(), 'addtags' => $this->pAddtags, 'tags' => $this->pTags));
         $lCoupons = $lDeal->getCoupons();
         if (count($lCoupons) > 0) {
             $this->pDefaultCode = $lCoupons[0]->getCode();
         } else {
             $this->pDefaultCode = $lI18n->__('Coupon Code');
         }
     } else {
         $this->pCouponType = 'single';
         $this->pCouponQuantity = '0';
         $this->pEdited = false;
         $lDealForm->setDefaults(array('button_wording' => $lI18n->__('...and win a free trial membership!'), 'summary' => $lI18n->__('Free trial membership'), 'description' => $lI18n->__('Like and win a free one month trial membership'), 'terms_of_deal' => $lI18n->__('Url to Conditions of Participation'), 'start_date' => date('Y-m-d G:i:s'), 'end_date' => date('Y-m-d G:i:s'), 'coupon_type' => 'single', 'addtags' => 'addnotags', 'redeem_url' => $lI18n->__('Your redeem url')));
         $this->pDefaultCode = 'Coupon Code';
     }
     $this->pForm = new DomainProfileDealForm();
     $this->pForm->setDefaults(array('id' => $lFirstDomain->getId()));
     $lCouponForm = new CouponCodesForm();
     $lCouponForm->setDefaults(array('single_code' => $this->pDefaultCode));
     $lDealForm->embedForm('coupon', $lCouponForm);
     //if single: getcode, if multiple: getcodes
     $this->pForm->embedForm('deal', $lDealForm);
 }
Пример #6
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->getResponse()->setSlot('js_document_ready', $this->getPartial('analytics/init_analytics.js'));
     $this->pVerifiedDomains = DomainProfileTable::retrieveVerifiedForUser($this->getUser()->getGuardUser());
     $domainUrls = array();
     foreach ($this->pVerifiedDomains as $domain) {
         $domainUrls[] = $domain->getUrl();
     }
     $hostRepo = MongoManager::getStatsDM()->getRepository('Documents\\ActivityStats');
     $this->last30ByHost = $hostRepo->findLast30($domainUrls);
     if ($this->last30ByHost) {
         $this->last30ByHost = $this->last30ByHost->toArray();
     }
     $urlRepo = MongoManager::getStatsDM()->getRepository('Documents\\ActivityUrlStats');
     $this->last30ByUrl = $urlRepo->findLast30($domainUrls);
     if ($this->last30ByUrl) {
         $this->last30ByUrl = $this->last30ByUrl->toArray();
     }
 }
Пример #7
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->getResponse()->setSlot('js_document_ready', $this->getPartial('deal_analytics/init_deal_analytics.js'));
     $this->pVerifiedDomains = DomainProfileTable::retrieveVerifiedForUser($this->getUser()->getGuardUser());
     $this->pDeals = DealTable::getInstance()->createQuery()->where('sf_guard_user_id = ?', array($this->getUser()->getUserId()))->execute();
 }