private function formatDate($mysqlDate) { $myDate = new w2p_Utilities_Date($mysqlDate); $myDatetime = $myDate->format('%Y%m%d %T'); $myDatetime = str_replace(':', '', $myDatetime); $myDatetime = str_replace(' ', 'T', $myDatetime) . 'Z'; return $myDatetime; }
protected function hook_preStore() { if ($this->budget_start_date) { $date = new w2p_Utilities_Date($this->budget_start_date); $this->budget_start_date = $date->format(FMT_DATETIME_MYSQL); } if ($this->budget_end_date) { $date = new w2p_Utilities_Date($this->budget_end_date); $this->budget_end_date = $date->format(FMT_DATETIME_MYSQL); } parent::hook_preStore(); }
$canRead = canView($m); if (!$canRead) { $AppUI->redirect('m=public&a=access_denied'); } $AppUI->savePlace(); w2PsetMicroTime(); // retrieve any state parameters if (isset($_REQUEST['company_id'])) { $AppUI->setState('CalIdxCompany', intval(w2PgetParam($_REQUEST, 'company_id', 0))); } $company_id = $AppUI->getState('CalIdxCompany', 0); // Using simplified set/get semantics. Doesn't need as much code in the module. $event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', 'my'), 'EVENTFILTER', 'my'); // get the passed timestamp (today if none) $ctoday = new w2p_Utilities_Date(); $today = $ctoday->format(FMT_TIMESTAMP_DATE); $date = w2PgetParam($_GET, 'date', $today); // 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('Monthly Calendar', 'myevo-appointments.png', $m, $m . '.' . $a); $titleBlock->addCrumb('?m=calendar&a=year_view&date=' . $date, 'year view'); $titleBlock->addCrumb('?m=calendar&date=' . $date, 'month view'); $titleBlock->addCrumb('?m=calendar&a=week_view&date=' . $date, 'week view'); $titleBlock->addCrumb('?m=calendar&a=day_view&date=' . $date, 'day view'); $titleBlock->addCell($AppUI->_('Company') . ':'); $titleBlock->addCell(arraySelect($companies, 'company_id', 'onChange="document.pickCompany.submit()" class="text"', $company_id), '', '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickCompany" accept-charset="utf-8">', '</form>'); $titleBlock->addCell($AppUI->_('Event Filter') . ':'); $titleBlock->addCell(arraySelect($event_filter_list, 'event_filter', 'onChange="document.pickFilter.submit()" class="text"', $event_filter, true), '', '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickFilter" accept-charset="utf-8">', '</form>');
} $forum = new CForum(); $forum->load($forum_id); $project = new CProject(); $project->load($forum->forum_project); $messages = $forum->getMessages(null, $forum_id, $message_id, $sort); // get the prefered date format $df = $AppUI->getPref('SHDATEFORMAT'); $df .= ' ' . $AppUI->getPref('TIMEFORMAT'); $pdfdata = array(); $pdfhead = array('Date', 'User', 'Message'); foreach ($messages as $row) { // Find the parent message - the topic. if ($row['message_id'] == $message_id) { $topic = $row['message_title']; } $date = new w2p_Utilities_Date($AppUI->formatTZAwareTime($row['message_date'], '%Y-%m-%d %T')); $pdfdata[] = array($date->format($df), $row['contact_display_name'], '<b>' . $row['message_title'] . '</b>' . "\n" . $row['message_body']); } $font_dir = W2P_BASE_DIR . '/lib/ezpdf/fonts'; $temp_dir = W2P_BASE_DIR . '/files/temp'; $output = new w2p_Output_PDFRenderer(); $pdf = $output->getPDF(); $pdf->selectFont($font_dir . '/Helvetica.afm'); $pdf->ezText('Project: ' . $project->project_name); $pdf->ezText('Forum: ' . $forum->forum_name); $pdf->ezText('Topic: ' . $topic); $pdf->ezText(''); $options = array('showLines' => 1, 'showHeadings' => 1, 'fontSize' => 8, 'rowGap' => 2, 'colGap' => 5, 'xPos' => 35, 'xOrientation' => 'right', 'width' => '400', 'cols' => array(0 => array('justification' => 'left', 'width' => 75), 1 => array('justification' => 'left', 'width' => 100), 2 => array('justification' => 'left', 'width' => 350))); $pdf->ezTable($pdfdata, $pdfhead, null, $options); $pdf->ezStream(array('Content-Disposition' => 'forum-thread-' . $forum_id . '.pdf'));
$df .= ' ' . $AppUI->getPref('TIMEFORMAT'); $contact_updatekey = $carr[$z][$x]['contact_updatekey']; $contact_lastupdate = $carr[$z][$x]['contact_lastupdate']; $contact_updateasked = $carr[$z][$x]['contact_updateasked']; $last_ask = new w2p_Utilities_Date($contact_updateasked); $lastAskFormatted = $last_ask->format($df); if (count($projectList) > 0) { echo '<a href="" onclick=" window.open(\'./index.php?m=public&a=selector&dialog=1&callback=goProject&table=projects&user_id=' . $carr[$z][$x]['contact_id'] . '\', \'selector\', \'left=50,top=50,height=250,width=400,resizable\');return false;">' . w2PshowImage('projects.png', '', '', $m, 'click to view projects associated with this contact') . '</a>'; } if ($contact_updateasked && (!$contact_lastupdate || $contact_lastupdate == 0) && $contact_updatekey) { echo w2PtoolTip('info', 'Waiting for Contact Update Information. (Asked on: ' . $lastAskFormatted . ')') . '<img src="' . w2PfindImage('log-info.gif') . '" style="float: right;">' . w2PendTip(); } elseif ($contact_updateasked && (!$contact_lastupdate || $contact_lastupdate == 0) && !$contact_updatekey) { echo w2PtoolTip('info', 'Waiting for too long! (Asked on ' . $lastAskFormatted . ')') . '<img src="' . w2PfindImage('log-error.gif') . '" style="float: right;">' . w2PendTip(); } elseif ($contact_updateasked && !$contact_updatekey) { $last_ask = new w2p_Utilities_Date($contact_lastupdate); echo w2PtoolTip('info', 'Update sucessfully done on: ' . $last_ask->format($df) . '') . '<img src="' . w2PfindImage('log-notice.gif') . '" style="float: right;">' . w2PendTip(); } ?> </span> </th> </table> </td> </tr> <tr> <?php reset($showfields); $s = ''; while (list($key, $val) = each($showfields)) { if (mb_strlen($carr[$z][$x][$key]) > 0) { if ($val == 'contact_email') { $s .= '<td class="hilite" colspan="2">' . w2p_email($carr[$z][$x][$key]) . '</td></tr>';
$result = $upd_task->store($AppUI); if (is_array($result)) { break; } } } //Action: Other Actions if (isset($_POST['bulk_task_other']) && $bulk_task_other != '') { if ($upd_task->task_id) { //Option 1 - Mark as finished if ($bulk_task_other == '1') { $upd_task->task_percent_complete = 100; if (!$upd_task->task_end_date || $upd_task->task_end_date == '0000-00-00 00:00:00') { $end_date = null; $end_date = new w2p_Utilities_Date(); $upd_task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL); } $result = $upd_task->store($AppUI); if (is_array($result)) { break; } //Option 2 - Mark as milestone } elseif ($bulk_task_other == '2') { $upd_task->task_milestone = 1; $result = $upd_task->store($AppUI); if (is_array($result)) { break; } //Option 3 - Mark as non milestone } elseif ($bulk_task_other == '3') { $upd_task->task_milestone = 0;
public function addHelpDeskTaskLog() { global $helpdesk_available; if ($helpdesk_available && $this->file_helpdesk_item != 0) { // create task log with information about the file that was uploaded $task_log = new CHDTaskLog(); $task_log->overrideDatabase($this->_query); $task_log->task_log_help_desk_id = $this->_hditem->item_id; if ($this->_message != 'deleted') { $task_log->task_log_name = 'File ' . $this->file_name . ' uploaded'; } else { $task_log->task_log_name = 'File ' . $this->file_name . ' deleted'; } $task_log->task_log_description = $this->file_description; $task_log->task_log_creator = $this->_AppUI->user_id; $date = new w2p_Utilities_Date(); $task_log->task_log_date = $date->format(FMT_DATETIME_MYSQL); if ($msg = $task_log->store()) { $this->_AppUI->setMsg($msg, UI_MSG_ERROR); } } return null; }
if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } $del = (int) w2PgetParam($_POST, 'del', 0); $obj = new CEvent(); if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect(); } if ($obj->event_start_date) { $start_date = new w2p_Utilities_Date($obj->event_start_date . $_POST['start_time']); $obj->event_start_date = $start_date->format(FMT_DATETIME_MYSQL); } if ($obj->event_end_date) { $end_date = new w2p_Utilities_Date($obj->event_end_date . $_POST['end_time']); $obj->event_end_date = $end_date->format(FMT_DATETIME_MYSQL); } $action = $del ? 'deleted' : 'stored'; $clashRedirect = false; if ($del) { $result = $obj->delete(); } else { if ($_POST['event_assigned'] > '' && ($clash = $obj->checkClash($_POST['event_assigned']))) { $last_a = $a; $GLOBALS['a'] = "clash"; $clashRedirect = true; } else { $result = $obj->store(); if (isset($_POST['event_assigned'])) { $obj->updateAssigned(explode(',', $_POST['event_assigned'])); }
function clash_process(CAppUI $AppUI) { global $do_include; $obj = new CEvent(); $obj->bind($_SESSION['add_event_post']); $attendees = $_SESSION['add_event_attendees']; $users = array(); if (isset($attendees) && $attendees) { $users = explode(',', $attendees); } array_push($users, $obj->event_owner); // First remove any duplicates $users = array_unique($users); // Now remove any null entries, so implode doesn't create a dud SQL // Foreach is safer as it works on a copy of the array. foreach ($users as $key => $user) { if (!$user) { unset($users[$key]); } } $start_date = new w2p_Utilities_Date($_POST['event_start_date'] . "000000"); $end_date = new w2p_Utilities_Date($_POST['event_end_date'] . "235959"); // First find any events in the range requested. $event_list = $obj->getEventsInWindow($start_date->format(FMT_DATETIME_MYSQL), $end_date->format(FMT_DATETIME_MYSQL), (int) ($_POST['start_time'] / 100), (int) ($_POST['end_time'] / 100), $users); $event_start_date = new w2p_Utilities_Date($_POST['event_start_date'] . $_POST['start_time']); $event_end_date = new w2p_Utilities_Date($_POST['event_end_date'] . $_POST['end_time']); if (!$event_list || !count($event_list)) { // First available date/time is OK, seed addEdit with the details. $obj->event_start_date = $event_start_date->format(FMT_DATETIME_MYSQL); $obj->event_end_date = $event_end_date->format(FMT_DATETIME_MYSQL); $_SESSION['add_event_post'] = get_object_vars($obj); $AppUI->setMsg('No clashes in suggested timespan', UI_MSG_OK); $_SESSION['event_is_clash'] = true; $_GET['event_id'] = $obj->event_id; $do_include = W2P_BASE_DIR . "/modules/calendar/addedit.php"; return; } // Now we grab the events, in date order, and compare against the // required start and end times. // Working in 30 minute increments from the start time, and remembering // the end time stipulation, find the first hole in the times. // Determine the duration in hours/minutes. $start_hour = (int) ($_POST['start_time'] / 10000); $start_minutes = (int) ($_POST['start_time'] % 10000 / 100); $start_time = $start_hour * 60 + $start_minutes; $end_hour = (int) ($_POST['end_time'] / 10000); $end_minutes = (int) ($_POST['end_time'] % 10000 / 100); $end_time = $end_hour * 60 + $end_minutes - $_POST['duration']; // First, build a set of "slots" that give us the duration // and start/end times we need $first_day = $start_date->format('%E'); $end_day = $end_date->format('%E'); $days_between = $end_day + 1 - $first_day; $oneday = new Date_Span(array(1, 0, 0, 0)); $slots = array(); $slot_count = 0; $first_date = new w2p_Utilities_Date($start_date); for ($i = 0; $i < $days_between; $i++) { if ($first_date->isWorkingDay()) { $slots[$i] = array(); for ($j = $start_time; $j <= $end_time; $j += 30) { $slot_count++; $slots[$i][] = array('date' => $first_date->format('%Y-%m-%d'), 'start_time' => $j, 'end_time' => $j + $_POST['duration'], 'committed' => false); } } $first_date->addSpan($oneday); } // Now process the events list foreach ($event_list as $event) { $sdate = new w2p_Utilities_Date($event['event_start_date']); $edate = new w2p_Utilities_Date($event['event_end_date']); $sday = $sdate->format('%E'); $day_offset = $sday - $first_day; // Now find the slots on that day that match list($syear, $smonth, $sday, $shour, $sminute, $ssecond) = sscanf($event['event_start_date'], "%4d-%2d-%2d %2d:%2d:%2d"); list($eyear, $emonth, $eday, $ehour, $eminute, $esecond) = sscanf($event['event_start_date'], "%4d-%2d-%2d %2d:%2d:%2d"); $start_mins = $shour * 60 + $sminute; $end_mins = $ehour * 60 + $eminute; if (isset($slots[$day_offset])) { foreach ($slots[$day_offset] as $key => $slot) { if ($start_mins <= $slot['end_time'] && $end_mins >= $slot['start_time']) { $slots[$day_offset][$key]['committed'] = true; } } } } // Third pass through, find the first uncommitted slot; foreach ($slots as $day_offset => $day_slot) { foreach ($day_slot as $slot) { if (!$slot['committed']) { $hour = (int) ($slot['start_time'] / 60); $min = $slot['start_time'] % 60; $ehour = (int) ($slot['end_time'] / 60); $emin = $slot['end_time'] % 60; $obj->event_start_date = $slot['date'] . ' ' . sprintf("%02d:%02d:00", $hour, $min); $obj->event_end_date = $slot['date'] . ' ' . sprintf("%02d:%02d:00", $ehour, $emin); $_SESSION['add_event_post'] = get_object_vars($obj); $AppUI->setMsg('First available time slot', UI_MSG_OK); $_SESSION['event_is_clash'] = true; $_GET['event_id'] = $obj->event_id; $do_include = W2P_BASE_DIR . '/modules/calendar/addedit.php'; return; } } } // If we get here we have found no available slots clear_clash(); $AppUI->setMsg('No times match your parameters', UI_MSG_ALERT); $AppUI->redirect(); }
switch ($rw['perc_assignment']) { case 100: $caption .= $rw['contact_display_name'] . ';'; break; default: $caption .= $rw['contact_display_name'] . ' [' . $rw['perc_assignment'] . '%];'; break; } } $q->clear(); $caption = mb_substr($caption, 0, mb_strlen($caption) - 1); } if ($flags == 'm') { $start = new w2p_Utilities_Date($start); $start->addDays(0); $s = $start->format($df); if ($caller == 'todo') { $gantt->addMilestone(array($name, $pname, '', $s, $s), $a['task_start_date']); } else { $gantt->addMilestone(array($name, '', $s, $s), $a['task_start_date']); } } else { $type = $a['task_duration_type']; $dur = $a['task_duration']; if ($type == 24) { $dur *= $w2Pconfig['daily_working_hours']; } if ($showWork == '1') { $work_hours = 0; $q = new w2p_Database_Query(); $q->addTable('tasks', 't');
$start_date = new w2p_Utilities_Date('2001-01-01 00:00:00'); $end_date = new w2p_Utilities_Date('2100-12-31 23:59:59'); // assemble the links for the events $events = CEvent::getEventsForPeriod($start_date, $end_date, 'all', 0, $project_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 w2p_Utilities_Date($row['event_start_date']); $end = new w2p_Utilities_Date($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">'; $html .= w2PshowImage('event' . $row['event_type'] . '.png', 16, 16, '', '', 'calendar'); $html .= ' <b>' . $AppUI->_($types[$row['event_type']]) . '</b><td>'; $html .= w2PtoolTip($row['event_title'], getEventTooltip($row['event_id']), true); $html .= '<a href="' . $href . '" class="event">'; $html .= $row['event_title']; $html .= '</a>'; $html .= w2PendTip(); $html .= '</td></tr>'; } $html .= '</table>'; echo $html;
echo $project['project_id']; ?> "><?php echo $project['project_name']; ?> </a> </td> <td nowrap="nowrap"><?php echo $project['contact_first_name']; ?> <?php echo $project['contact_last_name']; ?> </td> <td nowrap="nowrap"><?php echo $start_date->format($df); ?> </td> <td nowrap="nowrap"><?php echo $AppUI->_($pstatus[$project['project_status']]); ?> </td> <td nowrap="nowrap"> <?php echo $w2Pconfig['currency_symbol']; echo formatCurrency($project['project_target_budget'], $AppUI->getPref('CURRENCYFORM')); ?> </td> </tr> <?php }
} $q->clear(); $q->addQuery('a.*, b.resource_name'); $q->addTable('resource_tasks', 'a'); $q->addJoin('resources', 'b', 'a.resource_id = b.resource_id', 'inner'); $q->addWhere('a.task_id IN (' . implode(',', $task_list) . ')'); $res = $q->exec(); if (!$res) { $AppUI->setMsg(db_error(), UI_MSG_ERROR); $q->clear(); $AppUI->redirect(); } while ($row = db_fetch_assoc($res)) { $resources[$row['task_id']][$row['resource_id']] = $row['resource_name'] . ' [' . $row['percent_allocated'] . '%]'; } $q->clear(); } // Build the data columns foreach ($tasks as $task_id => $detail) { $row =& $pdfdata[]; $row[] = $detail['task_name']; $row[] = $detail['user_username']; $row[] = implode("\n", $assigned_users[$task_id]); if ($hasResources) { $row[] = implode("\n", $resources[$task_id]); } $end_date = new w2p_Utilities_Date($detail['task_end_date']); $row[] = $end_date->format($df); } $pdf->ezTable($pdfdata, $columns, $title, $options); $pdf->ezStream();
* @param string Formatted date */ function clickDay( idate, fdate ) { window.opener.<?php echo $callback; ?> (idate,fdate); window.close(); } </script> <table border="0" cellspacing="0" cellpadding="3" width="100%"> <tr> <?php $s = ''; for ($i = 0; $i < 12; $i++) { $this_month->setMonth($i + 1); $s .= '<td width="8%"><a href="index.php?m=public&a=calendar&dialog=1&callback=' . $callback . '&date=' . $this_month->format(FMT_TIMESTAMP_DATE) . '&uts=' . $prev_date . '" class="">' . substr($this_month->format('%b'), 0, 1) . '</a></td>'; } echo $s; ?> </tr> <tr> <?php echo '<td colspan="6" align="left">'; echo "<a href=\"index.php?m=public&a=calendar&dialog=1&callback={$callback}&date=" . $cal->prev_year->format(FMT_TIMESTAMP_DATE) . "&uts={$prev_date}\" class=\"\">" . $cal->prev_year->getYear() . '</a>'; echo '</td><td colspan="6" align="right">'; echo "<a href=\"index.php?m=public&a=calendar&dialog=1&callback={$callback}&date=" . $cal->next_year->format(FMT_TIMESTAMP_DATE) . "&uts={$prev_date}\" class=\"\">" . $cal->next_year->getYear() . '</a>'; echo '</td>'; ?> </tr> </table>
/** * This converts the date from the GMT/UTC value stored in the database to the * user-specific timezone specified by the user. */ public function formatTZAwareTime($datetime = '', $format = '') { $userTimezone = $this->getPref('TIMEZONE'); $userTimezone = '' == $userTimezone ? 'UTC' : $userTimezone; $userTZ = new DateTimeZone($userTimezone); $systemTZ = new DateTimeZone('UTC'); $ts = new DateTime($datetime, $systemTZ); $ts->setTimezone($userTZ); if ('' == $format) { $df = $this->getPref('FULLDATEFORMAT'); } else { $df = $format; $ts = new w2p_Utilities_Date($ts->format('Y-m-d H:i:s')); } return $ts->format($df); }
if ($log_pdf) { // make the PDF file $font_dir = W2P_BASE_DIR . '/lib/ezpdf/fonts'; $temp_dir = W2P_BASE_DIR . '/files/temp'; require $AppUI->getLibraryClass('ezpdf/class.ezpdf'); $pdf = new Cezpdf(); $pdf->ezSetCmMargins(1, 2, 1.5, 1.5); $pdf->selectFont($font_dir . '/Helvetica.afm'); $pdf->ezText(w2PgetConfig('company_name'), 12); if ($log_all) { $date = new w2p_Utilities_Date(); $pdf->ezText("\nAll hours as of " . $date->format($df), 8); } else { $sdate = new w2p_Utilities_Date($log_start_date); $edate = new w2p_Utilities_Date($log_end_date); $pdf->ezText("\nHours from " . $sdate->format($df) . ' to ' . $edate->format($df), 8); } $pdf->selectFont($font_dir . '/Helvetica-Bold.afm'); $pdf->ezText("\n" . $AppUI->_('Overall Report'), 12); foreach ($allpdfdata as $company => $data) { $title = $company; $options = array('showLines' => 1, 'showHeadings' => 0, 'fontSize' => 8, 'rowGap' => 2, 'colGap' => 5, 'xPos' => 50, 'xOrientation' => 'right', 'width' => '500', 'cols' => array(0 => array('justification' => 'left', 'width' => 250), 1 => array('justification' => 'right', 'width' => 120))); $pdf->ezTable($data, null, $title, $options); } $w2pReport = new CReport(); if ($fp = fopen($temp_dir . '/' . $w2pReport->getFilename() . '.pdf', 'wb')) { fwrite($fp, $pdf->ezOutput()); fclose($fp); echo '<a href="' . W2P_BASE_URL . '/files/temp/' . $w2pReport->getFilename() . '.pdf" target="pdf">'; echo $AppUI->_('View PDF File'); echo '</a>';
public function store(CAppUI $AppUI = null) { global $AppUI; $perms = $AppUI->acl(); $stored = false; $this->w2PTrimAll(); // ensure changes of state in checkboxes is captured $this->project_active = (int) $this->project_active; $this->project_private = (int) $this->project_private; $this->project_target_budget = filterCurrency($this->project_target_budget); $this->project_actual_budget = filterCurrency($this->project_actual_budget); // Make sure project_short_name is the right size (issue for languages with encoded characters) $this->project_short_name = mb_substr($this->project_short_name, 0, 10); if (empty($this->project_end_date)) { $this->project_end_date = null; } $this->_error = $this->check(); if (count($this->_error)) { return $this->_error; } $this->project_id = (int) $this->project_id; // convert dates to SQL format first if ($this->project_start_date) { $date = new w2p_Utilities_Date($this->project_start_date); $this->project_start_date = $date->format(FMT_DATETIME_MYSQL); } if ($this->project_end_date) { $date = new w2p_Utilities_Date($this->project_end_date); $date->setTime(23, 59, 59); $this->project_end_date = $date->format(FMT_DATETIME_MYSQL); } if ($this->project_actual_end_date) { $date = new w2p_Utilities_Date($this->project_actual_end_date); $this->project_actual_end_date = $date->format(FMT_DATETIME_MYSQL); } // check project parents and reset them to self if they do not exist if (!$this->project_parent) { $this->project_parent = $this->project_id; $this->project_original_parent = $this->project_id; } else { $parent_project = new CProject(); $parent_project->load($this->project_parent); $this->project_original_parent = $parent_project->project_original_parent; } if (!$this->project_original_parent) { $this->project_original_parent = $this->project_id; } /* * TODO: I don't like the duplication on each of these two branches, but I * don't have a good idea on how to fix it at the moment... */ $q = $this->_query; $this->project_updated = $q->dbfnNowWithTZ(); if ($this->project_id && $perms->checkModuleItem('projects', 'edit', $this->project_id)) { if ($msg = parent::store()) { return $msg; } $stored = true; } if (0 == $this->project_id && $perms->checkModuleItem('projects', 'add')) { $this->project_created = $q->dbfnNowWithTZ(); if ($msg = parent::store()) { return $msg; } if (0 == $this->project_parent || 0 == $this->project_original_parent) { $this->project_parent = $this->project_id; $this->project_original_parent = $this->project_id; if ($msg = parent::store()) { return $msg; } } $stored = true; } //split out related departments and store them seperatly. $q->setDelete('project_departments'); $q->addWhere('project_id=' . (int) $this->project_id); $q->exec(); $q->clear(); if ($this->project_departments) { foreach ($this->project_departments as $department) { if ($department) { $q->addTable('project_departments'); $q->addInsert('project_id', $this->project_id); $q->addInsert('department_id', $department); $q->exec(); $q->clear(); } } } //split out related contacts and store them seperatly. $q->setDelete('project_contacts'); $q->addWhere('project_id=' . (int) $this->project_id); $q->exec(); $q->clear(); if ($this->project_contacts) { foreach ($this->project_contacts as $contact) { if ($contact) { $q->addTable('project_contacts'); $q->addInsert('project_id', $this->project_id); $q->addInsert('contact_id', $contact); $q->exec(); $q->clear(); } } } if ($stored) { $custom_fields = new w2p_Core_CustomFields('projects', 'addedit', $this->project_id, 'edit'); $custom_fields->bind($_POST); $sql = $custom_fields->store($this->project_id); // Store Custom Fields CTask::storeTokenTask($AppUI, $this->project_id); } return $stored; }
function clash_suggest(w2p_Core_CAppUI $AppUI, $cal_sdf) { global $m, $a; $obj = new CEvent(); $obj->bind($_SESSION['add_event_post']); $start_date = new w2p_Utilities_Date($obj->event_start_date); $end_date = new w2p_Utilities_Date($obj->event_end_date); $df = $AppUI->getPref('SHDATEFORMAT'); $start_secs = $start_date->getTime(); $end_secs = $end_date->getTime(); $duration = (int) (($end_secs - $start_secs) / 60); $titleBlock = new w2p_Theme_TitleBlock('Suggest Alternative Event Time', 'myevo-appointments.png', $m, $m . '.' . $a); $titleBlock->show(); $calurl = W2P_BASE_URL . '/index.php?m=calendar&a=clash&event_id=' . $obj->event_id; $times = array(); $t = new w2p_Utilities_Date(); $t->setTime(0, 0, 0); if (!defined('LOCALE_TIME_FORMAT')) { define('LOCALE_TIME_FORMAT', '%I:%M %p'); } for ($m = 0; $m < 60; $m++) { $times[$t->format('%H%M%S')] = $t->format(LOCALE_TIME_FORMAT); $t->addSeconds(1800); } /* TODO: This needs to be refactored to use the core setDate_new function. */ ?> <script language="javascript" type="text/javascript"> function setDate( frm_name, f_date ) { fld_date = eval( 'document.' + frm_name + '.' + f_date ); fld_real_date = eval( 'document.' + frm_name + '.' + 'event_' + f_date ); if (fld_date.value.length>0) { if ((parseDate(fld_date.value))==null) { alert('The Date/Time you typed does not match your prefered format, please retype.'); fld_real_date.value = ''; fld_date.style.backgroundColor = 'red'; } else { fld_real_date.value = formatDate(parseDate(fld_date.value), 'yyyyMMdd'); fld_date.value = formatDate(parseDate(fld_date.value), '<?php echo $cal_sdf; ?> '); fld_date.style.backgroundColor = ''; } } else { fld_real_date.value = ''; } } function set_clash_action(action) { document.editFrm.clash_action.value = action; document.editFrm.submit(); } </script> <form name="editFrm" method="post" action="<?php echo $calurl . '&clash_action=process'; ?> " accept-charset="utf-8"> <table width='100%' class='std addedit'> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Earliest Date'); ?> :</td> <td width='50%' align='left' nowrap="nowrap"> <input type="hidden" name="event_start_date" id="event_start_date" value="<?php echo $start_date ? $start_date->format(FMT_TIMESTAMP_DATE) : ''; ?> " /> <input type="text" name="start_date" id="start_date" onchange="setDate('editFrm', 'start_date');" value="<?php echo $start_date ? $start_date->format($df) : ''; ?> " class="text" /> <a href="javascript: void(0);" onclick="return showCalendar('start_date', '<?php echo $df; ?> ', 'editFrm', null, true)"> <img src="<?php echo w2PfindImage('calendar.gif'); ?> " width="24" height="12" alt="<?php echo $AppUI->_('Calendar'); ?> " border="0" /> </a> </td> </tr> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Latest Date'); ?> :</td> <td width='50%' align='left' nowrap="nowrap"> <input type="hidden" name="event_end_date" id="event_end_date" value="<?php echo $end_date ? $end_date->format(FMT_TIMESTAMP_DATE) : ''; ?> " /> <input type="text" name="end_date" id="end_date" onchange="setDate('editFrm', 'end_date');" value="<?php echo $end_date ? $end_date->format($df) : ''; ?> " class="text" /> <a href="javascript: void(0);" onclick="return showCalendar('end_date', '<?php echo $df; ?> ', 'editFrm', null, true)"> <img src="<?php echo w2PfindImage('calendar.gif'); ?> " width="24" height="12" alt="<?php echo $AppUI->_('Calendar'); ?> " border="0" /> </a> </td> </tr> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Earliest Start Time'); ?> :</td> <td width='50%' align='left'> <?php echo arraySelect($times, 'start_time', 'size="1" class="text"', $start_date->format('%H%M%S')); ?> </td> </tr> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Latest Finish Time'); ?> :</td> <td width='50%' align='left'> <?php echo arraySelect($times, 'end_time', 'size="1" class="text"', $end_date->format('%H%M%S')); ?> </td> </tr> <tr> <td width='50%' align='right'><?php echo $AppUI->_('Duration'); ?> :</td> <td width='50%' align='left'> <input type="text" class="text" size="5" name="duration" value="<?php echo $duration; ?> " /> <?php echo $AppUI->_('minutes'); ?> </td> </tr> <tr> <td><input type="button" value="<?php echo $AppUI->_('cancel'); ?> " class="button" onclick="set_clash_action('cancel');" /></td> <td align="right"><input type="button" value="<?php echo $AppUI->_('submit'); ?> " class="button" onclick="set_clash_action('process')" /></td> </tr> </table> <input type='hidden' name='clash_action' value='cancel' /> </form> <?php }
<a href="<?php echo '?m=calendar&a=day_view&date=' . $prev_day->format(FMT_TIMESTAMP_DATE); ?> "><img src="<?php echo w2PfindImage('prev.gif'); ?> " width="16" height="16" alt="pre" border="0"></a> </td> <th width="100%"> <?php echo $AppUI->_(htmlspecialchars($this_day->format('%A'), ENT_COMPAT, $locale_char_set)) . ', ' . $this_day->format($df); ?> </th> <td> <a href="<?php echo '?m=calendar&a=day_view&date=' . $next_day->format(FMT_TIMESTAMP_DATE); ?> "><img src="<?php echo w2PfindImage('next.gif'); ?> " width="16" height="16" alt="next" border="0"></a> </td> </tr> </table> <?php // tabbed information boxes $tabBox = new CTabBox('?m=calendar&a=day_view&date=' . $this_day->format(FMT_TIMESTAMP_DATE), W2P_BASE_DIR . '/modules/calendar/', $tab); $tabBox->add('vw_day_events', 'Events'); $tabBox->add('vw_day_tasks', 'Tasks'); $tabBox->show();
?> </td> </tr> <tr> <td align="right"><?php echo $AppUI->_('Short Date Format'); ?> :</td> <td> <?php // exmample date $ex = new w2p_Utilities_Date(); $dates = array(); $f = '%d/%m/%Y'; $dates[$f] = $ex->format($f); $f = '%d/%b/%Y'; $dates[$f] = $ex->format($f); $f = '%m/%d/%Y'; $dates[$f] = $ex->format($f); $f = '%b/%d/%Y'; $dates[$f] = $ex->format($f); $f = '%d.%m.%Y'; $dates[$f] = $ex->format($f); $f = '%m.%d.%Y'; $dates[$f] = $ex->format($f); $f = '%Y/%b/%d'; $dates[$f] = $ex->format($f); $f = '%Y/%m/%d'; $dates[$f] = $ex->format($f); echo arraySelect($dates, 'pref_name[SHDATEFORMAT]', 'class=text size=1', $prefs['SHDATEFORMAT'], false);
<a href="javascript: void(0);" onclick="expand_collapse(\'component'+li+'_desc\', \'tblProjects\')"><img id="component'+li+'_desc_expand" src="<?php echo w2PfindImage('icons/expand.gif', $m); ?> " width="12" height="12" border="0" alt=""><img id="component'+li+'_desc_collapse" src="<?php echo w2PfindImage('icons/collapse.gif', $m); ?> " width="12" height="12" border="0" style="display:none" alt=""></a><?php echo w2PendTip(); ?> '; oCell.innerHTML =htmltxt; newtr.appendChild(oCell); oCell = document.createElement('td'); htmltxt = ''; htmltxt +='<input type="hidden" id="add_task_start_date_'+line_nr+'" name="add_task_start_date_'+line_nr+'" value="<?php echo $today->format(FMT_TIMESTAMP); ?> " />'; htmltxt +='<input type="text" onchange="setDate(\'editFrm\', \'start_date_'+line_nr+'\');" class="text" style="width:130px;" id="start_date_'+line_nr+'" name="start_date_'+line_nr+'" value="<?php echo $today->format($cf); ?> " />'; htmltxt +='<a href="javascript: void(0);" onclick="return showCalendar(\'start_date_'+line_nr+'\', \'<?php echo $cf; ?> \', \'editFrm\', \'<?php echo strpos($cf, '%p') !== false ? '12' : '24'; ?> \', true)" >'; htmltxt +=' <img src="<?php echo w2PfindImage('calendar.gif', $m);
<?php if (canAccess('tasks')) { ?> <td nowrap="nowrap" align="right"> <a class="button" href="./index.php?m=tasks&a=todo"><span><b><?php echo $AppUI->_('Todo'); ?> </b></span></a> </td><?php } if (canAccess('calendar')) { $now = new w2p_Utilities_Date(); ?> <td nowrap="nowrap" align="right"> <a class="button" href="./index.php?m=calendar&a=day_view&date=<?php echo $now->format(FMT_TIMESTAMP_DATE); ?> "><span><?php echo $AppUI->_('Today'); ?> </span></a> </td><?php } ?> <td nowrap="nowrap" align="right"> <a class="button" href="./index.php?logout=-1"><span><?php echo $AppUI->_('Logout'); ?> </span></a> </td> </tr>
<?php /* $Id$ $URL$ */ if (!defined('W2P_BASE_DIR')) { die('You should not call this file directly.'); } $df = $AppUI->getPref('SHDATEFORMAT'); $date = w2PgetParam($_GET, 'date', ''); $field = w2PgetParam($_GET, 'field', ''); $this_day = new w2p_Utilities_Date($date); $formatted_date = $this_day->format($df); ?> <script language="javascript" type="text/javascript"> <!-- window.parent.document.<?php echo $field; ?> .value = '<?php echo $formatted_date; ?> '; //--> </script>
/** * Stores the current task log in the database updating the task_log_updated * field appropriately. Then updates total hours worked cache on task. * * @return void * * @access public */ public function store() { $this->_error = $this->check(); if (count($this->_error)) { return $this->_error; } $q = $this->_getQuery(); $this->task_log_updated = $q->dbfnNowWithTZ(); if ($this->task_log_date) { $date = new w2p_Utilities_Date($this->task_log_date); $this->task_log_date = $date->format(FMT_DATETIME_MYSQL); } $dot = strpos($this->task_log_hours, ':'); if ($dot > 0) { $log_duration_minutes = sprintf('%.3f', substr($this->task_log_hours, $dot + 1) / 60.0); $this->task_log_hours = floor($this->task_log_hours) + $log_duration_minutes; } $this->task_log_hours = $this->task_log_hours; $this->task_log_costcode = cleanText($this->task_log_costcode); if ($this->{$this->_tbl_key} && $this->_perms->checkModuleItem($this->_tbl_module, 'edit', $this->{$this->_tbl_key})) { if ($msg = parent::store()) { $this->_error['store-check'] = $msg; } else { $stored = true; $this->updateTaskSummary($this->_AppUI, $this->task_log_task); } } if (0 == $this->{$this->_tbl_key} && $this->_perms->checkModuleItem($this->_tbl_module, 'add')) { $this->task_log_created = $q->dbfnNowWithTZ(); if ($msg = parent::store()) { $this->_error['store-check'] = $msg; } else { $stored = true; $this->updateTaskSummary(null, $this->task_log_task); } } return $stored; }
if ($t['task_end_date'] == '0000-00-00 00:00:00') { $todaydate = new w2p_Utilities_Date(); $t['task_start_date'] = $todaydate->format(FMT_TIMESTAMP_DATE); } else { $t['task_start_date'] = $t['task_end_date']; } } //Check if end date exists, if not try giving it the start date. //If the start date does not exist then set it for today. //This avoids jpgraphs internal errors that render the gantt completely useless if ($t['task_end_date'] == '0000-00-00 00:00:00') { if ($t['task_duration']) { $t['task_end_date'] = db_unix2dateTime(db_dateTime2unix($t['task_start_date']) + SECONDS_PER_DAY * convert2days($t['task_duration'], $t['task_duration_type'])); } else { $todaydate = new w2p_Utilities_Date(); $t['task_end_date'] = $todaydate->format(FMT_TIMESTAMP_DATE); } } $tStart = intval($t['task_start_date']) ? $t['task_start_date'] : $start; $tEnd = intval($t['task_end_date']) ? $t['task_end_date'] : $end; $tStartObj = new w2p_Utilities_Date($t['task_start_date']); $tEndObj = new w2p_Utilities_Date($t['task_end_date']); if ($t['task_milestone'] != 1) { $columnValues = array('task_name' => $name, 'start_date' => $tStart, 'end_date' => $tEnd, 'actual_end' => ''); $height = $t['task_dynamic'] == 1 ? 0.1 : 0.6; $gantt->addBar($columnValues, $t['task_percent_complete'] . '% ' . $AppUI->_('Complete'), $height, $p['project_color_identifier'], $p['project_active'], $t['task_percent_complete'], $t['task_id']); } else { $gantt->addMilestone(array('-- ' . $name), $t['task_start_date']); } $task->task_id = $t['task_id']; $workers = $task->getAssigned();
/** * Post Request Handler * * This method is called when a request is a POST * * @return array */ public function executePost() { /** * @todo Remove this once we figure out how to reference vars in file * that is autoloaded */ global $tracking_dynamics; $valid = $this->hasRequiredParameters($this->requiredParams); if ($valid instanceof Frapi_Error) { return $valid; } $username = $this->getParam('username'); $password = $this->getParam('password'); $project_id = $this->getParam('project_id', self::TYPE_INT); $hassign = $this->getParam('hassign'); $hdependencies = $this->getParam('hdependencies'); $notify = $this->getParam('task_notify'); $comment = $this->getParam('email_comment'); $task_id = $this->getParam('task_id'); $adjustStartDate = $this->getParam('set_task_start_date'); $task = new CTask(); // Attempt to login as user, a little bit of a hack as we currently // require the $_POST['login'] var to be set as well as a global AppUI $AppUI = new CAppUI(); $GLOBALS['AppUI'] = $AppUI; $_POST['login'] = '******'; if (!$AppUI->login($username, $password)) { throw new Frapi_Error('INVALID_LOGIN'); } $post_data = array('task_id' => $this->getParam('task_id'), 'task_name' => $this->getParam('task_name'), 'task_status' => $this->getParam('task_status'), 'task_percent_complete' => $this->getParam('task_percent_complete'), 'task_milestone' => $this->getParam('task_milestone'), 'task_owner' => $this->getParam('task_owner'), 'task_access' => $this->getParam('task_access'), 'task_related_url' => $this->getParam('task_related_url'), 'task_parent' => $this->getParam('task_parent'), 'task_type' => $this->getParam('task_type'), 'task_target_budget' => $this->getParam('task_target_budget'), 'task_description' => $this->getParam('task_description'), 'task_start_date' => $this->getParam('task_start_date'), 'task_end_date' => $this->getParam('task_end_date'), 'task_duration' => $this->getParam('task_duration'), 'task_duration_type' => $this->getParam('task_duration_type'), 'task_dynamic' => $this->getParam('task_dynamic'), 'task_allow_other_user_tasklogs' => $this->getParam('task_allow_other_user_tasklogs'), 'task_project' => $this->getParam('task_project'), 'task_priority' => $this->getParam('task_priority')); // Include any files for handling module-specific requirements foreach (findTabModules('tasks', 'addedit') as $mod) { $fname = W2P_BASE_DIR . '/modules/' . $mod . '/tasks_dosql.addedit.php'; if (file_exists($fname)) { require_once $fname; } } // Find the task if we are set $task_end_date = null; if ($task_id) { $task->load($task_id); $task_end_date = new w2p_Utilities_Date($task->task_end_date); } $task = new CTask(); if (!$task->bind($post_data)) { throw new Frapi_Error('SAVE_ERROR', $task->getError()); } if ($task->task_dynamic != 1) { $task_dynamic_delay = $this->getParam('task_dynamic_nodelay') ? $this->getParam('task_dynamic_nodelay') : '0'; if (in_array($task->task_dynamic, $tracking_dynamics)) { $task->task_dynamic = $task_dynamic_delay ? 21 : 31; } else { $task->task_dynamic = $task_dynamic_delay ? 11 : 0; } } // Let's check if task_dynamic is unchecked if (!$this->getParam('task_dynamic')) { $task->task_dynamic = false; } // Make sure task milestone is set or reset as appropriate if ($this->getParam('task_milestone')) { $task->task_milestone = false; } //format hperc_assign user_id=percentage_assignment;user_id=percentage_assignment;user_id=percentage_assignment; $tmp_ar = explode(';', $this->getParam('hperc_assign')); $i_cmp = sizeof($tmp_ar); $hperc_assign_ar = array(); for ($i = 0; $i < $i_cmp; $i++) { $tmp = explode('=', $tmp_ar[$i]); if (count($tmp) > 1) { $hperc_assign_ar[$tmp[0]] = $tmp[1]; } elseif ($tmp[0] != '') { $hperc_assign_ar[$tmp[0]] = 100; } } // let's check if there are some assigned departments to task $task->task_departments = implode(',', $this->getParam('dept_ids', self::TYPE_ARRAY)); // convert dates to SQL format first if ($task->task_start_date) { $date = new w2p_Utilities_Date($task->task_start_date); $task->task_start_date = $date->format(FMT_DATETIME_MYSQL); } $end_date = null; if ($task->task_end_date) { if (strpos($task->task_end_date, '2400') !== false) { $task->task_end_date = str_replace('2400', '2359', $task->task_end_date); } $end_date = new w2p_Utilities_Date($task->task_end_date); $task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL); } $error_array = $task->store($AppUI); // Return all the validation messages if ($error_array !== true) { $error_message = ''; foreach ($error_array as $error) { $error_message .= $error . '. '; } throw new Frapi_Error('SAVE_ERROR', $error_message); } $task_parent = $this->getParam('task_parent') ? $this->getParam('task_parent', SELF::TYPE_INT) : 0; $old_task_parent = $this->getParam('old_task_parent') ? $this->getParam('old_task_parent', SELF::TYPE_INT) : 0; if ($task_parent != $old_task_parent) { $oldTask = new CTask(); $oldTask->load($old_task_parent); $oldTask->updateDynamics(false); } // How to handle custom fields? Do we support it in api? // Now add any task reminders // If there wasn't a task, but there is one now, and // that task date is set, we need to set a reminder. if (empty($task_end_date) || !empty($end_date) && $task_end_date->dateDiff($end_date)) { $task->addReminder(); } if (isset($hassign)) { $task->updateAssigned($hassign, $hperc_assign_ar); } if (isset($hdependencies)) { // && !empty($hdependencies)) { // there are dependencies set! // backup initial start and end dates $tsd = new w2p_Utilities_Date($task->task_start_date); $ted = new w2p_Utilities_Date($task->task_end_date); // updating the table recording the // dependency relations with this task $task->updateDependencies($hdependencies, $task_parent); // we will reset the task's start date based upon dependencies // and shift the end date appropriately if ($adjustStartDate && !is_null($hdependencies)) { // load already stored task data for this task $tempTask = new CTask(); $tempTask->load($task->task_id); // shift new start date to the last dependency end date $nsd = new w2p_Utilities_Date($tempTask->get_deps_max_end_date($tempTask)); // prefer Wed 8:00 over Tue 16:00 as start date $nsd = $nsd->next_working_day(); // prepare the creation of the end date $ned = new w2p_Utilities_Date(); $ned->copy($nsd); if (empty($task->task_start_date)) { // appropriately calculated end date via start+duration $ned->addDuration($task->task_duration, $task->task_duration_type); } else { // calc task time span start - end $d = $tsd->calcDuration($ted); // Re-add (keep) task time span for end date. // This is independent from $obj->task_duration. // The value returned by Date::Duration() is always in hours ('1') $ned->addDuration($d, '1'); } // prefer tue 16:00 over wed 8:00 as an end date $ned = $ned->prev_working_day(); $task->task_start_date = $nsd->format(FMT_DATETIME_MYSQL); $task->task_end_date = $ned->format(FMT_DATETIME_MYSQL); $q = new w2p_Database_Query(); $q->addTable('tasks', 't'); $q->addUpdate('task_start_date', $task->task_start_date); $q->addUpdate('task_end_date', $task->task_end_date); $q->addWhere('task_id = ' . (int) $task->task_id); $q->addWhere('task_dynamic <> 1'); $q->exec(); $q->clear(); } $task->pushDependencies($task->task_id, $task->task_end_date); } //$task = (array)$task; $task->load($task_id); unset($task->_query, $task->_error, $task->_tbl_prefix, $task->_tbl, $task->_tbl_key, $task->_tbl_module); $this->data['task'] = $task; $this->data['success'] = true; return $this->toArray(); }
} } // 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'); } } $tf = $AppUI->getPref('TIMEFORMAT'); $dayStamp = $this_day->format(FMT_TIMESTAMP_DATE); $start = $start_hour; $end = $end_hour; $inc = w2PgetConfig('cal_day_increment'); if ($start === null) { $start = 8; } if ($end === null) { $end = 17; } if ($inc === null) {
} function clickWeek( uts, fdate ) { window.location = './index.php?m=events&a=week_view&date='+uts; } </script> <?php // establish the focus 'date' if (!$date) { $date = new w2p_Utilities_Date(); } else { $date = new w2p_Utilities_Date($date); } $date->setDay(1); $date->setMonth(1); $prev_year = $date->format(FMT_TIMESTAMP_DATE); $prev_year = (int) ($prev_year - 10000); $next_year = $date->format(FMT_TIMESTAMP_DATE); $next_year = (int) ($next_year + 10000); ?> <table class="std view"> <tr> <td align="center"> <table width="100%" cellspacing="0" cellpadding="4"> <tr> <td colspan="20" valign="top"> <table border="0" cellspacing="1" cellpadding="2" width="100%" class="motitle"> <tr> <td> <a href="<?php echo '?m=events&a=year_view&date=' . $prev_year;
$t = $gantt_arr[$p['project_id']][$i][0]; $level = $gantt_arr[$p['project_id']][$i][1]; if ($t['task_end_date'] == null) { $t['task_end_date'] = $t['task_start_date']; } $tStart = $t['task_start_date'] > '0000-00-00 00:00:00' ? $t['task_start_date'] : date('Y-m-d H:i:s'); $tEnd = $t['task_end_date'] > '0000-00-00 00:00:00' ? $t['task_end_date'] : date('Y-m-d H:i:s'); $tStartObj = new w2p_Utilities_Date($tStart); $tEndObj = new w2p_Utilities_Date($tEnd); if ($t['task_milestone'] != 1) { $advance = str_repeat(' ', $level + 2); $name = mb_strlen($advance . $t['task_name']) > 35 ? mb_substr($advance . $t['task_name'], 0, 33) . '...' : $advance . $t['task_name']; $height = $t['task_dynamic'] == 1 ? 0.1 : 0.6; $columnValues = array('project_name' => $name, 'start_date' => $tStartObj->getDate(), 'end_date' => $tEndObj->getDate(), 'actual_end' => ''); $gantt->addBar($columnValues, '', $height, $p['project_color_identifier'], $p['project_active'], $progress, $p['project_id']); } else { $name = $advance . '* ' . $t['task_name']; $milestone = substr($t['task_start_date'], 0, 10); $milestoneDate = new w2p_Utilities_Date($milestone); $gantt->addMilestone(array($name, '', $milestoneDate->format($df)), $t['task_start_date']); } // End of insert workers for each task into Gantt Chart } // End of insert tasks into Gantt Chart } // End of if showAllGant checkbox is checked } } // End of check for valid projects array. } $gantt->render();
print ' <p>DB Table Prefix: "' . w2PgetConfig('dbprefix') . '"</p>'; print ' <p>Web Server: ' . safe_get_env('SERVER_SOFTWARE') . '</p>'; print ' <p>Server Protocol | Gateway Interface: ' . safe_get_env('SERVER_PROTOCOL') . ' | ' . safe_get_env('GATEWAY_INTERFACE') . '</p>'; print ' <p>Client Browser: ' . safe_get_env('HTTP_USER_AGENT') . '</p>'; print ' <p>URL Query: ' . safe_get_env('QUERY_STRING') . '</p>'; if (file_exists($module_file)) { $script_handle = fopen($module_file, "r"); if ($script_handle) { $script_first_line = fgets($script_handle, 4096); fclose($script_handle); } $script_first_line = substr(trim($script_first_line), 10, -4); print ' <p>File Version ' . $script_first_line . '</p>'; } $right_now_is = new w2p_Utilities_Date(); print ' <p>Server Time | Timezone: ' . $right_now_is->format(FMT_DATERFC822) . ' | ' . date('T') . '</p>'; print ' <p>PHP Max. Execution Time: ' . ini_get('max_execution_time') . ' seconds</p>'; print ' <p>Memory Limit: ' . (ini_get('memory_limit') ? str_replace('M', ' Mb', ini_get('memory_limit')) : 'Not Defined') . '</p>'; print ' </td>'; print ' </tr>'; print ' <tr valign="top">'; print ' <th width="100%">Performance</th>'; print ' </tr>'; print ' <tr valign="top">'; print ' <td width="100%">'; if (is_callable('memory_get_usage')) { print ' <p>Memory Used: ' . sprintf('%01.2f Mb', memory_get_usage() / pow(1024, 2)) . '</p>'; print ' <p>Memory Unused: ' . sprintf('%01d Kb', (memory_get_usage() - $w2p_performance_memory_marker) / 1024) . '</p>'; } if (is_callable('memory_get_peak_usage')) { print ' <p>Memory Peak: ' . sprintf('%01d Kb', (memory_get_peak_usage() - $w2p_performance_memory_marker) / 1024) . '</p>';