Пример #1
0
function calendar_user_month()
{
    $data = xarMod::apiFunc('calendar', 'user', 'getUserDateTimeInfo');
    $MonthEvents = new Calendar_Month_Weekdays($data['cal_year'], $data['cal_month'] + 1, xarModVars::get('calendar', 'cal_sdow'));
    $end_time = $MonthEvents->getTimestamp();
    $MonthEvents = new Calendar_Month_Weekdays($data['cal_year'], $data['cal_month'], xarModVars::get('calendar', 'cal_sdow'));
    $start_time = $MonthEvents->getTimestamp();
    $q = new Query('SELECT');
    $a[] = $q->plt('start_time', $start_time);
    $a[] = $q->pge('start_time + duration', $start_time);
    $b[] = $q->plt('start_time', $end_time);
    $b[] = $q->pge('start_time + duration', $end_time);
    $c[] = $q->pgt('start_time', $start_time);
    $c[] = $q->ple('start_time + duration', $end_time);
    $d[] = $q->pqand($a);
    $d[] = $q->pqand($b);
    $d[] = $q->pqand($c);
    $q->qor($d);
    $q->eq('role_id', xarSession::getVar('role_id'));
    $data['conditions'] = $q;
    return $data;
}
Пример #2
0
 public function setup($timeframe, $role_id)
 {
     $data = xarMod::apiFunc('calendar', 'user', 'getUserDateTimeInfo');
     switch ($timeframe) {
         case 'week':
             $WeekEvents = new Calendar_Week($data['cal_year'], $data['cal_month'], $data['cal_day'], CALENDAR_FIRST_DAY_OF_WEEK);
             $start_time = $WeekEvents->thisWeek;
             $end_time = $WeekEvents->nextWeek;
             $events = $this->getEvents($start_time, $end_time, $role_id);
             $WeekDecorator = new WeekEvent_Decorator($WeekEvents);
             $WeekDecorator->build($events);
             $data['Week'] =& $WeekDecorator;
             $data['cal_sdow'] = CALENDAR_FIRST_DAY_OF_WEEK;
             break;
         case 'month':
             $MonthEvents = new Calendar_Month_Weekdays($data['cal_year'], $data['cal_month'] + 1, xarModVars::get('calendar', 'cal_sdow'));
             $end_time = $MonthEvents->getTimestamp();
             $MonthEvents = new Calendar_Month_Weekdays($data['cal_year'], $data['cal_month'], xarModVars::get('calendar', 'cal_sdow'));
             $start_time = $MonthEvents->getTimestamp();
             $events = $this->getEvents($start_time, $end_time, $role_id);
             $MonthDecorator = new MonthEvent_Decorator($MonthEvents);
             $MonthDecorator->build($events);
             $data['Month'] =& $MonthDecorator;
             break;
         case 'year':
             $Year = new Calendar_Year($data['cal_year'] + 1);
             $end_time = $Year->getTimestamp();
             $Year = new Calendar_Year($data['cal_year']);
             $start_time = $Year->getTimestamp();
             $events = $this->getEvents($start_time, $end_time, $role_id);
             $YearDecorator = new YearEvent_Decorator($Year);
             $YearDecorator->build($events);
             $data['Year'] =& $YearDecorator->calendar;
             $data['cal_sdow'] = CALENDAR_FIRST_DAY_OF_WEEK;
             break;
     }
     return $data;
 }
Пример #3
0
foreach ($events as $event) {
    if (!$event['event_isrecur']) {
        $eventsArray[] = $event;
    } else {
        $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startMonth, $endMonth);
        foreach ($recurEvents as $recurEvent) {
            $eventsArray[] = $recurEvent;
        }
    }
}
// Formating date
$eventHandler->formatEventsDate($eventsArray, $xoopsModuleConfig['event_date_month']);
// Assigning events to the template
$xoopsTpl->assign('events', $eventsArray);
// Retriving categories
$cats = $catHandler->objectToArray($catHandler->getAllCat($xoopsUser));
// Assigning categories to the template
$xoopsTpl->assign('cats', $cats);
// Making navig data
$monthCalObj = new Calendar_Month_Weekdays($year, $month);
$pMonthCalObj = $monthCalObj->prevMonth('object');
$nMonthCalObj = $monthCalObj->nextMonth('object');
$navig = array('prev' => array('uri' => 'year=' . $pMonthCalObj->thisYear() . '&month=' . $pMonthCalObj->thisMonth(), 'name' => $extcalTimeHandler->getFormatedDate($xoopsModuleConfig['nav_date_month'], $pMonthCalObj->getTimestamp())), 'this' => array('uri' => 'year=' . $monthCalObj->thisYear() . '&month=' . $monthCalObj->thisMonth(), 'name' => $extcalTimeHandler->getFormatedDate($xoopsModuleConfig['nav_date_month'], $monthCalObj->getTimestamp())), 'next' => array('uri' => 'year=' . $nMonthCalObj->thisYear() . '&month=' . $nMonthCalObj->thisMonth(), 'name' => $extcalTimeHandler->getFormatedDate($xoopsModuleConfig['nav_date_month'], $nMonthCalObj->getTimestamp())));
// Assigning navig data to the template
$xoopsTpl->assign('navig', $navig);
// Assigning current form navig data to the template
$xoopsTpl->assign('selectedCat', $cat);
$xoopsTpl->assign('year', $year);
$xoopsTpl->assign('month', $month);
$xoopsTpl->assign('view', "month");
include XOOPS_ROOT_PATH . '/footer.php';