Last active
January 4, 2017 14:12
Star
You must be signed in to star a gist
JEvents Latest Added Events Query / Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p><?php echo JText::_("JEV_CPANEL_LATEST_EVENTS_ADDED_DESC"); ?> </p> | |
<?php | |
// Get a db connection. | |
$db = JFactory::getDbo(); | |
// Create a new query object. | |
$query = $db->getQuery(true); | |
// Select all records from the user profile table where key begins with "custom.". | |
// Order it by the ordering field. | |
$query | |
->select(array('evdet_id','dtstart', 'dtend', 'summary', 'modified', 've.ev_id', 've.created', 've.created_by', 've.state', 've.modified_by')) | |
->from($db->quoteName('#__jevents_vevdetail')) | |
->leftJoin($db->quoteName('#__jevents_vevent') . 'AS ve ON ve.detail_id = evdet_id') | |
->where($db->quoteName('ve.state') . ' = 1') | |
->order('ve.created ASC') | |
->setLimit($limit); | |
// Reset the query using our newly populated query object. | |
$db->setQuery($query); | |
// Load the results as a list of stdClass objects (see later for more options on retrieving data). | |
$results = $db->loadObjectList(); | |
if (count($results) > 0) | |
{ | |
echo '<ul class="todo-list">'; | |
foreach ($results as $row) | |
{ | |
$user = JFactory::getUser($row->created_by); | |
echo '<li><span class="text">' . $row->summary . '</span> | |
<span class="label label-success"> ' . JText::sprintf("JEV_BY_SPRINT", $user->name) . '</span> | |
<div class="tools"> | |
<a href="index.php?option=com_jevents&task=icalevent.edit&evid=' . $row->ev_id . '"><i class="fa fa-edit"></i></a> | |
<a href="index.php?option=com_jevents&task=icalevent.delete&evid=' . $row->ev_id . '"><i class="fa fa-trash-o"></i></a> | |
</div> | |
</li>'; | |
} | |
echo '</ul>'; | |
} else { | |
echo JText::_('JEV_CPANEL_LATEST_EVENTS_ADDED_NONE'); | |
}?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Either my data is corrupt (yikes I hope not) or
should be