/** * 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(); }
/** * view task a documentation page @ingroup pages */ function taskViewAsDocu() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php'; ### get task #### $tsk = get('tsk'); $editable = false; # flag, if this task can be edited if ($task = Task::getEditableById($tsk)) { $editable = true; } else { if (!($task = Task::getVisibleById($tsk))) { $PH->abortWarning("invalid task-id", ERROR_FATAL); } } if (!($project = Project::getVisibleById($task->project))) { $PH->abortWarning("this task has an invalid project id", ERROR_DATASTRUCTURE); } ### create from handle ### $from_handle = $PH->defineFromHandle(array('tsk' => $task->id)); global $g_wiki_task; $g_wiki_task = $task; ### set up page and write header #### measure_start("page_render"); $page = new Page(); $page->use_autocomplete = true; initPageForTask($page, $task, $project); $page->title_minor_html = $PH->getLink('taskView', sprintf('#%d', $task->id), array('tsk' => $task->id)); if ($task->state == -1) { $page->title_minor_html .= ' ' . sprintf(__('(deleted %s)', 'page title add on with date of deletion'), renderTimestamp($task->deleted)); } ### page functions ### if ($project->isPersonVisibleTeamMember($auth->cur_user)) { ### edit ### if ($editable) { $page->add_function(new PageFunction(array('target' => 'taskEdit', 'params' => array('tsk' => $task->id), 'icon' => 'edit', 'tooltip' => __('Edit this task'), 'name' => __('Edit')))); $page->add_function(new PageFunction(array('target' => 'tasksMoveToFolder', 'params' => array('tsk' => $task->id), 'icon' => 'edit', 'name' => __('Move', 'page function to move current task')))); if ($task->state == 1) { $page->add_function(new PageFunction(array('target' => 'tasksDelete', 'params' => array('tsk' => $task->id), 'icon' => 'delete', 'tooltip' => __('Delete this task'), 'name' => __('Delete')))); } else { if ($task->state == -1) { $page->add_function(new PageFunction(array('target' => 'tasksUndelete', 'params' => array('tsk' => $task->id), 'icon' => 'undelete', 'tooltip' => __('Restore this task'), 'name' => __('Undelete')))); } } } if ($auth->cur_user->settings & USER_SETTING_ENABLE_EFFORTS && $project->settings & PROJECT_SETTING_ENABLE_EFFORTS) { $page->add_function(new PageFunction(array('target' => 'effortNew', 'params' => array('parent_task' => $task->id), 'icon' => 'effort', 'name' => __('Book Effort')))); } ### new ### if ($task->category == TCATEGORY_FOLDER) { $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->id, 'task_category' => TCATEGORY_DOCU, 'task_show_folder_as_documentation' => 1), 'icon' => 'edit', 'name' => __('New topic')))); } else { if ($task->parent_task) { $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->parent_task, 'task_category' => TCATEGORY_DOCU, 'task_show_folder_as_documentation' => 1), 'icon' => 'edit', 'name' => __('New topic')))); } else { $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('prj' => $task->project, 'task_category' => TCATEGORY_DOCU), 'icon' => 'edit', 'name' => __('New topic')))); } } if ($auth->cur_user->settings & USER_SETTING_ENABLE_BOOKMARKS) { require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php'; $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $task->id)); if (!$item || $item[0]->is_bookmark == 0) { $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('task' => $task->id), 'tooltip' => __('Mark this task as bookmark'), 'name' => __('Bookmark')))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('task' => $task->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } } } ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); require_once confGet('DIR_STREBER') . 'lists/list_docustructure.inc.php'; $list = new Block_DocuNavigation(array('current_task' => $task)); $list->print_all(); $block = new PageBlock(array('id' => 'summary', 'reduced_header' => true)); $block->render_blockStart(); echo "<div class=text>"; if ($person_creator = Person::getVisibleById($task->created_by)) { echo "<div class=labeled><label>" . __("Created", "Label in Task summary") . "</label>" . renderDateHtml($task->created) . ' / ' . $person_creator->getLink() . '</div>'; } if ($person_modify = Person::getVisibleById($task->modified_by)) { echo "<div class=labeled><label>" . __("Modified", "Label in Task summary") . "</label>" . renderDateHtml($task->modified) . ' / ' . $person_modify->getLink() . '</div>'; } require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php"; $versions = ItemVersion::getFromItem($task); if (count($versions) > 1) { $str_version = $PH->getLink('itemViewDiff', sprintf(__("View previous %s versions"), count($versions)), array('item' => $task->id)); echo "<div class=labeled><label></label>{$str_version}</div>"; } ### publish to ### global $g_pub_level_names; if ($task->pub_level != PUB_LEVEL_OPEN && isset($g_pub_level_names[$task->pub_level])) { echo "<div class=labeled><label>" . __("Publish to", "Label in Task summary") . "</label>" . $g_pub_level_names[$task->pub_level]; if ($editable) { echo '<br>(' . $PH->getLink('itemsSetPubLevel', __('Set to Open'), array('item' => $task->id, 'item_pub_level' => PUB_LEVEL_OPEN)) . ')'; } echo "</div>"; } echo "</div>"; $block->render_blockEnd(); require_once confGet('DIR_STREBER') . 'blocks/files_attached_to_item.inc.php'; print new FilesAttachedToItemBlock($task); echo new PageContentNextCol(); require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php'; if ($view = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $task->id, 'feedback_requested_by' => true))) { if ($requested_by = Person::getPeople(array('id' => $view[0]->feedback_requested_by))) { echo "<div class=item_notice>"; echo "<h3>" . sprintf(__("Your feedback is requested by %s."), asHtml($requested_by[0]->nickname)) . "</h3>"; echo __("Please edit or comment this item."); echo "</div>"; } } #$descriptionWithUpdates= $task->getTextfieldWithUpdateNotes('description'); echo "<div class=description>"; echo wikifieldAsHtml($task, 'description', array('empty_text' => "[quote]" . __("This topic does not have any text yet.\nDoubleclick here to add some.") . "[/quote]")); echo "</div>"; ### Apply automatic link conversions if (checkAutoWikiAdjustments()) { $task->description = applyAutoWikiAdjustments($task->description); $task->update(array('description'), false); } require_once confGet('DIR_STREBER') . 'blocks/comments_on_item_block.inc.php'; print new CommentsOnItemBlock($task); echo new PageContentClose(); echo new PageHtmlEnd(); measure_stop("page_render"); $task->nowViewedByUser(); }