function process() { $view = new EasyDiscussView(); $date = DiscussHelper::getDate(); $now = $date->toMySQL(); $modelSubscribe = $view->getModel('Subscribe'); $subscribers = $modelSubscribe->getSiteSubscribers($this->interval, $now); $total = count($subscribers); if (empty($total)) { return false; } foreach ($subscribers as $subscriber) { $notify = DiscussHelper::getNotification(); $data = array(); $rows = $modelSubscribe->getCreatedPostByInterval($subscriber->sent_out, $now); $posts = array(); if ($rows) { foreach ($rows as $row) { $row['categorylink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=categorie&layout=listings&category_id=' . $row['category_id'], false, true); $row['link'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $row['id'], false, true); $row['userlink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=profile&id=' . $row['user_id'], false, true); $category = DiscussHelper::getTable('Category'); $creator = DiscussHelper::getTable('Profile'); $category->load($row['category_id']); $creator->load($row['user_id']); $row['category'] = $category->getTitle(); $row['avatar'] = $creator->getAvatar(); $row['name'] = $creator->getName(); $row['date'] = DiscussDateHelper::toFormat($row['created'], '%b %e, %Y'); $row['message'] = DiscussHelper::parseContent($row['content']); $posts[] = $row; } } $data['post'] = $posts; $data['total'] = count($data['post']); $data['unsubscribeLink'] = DiscussHelper::getUnsubscribeLink($subscriber, true, true); $subject = $date->toMySQL(); switch (strtoupper($this->interval)) { case 'DAILY': $subject = $date->toFormat('%F'); $data['interval'] = JText::_('today'); break; case 'WEEKLY': $subject = $date->toFormat('%V'); $data['interval'] = JText::_('this week'); break; case 'MONTHLY': $subject = $date->toFormat('%B'); $data['interval'] = JText::_('this month'); break; } if (!empty($data['post'])) { $notify->addQueue($subscriber->email, JText::sprintf('COM_EASYDISCUSS_YOUR_' . $this->interval . '_SUBSCRIPTION', $subject), '', 'email.subscription.site.interval.php', $data); } $subscribe = DiscussHelper::getTable('Subscribe'); $subscribe->load($subscriber->id); $subscribe->sent_out = $now; $subscribe->store(); } }
/** * Displays the user's points achievement history * * @since 2.0 * @access public */ public function history($tmpl = null) { $app = JFactory::getApplication(); $id = JRequest::getInt('id'); if (!$id) { DiscussHelper::setMessageQueue(JText::_('Unable to locate the id of the user.'), DISCUSS_QUEUE_ERROR); $app->redirect('index.php?option=com_easydiscuss'); $app->close(); } $model = DiscussHelper::getModel('Points', true); $history = $model->getPointsHistory($id); foreach ($history as $item) { $date = DiscussDateHelper::dateWithOffSet($item->created); $item->created = $date->toFormat('%A, %b %e %Y'); $points = DiscussHelper::getHelper('Points')->getPoints($item->command); if ($points) { if ($points[0]->rule_limit < 0) { $item->class = 'badge-important'; $item->points = $points[0]->rule_limit; } else { $item->class = 'badge-info'; $item->points = '+' . $points[0]->rule_limit; } } else { $item->class = 'badge-info'; $item->points = '+'; } } $theme = new DiscussThemes(); $theme->set('history', $history); echo $theme->fetch('points.history.php'); }
public function display($tpl = null) { // Initialise variables $config = DiscussHelper::getConfig(); $catId = JRequest::getVar('catid', ''); $cat = JTable::getInstance('Category', 'Discuss'); $cat->load($catId); $this->cat = $cat; $this->addPathway('Home', 'index.php?option=com_easydiscuss'); $this->addPathway(JText::_('Categories'), 'index.php?option=com_easydiscuss&view=categories'); if ($catId) { $this->addPathway('Edit Category'); } else { $this->addPathway('New Category'); } // Set default values for new entries. if (empty($cat->created)) { $date = DiscussDateHelper::getDate(); $now = DiscussDateHelper::toFormat($date); $cat->created = $now; $cat->published = true; } $catRuleItems = JTable::getInstance('CategoryAclItem', 'Discuss'); $categoryRules = $catRuleItems->getAllRuleItems(); $assignedGroupACL = $cat->getAssignedACL('group'); $assignedUserACL = $cat->getAssignedACL('user'); $assignedGroupMod = $cat->getAssignedModerator('group'); $assignedUserMod = $cat->getAssignedModerator('user'); $joomlaGroups = DiscussHelper::getJoomlaUserGroups(); $parentList = DiscussHelper::populateCategories('', '', 'select', 'parent_id', $cat->parent_id); $jConfig = DiscussHelper::getJConfig(); $editor = JFactory::getEditor($jConfig->get('editor')); $this->assignRef('editor', $editor); $this->assignRef('cat', $cat); $this->assignRef('config', $config); $this->assignRef('acl', $acl); $this->assignRef('parentList', $parentList); $this->assignRef('categoryRules', $categoryRules); $this->assignRef('assignedGroupACL', $assignedGroupACL); $this->assignRef('assignedUserACL', $assignedUserACL); $this->assignRef('assignedGroupMod', $assignedGroupMod); $this->assignRef('assignedUserMod', $assignedUserMod); $this->assignRef('joomlaGroups', $joomlaGroups); parent::display($tpl); }
public static function dateWithOffSet($str = '') { $userTZ = DiscussDateHelper::getOffSet(); $date = DiscussHelper::getDate($str); if (DiscussHelper::getJoomlaVersion() >= '1.6') { $user = JFactory::getUser(); $config = DiscussHelper::getConfig(); $jConfig = DiscussHelper::getJConfig(); // temporary ignore the dst in joomla 1.6 if ($user->id != 0) { $userTZ = $user->getParam('timezone'); } if (empty($userTZ)) { $userTZ = $jConfig->get('offset'); } $tmp = new DateTimeZone($userTZ); $date->setTimeZone($tmp); } else { $date->setOffset($userTZ); } return $date; }
echo $row->reportCnt; ?> </a> <?php } else { ?> <?php echo $row->reportCnt; ?> <?php } ?> </td> <td align="center" class="center"> <?php echo DiscussDateHelper::toFormat($date); ?> </td> <td align="center" class="center"> <?php echo $published; ?> </td> <td class="center"> <div id="action-container-<?php echo $row->id; ?> "> <?php echo $actionsDropdown; ?>
public function getLastOnline($front = false) { $config = DiscussHelper::getConfig(); $date = DiscussDateHelper::dateWithOffSet($this->user->lastvisitDate); if ($front) { return $date->toFormat('%l.%M %P, %d/%m/%Y'); } else { return $date->toFormat('%d/%m/%Y'); } }
<div class="span7"> <?php echo $this->renderCheckbox('published', $this->label->published); ?> </div> </div> <div class="si-form-row"> <div class="span5 form-row-label"> <label><?php echo JText::_('Created'); ?> </label> </div> <div class="span7"> <input type="text" id="datepicker" class="full-width" name="created_time" value="<?php echo DiscussDateHelper::toFormat($this->label->created, '%A, %B %d %Y'); ?> " /> </div> </div> </div> </div> </div> </div> </div> <?php echo JHTML::_('form.token'); ?> <input type="hidden" name="option" value="com_easydiscuss" /> <input type="hidden" name="controller" value="labels" />
<div class="span7"> <?php echo $this->renderCheckbox('published', $this->role->published); ?> </div> </div> <div class="si-form-row"> <div class="span5 form-row-role"> <label><?php echo JText::_('COM_EASYDISCUSS_ROLES_CREATION_DATE'); ?> </label> </div> <div class="span7"> <input type="text" id="datepicker" class="full-width" name="created_time" value="<?php echo DiscussDateHelper::toFormat($this->role->created_time, '%A, %B %d %Y'); ?> " /> </div> </div> </div> </div> </div> </div> </div> <?php echo JHTML::_('form.token'); ?> <input type="hidden" name="option" value="com_easydiscuss" /> <input type="hidden" name="controller" value="roles" />
</div> <?php } ?> <?php if ($params->get('show_footer')) { ?> <div class="item-info push-top small"> <span> <img src="<?php echo JURI::root(); ?> modules/mod_recentdiscussions/images/clock.png"> <?php echo DiscussDateHelper::getLapsedTime($post->created); ?> </span> <span data-original-title="<?php echo $post->num_replies . ' ' . JText::_('MOD_RECENTDISCUSSIONS_REPLIES'); ?> " rel="ed-tooltip"> <img src="<?php echo JURI::root(); ?> modules/mod_recentdiscussions/images/replies.png"> <?php echo $post->num_replies; ?> </span> <span data-original-title="<?php
public function getComments($postId, $limit = null, $limitstart = null) { $db = DiscussHelper::getDBO(); $date = DiscussDateHelper::getDate(); $offset = DiscussDateHelper::getOffSet(true); $query = 'SELECT DATEDIFF(' . $db->Quote($date->toMySQL(true)) . ', DATE_ADD(a.`created`, INTERVAL ' . $offset . ' HOUR ) ) as `noofdays`, ' . ' DATEDIFF(' . $db->Quote($date->toMySQL(true)) . ', DATE_ADD(a.`created`, INTERVAL ' . $offset . ' HOUR ) ) as `daydiff`, ' . ' TIMEDIFF(' . $db->Quote($date->toMySQL(true)) . ', DATE_ADD(a.`created`, INTERVAL ' . $offset . ' HOUR ) ) as `timediff`, ' . ' a.* '; $query .= ' FROM `#__discuss_comments` AS a'; if (is_array($postId)) { if (count($postId) == 1) { $query .= ' WHERE a.`post_id` = ' . $db->Quote($postId); $query .= ' ORDER BY a.`created` ASC'; } else { $query .= ' WHERE a.`post_id` IN (' . implode(',', $postId) . ')'; $query .= ' ORDER BY a.post_id, a.`created` ASC'; } } else { $query .= ' WHERE a.`post_id` = ' . $db->Quote($postId); $query .= ' ORDER BY a.`created` ASC'; } if ($limit !== null) { if ($limitstart !== null) { $query .= ' LIMIT ' . $limitstart . ',' . $limit; } else { $query .= ' LIMIT ' . $limit; } } $db->setQuery($query); $result = $db->loadObjectList(); return $result; }
?> </label></div> <div class="span8"> <?php echo $this->renderCheckbox('published', $this->point->get('published', 1)); ?> </div> </div> <div class="si-form-row"> <div class="span4 form-row-label"><label><?php echo JText::_('COM_EASYDISCUSS_CREATION_DATE'); ?> </label></div> <div class="span8"> <?php echo DiscussDateHelper::toFormat($this->point->created, '%A, %B %d %Y, %I:%M %p'); ?> </div> </div> <div class="si-form-row"> <div class="span4 form-row-label"><label><?php echo JText::_('COM_EASYDISCUSS_POINT_ACTION'); ?> </label></div> <div class="span8"> <select name="rule_id" onchange="showDescription( this.value );" class="full-width" > <option value="0"<?php echo !$this->point->get('rule_id') ? ' selected="selected"' : ''; ?> ><?php echo JText::_('COM_EASYDISCUSS_SELECT_RULE');
</label> </div> <div class="span7" rel="ed-popover" data-placement="left" data-original-title="<?php echo JText::_('COM_EASYDISCUSS_CATEGORIES_EDIT_CATEGORY_CREATED'); ?> " data-content="<?php echo JText::_('COM_EASYDISCUSS_CATEGORIES_EDIT_CATEGORY_CREATED_DESC'); ?> " > <?php echo DiscussDateHelper::toFormat(DiscussDateHelper::dateWithOffset($this->cat->created), '%A, %B %d %Y, %I:%M %p'); ?> </div> </div> <div class="si-form-row"> <div class="span5 form-row-label"> <label> <?php echo JText::_('COM_EASYDISCUSS_CATEGORIES_EDIT_SHOW_DESCRIPTION'); ?> </label> </div> <div class="span7" rel="ed-popover" data-placement="left" data-original-title="<?php
public function store($alterOrdering = false) { if (empty($this->created)) { $offset = DiscussDateHelper::getOffSet(); $newDate = DiscussHelper::getDate('', $offset); $this->created = $newDate->toMySQL(); } else { $newDate = DiscussHelper::getDate($this->created); $this->created = $newDate->toMySQL(); } $this->setAlias(); // Figure out the proper nested set model // No parent id, we use the current lft,rgt if ($alterOrdering) { if ($this->parent_id) { $left = $this->getLeft($this->parent_id); $this->lft = $left; $this->rgt = $this->lft + 1; // Update parent's right $this->updateRight($left); $this->updateLeft($left); } else { $this->lft = $this->getLeft() + 1; $this->rgt = $this->lft + 1; } } return parent::store(); }
?> </th> <th width="1%"><?php echo JText::_('COM_EASYDISCUSS_ID'); ?> </th> </tr> </thead> <tbody> <?php if ($this->mails) { $k = 0; $x = 0; for ($i = 0, $n = count($this->mails); $i < $n; $i++) { $row = $this->mails[$i]; $date = DiscussDateHelper::getDate($row->created); ?> <tr class="<?php echo "row{$k}"; ?> "> <td><?php echo JHTML::_('grid.id', $x++, $row->id); ?> </td> <td><?php echo $row->recipient; ?> </td> <td> <?php
function formatDate($format, $dateString) { $date = DiscussDateHelper::dateWithOffSet($dateString); return DiscussDateHelper::toFormat($date, $format); }