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(); } }
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); }
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; ?>
<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" />
?> </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
function formatDate($format, $dateString) { $date = DiscussDateHelper::dateWithOffSet($dateString); return DiscussDateHelper::toFormat($date, $format); }