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 function getDateJoined() { $config = DiscussHelper::getConfig(); $date = DiscussDateHelper::getDate($this->user->registerDate); return $date->toFormat('%d/%m/%Y'); }
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; }
?> </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