| 1 |
<?php |
| 2 |
/** |
| 3 |
* Report parameter template: section |
| 4 |
* |
| 5 |
* @package UpStream |
| 6 |
*/ |
| 7 |
|
| 8 |
// Prevent direct access. |
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
$up_type = $option_info['type']; |
| 14 |
$mm = \UpStream_Model_Manager::get_instance(); |
| 15 |
$projects = $mm->findAccessibleProjects(); |
| 16 |
$fields = array(); |
| 17 |
$type_info = ''; |
| 18 |
|
| 19 |
$show = true; |
| 20 |
|
| 21 |
switch ( $up_type ) { |
| 22 |
case 'project': |
| 23 |
$type_info = upstream_project_label(); |
| 24 |
$fields = UpStream_Model_Project::fields(); |
| 25 |
break; |
| 26 |
case 'milestone': |
| 27 |
$type_info = upstream_milestone_label(); |
| 28 |
$fields = UpStream_Model_Milestone::fields(); |
| 29 |
$show = ! upstream_disable_milestones(); |
| 30 |
break; |
| 31 |
case 'task': |
| 32 |
$type_info = upstream_task_label(); |
| 33 |
$fields = UpStream_Model_Task::fields(); |
| 34 |
$show = ! upstream_disable_tasks(); |
| 35 |
break; |
| 36 |
case 'bug': |
| 37 |
$type_info = upstream_bug_label(); |
| 38 |
$fields = UpStream_Model_Bug::fields(); |
| 39 |
$show = ! upstream_disable_bugs(); |
| 40 |
break; |
| 41 |
case 'file': |
| 42 |
$type_info = upstream_file_label(); |
| 43 |
$fields = UpStream_Model_File::fields(); |
| 44 |
$show = ! upstream_disable_files(); |
| 45 |
break; |
| 46 |
} |
| 47 |
|
| 48 |
if ( $show ) { |
| 49 |
?> |
| 50 |
<div class="col-md-12 col-sm-12 col-xs-12"> |
| 51 |
<div class="x_panel" data-section="report-parameters-<?php echo esc_attr( $section_id ); ?>"> |
| 52 |
<div class="x_title"> |
| 53 |
<h2> |
| 54 |
<?php echo esc_html( $type_info . __( ' Filters' ) ); ?> |
| 55 |
</h2> |
| 56 |
<div class="clearfix"></div> |
| 57 |
</div> |
| 58 |
<div class="x_content"> |
| 59 |
|
| 60 |
<div class="row"> |
| 61 |
|
| 62 |
<div class="col-lg-12 col-xs-12"> |
| 63 |
<div class="form-group"> |
| 64 |
<label><?php esc_html_e( 'Name' ); ?></label> |
| 65 |
<select class="form-control" multiple name="upstream_report__<?php echo esc_attr( $section_id ); ?>_id[]"> |
| 66 |
<?php |
| 67 |
foreach ( $projects as $project ) : |
| 68 |
$user = upstream_user_data(); |
| 69 |
if ( upstream_user_can_access_project( isset( $user['id'] ) ? $user['id'] : 0, $project->id ) ) : |
| 70 |
?> |
| 71 |
<?php if ( 'project' == $up_type ) : ?> |
| 72 |
<option selected value="<?php echo esc_attr( $project->id ); ?>"><?php echo esc_html( $project->title ); ?></option> |
| 73 |
<?php else : ?> |
| 74 |
<option disabled |
| 75 |
style="color:#DDDDDD;font-style: italic"><?php echo esc_html( $project->title ); ?></option> |
| 76 |
<?php endif; ?> |
| 77 |
|
| 78 |
<?php |
| 79 |
if ( 'milestone' == $up_type || 'bug' == $up_type || 'file' == $up_type || 'task' == $up_type ) { |
| 80 |
|
| 81 |
$children = array(); |
| 82 |
if ( 'bug' == $up_type ) { |
| 83 |
$children = &$project->bugs(); |
| 84 |
} elseif ( 'file' == $up_type ) { |
| 85 |
$children = &$project->files(); |
| 86 |
} elseif ( 'task' == $up_type ) { |
| 87 |
$children = &$project->tasks(); |
| 88 |
} elseif ( 'milestone' == $up_type ) { |
| 89 |
$children = $project->findMilestones(); |
| 90 |
} |
| 91 |
|
| 92 |
foreach ( $children as $child ) { |
| 93 |
if ( upstream_override_access_object( true, $up_type, $child->id, UPSTREAM_ITEM_TYPE_PROJECT, $project->id, UPSTREAM_PERMISSIONS_ACTION_VIEW ) ) { |
| 94 |
?> |
| 95 |
<option selected value="<?php echo esc_attr( $child->id ); ?>"> |
| 96 |
 <?php echo esc_html( $child->title ); ?></option> |
| 97 |
<?php |
| 98 |
} |
| 99 |
} |
| 100 |
} |
| 101 |
?> |
| 102 |
<?php |
| 103 |
endif; |
| 104 |
endforeach; |
| 105 |
?> |
| 106 |
</select> |
| 107 |
<a onclick="jQuery('[name=\'upstream_report__<?php print esc_js( $section_id ); ?>_id[]\'] option').prop('selected', true)">Select |
| 108 |
all</a> | <a |
| 109 |
onclick="jQuery('[name=\'upstream_report__<?php print esc_js( $section_id ); ?>_id[]\'] option').prop('selected', false)">Select |
| 110 |
none</a> |
| 111 |
</div> |
| 112 |
|
| 113 |
<?php include 'search-fields.php'; ?> |
| 114 |
</div> |
| 115 |
</div> |
| 116 |
</div> |
| 117 |
</div> |
| 118 |
</div> |
| 119 |
<?php |
| 120 |
} |
| 121 |
?> |
| 122 |
|