Пример #1
0
/**
* display efforts for current user  @ingroup pages
*
* @NOTE 
* - actually this is an excact copy for personViewEfforts
* - this is of course not a good solution, but otherwise the breadcrumbs would change
*
*/
function homeListEfforts()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . 'db/class_effort.inc.php';
    require_once confGet('DIR_STREBER') . 'lists/list_efforts.inc.php';
    ### get current project ###
    $person = $auth->cur_user;
    $presets = array('all_efforts' => array('name' => __('all'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_NEW, 'max' => EFFORT_STATUS_BALANCED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'new_efforts' => array('name' => __('new'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_NEW, 'max' => EFFORT_STATUS_NEW)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'open_efforts' => array('name' => __('open'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_OPEN, 'max' => EFFORT_STATUS_OPEN)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'discounted_efforts' => array('name' => __('discounted'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_DISCOUNTED, 'max' => EFFORT_STATUS_DISCOUNTED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'notchargeable_efforts' => array('name' => __('not chargeable'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_NOTCHARGEABLE, 'max' => EFFORT_STATUS_NOTCHARGEABLE)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'balanced_efforts' => array('name' => __('balanced'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_BALANCED, 'max' => EFFORT_STATUS_BALANCED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), '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'))), 'last_week' => array('name' => __('1 week'), 'filters' => array('last_weeks' => array('id' => 'last_weeks', '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_weeks' => array('id' => 'last_weeks', 'visible' => true, 'active' => true, 'factor' => 14, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'last_three_weeks' => array('name' => __('3 weeks'), 'filters' => array('last_weeks' => array('id' => 'last_weeks', 'visible' => true, 'active' => true, 'factor' => 21, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'last_month' => array('name' => __('1 month'), 'filters' => array('last_weeks' => array('id' => 'last_weeks', 'visible' => true, 'active' => true, 'factor' => 28, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'prior' => array('name' => __('prior'), 'filters' => array('prior' => array('id' => 'prior', 'visible' => true, 'active' => true, 'factor' => 29, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))));
    ## set preset location ##
    $preset_location = 'homeListEfforts';
    $preset_id = 'all_efforts';
    # default value
    if ($tmp_preset_id = get('preset')) {
        if (isset($presets[$tmp_preset_id])) {
            $preset_id = $tmp_preset_id;
        }
        ### set cookie
        setcookie('STREBER_homeListEfforts_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0);
    } else {
        if ($tmp_preset_id = get('STREBER_homeListEfforts_preset')) {
            if (isset($presets[$tmp_preset_id])) {
                $preset_id = $tmp_preset_id;
            }
        }
    }
    ### create from handle ###
    $PH->defineFromHandle(array('person' => $person->id, 'preset_id' => $preset_id));
    $page = new Page();
    $page->cur_tab = 'home';
    $page->title = __("Your efforts");
    $page->title_minor = __('Efforts', 'Page title add on');
    $page->type = __("Person");
    #$page->crumbs = build_person_crumbs($person);
    $page->options = build_home_options($person);
    echo new PageHeader();
    echo new PageContentOpen();
    $order_by = get('sort_' . $PH->cur_page->id . "_efforts");
    require_once confGet('DIR_STREBER') . 'db/class_effort.inc.php';
    /*$efforts= Effort::getAll(array(
          'person'    => $person->id,
          'order_by'  => $order_by,
      ));*/
    $list = new ListBlock_efforts();
    unset($list->functions['effortNew']);
    unset($list->functions['effortNew']);
    $list->no_items_html = __('no efforts yet');
    $list->filters[] = new ListFilter_efforts();
    $preset = $presets[$preset_id];
    foreach ($preset['filters'] as $f_name => $f_settings) {
        switch ($f_name) {
            case 'effort_status':
                $list->filters[] = new ListFilter_effort_status_min(array('value' => $f_settings['min']));
                $list->filters[] = new ListFilter_effort_status_max(array('value' => $f_settings['max']));
                break;
            case 'last_logout':
                $list->filters[] = new ListFilter_last_logout(array('value' => $f_settings['value']));
                break;
            case 'last_weeks':
                $list->filters[] = new ListFilter_min_week(array('value' => $f_settings['value'], 'factor' => $f_settings['factor']));
                break;
            case 'prior':
                $list->filters[] = new ListFilter_max_week(array('value' => $f_settings['value'], 'factor' => $f_settings['factor']));
                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->print_presets(array('target' => $preset_location, 'project_id' => '', 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => $person->id));
    $list->query_options['order_by'] = $order_by;
    $list->query_options['person'] = $person->id;
    $list->print_automatic();
    //$list->render_list($efforts);
    echo '<input type="hidden" name="person" value="' . $person->id . '">';
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Пример #2
0
function personViewChanges()
{
    global $PH;
    global $auth;
    ### get current project ###
    $id = getOnePassedId('person', 'people_*');
    if (!($person = Person::getVisibleById($id))) {
        $PH->abortWarning("invalid person-id");
        return;
    }
    ### sets the presets ###
    $presets = array('all_changes' => array('name' => __('all'), 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'min' => STATUS_UNDEFINED, 'max' => STATUS_CLOSED)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), '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'))), '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 = 'personViewChanges';
    $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_personViewChanges_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0);
    } else {
        if ($tmp_preset_id = get('STREBER_personViewChanges_preset')) {
            if (isset($presets[$tmp_preset_id])) {
                $preset_id = $tmp_preset_id;
            }
        }
    }
    ### create from handle ###
    $PH->defineFromHandle(array('person' => $person->id, 'preset_id' => $preset_id));
    $page = new Page();
    $page->cur_tab = 'people';
    $page->title = $person->name;
    $page->title_minor = __('Changes', 'Page title add on');
    $page->type = __("Person");
    $page->crumbs = build_person_crumbs($person);
    $page->options = build_person_options($person);
    echo new PageHeader();
    echo new PageContentOpen();
    require_once confGet('DIR_STREBER') . './lists/list_changes.inc.php';
    $list = new ListBlock_changes();
    $list->no_items_html = __('no changes yet');
    $list->filters[] = new ListFilter_changes();
    $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 'last_logout':
                $list->filters[] = new ListFilter_last_logout(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->print_presets(array('target' => $preset_location, 'project_id' => '', 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => $person->id));
    $list->query_options['modified_by'] = $person->id;
    $list->print_automatic();
    echo '<input type="hidden" name="person" value="' . $person->id . '">';
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Пример #3
0
/**
* List efforts booked for a Project  @ingroup pages
*/
function ProjViewEfforts()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . "lists/list_efforts.inc.php";
    require_once confGet('DIR_STREBER') . "lists/list_effortsperson.inc.php";
    require_once confGet('DIR_STREBER') . "lists/list_effortstask.inc.php";
    ### get current project ###
    $id = getOnePassedId('prj', 'projects_*');
    if (!($project = Project::getVisibleById($id))) {
        $PH->abortWarning("invalid project-id");
        return;
    }
    $presets = array('all_efforts' => array('name' => __('all', 'Filter preset'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_NEW, 'max' => EFFORT_STATUS_BALANCED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'new_efforts' => array('name' => __('new', 'Filter preset'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_NEW, 'max' => EFFORT_STATUS_NEW)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'open_efforts' => array('name' => __('open', 'Filter preset'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_NEW, 'max' => EFFORT_STATUS_OPEN)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'discounted_efforts' => array('name' => __('discounted', 'Filter preset'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_DISCOUNTED, 'max' => EFFORT_STATUS_DISCOUNTED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'notchargeable_efforts' => array('name' => __('not chargeable', 'Filter preset'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_NOTCHARGEABLE, 'max' => EFFORT_STATUS_NOTCHARGEABLE)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'balanced_efforts' => array('name' => __('balanced', 'Filter preset'), 'filters' => array('effort_status' => array('id' => 'effort_status', 'visible' => true, 'active' => true, 'min' => EFFORT_STATUS_BALANCED, 'max' => EFFORT_STATUS_BALANCED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'last_logout' => array('name' => __('last logout', 'Filter preset'), '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'))), 'last_week' => array('name' => __('1 week', 'Filter preset'), 'filters' => array('last_weeks' => array('id' => 'last_weeks', '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', 'Filter preset'), 'filters' => array('last_weeks' => array('id' => 'last_weeks', 'visible' => true, 'active' => true, 'factor' => 14, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'last_three_weeks' => array('name' => __('3 weeks', 'Filter preset'), 'filters' => array('last_weeks' => array('id' => 'last_weeks', 'visible' => true, 'active' => true, 'factor' => 21, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'last_month' => array('name' => __('1 month', 'Filter preset'), 'filters' => array('last_weeks' => array('id' => 'last_weeks', 'visible' => true, 'active' => true, 'factor' => 28, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'prior' => array('name' => __('prior', 'Filter preset'), 'filters' => array('prior' => array('id' => 'prior', 'visible' => true, 'active' => true, 'factor' => 29, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))));
    ## set preset location ##
    $preset_location = 'projViewEfforts';
    $preset_id = 'all_efforts';
    # default value
    if ($tmp_preset_id = get('preset')) {
        if (isset($presets[$tmp_preset_id])) {
            $preset_id = $tmp_preset_id;
        }
        ### set cookie
        setcookie('STREBER_projViewEfforts_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0);
    } else {
        if ($tmp_preset_id = get('STREBER_projViewEfforts_preset')) {
            if (isset($presets[$tmp_preset_id])) {
                $preset_id = $tmp_preset_id;
            }
        }
    }
    ### create from handle ###
    $PH->defineFromHandle(array('prj' => $project->id, 'preset_id' => $preset_id));
    $page = new Page();
    $page->cur_tab = 'projects';
    $page->crumbs = build_project_crumbs($project);
    $page->options = build_projView_options($project);
    $page->title_minor = __("Project Efforts");
    $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)) {
        $page->add_function(new PageFunction(array('target' => 'effortNew', 'params' => array('prj' => $project->id), 'icon' => 'new', 'name' => __('new Effort'))));
    }
    $page->add_function(new PageFunction(array('target' => 'projViewEffortCalculations', 'params' => array('prj' => $project->id), 'name' => __('View calculation'))));
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen();
    $order_by = get('sort_' . $PH->cur_page->id . "_efforts");
    require_once confGet('DIR_STREBER') . "db/class_effort.inc.php";
    $efforts = Effort::getAll(array('project' => $project->id, 'order_by' => $order_by));
    $list = new ListBlock_efforts();
    $list->filters[] = new ListFilter_efforts();
    $preset = $presets[$preset_id];
    foreach ($preset['filters'] as $f_name => $f_settings) {
        switch ($f_name) {
            case 'effort_status':
                $list->filters[] = new ListFilter_effort_status_min(array('value' => $f_settings['min']));
                $val1 = $f_settings['min'];
                $list->filters[] = new ListFilter_effort_status_max(array('value' => $f_settings['max']));
                $val2 = $f_settings['max'];
                break;
            case 'last_logout':
                $list->filters[] = new ListFilter_last_logout(array('value' => $f_settings['value']));
                break;
            case 'last_weeks':
                $list->filters[] = new ListFilter_min_week(array('value' => $f_settings['value'], 'factor' => $f_settings['factor']));
                break;
            case 'prior':
                $list->filters[] = new ListFilter_max_week(array('value' => $f_settings['value'], 'factor' => $f_settings['factor']));
                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;
    ### Link to start cvs export ###
    $format = get('format');
    if ($format == FORMAT_HTML || $format == '') {
        $list->footer_links[] = $PH->getCSVLink();
    }
    unset($list->columns['p.name']);
    $page->print_presets(array('target' => $preset_location, 'project_id' => $project->id, 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => ''));
    $list->query_options['order_by'] = $order_by;
    $list->query_options['project'] = $project->id;
    $list->print_automatic();
    ### 'add new task'-field ###
    $PH->go_submit = 'taskNew';
    echo '<input type="hidden" name="prj" value="' . $id . '">';
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Пример #4
0
/**
* list all tasks assigned to person @ingroup pages
*/
function homeTasks()
{
    global $PH;
    global $auth;
    ### set up page ####
    $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)), 'my_blocked_tasks' => array('name' => __('my blocked'), 'filter_empty_folders' => true, 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'values' => array(STATUS_BLOCKED), 'min' => STATUS_BLOCKED, '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)), 'blocked_tasks' => array('name' => __('blocked'), 'filter_empty_folders' => true, 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'values' => array(STATUS_BLOCKED), 'min' => STATUS_BLOCKED, 'max' => STATUS_BLOCKED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'needs_feedback' => array('name' => __('needs feedback'), '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 = 'homeTasks';
    $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_homeTasks_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0);
    } else {
        if ($tmp_preset_id = get('STREBER_homeTasks_preset')) {
            if (isset($presets[$tmp_preset_id])) {
                $preset_id = $tmp_preset_id;
            }
        }
    }
    $page = new Page();
    ### init known filters for preset ###
    $list = new ListBlock_tasks(array('active_block_function' => 'list'));
    $list->filters[] = new ListFilter_for_milestone();
    $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;
    ### create from handle ###
    $PH->defineFromHandle(array('preset_id' => $preset_id));
    ### setup page details ###
    $page->cur_tab = 'home';
    $page->options = build_home_options();
    $page->title = __("Your Tasks");
    $page->type = __('List', 'page type');
    $page->title_minor = renderTitleDate(time());
    echo new PageHeader();
    echo new PageContentOpen();
    $page->print_presets(array('target' => $preset_location, 'project_id' => '', 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => ''));
    ### remove assigned column (we know, who they are assigned to) ###
    unset($list->columns['assigned_to']);
    unset($list->columns['efforts']);
    unset($list->columns['project']);
    unset($list->columns['pub_level']);
    #    unset($list->columns['planned_end']);
    unset($list->block_functions['tree']);
    $list->query_options['assigned_to_person'] = $auth->cur_user->id;
    $list->print_automatic();
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Пример #5
0
/**
* companyList
*
* @ingroup pages
*
* - requires prj or task or tsk_*
*/
function companyList()
{
    global $PH;
    global $auth;
    $presets = array('all_companies' => array('name' => __('all'), 'filters' => array('company_category' => array('id' => 'company_category', 'visible' => true, 'active' => true, 'min' => CCATEGORY_UNDEFINED, 'max' => CCATEGORY_PARTNER)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'tree'))), 'clients' => array('name' => __('clients'), 'filters' => array('company_category' => array('id' => 'company_category', 'visible' => true, 'active' => true, 'min' => CCATEGORY_CLIENT, 'max' => CCATEGORY_CLIENT)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'tree'))), 'pros_clients' => array('name' => __('prospective clients'), 'filters' => array('company_category' => array('id' => 'company_category', 'visible' => true, 'active' => true, 'min' => CCATEGORY_PROSCLIENT, 'max' => CCATEGORY_PROSCLIENT)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'tree'))), 'supplier' => array('name' => __('supplier'), 'filters' => array('company_category' => array('id' => 'company_category', 'visible' => true, 'active' => true, 'min' => CCATEGORY_SUPPLIER, 'max' => CCATEGORY_SUPPLIER)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'tree'))), 'partner' => array('name' => __('partner'), 'filters' => array('company_category' => array('id' => 'company_category', 'visible' => true, 'active' => true, 'min' => CCATEGORY_PARTNER, 'max' => CCATEGORY_PARTNER)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'tree'))));
    ## set preset location ##
    $preset_location = 'companyList';
    $preset_id = 'all_companies';
    # default value
    if ($tmp_preset_id = get('preset')) {
        if (isset($presets[$tmp_preset_id])) {
            $preset_id = $tmp_preset_id;
        }
        ### set cookie
        setcookie('STREBER_companyList_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0);
    } else {
        if ($tmp_preset_id = get('STREBER_companyList_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 = 'companies';
    $page->title = __("Companies");
    if (!($auth->cur_user->user_rights & RIGHT_VIEWALL)) {
        $page->title_minor = sprintf(__("related projects of %s"), $page->title_minor = $auth->cur_user->name);
    } else {
        $page->title_minor = __("admin view");
    }
    $page->type = __("List");
    $page->options = build_companyList_options();
    ### page functions ###
    if ($auth->cur_user->user_rights & RIGHT_COMPANY_CREATE) {
        ### page functions ###
        $page->add_function(new PageFunctionGroup(array('name' => __('new'))));
        $page->add_function(new PageFunction(array('target' => 'companyNew', 'name' => __('Company'), 'params' => array('company_category' => CCATEGORY_UNDEFINED))));
    }
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen();
    $list = new ListBlock_companies();
    $list->filters[] = new ListFilter_companies();
    $preset = $presets[$preset_id];
    foreach ($preset['filters'] as $f_name => $f_settings) {
        switch ($f_name) {
            case 'company_category':
                $list->filters[] = new ListFilter_company_category_min(array('value' => $f_settings['min']));
                $list->filters[] = new ListFilter_company_category_max(array('value' => $f_settings['max']));
                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;
    ### may user create companies? ###
    if ($auth->cur_user->user_rights & RIGHT_COMPANY_CREATE) {
        $list->no_items_html = $PH->getLink('companyNew', '', array('person' => $auth->cur_user->id));
    } else {
        $list->no_items_html = __("no companies");
    }
    $order_str = get("sort_" . $PH->cur_page->id . "_" . $list->id);
    $order_str = str_replace(",", ", ", $order_str);
    $list->query_options['order_str'] = $order_str;
    $list->title = $page->title;
    $page->print_presets(array('target' => $preset_location, 'project_id' => '', 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => ''));
    $list->print_automatic();
    ### Link to start cvs export ###
    $format = get('format');
    if ($format == FORMAT_HTML || $format == '') {
        echo $PH->getCSVLink();
    }
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Пример #6
0
/**
* 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();
}