/** * Sub-function to collect events within a period * @param Date the starting date of the period * @param Date the ending date of the period * @param array by-ref an array of links to append new items to * @param int the length to truncate entries by * @author Andrew Eddie <*****@*****.**> */ function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen) { global $AppUI, $event_filter; $events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter); // assemble the links for the events foreach ($events as $row) { $start = new CDate($row['event_start_date']); $end = new CDate($row['event_end_date']); $date = $start; $date->setTime(0, 0, 0); $cwd = explode(',', $GLOBALS['dPconfig']['cal_working_days']); for ($i = 0, $x = $end->dateDiff($start); $i <= $x; $i++) { // the link // optionally do not show events on non-working days if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) { $link['href'] = '?m=calendar&a=view&event_id=' . $row['event_id']; $link['alt'] = $row['event_description']; $link['text'] = dPshowImage(dPfindImage('event' . $row['event_type'] . '.png', 'calendar'), 16, 16) . htmlspecialchars($row['event_title']); if ($i == 0) { $link['alt'] .= ' [' . $AppUI->_('START') . ']'; } if ($i == $x) { $link['alt'] .= ' [' . $AppUI->_('END') . ']'; } $links[$date->format(FMT_TIMESTAMP_DATE)][] = $link; } $date = $date->getNextDay(); } } }
/** * Sub-function to collect events within a period * @param Date the starting date of the period * @param Date the ending date of the period * @param array by-ref an array of links to append new items to * @param int the length to truncate entries by * @author Andrew Eddie <*****@*****.**> */ function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $minical = false) { global $event_filter; $events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter); $cwd = explode(',', w2PgetConfig('cal_working_days')); // assemble the links for the events foreach ($events as $row) { $start = new CDate($row['event_start_date']); $end = new CDate($row['event_end_date']); $date = $start; for ($i = 0, $i_cmp = $start->dateDiff($end); $i <= $i_cmp; $i++) { // the link // optionally do not show events on non-working days if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) { if ($minical) { $link = array(); } else { $url = '?m=calendar&a=view&event_id=' . $row['event_id']; $link['href'] = ''; $link['alt'] = ''; $link['text'] = w2PtoolTip($row['event_title'], getEventTooltip($row['event_id']), true) . w2PshowImage('event' . $row['event_type'] . '.png', 16, 16, '', '', 'calendar') . '</a> ' . '<a href="' . $url . '"><span class="event">' . $row['event_title'] . '</span></a>' . w2PendTip(); } $links[$date->format(FMT_TIMESTAMP_DATE)][] = $link; } $date = $date->getNextDay(); } } }
/** * Sub-function to collect events within a period * @param Date the starting date of the period * @param Date the ending date of the period * @param array by-ref an array of links to append new items to * @param int the length to truncate entries by * @author Andrew Eddie <*****@*****.**> */ function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen) { global $event_filter; $events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter); // assemble the links for the events foreach ($events as $row) { $start = new CDate($row['event_start_date']); $end = new CDate($row['event_end_date']); $date = $start; $cwd = explode(",", $GLOBALS["dPconfig"]['cal_working_days']); for ($i = 0; $i <= $start->dateDiff($end); $i++) { // the link // optionally do not show events on non-working days if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) { $url = '?m=calendar&a=view&event_id=' . $row['event_id']; $link['href'] = ''; $link['alt'] = $row['event_description']; $link['text'] = '<table cellspacing="0" cellpadding="0" border="0"><tr>' . '<td><a href=' . $url . '>' . dPshowImage(dPfindImage('event' . $row['event_type'] . '.png', 'calendar'), 16, 16, '') . '</a></td>' . '<td><a href="' . $url . '" title="' . $row['event_description'] . '"><span class="event">' . $row['event_title'] . '</span></a>' . '</td></tr></table>'; $links[$date->format(FMT_TIMESTAMP_DATE)][] = $link; } $date = $date->getNextDay(); } } }
// check tasks access $result = array(); foreach ($tasks as $key => $row) { $obj->load($row['task_id']); $canAccess = $obj->canAccess(); if (!$canAccess) { continue; } $result[$key] = $row; } // execute and return return $result; } } // assemble the links for the events $events = CEvent::getEventsForPeriod($first_time, $last_time, $event_filter, $user_id); $events2 = array(); $tasks = CTask_ex::getAllTasksForPeriod($first_time, $last_time, $company_id); $start_hour = w2PgetConfig('cal_day_start'); $end_hour = w2PgetConfig('cal_day_end'); foreach ($events as $row) { $start = new w2p_Utilities_Date($row['event_start_date']); $end = new w2p_Utilities_Date($row['event_end_date']); $events2[$start->format('%H%M%S')][] = $row; if ($start_hour > $start->format('%H')) { $start_hour = $start->format('%H'); } if ($end_hour < $end->format('%H')) { $end_hour = $end->format('%H'); } }
/* $Id: projects_tab.events.php 5691 2008-04-30 21:34:23Z merlinyoda $ */ if (!defined('DP_BASE_DIR')) { die('You should not access this file directly.'); } global $AppUI, $project_id, $deny, $canRead, $canEdit, $dPconfig, $start_date, $end_date; global $this_day, $event_filter, $event_filter_list; require_once $AppUI->getModuleClass('calendar'); $perms =& $AppUI->acl(); $user_id = $AppUI->user_id; $other_users = false; $no_modify = false; $start_date = isset($start_date) ? $start_date : new CDate('0000-00-00 00:00:00'); $end_date = isset($end_date) ? $end_date : new CDate('9999-12-31 23:59:59'); // assemble the links for the events $events = CEvent::getEventsForPeriod($start_date, $end_date, 'all', null, $project_id); //echo '<pre>' . print_r($events, true) . '</pre>'; $start_hour = dPgetConfig('cal_day_start'); $end_hour = dPgetConfig('cal_day_end'); $tf = $AppUI->getPref('TIMEFORMAT'); $df = $AppUI->getPref('SHDATEFORMAT'); $types = dPgetSysVal('EventType'); ?> <table cellspacing="1" cellpadding="2" border="0" width="100%" class="tbl"> <tr> <th><?php echo $AppUI->_('Date'); ?> </th> <th><?php echo $AppUI->_('Type');
<?php /* $Id$ $URL$ */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } global $AppUI, $company_id, $deny, $canRead, $canEdit, $w2Pconfig, $start_date, $end_date, $this_day, $event_filter, $event_filter_list; $perms =& $AppUI->acl(); $user_id = $AppUI->user_id; $other_users = false; $no_modify = false; $start_date = new CDate('0000-00-00 00:00:00'); $end_date = new CDate('9999-12-31 23:59:59'); // assemble the links for the events $events = CEvent::getEventsForPeriod($start_date, $end_date, 'all', 0, 0, $company_id); $start_hour = w2PgetConfig('cal_day_start'); $end_hour = w2PgetConfig('cal_day_end'); $tf = $AppUI->getPref('TIMEFORMAT'); $df = $AppUI->getPref('SHDATEFORMAT'); $types = w2PgetSysVal('EventType'); $html = '<table cellspacing="1" cellpadding="2" border="0" width="100%" class="tbl">'; $html .= '<tr><th>' . $AppUI->_('Date') . '</th><th>' . $AppUI->_('Type') . '</th><th>' . $AppUI->_('Event') . '</th></tr>'; foreach ($events as $row) { $html .= '<tr>'; $start = new CDate($row['event_start_date']); $end = new CDate($row['event_end_date']); $html .= '<td width="25%" nowrap="nowrap">' . $start->format($df . ' ' . $tf) . ' - '; $html .= $end->format($df . ' ' . $tf) . '</td>'; $href = '?m=calendar&a=view&event_id=' . $row['event_id']; $alt = $row['event_description']; $html .= '<td width="10%" nowrap="nowrap">';
$this_week = new CDate($date); $dd = $this_week->getDay(); $mm = $this_week->getMonth(); $yy = $this_week->getYear(); // prepare time period for 'events' $first_time = new CDate(Date_calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $week_time = new CDate($first_time); // Can't use first_time after we adjust it. $first_time->setTime(0, 0, 0); $first_time->subtractSeconds(1); $last_time = new CDate(Date_calc::endOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $last_time->setTime(23, 59, 59); $prev_week = new CDate(Date_calc::beginOfPrevWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $next_week = new CDate(Date_calc::beginOfNextWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $tasks = CTask::getTasksForPeriod($first_time, $last_time, $company_id); $events = CEvent::getEventsForPeriod($first_time, $last_time); $links = array(); // assemble the links for the tasks require_once DP_BASE_DIR . '/modules/calendar/links_tasks.php'; getTaskLinks($first_time, $last_time, $links, 50, $company_id); // assemble the links for the events require_once DP_BASE_DIR . '/modules/calendar/links_events.php'; getEventLinks($first_time, $last_time, $links, 50); $cal_week = new CMonthCalendar($date); $cal_week->setEvents($links); // get the list of visible companies $company = new CCompany(); $companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name'); $companies = arrayMerge(array('0' => $AppUI->_('All')), $companies); // setup the title block $titleBlock = new CTitleBlock('Week View', 'myevo-appointments.png', $m, "{$m}.{$a}");
<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } // @todo convert to template global $AppUI, $project_id; $start_date = new w2p_Utilities_Date('2001-01-01 00:00:00'); $end_date = new w2p_Utilities_Date('2100-12-31 23:59:59'); $items = CEvent::getEventsForPeriod($start_date, $end_date, 'all', 0, $project_id); $module = new w2p_System_Module(); $fields = $module->loadSettings('events', 'project_view'); if (0 == count($fields)) { $fieldList = array('event_start_date', 'event_end_date', 'event_type', 'event_name'); $fieldNames = array('Start Date', 'End Date', 'Type', 'Event'); $module->storeSettings('events', 'project_view', $fieldList, $fieldNames); $fields = array_combine($fieldList, $fieldNames); } ?> <a name="events-project_view"> </a><?php $event_types = w2PgetSysVal('EventType'); $customLookups = array('event_type' => $event_types); $listTable = new w2p_Output_ListTable($AppUI); $listTable->df .= ' ' . $AppUI->getPref('TIMEFORMAT'); // @todo cleanup this hack echo $listTable->startTable(); echo $listTable->buildHeader($fields); echo $listTable->buildRows($items, $customLookups); echo $listTable->endTable();