Esempio n. 1
0
 /**
  * Group a set of notifications by date.
  * 
  * @param array $notifications
  * 
  * @return array
  */
 public function group($notifications)
 {
     $dates = array();
     $actor = $this->getTemplate()->getView()->actor;
     $timezone = pick($actor->timezone, 0);
     foreach ($notifications as $notification) {
         $current = AnDomainAttributeDate::getInstance()->addHours($timezone);
         $diff = $current->compare($notification->creationTime->addHours($timezone));
         if ($diff <= AnHelperDate::dayToSeconds('1')) {
             if ($current->day == $notification->creationTime->day) {
                 $key = JText::_('LIB-AN-DATE-TODAY');
             } else {
                 $key = JText::_('LIB-AN-DATE-DAY');
             }
         } else {
             $key = $this->getTemplate()->renderHelper('date.format', $notification->creationTime, array('format' => '%B %d'));
         }
         if (!isset($dates[$key])) {
             $dates[$key] = array();
         }
         $dates[$key][] = $notification;
     }
     return $dates;
 }
Esempio n. 2
0
 /**
  * Update a status of an actor.
  *
  * @param string $status The status update
  */
 public function setStatus($status)
 {
     $this->set('status', $status);
     $this->statusUpdateTime = AnDomainAttributeDate::getInstance();
 }
Esempio n. 3
0
 /**
  * Sets the start date of an expirable.
  *
  * @param AnDomainAttributeDate|KDate|array $date The start date
  */
 public function setStartDate($date)
 {
     $date = AnDomainAttributeDate::getInstance()->setDate($date);
     $this->set('startDate', $date);
     return $this;
 }
Esempio n. 4
0
 /**
  * Return a payload object for this order
  * 
  * @return ComSubscriptionsDomainPaymentPayload
  */
 public function getPayload()
 {
     $payload = $this->getService('com://site/subscriptions.domain.payment.payload', array('order_id' => $this->orderId, 'description' => $this->_package->name, 'amount' => $this->getItemAmountAfterDiscount(), 'tax_amount' => $this->getTaxAmount(), 'payment_method' => $this->getPaymentMethod(), 'currency' => $this->currency));
     if ($this->_package->recurring) {
         $payload->setRecurring(1, $this->_package->billingPeriod, AnDomainAttributeDate::getInstance()->getDate(DATE_FORMAT_ISO_EXTENDED));
     }
     return $payload;
 }
Esempio n. 5
0
 /**
  * Return whether a subscriptions is expired or not
  * 
  * @return boolean
  */
 public function expired()
 {
     return $this->endDate->compare(AnDomainAttributeDate::getInstance()) < 0;
 }
Esempio n. 6
0
 /**
  * Return whether a subscriptions is expired or not.
  *
  * @return bool
  */
 public function expired()
 {
     if (empty($this->expiresOn)) {
         return false;
     }
     return AnDomainAttributeDate::getInstance()->toDate()->compare($this->expiresOn) > 0;
 }
Esempio n. 7
0
 /**
  * Timestamping a node
  * 
  * @return void
  */
 public function timestamp()
 {
     $this->updateTime = AnDomainAttributeDate::getInstance();
     if (!isset($this->creationTime)) {
         $this->creationTime = AnDomainAttributeDate::getInstance();
     }
 }
Esempio n. 8
0
 /**
  * Constructor.
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     //load the com_Anahita_SocialCore language for the date related string
     $this->_current_time = AnDomainAttributeDate::getInstance();
 }