function getEventTooltip($event_id) { global $AppUI; if (!$event_id) { return ''; } $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); // load the record data $event = new CEvent(); $event->loadFull($event_id); // load the event types $types = w2PgetSysVal('EventType'); // load the event recurs types $recurs = array('Never', 'Hourly', 'Daily', 'Weekly', 'Bi-Weekly', 'Every Month', 'Quarterly', 'Every 6 months', 'Every Year'); $obj = new CEvent(); $obj->event_id = $event_id; $assigned = $obj->getAssigned(); $start_date = $event->event_start_date ? new CDate($event->event_start_date) : null; $end_date = $event->event_end_date ? new CDate($event->event_end_date) : null; if ($event->event_project) { $event_project = $event->project_name; $event_company = $event->company_name; } $tt = '<table border="0" cellpadding="0" cellspacing="0" width="96%">'; $tt .= '<tr>'; $tt .= ' <td valign="top" width="50%">'; $tt .= ' <strong>' . $AppUI->_('Details') . '</strong>'; $tt .= ' <table cellspacing="3" cellpadding="2" width="100%">'; $tt .= ' <tr>'; $tt .= ' <td style="text-color:white;border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Type') . '</td>'; $tt .= ' <td width="100%" nowrap="nowrap">' . $AppUI->_($types[$event->event_type]) . '</td>'; $tt .= ' </tr> '; if ($event->event_project) { $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Company') . '</td>'; $tt .= ' <td width="100%">' . $event_company . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Project') . '</td>'; $tt .= ' <td width="100%">' . $event_project . '</td>'; $tt .= ' </tr>'; } $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Starts') . '</td>'; $tt .= ' <td nowrap="nowrap">' . ($start_date ? $start_date->format($df . ' ' . $tf) : '-') . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Ends') . '</td>'; $tt .= ' <td nowrap="nowrap">' . ($end_date ? $end_date->format($df . ' ' . $tf) : '-') . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Recurs') . '</td>'; $tt .= ' <td nowrap="nowrap">' . $AppUI->_($recurs[$event->event_recurs]) . ($event->event_recurs ? ' (' . $event->event_times_recuring . ' ' . $AppUI->_('times') . ')' : '') . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Attendees') . '</td>'; $tt .= ' <td nowrap="nowrap">'; if (is_array($assigned)) { $start = false; foreach ($assigned as $user) { if ($start) { $tt .= '<br />'; } else { $start = true; } $tt .= $user; } } $tt .= ' </tr>'; $tt .= ' </table>'; $tt .= ' </td>'; $tt .= ' <td width="50%" valign="top">'; $tt .= ' <strong>' . $AppUI->_('Note') . '</strong>'; $tt .= ' <table cellspacing="0" cellpadding="2" border="0" width="100%">'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;">'; $tt .= ' ' . mb_str_replace(chr(10), "<br />", $event->event_description) . ' '; $tt .= ' </td>'; $tt .= ' </tr>'; $tt .= ' </table>'; $tt .= ' </td>'; $tt .= '</tr>'; $tt .= '</table>'; return $tt; }
/* $Id$ $URL$ */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } $event_id = (int) w2PgetParam($_GET, 'event_id', 0); // check permissions for this record $perms =& $AppUI->acl(); $canRead = $perms->checkModuleItem($m, 'view', $event_id); if (!$canRead) { $AppUI->redirect('m=public&a=access_denied'); } $canEdit = $perms->checkModuleItem($m, 'edit', $event_id); // check if this record has dependencies to prevent deletion $msg = ''; $event = new CEvent(); $event->loadFull($event_id); $canDelete = canDelete($m, $event_id); // load the record data if (!$event) { $AppUI->setMsg('Event'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else { $AppUI->savePlace(); } //check if the user has view permission over the project if ($event->event_project && !$perms->checkModuleItem('projects', 'view', $event->event_project)) { $AppUI->redirect('m=public&a=access_denied'); } // load the event types $types = w2PgetSysVal('EventType');
function getEventTooltip($event_id) { global $AppUI; if (!$event_id) { return ''; } $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); // load the record data $event = new CEvent(); $event->loadFull($event_id); // load the event types $types = w2PgetSysVal('EventType'); // load the event recurs types $recurs = array('Never', 'Hourly', 'Daily', 'Weekly', 'Bi-Weekly', 'Every Month', 'Quarterly', 'Every 6 months', 'Every Year'); $obj = new CEvent(); $obj->event_id = $event_id; $assigned = $obj->getAssigned(); if ($event->event_project) { $event_project = $event->project_name; $event_company = $event->company_name; } $tt = '<table class="tool-tip">'; $tt .= '<tr>'; $tt .= ' <td valign="top" width="40%">'; $tt .= ' <strong>' . $AppUI->_('Details') . '</strong>'; $tt .= ' <table cellspacing="3" cellpadding="2" width="100%">'; $tt .= ' <tr>'; $tt .= ' <td class="tip-label">' . $AppUI->_('Type') . '</td>'; $tt .= ' <td>' . $AppUI->_($types[$event->event_type]) . '</td>'; $tt .= ' </tr> '; if ($event->event_project) { $tt .= ' <tr>'; $tt .= ' <td class="tip-label">' . $AppUI->_('Company') . '</td>'; $tt .= ' <td>' . $event_company . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td class="tip-label">' . $AppUI->_('Project') . '</td>'; $tt .= ' <td>' . $event_project . '</td>'; $tt .= ' </tr>'; } $tt .= ' <tr>'; $tt .= ' <td class="tip-label">' . $AppUI->_('Starts') . '</td>'; $tt .= ' <td>' . $AppUI->formatTZAwareTime($event->event_start_date, $df . ' ' . $tf) . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td class="tip-label">' . $AppUI->_('Ends') . '</td>'; $tt .= ' <td>' . $AppUI->formatTZAwareTime($event->event_end_date, $df . ' ' . $tf) . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td class="tip-label">' . $AppUI->_('Recurs') . '</td>'; $tt .= ' <td>' . $AppUI->_($recurs[$event->event_recurs]) . ($event->event_recurs ? ' (' . $event->event_times_recuring . ' ' . $AppUI->_('times') . ')' : '') . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td class="tip-label">' . $AppUI->_('Attendees') . '</td>'; $tt .= ' <td>'; $tt .= implode('<br />', $assigned); $tt .= ' </tr>'; $tt .= ' </table>'; $tt .= ' </td>'; $tt .= ' <td width="60%" valign="top">'; $tt .= ' <strong>' . $AppUI->_('Note') . '</strong>'; $tt .= ' <table cellspacing="0" cellpadding="2" border="0" width="100%">'; $tt .= ' <tr>'; $tt .= ' <td class="tip-label description">'; $tt .= ' ' . mb_str_replace(chr(10), "<br />", $event->event_description) . ' '; $tt .= ' </td>'; $tt .= ' </tr>'; $tt .= ' </table>'; $tt .= ' </td>'; $tt .= '</tr>'; $tt .= '</table>'; return $tt; }