Quote from: sottwell at Apr 02, 2010, 09:19 PM
I have a question. In the module, all I’m getting is a message "No Events to list for Current Month". How do I access previous events to delete or edit them?
sorry for the delayed response, that is a major issue with all the previous releases that is addressed in the coming, very very soon, 0.0.5b release.
in short the only way to edit this is to change the class file; you can try the following
//-- change Line 249 (the following)
$result = $this->_getEvents();
//-- to this Note: the first value, 5, is the number of events to list per page (default is 20 if Null)
$result = $this->_getEventsPagination(20,(isset($_REQUEST['pg']) ? $_REQUEST['pg'] : 0 ));
$pagination = $result[1];
$result = $result[0];
then add the following to the mxCalendar.class.php file
//-- Add this new function to the class file
//-- Events with pagination
function _getEventsPagination($limit=20,$page=0,$filter=NULL){
global $modx;
switch($filter){
default:
$where_or[] = 'startdate >= \''.date("Y-m-d").'\' ';
$where_or[] = '`repeat` REGEXP \''.date("Y-m-d").'\'';
$where_or[] = 'enddate <= \''.date("Y-m-d").'\'';
$where[] = 'E.active=1';
}
$eventsSQL = 'SELECT *,E.id as eid,E.category as catID, C.name as category, (SELECT DATEDIFF(E.enddate, E.startdate)) as DurationDays, (SELECT TIMEDIFF(E.endtime, E.starttime)) as DurationTime
FROM '.$modx->getFullTableName($this->tables['events']).' as E
LEFT JOIN '.$modx->getFullTableName($this->tables['categories']).' as C
ON E.category = C.id
WHERE '.implode(' or ',$where_or).' and '.implode(' and ', $where).'
ORDER BY startdate LIMIT '.($page*$limit).','.$limit;
$results = $modx->db->query($eventsSQL);
$eventsSQLpg = 'SELECT count(E.id)
FROM '.$modx->getFullTableName($this->tables['events']).' as E
LEFT JOIN '.$modx->getFullTableName($this->tables['categories']).' as C
ON E.category = C.id
WHERE '.implode(' or ',$where_or).' and '.implode(' and ', $where).'
ORDER BY startdate';
$resultsCount = $modx->db->query($eventsSQLpg);
$data = mysql_fetch_array($resultsCount);
$numevents = $data[0];
//-- create the pagination links
$resltLastPage = ceil($numevents/$limit);
$paginationLinks = '';
for($x=0;$x<$resltLastPage;$x++)
$paginationLinks .= " <a href='".(($x == $page) ? '#' : "?{$_SERVER['QUERY_STRING']}&pg={$x}")."' class='mxcPage".($x==$page ? 'active' : '')."'>".($x + 1)."</a> ";
return array($results,$paginationLinks);
}