Пример #1
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();
}
Пример #2
0
/**
* list changes of a project @ingroup pages
*/
function ProjViewChanges()
{
    global $PH;
    global $auth;
    ### get current project ###
    $id = getOnePassedId('prj', 'projects_*');
    if (!($project = Project::getVisibleById($id))) {
        $PH->abortWarning(__("invalid project-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'))), 'modified_by_me' => array('name' => __('modified by me'), 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'min' => STATUS_UNDEFINED, 'max' => STATUS_CLOSED), 'modified_by' => array('id' => 'modified_by', 'visible' => true, 'active' => true, 'value' => $auth->cur_user->id)), 'list_settings' => array('changes' => array('hide_columns' => array(''), 'style' => 'list'))), 'modified_by_others' => array('name' => __('modified by others'), 'filters' => array('task_status' => array('id' => 'task_status', 'visible' => true, 'active' => true, 'min' => STATUS_UNDEFINED, 'max' => STATUS_CLOSED), 'not_modified_by' => array('id' => 'not_modified_by', 'visible' => true, 'active' => true, 'value' => $auth->cur_user->id)), '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 = 'projViewChanges';
    $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_projViewChanges_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0);
    } else {
        if ($tmp_preset_id = get('STREBER_projViewChanges_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));
    ## init known filters for preset ##
    require_once confGet('DIR_STREBER') . './lists/list_changes.inc.php';
    $page = new Page();
    $list = new ListBlock_changes();
    $list->query_options['project'] = $project->id;
    $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 'modified_by':
                $list->filters[] = new ListFilter_modified_by(array('value' => $f_settings['value']));
                break;
            case 'not_modified_by':
                $list->filters[] = new ListFilter_not_modified_by(array('value' => $f_settings['value']));
                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->cur_tab = 'projects';
    $page->crumbs = build_project_crumbs($project);
    $page->options = build_projView_options($project);
    $page->title_minor = __("Changes");
    $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");
        }
    }
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen();
    $page->print_presets(array('target' => $preset_location, 'project_id' => $project->id, 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => ''));
    $list->print_automatic($project);
    ### HACKING: 'add new task'-field ###
    $PH->go_submit = 'taskNew';
    echo '<input type="hidden" name="prj" value="' . $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();
}