/** * personList active @ingroup pages */ function personList() { global $PH; global $auth; if (!($auth->cur_user->user_rights & RIGHT_PERSON_EDIT) && confGet('ANONYMOUS_USER') != false) { ### set up page and write header #### $page = new Page(); $page->type = __("List"); $page->cur_tab = 'people'; $page->title = __('List of people'); echo new PageHeader(); echo new PageContentOpen(); echo "<div class=license>"; echo wiki2purehtml("\r\nYou have insufficent user rights to see complete list.\r\n"); echo "</div>"; echo new PageContentClose(); echo new PageHtmlEnd(); exit; } $presets = array('all_people' => array('name' => __('all'), 'filters' => array('person_category' => array('id' => 'person_category', 'visible' => true, 'active' => true, 'min' => PCATEGORY_UNDEFINED, 'max' => PCATEGORY_PARTNER)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'tree'))), 'people_without_account' => array('name' => __('without account'), 'filters' => array('can_login' => array('id' => 'can_login', 'value' => '0', 'visible' => true, 'active' => true)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'people_with_account' => array('name' => __('with account'), 'filters' => array('can_login' => array('id' => 'can_login', 'value' => '1', 'visible' => true, 'active' => true)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'person_employee' => array('name' => __('employees'), 'filters' => array('person_category' => array('id' => 'person_category', 'visible' => false, 'active' => true, 'min' => PCATEGORY_STAFF, 'max' => PCATEGORY_EXEMPLOYEE)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'person_contact' => array('name' => __('contact people'), 'filters' => array('person_category' => array('id' => 'person_category', 'visible' => true, 'active' => true, 'min' => PCATEGORY_CLIENT, 'max' => PCATEGORY_PARTNER)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'deleted_people' => array('name' => __('deleted'), 'filters' => array('person_is_alive' => array('id' => 'person_is_alive', 'value' => false, 'visible' => true, 'active' => true)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list')))); ## set preset location ## $preset_location = 'personList'; $preset_id = 'people_with_account'; # default value if ($tmp_preset_id = get('preset')) { if (isset($presets[$tmp_preset_id])) { $preset_id = $tmp_preset_id; } ### set cookie setcookie('STREBER_personList_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0); } else { if ($tmp_preset_id = get('STREBER_personList_preset')) { if (isset($presets[$tmp_preset_id])) { $preset_id = $tmp_preset_id; } } } ### create from handle ### $PH->defineFromHandle(array('preset_id' => $preset_id)); $page = new Page(); $page->cur_tab = 'people'; $page->title = __('People', 'Pagetitle for person list'); if (!($auth->cur_user->user_rights & RIGHT_VIEWALL)) { $page->title_minor = sprintf(__("relating to %s", "Page title Person list title add on"), $auth->cur_user->name); } else { $page->title_minor = __("admin view", "Page title add on if admin"); } $page->type = __('List', 'page type'); $page->options = build_personList_options(); ### page functions ### $page->add_function(new PageFunction(array('target' => 'personNew', 'params' => array(), 'icon' => 'new', 'tooltip' => __('New person')))); ### render title ### echo new PageHeader(); echo new PageContentOpen(); if ($order_by = get('sort_' . $PH->cur_page->id . "_people_list")) { $order_by = str_replace(",", ", ", $order_by); } else { $order_by = 'name'; } $list = new ListBlock_people(); $list->title = $page->title; unset($list->columns['profile']); unset($list->columns['projects']); unset($list->columns['changes']); $list->filters[] = new ListFilter_people(); $preset = $presets[$preset_id]; foreach ($preset['filters'] as $f_name => $f_settings) { switch ($f_name) { case 'person_category': $list->filters[] = new ListFilter_person_category_min(array('value' => $f_settings['min'])); $list->filters[] = new ListFilter_person_category_max(array('value' => $f_settings['max'])); break; case 'can_login': $list->filters[] = new ListFilter_can_login(array('value' => $f_settings['value'])); break; case 'person_is_alive': $list->filters[] = new ListFilter_is_alive(array('value' => $f_settings['value'])); break; default: trigger_error("Unknown filter setting {$f_name}", E_USER_WARNING); break; } } $filter_empty_folders = isset($preset['filter_empty_folders']) && $preset['filter_empty_folders'] ? true : NULL; if ($auth->cur_user->user_rights & RIGHT_PERSON_CREATE) { $list->no_items_html = $PH->getLink('personNew', ''); } else { $list->no_items_html = __("no related people"); } $page->print_presets(array('target' => $preset_location, 'project_id' => '', 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => '')); $list->query_options['order_by'] = $order_by; $list->print_automatic(); ## Link to start cvs export for priviledged users ## if ($auth->cur_user->user_rights & RIGHT_PERSON_EDIT || confGet('ANONYMOUS_USER') == false) { $format = get('format'); if ($format == FORMAT_HTML || $format == '') { echo $PH->getCSVLink(); } } echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * Person View @ingroup pages */ function personView() { global $PH; global $auth; ### get current person ### $id = getOnePassedId('person', 'people_*'); if (!($person = Person::getVisibleById($id))) { $PH->abortWarning("invalid person-id"); return; } ### create from handle ### $PH->defineFromHandle(array('person' => $person->id)); ## is viewed by user ## $person->nowViewedByUser(); $page = new Page(); $page->cur_tab = 'people'; if ($person->can_login) { $page->title = $person->nickname; $page->title_minor = $person->name; } else { $page->title = $person->name; if ($person->category) { global $g_pcategory_names; if (isset($g_pcategory_names[$person->category])) { $page->title_minor = $g_pcategory_names[$person->category]; } } } $page->type = __("Person"); $page->crumbs = build_person_crumbs($person); $page->options = build_person_options($person); ### skip edit functions ### if ($edit = Person::getEditableById($person->id)) { ### page functions ### $page->add_function(new PageFunction(array('target' => 'taskNoteOnPersonNew', 'params' => array('person' => $person->id), 'tooltip' => __('Add task for this people (optionally creating project and effort on the fly)', 'Tooltip for page function'), 'name' => __('Add note', 'Page function person')))); #$page->add_function(new PageFunction(array( #'target' =>'personLinkCompanies', #'params' =>array('person'=>$person->id), #'tooltip' =>__('Add existing companies to this person'), #'name' =>__('Companies'), #))); $page->add_function(new PageFunction(array('target' => 'personEdit', 'params' => array('person' => $person->id), 'icon' => 'edit', 'tooltip' => __('Edit this person', 'Tooltip for page function'), 'name' => __('Edit', 'Page function edit person')))); $page->add_function(new PageFunction(array('target' => 'personEditRights', 'params' => array('person' => $person->id), 'icon' => 'edit', 'tooltip' => __('Edit user rights', 'Tooltip for page function'), 'name' => __('Edit rights', 'Page function for edit user rights')))); if ($person->id != $auth->cur_user->id) { $page->add_function(new PageFunction(array('target' => 'personDelete', 'params' => array('person' => $person->id), 'name' => __('Delete')))); } $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $person->id)); if (!$item || $item[0]->is_bookmark == 0) { #$page->add_function(new PageFunction(array( # 'target' =>'itemsAsBookmark', # 'params' =>array('person'=>$person->id), # 'tooltip' =>__('Mark this person as bookmark'), # 'name' =>__('Bookmark'), #))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('person' => $person->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } if ($person->state == ITEM_STATE_OK && $person->can_login && ($person->personal_email || $person->office_email)) { $page->add_function(new PageFunction(array('target' => 'personSendActivation', 'params' => array('person' => $person->id)))); $page->add_function(new PageFunction(array('target' => 'peopleFlushNotifications', 'params' => array('person' => $person->id)))); } } ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); ### write info block (but only for registed users) global $auth; if ($auth->cur_user->id != confGet('ANONYMOUS_USER')) { $block = new PageBlock(array('title' => __('Summary', 'Block title'), 'id' => 'summary')); $block->render_blockStart(); echo "<div class=text>"; if ($person->mobile_phone) { echo "<div class=labeled><label>" . __('Mobile', 'Label mobilephone of person') . '</label>' . asHtml($person->mobile_phone) . '</div>'; } if ($person->office_phone) { echo "<div class=labeled><label>" . __('Office', 'label for person') . '</label>' . asHtml($person->office_phone) . '</div>'; } if ($person->personal_phone) { echo "<div class=labeled><label>" . __('Private', 'label for person') . '</label>' . asHtml($person->personal_phone) . '</div>'; } if ($person->office_fax) { echo "<div class=labeled><label>" . __('Fax (office)', 'label for person') . '</label>' . asHtml($person->office_fax) . '</div>'; } if ($person->office_homepage) { echo "<div class=labeled><label>" . __('Website', 'label for person') . '</label>' . url2linkExtern($person->office_homepage) . '</div>'; } if ($person->personal_homepage) { echo "<div class=labeled><label>" . __('Personal', 'label for person') . '</label>' . url2linkExtern($person->personal_homepage) . '</div>'; } if ($person->office_email) { echo "<div class=labeled><label>" . __('E-Mail', 'label for person office email') . '</label>' . url2linkMail($person->office_email) . '</div>'; } if ($person->personal_email) { echo "<div class=labeled><label>" . __('E-Mail', 'label for person personal email') . '</label>' . url2linkMail($person->personal_email) . '</div>'; } if ($person->personal_street) { echo "<div class=labeled><label>" . __('Adress Personal', 'Label') . '</label>' . asHtml($person->personal_street) . '</div>'; } if ($person->personal_zipcode) { echo '<div class=labeled><label></label>' . asHtml($person->personal_zipcode) . '</div>'; } if ($person->office_street) { echo "<div class=labeled><label>" . __('Adress Office', 'Label') . '</label>' . asHtml($person->office_street) . '</div>'; } if ($person->office_zipcode) { echo "<div class=labeled><label></label>" . asHtml($person->office_zipcode) . '</div>'; } if ($person->birthdate && $person->birthdate != "0000-00-00") { echo "<div class=labeled><label>" . __('Birthdate', 'Label') . "</label>" . renderDateHtml($person->birthdate) . "</div>"; } if ($person->last_login) { echo "<div class=labeled><label>" . __('Last login', 'Label') . '</label>' . renderDateHtml($person->last_login) . '</div>'; } ### functions #### echo "</div>"; $block->render_blockEnd(); } require_once confGet('DIR_STREBER') . 'lists/list_companies.inc.php'; $companies = $person->getCompanies(); $list = new ListBlock_companies(); $list->title = __('works for', 'List title'); unset($list->columns['short']); unset($list->columns['homepage']); unset($list->columns['people']); unset($list->functions['companyDelete']); #unset($list->functions['companyNew']); /** * \todo We should provide a list-function to link more * people to this company. But therefore we would need to * pass the company's id, which is not possible right now... */ $list->add_function(new ListFunction(array('target' => $PH->getPage('personLinkCompanies')->id, 'name' => __('Link Companies'), 'id' => 'personLinkCompanies', 'icon' => 'add'))); $list->add_function(new ListFunction(array('target' => $PH->getPage('personCompaniesDelete')->id, 'name' => __('Remove companies from person'), 'id' => 'personCompaniesDelete', 'icon' => 'sub', 'context_menu' => 'submit'))); if ($auth->cur_user->user_rights & RIGHT_PERSON_EDIT) { $list->no_items_html = $PH->getLink('personLinkCompanies', __('link existing Company'), array('person' => $person->id)) . " " . __("or") . " " . $PH->getLink('companyNew', __('create new'), array('person' => $person->id)); } else { $list->no_items_html = __("no companies related"); } #$list->no_items_html=__("no company"); $list->render_list($companies); echo new PageContentNextCol(); #--- description ---------------------------------------------------------------- if ($person->description != "") { $block = new PageBlock(array('title' => __('Person details'), 'id' => 'persondetails')); $block->render_blockStart(); echo "<div class=text>"; echo wikifieldAsHtml($person, 'description'); echo "</div>"; $block->render_blockEnd(); } /** * \Note: passing colum to person->getProject is not simple... * the sql-querry currently just querry project-people, which do not contain anything usefull * Possible solutions: * - rewrite the querry-string * - rewrite all order-keys to something like company.name */ $order_by = get('sort_' . $PH->cur_page->id . "_projects"); require_once confGet('DIR_STREBER') . 'lists/list_projects.inc.php'; $projects = $person->getProjects($order_by); if ($projects || $person->can_login) { $list = new ListBlock_projects(); $list->title = __('works in Projects', 'list title for person projects'); $list->id = "works_in_projects"; unset($list->columns['date_closed']); unset($list->columns['date_start']); unset($list->columns['tasks']); unset($list->columns['efforts']); unset($list->functions['projDelete']); unset($list->functions['projNew']); if ($auth->cur_user->user_rights & RIGHT_PROJECT_CREATE) { $list->no_items_html = $PH->getLink('projNew', '', array()); } else { $list->no_items_html = __("no active projects"); } $list->render_list($projects); } require_once confGet('DIR_STREBER') . 'lists/list_tasks.inc.php'; $list = new ListBlock_tasks(array('active_block_function' => 'list')); $list->query_options['assigned_to_person'] = $person->id; unset($list->columns['created_by']); unset($list->columns['planned_start']); unset($list->columns['assigned_to']); $list->title = __('Assigned tasks'); $list->no_items_html = __('No open tasks assigned'); if (isset($list->block_functions['tree'])) { unset($list->block_functions['tree']); $list->block_functions['grouped']->default = true; } $list->print_automatic(); ### add company-id ### # note: some pageFunctions like personNew can use this for automatical linking # echo "<input type='hidden' name='person' value='{$person->id}'>"; #echo "<a href=\"javascript:document.my_form.go.value='tasksMoveToFolder';document.my_form.submit();\">move to task-folder</a>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * view details of a version @ingroup pages */ function versionView() { global $PH; global $auth; require_once "render/render_wiki.inc.php"; ### get task #### if (!($version = Version::getVisibleById(get('version')))) { $PH->abortWarning("invalid version-id", ERROR_FATAL); } if (!($project = Project::getVisibleById($version->project))) { $PH->abortWarning("invalid project-id", ERROR_FATAL); } ### create from handle ### $from_handle = $PH->defineFromHandle(array('version' => $version->id)); ## is viewed by user ## $version->isViewedByUser($auth->cur_user); $page = new Page(); $page->cur_tab = 'projects'; $page->cur_crumb = 'projViewTasks'; $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $type = __('Version', 'page type'); if ($task) { $folder = $task->getFolderLinks() . "<em>></em>" . $task->getLink(); $page->type = $folder . " > " . $type; } else { $page->type = $type; } $page->title = $version->name; $page->title_minor = ""; if ($version->state == -1) { $page->title_minor = sprintf(__('(deleted %s)', 'page title add on with date of deletion'), renderTimestamp($version->deleted)); } ### page functions ### $page->add_function(new PageFunction(array('target' => 'versionEdit', 'params' => array('version' => $version->id), 'icon' => 'edit', 'tooltip' => __('Edit this version'), 'name' => __('Edit')))); $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $version->id)); if (!$item || $item[0]->is_bookmark == 0) { $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('version' => $version->id), 'tooltip' => __('Mark this version as bookmark'), 'name' => __('Bookmark')))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('version' => $version->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } ### render title ### echo new PageHeader(); echo new PageContentOpen(); $block = new PageBlock(array('title' => __('Description'), 'id' => 'description', 'noshade' => true)); $block->render_blockStart(); $str = wikifieldAsHtml($version, 'description'); echo "<div class=text>"; echo "{$str}"; echo "</div>"; $block->render_blockEnd(); echo '<input type="hidden" name="prj" value="' . $version->project . '">'; /** * give parameter for create of new items (subtasks, efforts, etc) */ #echo '<input type="hidden" name="parent_task" value="'.$task->id.'">'; echo new PageContentClose(); echo new PageHtmlEnd(); }
function ProjView() { global $PH; global $auth; require_once confGet('DIR_STREBER') . "render/render_wiki.inc.php"; ### get current project ### $id = getOnePassedId('prj', 'projects_*'); if ($project = Project::getEditableById($id)) { $editable = true; } else { if ($project = Project::getVisibleById($id)) { $editable = false; } else { $PH->abortWarning(__("invalid project-id")); return; } } ### define from-handle ### $PH->defineFromHandle(array('prj' => $project->id)); ## is viewed by user ## $project->nowViewedByUser(); ## next milestone ## $next = $project->getNextMilestone(); $page = new Page(); $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $page->cur_tab = 'projects'; $page->title = $project->name; $page->title_minor = __("Project overview"); if ($project->status == STATUS_TEMPLATE) { $page->type = __("Project Template"); } else { if ($project->status >= STATUS_COMPLETED) { $page->type = __("Inactive Project"); } else { $page->type = __("Project", "Page Type"); } } ### page functions ### if ($project->isPersonVisibleTeamMember($auth->cur_user)) { if ($editable) { $page->add_function(new PageFunction(array('target' => 'projEdit', 'params' => array('prj' => $project->id), 'icon' => 'edit', 'tooltip' => __('Edit this project'), 'name' => __('Edit project')))); } /* $item = ItemPerson::getAll(array( 'person'=>$auth->cur_user->id, 'item'=>$project->id )); if((!$item) || ($item[0]->is_bookmark == 0)){ $page->add_function(new PageFunction(array( 'target' =>'itemsAsBookmark', 'params' =>array('proj'=>$project->id), 'tooltip' =>__('Mark this project as bookmark'), 'name' =>__('Bookmark'), ))); } else{ $page->add_function(new PageFunction(array( 'target' =>'itemsRemoveBookmark', 'params' =>array('proj'=>$project->id), 'tooltip' =>__('Remove this bookmark'), 'name' =>__('Remove Bookmark'), ))); } */ /* if($project->state == 1) { $page->add_function(new PageFunction(array( 'target'=>'projDelete', 'params'=>array('prj'=>$project->id), 'icon'=>'delete', 'tooltip'=>__('Delete this project'), 'name'=>__('Delete') ))); } */ #$page->add_function(new PageFunctionGroup(array( # 'name' => __('new') #))); /* $page->add_function(new PageFunction(array( 'target' =>'projAddPerson', 'params' =>array('prj'=>$project->id), 'icon' =>'add', 'tooltip' =>__('Add person as team-member to project'), 'name' =>__('Team member') ))); */ if ($project->settings & PROJECT_SETTING_ENABLE_TASKS) { $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('prj' => $project->id), 'icon' => 'new', 'tooltip' => __('Create task'), 'name' => __('New task')))); } if ($project->settings & PROJECT_SETTING_ENABLE_BUGS) { $page->add_function(new PageFunction(array('target' => 'taskNewBug', 'params' => array('prj' => $project->id, 'add_issue' => 1), 'icon' => 'new', 'tooltip' => __('Create task with issue-report'), 'name' => __('New bug')))); } $page->add_function(new PageFunction(array('target' => 'taskNewDocu', 'params' => array('prj' => $project->id), 'icon' => 'new', 'tooltip' => __('Create wiki documentation page or start discussion topic'), 'name' => __('New topic')))); if ($project->settings & PROJECT_SETTING_ENABLE_EFFORTS && $auth->cur_user->settings & USER_SETTING_ENABLE_EFFORTS) { $page->add_function(new PageFunction(array('target' => 'effortNew', 'params' => array('prj' => $project->id), 'icon' => 'loghours', 'tooltip' => __('Book effort for this project'), 'name' => __('Book effort')))); } } $url = $PH->getUrl("projViewAsRSS", array('prj' => $project->id)); $page->extra_header_html .= '<link rel="alternate" type="application/rss+xml" title="' . asHtml($project->name) . ' ' . __("News") . '"' . ' href="' . $url . '" />'; ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); measure_stop('current milestone'); require_once confGet('DIR_STREBER') . 'blocks/current_milestone_block.inc.php'; $block = new CurrentMilestoneBlock($project); $block->render(); measure_stop('current milestone'); measure_start('team'); require_once confGet('DIR_STREBER') . 'lists/list_docustructure.inc.php'; if (Task::getDocuTasks($project->id, 0)) { $list = new Block_DocuNavigation(array('project_id' => $project->id)); $list->print_all(); } #--- list team ----------------------------------------------------------- /* { $list= new ListBlock_projectTeam(); $list->title= __('Team members'); $list->show_icons=true; $list->active_block_function = 'list'; $list->print_automatic($project); } measure_stop('team'); */ echo new PageContentNextCol(); echo "<div class=description>"; echo wikifieldAsHtml($project, 'description', array('empty_text' => "[quote]" . __("This project does not have any text yet.\nDoubleclick here to add some.") . "[/quote]")); echo "</div>"; #--- news ----------------------------------------------------------- if ($project->settings & PROJECT_SETTING_ENABLE_NEWS) { require_once confGet('DIR_STREBER') . './blocks/project_news_block.inc.php'; print new ProjectNewsBlock($project); } require_once confGet('DIR_STREBER') . './lists/list_recentchanges.inc.php'; printRecentChanges(array($project), false); /* measure_start('changes'); { require_once(confGet('DIR_STREBER') . './lists/list_changes.inc.php'); $list= new ListBlock_changes(); $list->query_options['date_min']= $auth->cur_user->last_logout; $list->query_options['not_modified_by']= $auth->cur_user->id; $list->query_options['project']= $project->id; //$list->print_automatic($project); $list->print_automatic(); } measure_stop('changes'); */ echo "<br><br>"; # @@@ hack for firefox overflow problems ### HACKING: 'add new task'-field ### $PH->go_submit = 'taskNew'; echo '<input type="hidden" name="prj" value="' . $project->id . '">'; #$rss_url = confGet('SELF_PROTOCOL').'://'.confGet('SELF_URL'); #$rss_url = str_replace("index.php", "rss/", $rss_url); #$prj_id = $this->page->options[0]->target_params['prj']; $url = $PH->getUrl('projViewAsRSS', array('prj' => $project->id)); echo "<a style='margin:0px; border-width:0px;' href='{$url}' target='_blank'>" . "<img style='margin:0px; border-width:0px;' src='" . getThemeFile("icons/rss_icon.gif") . "'>" . "</a>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * renders a comparision between two versions of an item @ingroup pages */ function itemViewDiff() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; ### get task #### $item_id = get('item'); if (!($item = DbProjectItem::getObjectById($item_id))) { $PH->abortWarning("invalid item-id", ERROR_FATAL); } if (!($project = Project::getVisibleById($item->project))) { $PH->abortWarning("this item has an invalid project id", ERROR_DATASTRUCTURE); } require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php"; $versions = ItemVersion::getFromItem($item); $date1 = get('date1'); $date2 = get('date2'); if (!$date1) { #if(count($versions) > 1) { # if($auth->cur_user->last_logout < $versions[count($versions)-2]->date_to) # { # $date1 = $auth->cur_user->last_logout; # } # else { # $date1 = $versions[count($versions)-2]->date_from; # } #} #else { foreach (array_reverse($versions) as $v) { if ($v->author == $auth->cur_user->id) { $date1 = $v->date_from; break; } } #} } if (!$date2) { $date2 = getGMTString(); } $page = new Page(); $page->cur_tab = 'projects'; $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $page->title = $item->name; $page->title_minor = __('changes'); $page->add_function(new PageFunction(array('target' => 'itemView', 'params' => array('item' => $item->id), 'icon' => 'edit', 'name' => __('View item')))); ### render title ### echo new PageHeader(); echo new PageContentOpen(); if ($date1 > $date2) { new FeedbackMessage(__("date1 should be smaller than date2. Swapped")); $t = $date1; $date1 = $date2; $date2 = $t; } if (count($versions) == 1) { echo __("item has not been edited history"); } else { $old_version = NULL; $version_right = NULL; $version_left = $versions[0]; foreach ($versions as $v) { if ($v->date_from <= $date1) { $version_left = $v; } if ($v->date_from >= $date2) { if (isset($version_right)) { if ($version_right->date_from > $v->date_from) { $version_right = $v; } } else { $version_right = $v; } } } if (!isset($version_right)) { $version_right = $versions[count($versions) - 1]; } $options_left = array(); $options_right = array(); ### list versions left ### for ($i = 0; $i < count($versions) - 1; $i++) { $v = $versions[$i]; if ($person = Person::getVisibleById($v->author)) { $author = $person->name; } else { $author = __('unknown'); } if ($v->version_number == $version_left->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to)); $name = ' v.' . $v->version_number . ' -- ' . $author . " -- " . $v->date_from; $options_left[] = "<option selected=1 value='" . $str_link . "'>" . $name . "</option>"; } else { if ($v->version_number > $version_left->version_number) { if ($v->version_number < $version_right->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to)); $name = '> v.' . $v->version_number . ' -- ' . $author . " -- " . renderDate($v->date_from); } else { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $version_right->date_to)); $name = '>> v.' . $v->version_number . ' -- ' . $author . " -- " . renderDate($v->date_from); } $options_left[] = "<option value='" . $str_link . "'>" . $name . "</option>"; } else { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $version_right->date_from)); $name = '< v.' . $v->version_number . ' -- ' . $author . " -- " . renderDate($v->date_from); $options_left[] = "<option value='" . $str_link . "'>" . $name . "</option>"; } } } ### list versions right ### for ($i = 1; $i < count($versions); $i++) { $v = $versions[$i]; if ($person = Person::getVisibleById($v->author)) { $author = $person->name; } else { $author = __('unknown'); } if ($v->version_number == $version_right->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to)); $name = ' v.' . $v->version_number . ' -- ' . $author . " -- " . $v->date_from; $options_right[] = "<option selected=1 value='" . $str_link . "'>" . $name . "</option>"; } else { if ($v->version_number > $version_right->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $version_left->date_from, 'date2' => $versions[$i]->date_from)); $name = '> v.' . $v->version_number . ' -- ' . $author . ' -- ' . renderDate($v->date_from); $options_right[] = "<option value='" . $str_link . "'>" . $name . "</option>"; } else { if ($v->version_number > $version_left->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $version_left->date_from, 'date2' => $versions[$i]->date_from)); $name = '< v.' . $v->version_number . ' -- ' . $author . " -- " . renderDate($v->date_from); } else { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to)); $name = '<< v.' . $v->version_number . ' -- ' . $author . ' -- ' . renderDate($v->date_from); } $options_right[] = "<option value='" . $str_link . "'>" . $name . "</option>"; } } } ### prev ### if ($version_left->version_number > 1) { $link_prev = $PH->getLink('itemViewDiff', '<< ' . __('prev change'), array('item' => $item->id, 'date1' => $versions[$version_left->version_number - 2]->date_from, 'date2' => $versions[$version_left->version_number - 2]->date_to), NULL, true); } else { $link_prev = ''; } ### next ### if ($version_right->version_number < count($versions)) { $link_next = $PH->getLink('itemViewDiff', __('next') . '>>', array('item' => $item->id, 'date1' => $versions[$version_right->version_number - 1]->date_from, 'date2' => $versions[$version_right->version_number - 1]->date_to), NULL, true); } else { $link_next = ''; } ### summary ### $link_summary = $PH->getLink('itemViewDiff', __('summary'), array('item' => $item->id, 'date1' => $auth->cur_user->last_logout, 'date2' => getGMTString()), NULL, true); echo "<div class=diff>"; echo "<table class=nav><tr>"; echo "<td class=older>" . "<select onChange='location.href=this.options[this.selectedIndex].value'>" . join(array_reverse($options_left)) . "</select>" . '<br><b class=doclear></b>' . $link_prev . "</td>"; echo "<td class=newer>" . "<select onChange='location.href=this.options[this.selectedIndex].value'>" . join(array_reverse($options_right)) . "</select>" . '<br><b class=doclear></b>' . $link_next . $link_summary . "</td>"; echo "</table>"; #if(!$date2 || !$date1) { # echo sprintf(__("Item did not exists at %s"), renderTime($date2)); #} if ($old_version == $version_right) { echo sprintf(__('no changes between %s and %s'), renderTime($date1), renderTime($date2)); } ### collect changes ### $old_field_values = array(); $new_field_values = array(); foreach ($versions as $v) { if ($v->version_number <= $version_left->version_number) { foreach ($v->values as $name => $value) { $old_field_values[$name] = $value; } } if ($v->version_number >= $version_left->version_number && $v->version_number < $version_right->version_number) { foreach ($v->values_next as $name => $value) { $new_field_values[$name] = $value; } } } foreach ($new_field_values as $field_name => $value) { echo "<h2>{$field_name}</h2>"; $old_value = isset($old_field_values[$field_name]) ? $old_field_values[$field_name] : ""; $new_value = isset($new_field_values[$field_name]) ? $new_field_values[$field_name] : ''; $field_type = $item->fields[$field_name]->type; if ($field_type == 'FieldText') { echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldOption') { if ($field_name == 'status') { global $g_status_names; $old_value = isset($g_status_names[$old_value]) ? $g_status_names[$old_value] : __('undefined'); $new_value = isset($g_status_names[$new_value]) ? $g_status_names[$new_value] : __('undefined'); } else { if ($field_name == 'label') { if ($project = Project::getVisibleById($item->project)) { $labels = explode(",", $project->labels); $old_value = isset($labels[$old_value - 1]) ? $labels[$old_value - 1] : __('undefined'); $new_value = isset($labels[$new_value - 1]) ? $labels[$new_value - 1] : __('undefined'); } } } echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldInternal') { if ($field_name == 'parent_item') { if ($task_parent_old = Task::getVisibleById($old_value)) { $ar = array(); foreach ($task_parent_old->getFolder() as $f) { $ar[] = $f->name; } $ar[] = $task_parent_old->name; $old_value = join($ar, " > "); } if ($task_parent_new = Task::getVisibleById($new_value)) { $ar = array(); foreach ($task_parent_new->getFolder() as $f) { $ar[] = $f->name; } $ar[] = $task_parent_new->name; $new_value = join($ar, " > "); } } else { if ($field_name == 'state') { $old_value = $old_value == -1 ? __('deleted') : __('ok'); $new_value = $new_value == -1 ? __('deleted') : __('ok'); } else { if ($field_name == 'pub_level') { global $g_pub_level_names; $old_value = isset($g_pub_level_names[$old_value]) ? $g_pub_level_names[$old_value] : __('undefined'); $new_value = isset($g_pub_level_names[$new_value]) ? $g_pub_level_names[$new_value] : __('undefined'); } } } echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldPercentage') { echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldInt') { echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldString') { echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldDate') { echo render_changes(renderDate($old_value), renderDate($new_value)); } else { if ($field_type == 'FieldDatetime') { echo render_changes(renderTimestamp($old_value), renderTimestamp($new_value)); } } } } } } } } } } echo "</div>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * List released versions of a project @ingroup pages */ function ProjViewVersions() { global $PH; global $auth; require_once confGet('DIR_STREBER') . "lists/list_versions.inc.php"; ### get current project ### $id = getOnePassedId('prj', 'projects_*'); if (!($project = Project::getVisibleById($id))) { $PH->abortWarning("invalid project-id"); return; } ### create from handle ### $PH->defineFromHandle(array('prj' => $project->id)); $page = new Page(); $page->cur_tab = 'projects'; $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $page->title_minor = __("Released versions"); $page->title = $project->name; if ($project->status == STATUS_TEMPLATE) { $page->type = __("Project Template"); } else { if ($project->status >= STATUS_COMPLETED) { $page->type = __("Inactive Project"); } else { $page->type = __("Project", "Page Type"); } } ### page functions ### if ($project->isPersonVisibleTeamMember($auth->cur_user)) { if ($auth->cur_user->id != confGet('ANONYMOUS_USER')) { $page->add_function(new PageFunction(array('target' => 'taskNewVersion', 'params' => array('prj' => $project->id), 'icon' => 'new', 'name' => __('New released Version')))); } } ### render title ### echo new PageHeader(); echo new PageContentOpen(); $list = new ListBlock_versions(); $list->query_options['project'] = $project->id; $list->print_automatic($project); if ($tasks = Task::getAll(array('project' => $project->id, 'status_min' => STATUS_COMPLETED, 'status_max' => STATUS_CLOSED, 'resolved_version' => RESOLVED_IN_NEXT_VERSION, 'resolve_reason_min' => RESOLVED_DONE))) { $block = new PageBlock(array('title' => __("Tasks resolved in upcoming version"), 'id' => 'resolved_tasks')); $block->render_blockStart(); echo "<div class=text>"; echo '<ul>'; foreach ($tasks as $t) { global $g_resolve_reason_names; if ($t->resolve_reason && isset($g_resolve_reason_names[$t->resolve_reason])) { $reason = $g_resolve_reason_names[$t->resolve_reason] . ": "; } else { $reason = ""; } echo '<li>' . $reason . $t->getLink(false) . '</li>'; } echo '</ul>'; $block->render_blockEnd(); } echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * list all changes on server @ingroup pages */ function homeAllChanges() { global $PH; global $auth; ### sets the presets ### $presets = array('last_logout' => array('name' => __('last logout'), 'filters' => array('last_logout' => array('id' => 'last_logout', 'visible' => true, 'active' => true, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'today' => array('name' => __('today'), 'filters' => array('today' => array('id' => 'today', 'visible' => true, 'active' => true, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'yesterday' => array('name' => __('yesterday'), 'filters' => array('yesterday' => array('id' => 'yesterday', 'visible' => true, 'active' => true, 'factor' => 1, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'last_week' => array('name' => __('1 week'), 'filters' => array('last_week' => array('id' => 'last_week', 'visible' => true, 'active' => true, 'factor' => 7, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'last_two_weeks' => array('name' => __('2 weeks'), 'filters' => array('last_two_weeks' => array('id' => 'last_two_weeks', 'visible' => true, 'active' => true, 'factor' => 14, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list')))); ## set preset location ## $preset_location = 'homeAllChanges'; $preset_id = 'last_two_weeks'; # default value if ($tmp_preset_id = get('preset')) { if (isset($presets[$tmp_preset_id])) { $preset_id = $tmp_preset_id; } ### set cookie setcookie('STREBER_homeAllChanges_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0); } else { if ($tmp_preset_id = get('STREBER_homeAllChanges_preset')) { if (isset($presets[$tmp_preset_id])) { $preset_id = $tmp_preset_id; } } } ### create from handle ### $PH->defineFromHandle(array('preset_id' => $preset_id)); ### set up page #### $page = new Page(); #$list = new ListBlock_AllChanges(); require_once confGet('DIR_STREBER') . 'lists/list_changes.inc.php'; $list = new ListBlock_Changes(); #$list->query_options[''] #require_once(confGet('DIR_STREBER') . './lists/list_changes.inc.php'); #$list= new ListBlock_changes(); $list->filters[] = new ListFilter_changes(); $preset = $presets[$preset_id]; foreach ($preset['filters'] as $f_name => $f_settings) { switch ($f_name) { case 'last_logout': $list->filters[] = new ListFilter_last_logout(array('value' => $f_settings['value'])); break; /*case 'today': $list->filters[]= new ListFilter_today(array( 'value'=>$f_settings['value'], )); break;*/ /*case 'today': $list->filters[]= new ListFilter_today(array( 'value'=>$f_settings['value'], )); break;*/ case 'today': $list->filters[] = new ListFilter_min_week(array('value' => $f_settings['value'], 'factor' => 0)); #$list->filters[]= new ListFilter_max_week(array( # 'value'=>$f_settings['value'], #)); break; case 'yesterday': $list->filters[] = new ListFilter_min_week(array('value' => $f_settings['value'], 'factor' => $f_settings['factor'])); #$list->filters[]= new ListFilter_max_week(array( # 'value'=>$f_settings['value'], #)); break; case 'last_week': $list->filters[] = new ListFilter_min_week(array('value' => $f_settings['value'], 'factor' => $f_settings['factor'])); #$list->filters[]= new ListFilter_max_week(array( # 'value'=>$f_settings['value'], #)); break; case 'last_two_weeks': $list->filters[] = new ListFilter_min_week(array('value' => $f_settings['value'], 'factor' => $f_settings['factor'])); #$list->filters[]= new ListFilter_max_week(array( # 'value'=>$f_settings['value'], #)); break; default: trigger_error("Unknown filter setting {$f_name}", E_USER_WARNING); break; } } $filter_empty_folders = isset($preset['filter_empty_folders']) && $preset['filter_empty_folders'] ? true : NULL; $page->cur_tab = 'home'; $page->options = build_home_options(); $page->title = __("Changes"); $page->type = __('List', 'page type'); $page->title_minor = renderTitleDate(time()); $page->add_function(new PageFunction(array('target' => 'itemsRemoveMany', 'icon' => 'remove'))); echo new PageHeader(); echo new PageContentOpen(); $page->print_presets(array('target' => $preset_location, 'project_id' => '', 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => '')); #echo(new PageContentNextCol); $list->print_automatic(); echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * View a company * * @ingroup pages */ function companyView() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; ### get current company ### $id = getOnePassedId('company', 'companies_*'); $company = Company::getVisibleById($id); if (!$company) { $PH->abortWarning("invalid company-id"); return; } ## is viewed by user ## $company->nowViewedByUser(); $company->validateView(); ### create from handle ### $PH->defineFromHandle(array('company' => $company->id)); $page = new Page(); $page->cur_tab = 'companies'; $page->title = $company->name; $page->title_minor = __("Overview"); $page->type = __("Company"); ### breadcrumbs ### $page->crumbs = build_company_crumbs($company); ### page functions ### $page->add_function(new PageFunctionGroup(array('name' => __('edit')))); $page->add_function(new PageFunction(array('target' => 'companyEdit', 'params' => array('company' => $company->id), 'icon' => 'edit', 'tooltip' => __('Edit this company'), 'name' => __('Company')))); $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $company->id)); if (!$item || $item[0]->is_bookmark == 0) { $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('company' => $company->id), 'tooltip' => __('Mark this company as bookmark'), 'name' => __('Bookmark')))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('company' => $company->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } if ($company->state == 1) { $page->add_function(new PageFunction(array('target' => 'companyDelete', 'params' => array('company' => $company->id), 'icon' => 'delete', 'tooltip' => __('Delete this company'), 'name' => __('Delete')))); } $page->add_function(new PageFunctionGroup(array('name' => __('new')))); $page->add_function(new PageFunction(array('target' => 'personNew', 'params' => array('company' => $company->id), 'icon' => 'new', 'tooltip' => __('Create new person for this company'), 'name' => __('Person')))); $page->add_function(new PageFunction(array('target' => 'projNew', 'params' => array('company' => $company->id), 'icon' => 'new', 'tooltip' => __('Create new project for this company'), 'name' => __('Project')))); $page->add_function(new PageFunction(array('target' => 'companyLinkPeople', 'params' => array('company' => $company->id), 'icon' => 'add', 'tooltip' => __('Add existing people to this company'), 'name' => __('People')))); ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); $block = new PageBlock(array('title' => __('Summary'), 'id' => 'summary')); $block->render_blockStart(); echo "<div class=text>"; if ($company->comments) { echo wikifieldAsHtml($company, 'comments'); } if ($company->street) { echo '<div class=labeled><label>' . __('Adress') . ':</label>' . asHtml($company->street) . '</div>'; } if ($company->zipcode) { echo '<div class=labeled><label></label>' . asHtml($company->zipcode) . '</div>'; } if ($company->phone) { echo '<div class=labeled><label>' . __('Phone') . ':</label>' . asHtml($company->phone) . '</div>'; } if ($company->fax) { echo '<div class=labeled><label>' . __('Fax') . ':</label>' . asHtml($company->fax) . '</div>'; } if ($company->homepage) { echo '<div class=labeled><label>' . __('Web') . ':</label>' . url2linkExtern($company->homepage) . '</div>'; } if ($company->intranet) { echo '<div class=labeled><label>' . __('Intra') . ':</label>' . url2linkExtern($company->intranet) . '</div>'; } if ($company->email) { echo '<div class=labeled><label>' . __('Mail') . ':</label>' . url2linkMail($company->email) . '</div>'; } $sum = 0; foreach ($company->getProjects() as $p) { $sum += $p->getOpenEffortsSum(); } if ($sum > 0) { echo "<div class=text>"; echo '<div class=labeled><label>' . __('Open efforts') . ':</label>' . round($sum / 60 / 60, 1) . 'h</div>'; echo "</div>"; } echo "</div>"; $block->render_blockEnd(); require_once confGet('DIR_STREBER') . 'pages/person.inc.php'; $list = new ListBlock_people(); $people = $company->getPeople(); $list->title = __('related People'); $list->id = "related_people"; unset($list->columns['tagline']); unset($list->columns['nickname']); unset($list->columns['profile']); unset($list->columns['projects']); unset($list->columns['personal_phone']); unset($list->columns['office_phone']); unset($list->columns['companies']); unset($list->columns['changes']); unset($list->columns['last_login']); unset($list->functions['personDelete']); unset($list->functions['personEditRights']); /** * \NOTE We should provide a list-function to link more * people to this company. But therefore we would need to * pass the company's id, which is not possible right now... */ $list->add_function(new ListFunction(array('target' => $PH->getPage('companyLinkPeople')->id, 'name' => __('Link People'), 'id' => 'companyLinkPeople', 'icon' => 'add'))); $list->add_function(new ListFunction(array('target' => $PH->getPage('companyPeopleDelete')->id, 'name' => __('Remove person from company'), 'id' => 'companyPeopleDelete', 'icon' => 'sub', 'context_menu' => 'submit'))); if ($auth->cur_user->user_rights & RIGHT_COMPANY_EDIT) { $list->no_items_html = $PH->getLink('companyLinkPeople', __('link existing Person'), array('company' => $company->id)) . " " . __("or") . " " . $PH->getLink('personNew', __('create new'), array('company' => $company->id)); } else { $list->no_items_html = __("no people related"); } $list->render_list($people); //$list->print_automatic($people); echo new PageContentNextCol(); require_once confGet('DIR_STREBER') . 'lists/list_projects.inc.php'; $order_by = get('sort_' . $PH->cur_page->id . "_projects"); $list = new ListBlock_projects(); $list->title = __("Active projects"); $list->id = "active_projects"; $list->groupings = NULL; $list->block_functions = NULL; unset($list->columns['company']); unset($list->functions['projNew']); unset($list->functions['projDelete']); $list->query_options['status_min'] = STATUS_UPCOMING; $list->query_options['status_max'] = STATUS_OPEN; $list->query_options['company'] = $company->id; if ($auth->cur_user->user_rights & RIGHT_PROJECT_CREATE) { $list->no_items_html = $PH->getLink('projNew', __('Create new project'), array('company' => $company->id)) . " " . __(" Hint: for already existing projects please edit those and adjust company-setting."); } else { $list->no_items_html = __("no projects yet"); } $list->print_automatic(); $list = new ListBlock_projects(); $list->groupings = NULL; $list->block_functions = NULL; $list->title = __("Closed projects"); $list->id = "closed_projects"; unset($list->columns['company']); unset($list->functions['projNew']); unset($list->functions['projDelete']); $list->query_options['status_min'] = STATUS_BLOCKED; $list->query_options['status_max'] = STATUS_CLOSED; $list->query_options['company'] = $company->id; $list->print_automatic(); ### add company-id ### # note: some pageFunctions like personNew can use this for automatical linking echo "<input type=hidden name=company value='{$company->id}'>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * list tasks of a project @ingroup pages */ function projViewTasks() { global $PH; global $auth; ### get current project ### $id = getOnePassedId('prj', 'projects_*'); if (!($project = Project::getVisibleById($id))) { $PH->abortWarning("invalid project-id"); return; } ### get upcoming or selected milestone ### /* pixtur: 2008-09-60 WARNING: Selecting a milestone directly to limit the viewed tasks does not work because editing a task with a milestone will compromize the following task list. I have no idea, why this code is in here, or weather it is required at all. */ $for_milestone = intval(get("for_milestone")); $milestone = NULL; if ($for_milestone) { $milestone = Task::getVisibleById($for_milestone); } #if($milestone= $project->getNextMilestone()) { # $for_milestone= $milestone->id; #} $presets = array('all_tasks' => array('name' => __('all'), 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'min' => STATUS_NEW, 'max' => STATUS_CLOSED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'tree'))), 'open_tasks' => array('name' => __('open'), 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'values' => array(STATUS_NEW, STATUS_OPEN, STATUS_BLOCKED, STATUS_COMPLETED), 'min' => STATUS_NEW, 'max' => STATUS_COMPLETED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'my_open_tasks' => array('name' => __('my open'), 'filter_empty_folders' => true, 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'values' => array(STATUS_NEW, STATUS_OPEN, STATUS_BLOCKED), 'min' => STATUS_NEW, 'max' => STATUS_BLOCKED), 'assigned_to' => array('id' => 'assigned_to', 'visible' => true, 'active' => true, 'value' => $auth->cur_user->id)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list')), 'new_task_options' => array('task_assign_to_0' => $auth->cur_user->id)), 'next_milestone' => array('name' => __('for milestone'), 'filter_empty_folders' => true, 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => false, 'active' => true, 'values' => array(STATUS_NEW, STATUS_OPEN, STATUS_BLOCKED, STATUS_COMPLETED), 'min' => STATUS_NEW, 'max' => STATUS_COMPLETED), 'for_milestone' => array('id' => 'for_milestone', 'visible' => true, 'active' => true, 'value' => $for_milestone)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list')), 'new_task_options' => array('for_milestone' => $for_milestone)), 'needs_feedback' => array('name' => __('modified'), 'filter_empty_folders' => true, 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'values' => array(STATUS_COMPLETED), 'min' => STATUS_NEW, 'max' => STATUS_COMPLETED), 'not_modified_by' => $auth->cur_user->id), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'approve_tasks' => array('name' => __('needs approval'), 'filter_empty_folders' => true, 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'values' => array(STATUS_COMPLETED), 'min' => STATUS_COMPLETED, 'max' => STATUS_COMPLETED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'without_milestone' => array('name' => __('without milestone'), 'filter_empty_folders' => true, 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'values' => array(STATUS_COMPLETED), 'min' => STATUS_NEW, 'max' => STATUS_COMPLETED), 'for_milestone' => array('id' => 'for_milestone', 'visible' => true, 'active' => true, 'value' => 0)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'closed_tasks' => array('name' => __('closed'), 'filter_empty_folders' => false, 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'values' => array(STATUS_APPROVED, STATUS_CLOSED), 'min' => STATUS_APPROVED, 'max' => STATUS_CLOSED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list')))); ## set preset location ## $preset_location = 'projViewTasks'; $preset_id = 'open_tasks'; # default value if ($tmp_preset_id = get('preset')) { if (isset($presets[$tmp_preset_id])) { $preset_id = $tmp_preset_id; } ### set cookie setcookie('STREBER_projViewTasks_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0); } else { if ($tmp_preset_id = get('STREBER_projViewTasks_preset')) { if (isset($presets[$tmp_preset_id])) { $preset_id = $tmp_preset_id; } } } if ($milestone) { ### create from handle ### $PH->defineFromHandle(array('prj' => $project->id, 'preset_id' => $preset_id, 'for_milestone' => $milestone->id)); } else { ### create from handle ### $PH->defineFromHandle(array('prj' => $project->id, 'preset_id' => $preset_id)); } $page = new Page(); ### init known filters for preset ### $list = new ListBlock_tasks(array('active_block_function' => 'tree')); $list->filters[] = new ListFilter_category_in(array('value' => array(TCATEGORY_TASK, TCATEGORY_BUG))); $preset = $presets[$preset_id]; foreach ($preset['filters'] as $f_name => $f_settings) { switch ($f_name) { case 'task_status': $list->filters[] = new ListFilter_status_min(array('value' => $f_settings['min'])); $list->filters[] = new ListFilter_status_max(array('value' => $f_settings['max'])); break; case 'assigned_to': $list->filters[] = new ListFilter_assigned_to(array('value' => $f_settings['value'])); break; case 'for_milestone': $list->filters[] = new ListFilter_for_milestone(array('value' => $f_settings['value'])); break; case 'not_modified_by': $list->filters[] = new ListFilter_not_modified_by(array('value' => $f_settings['value'])); break; default: trigger_error("Unknown filter setting {$f_name}", E_USER_WARNING); break; } } $filter_empty_folders = isset($preset['filter_empty_folders']) && $preset['filter_empty_folders'] ? true : NULL; $page->cur_tab = 'projects'; $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $page->title = $project->name; if (isset($preset['name'])) { $page->title_minor = $preset['name']; if ($preset_id == 'next_milestone' && isset($milestone) && isset($milestone->name)) { $page->title_minor = __('Milestone') . ' ' . $milestone->name; } } else { $page->title_minor = __("Tasks"); } if ($project->status == STATUS_TEMPLATE) { $page->type = __("Project Template"); } else { if ($project->status >= STATUS_COMPLETED) { $page->type = __("Inactive Project"); } else { $page->type = __("Project", "Page Type"); } } ### page functions ### $new_task_options = isset($preset['new_task_options']) ? $preset['new_task_options'] : array(); if ($project->isPersonVisibleTeamMember($auth->cur_user)) { #$page->add_function(new PageFunctionGroup(array( # 'name'=>__('new'), #))); if ($preset_id != 'next_milestone') { $page->add_function(new PageFunction(array('target' => 'taskNewFolder', 'params' => array('prj' => $project->id) + $new_task_options, 'icon' => 'new', 'tooltip' => __('Create a new folder for tasks and files')))); } $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('prj' => $project->id) + $new_task_options, 'icon' => 'new', 'tooltip' => __('new subtask for this folder')))); if ($project->settings & PROJECT_SETTING_ENABLE_BUGS) { $page->add_function(new PageFunction(array('target' => 'taskNewBug', 'params' => array('prj' => $project->id, 'add_issue' => 1) + $new_task_options, 'icon' => 'new', 'tooltip' => __('Create task with issue-report')))); } } ### render title ### echo new PageHeader(); echo new PageContentOpen(); ### list available presets ### if ($page->format != FORMAT_CSV) { $page->print_presets(array('target' => $preset_location, 'project_id' => $project->id, 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => '')); } if ($page->format == FORMAT_HTML) { $PH->go_submit = 'taskNew'; echo '<input type="hidden" name="prj" value="' . $id . '">'; /** * add preset specific options (like milestone,etc) as hidden fields * e.i. if we list tasks for a milestone, new tasks require to belong to this * milestone, otherwise they are not visible after creation */ foreach ($new_task_options as $name => $value) { echo "<input type=hidden name='{$name}' value='{$value}'>"; } ### Link to start cvs export ### $format = get('format'); if ($format == FORMAT_HTML || $format == '') { $list->footer_links[] = $PH->getCSVLink(); } } if ($for_milestone) { $list->filters[] = new ListFilter_for_milestone(array('value' => $for_milestone)); } $list->show_project_folder = false; unset($list->columns['project']); unset($list->columns['planned_start']); /** * NOTE: pixtur 2006-10-13 * for a clean version of this list with a AJAX-driven side board * following columns should be hidden: */ if (confGet('TASKDETAILS_IN_SIDEBOARD')) { unset($list->columns['assigned_to']); #unset($list->columns['for_milestone']); unset($list->columns['estimate_complete']); unset($list->columns['pub_level']); #unset($list->columns['_select_col_']); unset($list->columns['label']); } if (!confGet('TASK_LIST_EFFORT_COLUMN')) { unset($list->columns['efforts']); } $list->no_items_html = __('No tasks'); $list->print_automatic($project, NULL, $filter_empty_folders); #echo "<a href=\"javascript:document.my_form.go.value='tasksMoveToFolder';document.my_form.submit();\">move to task-folder</a>"; echo new PageContentClose(); echo new PageHtmlEnd(); }