Quote:
Biteronboard wrote:
I am running the latest version of this module.
I have scoured every possible knowledgebase on this subject.
Yet I am having a somewhat similar problem.
Via admin Panel, when looking at Events.
The events are not chronological, instead they are sorted by last modification.
Does anyone know of a method to force the events to sort chronologically here?
Also, Does anyone know where to find the hack to sort the category's alphabetically?
Zoullou's site has 0 usable info.
Took me some time to see how I did it (long ago)
fixes the user-side yearly sorting for by-date-sorting
open /class/event.php
around line 165 look for:
}
return $this->getObjects($criteriaCompo);
}
function getEventMonth($month, $year, $user, $cats=0)
{
$userStartTime = mktime(0,0,0,$month,1,$year);
$userEndTime = mktime(23,59,59,$month+1,0,$year);
$monthStart = userTimeToServerTime($userStartTime, $this->_extcalTime->_getUserTimeZone($user));
$monthEnd = userTimeToServerTime($userEndTime, $this->_extcalTime->_getUserTimeZone($user));
$criteriaCompo = new CriteriaCompo();
$authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
$criteriaCompo->add(new Criteria('event_start', $monthEnd, '<='));
$criteriaCompo->add(new Criteria('event_end', $monthStart, '>='));
$criteriaCompo->add(new Criteria('event_approved', 1));
if(!is_array($cats) && $cats > 0) {
$criteriaCompo->add(new Criteria('cat_id', $cats));
}
if(is_array($cats)) {
if(array_search(0, $cats) === false) {
$in = '('.current($cats);
array_shift($cats);
foreach($cats as $cat) {
$in .= ','.$cat;
}
$in .= ')';
$criteriaCompo->add(new Criteria('cat_id', $in, 'IN'));
}
}
$count = count($authorizedAccessCats);
if($count > 0) {
$in = '('.$authorizedAccessCats[0];
array_shift($authorizedAccessCats);
foreach($authorizedAccessCats as $authorizedAccessCat) {
$in .= ','.$authorizedAccessCat;
}
$in .= ')';
$criteriaCompo->add(new Criteria('cat_id', $in, 'IN'));
} else {
$criteriaCompo->add(new Criteria('cat_id', '(0)', 'IN'));
}
return $this->getObjects($criteriaCompo);
}
function getEventYear($year, $user, $cat=0)
{
$userStartTime = mktime(0,0,0,1,1,$year);
$userEndTime = mktime(23,59,59,12,31,$year);
$yearStart = userTimeToServerTime($userStartTime, $this->_extcalTime->_getUserTimeZone($user));
$yearEnd = userTimeToServerTime($userEndTime, $this->_extcalTime->_getUserTimeZone($user));
$criteriaCompo = new CriteriaCompo();
$authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
$criteriaCompo->add(new Criteria('event_start', $yearEnd, '<='));
$criteriaCompo->add(new Criteria('event_end', $yearStart, '>='));
$criteriaCompo->add(new Criteria('event_approved', 1));
if($cat > 0) {
$criteriaCompo->add(new Criteria('cat_id', $cat));
}
$count = count($authorizedAccessCats);
if($count > 0) {
$in = '('.$authorizedAccessCats[0];
array_shift($authorizedAccessCats);
foreach($authorizedAccessCats as $authorizedAccessCat) {
$in .= ','.$authorizedAccessCat;
}
$in .= ')';
$criteriaCompo->add(new Criteria('cat_id', $in, 'IN'));
} else {
$criteriaCompo->add(new Criteria('cat_id', '(0)', 'IN'));
}
return $this->getObjects($criteriaCompo);
}
replace with
}
$criteriaCompo->setSort('event_start');
return $this->getObjects($criteriaCompo);
}
function getEventThisDay($user, $limit, $cats)
{
$time = mktime(0,0,0,date("n"),date("j"),date("Y"));
$dayStart = userTimeToServerTime($time, $this->_extcalTime->_getUserTimeZone($user));
$dayEnd = userTimeToServerTime($time+86399, $this->_extcalTime->_getUserTimeZone($user));
$criteriaCompo = new CriteriaCompo();
$authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
$criteriaCompo->add(new Criteria('event_start', $dayEnd, '<='));
$criteriaCompo->add(new Criteria('event_end', $dayStart, '>='));
$criteriaCompo->add(new Criteria('event_approved', 1));
if(!is_array($cats) && $cats > 0) {
$criteriaCompo->add(new Criteria('cat_id', $cats));
}
if(is_array($cats)) {
if(array_search(0, $cats) === false) {
$in = '('.current($cats);
array_shift($cats);
foreach($cats as $cat) {
$in .= ','.$cat;
}
$in .= ')';
$criteriaCompo->add(new Criteria('cat_id', $in, 'IN'));
}
}
$criteriaCompo->setSort('event_start');
return $this->getObjects($criteriaCompo);
}
function getEventMonth($month, $year, $user, $cats=0)
{
$userStartTime = mktime(0,0,0,$month,1,$year);
$userEndTime = mktime(23,59,59,$month+1,0,$year);
$monthStart = userTimeToServerTime($userStartTime, $this->_extcalTime->_getUserTimeZone($user));
$monthEnd = userTimeToServerTime($userEndTime, $this->_extcalTime->_getUserTimeZone($user));
$criteriaCompo = new CriteriaCompo();
$authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
$criteriaCompo->add(new Criteria('event_start', $monthEnd, '<='));
$criteriaCompo->add(new Criteria('event_end', $monthStart, '>='));
$criteriaCompo->add(new Criteria('event_approved', 1));
if(!is_array($cats) && $cats > 0) {
$criteriaCompo->add(new Criteria('cat_id', $cats));
}
if(is_array($cats)) {
if(array_search(0, $cats) === false) {
$in = '('.current($cats);
array_shift($cats);
foreach($cats as $cat) {
$in .= ','.$cat;
}
$in .= ')';
$criteriaCompo->add(new Criteria('cat_id', $in, 'IN'));
}
}
$count = count($authorizedAccessCats);
if($count > 0) {
$in = '('.$authorizedAccessCats[0];
array_shift($authorizedAccessCats);
foreach($authorizedAccessCats as $authorizedAccessCat) {
$in .= ','.$authorizedAccessCat;
}
$in .= ')';
$criteriaCompo->add(new Criteria('cat_id', $in, 'IN'));
} else {
$criteriaCompo->add(new Criteria('cat_id', '(0)', 'IN'));
}
$criteriaCompo->setSort('event_start');
$criteriaCompo->setOrder('DESC');
return $this->getObjects($criteriaCompo);
}
function getEventYear($year, $user, $cat=0)
{
$userStartTime = mktime(0,0,0,1,1,$year);
$userEndTime = mktime(23,59,59,12,31,$year);
$yearStart = userTimeToServerTime($userStartTime, $this->_extcalTime->_getUserTimeZone($user));
$yearEnd = userTimeToServerTime($userEndTime, $this->_extcalTime->_getUserTimeZone($user));
$criteriaCompo = new CriteriaCompo();
$authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
$criteriaCompo->add(new Criteria('event_start', $yearEnd, '<='));
$criteriaCompo->add(new Criteria('event_end', $yearStart, '>='));
$criteriaCompo->add(new Criteria('event_approved', 1));
if($cat > 0) {
$criteriaCompo->add(new Criteria('cat_id', $cat));
}
$count = count($authorizedAccessCats);
if($count > 0) {
$in = '('.$authorizedAccessCats[0];
array_shift($authorizedAccessCats);
foreach($authorizedAccessCats as $authorizedAccessCat) {
$in .= ','.$authorizedAccessCat;
}
$in .= ')';
$criteriaCompo->add(new Criteria('cat_id', $in, 'IN'));
} else {
$criteriaCompo->add(new Criteria('cat_id', '(0)', 'IN'));
}
$criteriaCompo->setSort('event_start');
$criteriaCompo->setOrder('DESC');
return $this->getObjects($criteriaCompo);
}
I'm using version 2 with XOOPS 2.2.x