protected function _formatDates($dates)
 {
     $result = array();
     $d = new KDate();
     foreach ($dates as $date) {
         $d->setDate($date);
         $result[] = $d->format('%b %e');
     }
     return $result;
 }
Beispiel #2
0
 /**
  * Sets the Date's internal date.
  *
  * @param $mixed date
  * @param $format Object[optional]
  */
 public function setDate($date, $format = DATE_FORMAT_ISO)
 {
     if ($date instanceof KDate) {
         $this->copy($date);
     } elseif (is_array($date) || $date instanceof KConfig) {
         foreach ($date as $key => $value) {
             $this->{$key} = $value;
         }
     } else {
         parent::setDate($date, $format);
     }
     return $this;
 }
Beispiel #3
0
<?php

if ($post->id) {
    ?>
	<div class="post" >
		
		<?php 
    $date = new KDate();
    $date->setDate($post->created_on);
    ?>
		<div class="date">
			<div class="day"><?php 
    echo $date->format('%d');
    ?>
</div>
			<div class="month"><?php 
    echo $date->format('%B');
    ?>
</div>
			<div class="year"><?php 
    echo $date->format('%Y');
    ?>
</div>
		</div>
		
		<h2>
			<b><?php 
    echo $post->title;
    ?>
</b>
		</h2>
Beispiel #4
0
    $currentDay = null;
    ?>
    <?php 
    foreach (@$myactivities as $activity) {
        ?>
    
        <?php 
        if (!in_array($activity->parent_target_id, $array)) {
            continue;
        }
        ?>

	 	<?php 
        $date = new KDate();
        $offset = KFactory::get('lib.joomla.config')->getValue('config.offset') + 1;
        $date->setDate($activity->created_on)->addHours($offset);
        ?>
		<?php 
        if ($currentDay == $date->format('%d %B')) {
            ?>
     	    <tr> 
     	        <td class="empty">&nbsp;</td> 
     	<?php 
        } else {
            ?>
     	    <tr class="new-day"> 
     	        <td class="day"> 
     	            <span>
     	                <a><?php 
            echo $date->format('%d %b');
            ?>
Beispiel #5
0
    ?>
&size=50'>
						
					</div>
					<div class="comment-text">
						<?php 
    echo $comment->text;
    ?>
						<?php 
    echo $user->name;
    ?>
, 
						<?php 
    $date = new KDate();
    $offset = KFactory::get('lib.joomla.config')->getValue('config.offset') + 1;
    $date->setDate($comment->created_on)->addHours($offset);
    ?>
						<?php 
    KFactory::get('lib.joomla.language.language')->load('com_comments');
    ?>
						<?php 
    echo @text(KFactory::tmp('site::com.comments.helper.date')->since($date));
    ?>
			
		 			</div>
				</div>
			</div>
		</fieldset>
	<?php 
}
?>
Beispiel #6
0
 public function display()
 {
     $user = KFactory::tmp('lib.joomla.user', array(KRequest::get('get.userid', 'int')));
     if ($user->username == KRequest::get('get.username', 'string')) {
         $targets = KFactory::tmp('site::com.stream.model.targets')->getList()->getData();
         $thing = reset($targets);
         $string = substr($thing['title'], 3);
         $option = strtolower(substr($string, 0, stripos($string, 'controller')));
         $view = strtolower(substr($string, stripos($string, 'controller') + 10));
         $model = KInflector::pluralize($view);
         $list = KFactory::tmp('site::com.' . $option . '.model.' . $model)->userid($user->id)->getList()->getData();
         $array = array();
         foreach ($list as $item) {
             $array[] = $item['id'];
         }
         //Get the list of posts
         $activities = KFactory::get($this->getModel())->set('parent_target_id', KRequest::get('get.parent_target_id', 'int'))->getList();
         $doc =& JFactory::getDocument();
         foreach ($activities as $activity) {
             if (!in_array($activity->parent_target_id, $array)) {
                 continue;
             }
             $date = new KDate();
             $date->setDate($activity->created_on);
             $currentDay == $date->format('%d %B');
             $user = KFactory::tmp('lib.joomla.user', array('id' => $activity->created_by));
             $string = substr($activity->controller, 3);
             $option = strtolower(substr($string, 0, stripos($string, 'controller')));
             $view = strtolower(substr($string, stripos($string, 'controller') + 10));
             $link = '';
             if ($activity->action != 'delete') {
                 $link = KRequest::base() . '/index.php?option=com_' . $option . '&view=' . $view . '&id=' . $activity->target_id . '&project_id=' . $activity->parent_target_id . '&Itemid=2';
             }
             $description = '<i>' . JText::_($activity->controller . '-' . $activity->action) . '</i>';
             $description .= ' ' . $activity->target_title;
             //add the parent name in the description, if I'm not in a specialized view
             if (!KRequest::get('get.parent_target_id', 'int')) {
                 $targets = KFactory::tmp('site::com.stream.model.targets')->getList()->getData();
                 $thing = reset($targets);
                 $string = substr($thing['title'], 3);
                 $option = strtolower(substr($string, 0, stripos($string, 'controller')));
                 $view = strtolower(substr($string, stripos($string, 'controller') + 10));
                 $model = KInflector::pluralize($view);
                 $data = KFactory::tmp('site::com.' . $option . '.model.' . $model)->id($activity->parent_target_id)->getItem();
                 $description .= '<strong>' . $data->title . '</strong>';
             }
             $date = new KDate();
             $date->setDate($activity->created_on);
             $item = new JFeedItem();
             $item->title = $activity->target_title;
             $item->link = $link . '&param=' . $activity->created_on;
             $item->description = $description;
             $item->date = $date->format('%d %B %Y, %R');
             $item->category = '';
             $item->authorEmail = '';
             $item->author = '';
             $user = KFactory::tmp('lib.joomla.user', array('id' => $activity->created_by));
             if ($user->id) {
                 $item->authorEmail = $user->email;
                 $item->author = $user->name;
             }
             // loads item info into rss array
             $doc->addItem($item);
         }
         $doc->link = $this->createRoute('format=html&view=activities');
     }
 }