function render_tr(&$obj, $style = "") { if (!isset($obj) || !$obj instanceof Effort) { trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING); return; } #$value= date(__("D, d.m.Y"), strToGMTime($obj->time_start) ); $value = renderTimestampHtml($obj->time_start); if ($obj->as_duration) { $value .= " " . renderTime($obj->time_start); } print "<td><nobr>{$value}</nobr></td>"; #@@@ note: nobr is a hack for firefox 1.0 }
/** * Edit several efforts @ingroup pages */ function effortViewMultiple() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; ### get effort #### $ids = getPassedIds('effort', 'efforts_*'); if (!$ids) { $PH->abortWarning(__("Select one or more efforts")); return; } $number = 0; $sum = 0; $count = 0; foreach ($ids as $id) { if ($e = Effort::getEditableById($id)) { ## array with all efforts ## $e_array[] = $e; ## array with all effort ids (for Effort::getMinMaxTime())## $e_ids[] = $e->id; ## is viewed by user ## $e->nowViewedByUser(); ## number of efforts ## $number++; ## sum of all efforts ## $sum += round((strToGMTime($e->time_end) - strToGMTime($e->time_start)) / 60 / 60, 1); ### check project of first effort if (count($e_array) == 1) { if (!($project = Project::getVisibleById($e->project))) { $PH->abortWarning('could not get project'); } } else { $count = 0; ### check if the efforts are related to the same task ### if ($e->task != $e_array[0]->task) { $count++; } } } else { $PH->abortWarning(__("You do not have enough rights"), ERROR_RIGHTS); } } $page = new Page(); $page->cur_tab = 'projects'; $page->cur_crumb = 'effortViewMultiple'; $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $type = __('Multiple Efforts', 'page type'); ## same tasks ## if ($count == 0) { $task = $e_array[0]->task ? Task::getVisibleById($e_array[0]->task) : NULL; if ($task) { $folder = $task->getFolderLinks() . "<em>></em>" . $task->getLink(); $page->type = $folder . "<em>></em>" . $type; } else { $page->type = $type; } } else { $page->type = $project->getLink() . "<em>></em>" . $type; } $page->title = __('Multiple Efforts'); $page->title_minor = __('Overview'); ### render title ### echo new PageHeader(); echo new PageContentOpen(); ### summary ### ### title ### echo '<div class="text"><h3>' . __('summary') . "</h3></div>"; ### content ### $block = new PageBlock(array('title' => __('Information'), 'id' => 'info')); $block->render_blockStart(); echo '<div class="text">'; if ($number) { echo "<div class=labeled><label>" . __('Number of efforts', 'label') . "</label>" . asHtml($number) . "</div>"; } if ($sum) { echo "<div class=labeled><label>" . __('Sum of efforts', 'label') . "</label>" . asHtml($sum) . " h</div>"; } $content['e_ids'] = $e_ids; $time = Effort::getMinMaxTime($content); if ($time) { $line = "<div class=labeled><label>" . __('from', 'time label') . "</label>" . renderDateHtml($time[0]) . "</div>"; $line .= "<div class=labeled><label>" . __('to', 'time label') . "</label>" . renderDateHtml($time[1]) . "</div>"; echo $line; } else { echo "<div class=labeled><label>" . __('Time', 'label') . "</label>" . __('not available') . "</div>"; } echo "</div>"; $block->render_blockEnd(); ### start to list efforts ### foreach ($e_array as $effort) { ### title ### echo '<div class="text"><h3>' . asHtml($effort->name) . "</h3></div>"; $block = new PageBlock(array('title' => __('Details'), 'id' => 'details' . $effort->id)); $block->render_blockStart(); echo '<div class="text">'; if ($project) { echo "<div class=labeled><label>" . __('Project', 'label') . "</label>" . $project->getLink(false) . "</div>"; } $task = $effort->task ? Task::getVisibleById($effort->task) : NULL; if ($task) { if ($task->parent_task != 0) { $folder = $task->getFolderLinks(false) . "<em> > </em>" . $task->getLink(false); echo "<div class=labeled><label>" . __('Task', 'label') . "</label>" . $folder . "</div>"; } else { echo "<div class=labeled><label>" . __('Task', 'label') . "</label>" . $task->getLink(false) . "</div>"; } } else { echo "<div class=labeled><label>" . __('Task', 'label') . "</label>" . __('No task related') . "</div>"; } if (!($person = Person::getById($effort->person))) { echo "<div class=labeled><label>" . __('Created by', 'label') . "</label>" . __('not available') . "</div>"; } else { echo "<div class=labeled><label>" . __('Created by', 'label') . "</label>" . $person->getLink() . "</div>"; } if ($effort) { $duration = round((strToGMTime($effort->time_end) - strToGMTime($effort->time_start)) / 60 / 60, 1) . " h"; if ($effort->as_duration) { echo "<div class=labeled><label>" . __('Created at', 'label') . "</label>" . renderDateHtml($effort->time_start) . "</div>"; echo "<div class=labeled><label>" . __('Duration', 'label') . "</label>" . asHtml($duration) . "</div>"; } else { echo "<div class=labeled><label>" . __('Time start', 'label') . "</label>" . renderTimestampHtml($effort->time_start) . "</div>"; echo "<div class=labeled><label>" . __('Time end', 'label') . "</label>" . renderTimestampHtml($effort->time_end) . "</div>"; echo "<div class=labeled><label>" . __('Duration', 'label') . "</label>" . asHtml($duration) . "</div>"; } } echo "</div>"; $block->render_blockEnd(); $block = new PageBlock(array('title' => __('Description'), 'id' => 'description' . $effort->id)); $block->render_blockStart(); if ($effort->description != "") { echo '<div class="text">'; echo wikifieldAsHtml($effort, 'description'); ### update task if relative links have been converted to ids ### if (checkAutoWikiAdjustments()) { $effort->description = applyAutoWikiAdjustments($effort->description); $effort->update(array('description'), false); } echo "</div>"; } else { if ($auth->cur_user->user_rights & RIGHT_PROJECT_ASSIGN) { echo '<div class="empty">' . $PH->getLink('effortEdit', '', array('effort' => $effort->id)) . "</div>"; } else { echo '<div class="text">' . __('No description available') . "</div>"; } } $block->render_blockEnd(); } echo new PageContentClose(); echo new PageHtmlEnd(); }