Esempio n. 1
0
/**
 * Print filter by date fields
 * @param boolean $p_hide_checkbox Hide data filter checkbox.
 * @return void
 */
function print_filter_do_filter_by_date($p_hide_checkbox = false)
{
    global $g_filter;
    ?>
		<table cellspacing="0" cellpadding="0">
<?php 
    $t_menu_disabled = '';
    if (!$p_hide_checkbox) {
        ?>
		<tr>
			<td colspan="2">
				<label>
					<input type="checkbox" id="use_date_filters" name="<?php 
        echo FILTER_PROPERTY_FILTER_BY_DATE;
        ?>
"<?php 
        check_checked(gpc_string_to_bool($g_filter[FILTER_PROPERTY_FILTER_BY_DATE]), true);
        ?>
 />
					<?php 
        echo lang_get('use_date_filters');
        ?>
				</label>
			</td>
		</tr>
<?php 
        if ('on' !== $g_filter[FILTER_PROPERTY_FILTER_BY_DATE]) {
            $t_menu_disabled = ' disabled="disabled" ';
        }
    }
    ?>

		<!-- Start date -->
		<tr>
			<td>
			<?php 
    echo lang_get('start_date_label');
    ?>
			</td>
			<td class="nowrap">
			<?php 
    $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
    foreach ($t_chars as $t_char) {
        if (strcasecmp($t_char, 'M') == 0) {
            echo '<select name="', FILTER_PROPERTY_START_MONTH, '"', $t_menu_disabled, '>';
            print_month_option_list($g_filter[FILTER_PROPERTY_START_MONTH]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, 'D') == 0) {
            echo '<select name="', FILTER_PROPERTY_START_DAY, '"', $t_menu_disabled, '>';
            print_day_option_list($g_filter[FILTER_PROPERTY_START_DAY]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, 'Y') == 0) {
            echo '<select name="', FILTER_PROPERTY_START_YEAR, '"', $t_menu_disabled, '>';
            print_year_option_list($g_filter[FILTER_PROPERTY_START_YEAR]);
            print "</select>\n";
        }
    }
    ?>
			</td>
		</tr>
		<!-- End date -->
		<tr>
			<td>
			<?php 
    echo lang_get('end_date_label');
    ?>
			</td>
			<td>
			<?php 
    $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
    foreach ($t_chars as $t_char) {
        if (strcasecmp($t_char, 'M') == 0) {
            echo '<select name="', FILTER_PROPERTY_END_MONTH, '"', $t_menu_disabled, '>';
            print_month_option_list($g_filter[FILTER_PROPERTY_END_MONTH]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, 'D') == 0) {
            echo '<select name="', FILTER_PROPERTY_END_DAY, '"', $t_menu_disabled, '>';
            print_day_option_list($g_filter[FILTER_PROPERTY_END_DAY]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, 'Y') == 0) {
            echo '<select name="', FILTER_PROPERTY_END_YEAR, '"', $t_menu_disabled, '>';
            print_year_option_list($g_filter[FILTER_PROPERTY_END_YEAR]);
            print "</select>\n";
        }
    }
    ?>
			</td>
		</tr>
		</table>
		<?php 
}
Esempio n. 2
0
function print_filter_do_filter_by_date($p_hide_checkbox = false)
{
    global $t_filter;
    ?>
		<table cellspacing="0" cellpadding="0">
		<?php 
    if (!$p_hide_checkbox) {
        ?>
		<tr><td colspan="2">
			<input type="checkbox" name="do_filter_by_date" <?php 
        check_checked($t_filter['do_filter_by_date'], 'on');
        if (ON == config_get('use_javascript')) {
            print "onclick=\"SwitchDateFields();\"";
        }
        ?>
 />
			<?php 
        echo lang_get('use_date_filters');
        ?>
		</td></tr>
		<?php 
    }
    $t_menu_disabled = 'on' == $t_filter['do_filter_by_date'] ? '' : ' disabled ';
    ?>

		<!-- Start date -->
		<tr>
			<td>
			<?php 
    echo lang_get('start_date');
    ?>
:
			</td>
			<td nowrap="nowrap">
			<?php 
    $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
    foreach ($t_chars as $t_char) {
        if (strcasecmp($t_char, "M") == 0) {
            print "<select name=\"start_month\" {$t_menu_disabled}>";
            print_month_option_list($t_filter['start_month']);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "D") == 0) {
            print "<select name=\"start_day\" {$t_menu_disabled}>";
            print_day_option_list($t_filter['start_day']);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "Y") == 0) {
            print "<select name=\"start_year\" {$t_menu_disabled}>";
            print_year_option_list($t_filter['start_year']);
            print "</select>\n";
        }
    }
    ?>
			</td>
		</tr>
		<!-- End date -->
		<tr>
			<td>
			<?php 
    echo lang_get('end_date');
    ?>
:
			</td>
			<td>
			<?php 
    $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
    foreach ($t_chars as $t_char) {
        if (strcasecmp($t_char, "M") == 0) {
            print "<select name=\"end_month\" {$t_menu_disabled}>";
            print_month_option_list($t_filter['end_month']);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "D") == 0) {
            print "<select name=\"end_day\" {$t_menu_disabled}>";
            print_day_option_list($t_filter['end_day']);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "Y") == 0) {
            print "<select name=\"end_year\" {$t_menu_disabled}>";
            print_year_option_list($t_filter['end_year']);
            print "</select>\n";
        }
    }
    ?>
			</td>
		</tr>
		</table>
		<?php 
}
Esempio n. 3
0
    /**
     * Show TimeTracking information when viewing bugs.
     * @param string Event name
     * @param int Bug ID
     */
    function view_bug_time($p_event, $p_bug_id)
    {
        $table = plugin_table('data');
        $t_user_id = auth_get_current_user_id();
        # Pull all Time-Record entries for the current Bug
        if (access_has_bug_level(plugin_config_get('view_others_threshold'), $p_bug_id)) {
            $query_pull_timerecords = "SELECT * FROM {$table} WHERE bug_id = {$p_bug_id} ORDER BY timestamp DESC";
        } else {
            if (access_has_bug_level(plugin_config_get('admin_own_threshold'), $p_bug_id)) {
                $query_pull_timerecords = "SELECT * FROM {$table} WHERE bug_id = {$p_bug_id} and user = {$t_user_id} ORDER BY timestamp DESC";
            } else {
                // User has no access
                return;
            }
        }
        $result_pull_timerecords = db_query($query_pull_timerecords);
        $num_timerecords = db_num_rows($result_pull_timerecords);
        # Get Sum for this bug
        $query_pull_hours = "SELECT SUM(hours) as hours FROM {$table} WHERE bug_id = {$p_bug_id}";
        $result_pull_hours = db_query($query_pull_hours);
        $row_pull_hours = db_fetch_array($result_pull_hours);
        ?>


   <a name="timerecord" id="timerecord" /><br />

<?php 
        collapse_open('timerecord');
        ?>
   <table class="width100" cellspacing="1">
   <tr>
      <td colspan="6" class="form-title">
<?php 
        collapse_icon('timerecord');
        echo plugin_lang_get('title');
        ?>
      </td>
   </tr>
   <tr class="row-category">
      <td><div align="center"><?php 
        echo plugin_lang_get('user');
        ?>
</div></td>
      <td><div align="center"><?php 
        echo plugin_lang_get('expenditure_date');
        ?>
</div></td>
      <td><div align="center"><?php 
        echo plugin_lang_get('hours');
        ?>
</div></td>
      <td><div align="center"><?php 
        echo plugin_lang_get('information');
        ?>
</div></td>
      <td><div align="center"><?php 
        echo plugin_lang_get('entry_date');
        ?>
</div></td>
      <td>&nbsp;</td>
   </tr>


<?php 
        if (access_has_bug_level(plugin_config_get('admin_own_threshold'), $p_bug_id)) {
            $current_date = explode("-", date("Y-m-d"));
            ?>


   <form name="time_tracking" method="post" action="<?php 
            echo plugin_page('add_record');
            ?>
" >
      <?php 
            echo form_security_field('plugin_TimeTracking_add_record');
            ?>

      <input type="hidden" name="bug_id" value="<?php 
            echo $p_bug_id;
            ?>
">

   <tr <?php 
            echo helper_alternate_class();
            ?>
>
     <td><?php 
            echo user_get_name(auth_get_current_user_id());
            ?>
</td>
     <td nowrap>
        <div align="center">
           <select tabindex="5" name="day"><?php 
            print_day_option_list($current_date[2]);
            ?>
</select>
           <select tabindex="6" name="month"><?php 
            print_month_option_list($current_date[1]);
            ?>
</select>
           <select tabindex="7" name="year"><?php 
            print_year_option_list($current_date[0]);
            ?>
</select>
        </div>
     </td>
     <td><div align="right"><input type="text" name="time_value" value="00:00" size="5"></div></td>
     <td><div align="center"><input type="text" name="time_info"></div></td>
     <td>&nbsp;</td>
     <td><input name="<?php 
            echo plugin_lang_get('submit');
            ?>
" type="submit" value="<?php 
            echo plugin_lang_get('submit');
            ?>
"></td>
   </tr>
</form>

<?php 
        }
        # END Access Control
        for ($i = 0; $i < $num_timerecords; $i++) {
            $row = db_fetch_array($result_pull_timerecords);
            ?>


   <tr <?php 
            echo helper_alternate_class();
            ?>
>
      <td><?php 
            echo user_get_name($row["user"]);
            ?>
</td>
      <td><div align="center"><?php 
            echo date(config_get("short_date_format"), strtotime($row["expenditure_date"]));
            ?>
 </div></td>
      <td><div align="right"><?php 
            echo db_minutes_to_hhmm($row["hours"] * 60);
            ?>
 </div></td>
      <td><div align="center"><?php 
            echo string_display_links($row["info"]);
            ?>
</div></td>
      <td><div align="center"><?php 
            echo date(config_get("complete_date_format"), strtotime($row["timestamp"]));
            ?>
 </div></td>

<?php 
            $user = auth_get_current_user_id();
            if ($user == $row["user"] && access_has_bug_level(plugin_config_get('admin_own_threshold'), $p_bug_id) || access_has_bug_level(plugin_config_get('admin_threshold'), $p_bug_id)) {
                ?>


      <td><a href="<?php 
                echo plugin_page('delete_record');
                ?>
&bug_id=<?php 
                echo $p_bug_id;
                ?>
&delete_id=<?php 
                echo $row["id"];
                echo form_security_param('plugin_TimeTracking_delete_record');
                ?>
"><?php 
                echo plugin_lang_get('delete');
                ?>
</a></td>

<?php 
            } else {
                ?>
      <td>&nbsp;</td>

<?php 
            }
            ?>
   </tr>


<?php 
        }
        # End for loop
        ?>


   <tr class="row-category">
      <td><?php 
        echo plugin_lang_get('sum');
        ?>
</td>
      <td>&nbsp;</td>
      <td><div align="right"><b><?php 
        echo db_minutes_to_hhmm($row_pull_hours['hours'] * 60);
        ?>
</b></div></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
   </tr>
</table>

<?php 
        collapse_closed('timerecord');
        ?>

<table class="width100" cellspacing="1">
<tr>
   <td class="form-title" colspan="2">
          <?php 
        collapse_icon('timerecord');
        ?>
          <?php 
        echo plugin_lang_get('title');
        ?>
	</td>
</tr>
</table>

<?php 
        collapse_end('timerecord');
    }
/**
 *  print filter by date fields with javascript
 * @todo Javascript should be removed and added dynamically
 *      via external script
 */
function print_filter_do_filter_by_date($p_hide_checkbox = false)
{
    global $t_filter;
    ?>
		<table cellspacing="0" cellpadding="0">
		<?php 
    if (!$p_hide_checkbox) {
        ?>
		<tr><td colspan="2">
			<input type="checkbox" name="<?php 
        echo FILTER_PROPERTY_FILTER_BY_DATE;
        ?>
" <?php 
        check_checked($t_filter[FILTER_PROPERTY_FILTER_BY_DATE], 'on');
        if (ON == config_get('use_javascript')) {
            print "onclick=\"SwitchDateFields();\"";
        }
        ?>
 />
			<?php 
        echo lang_get('use_date_filters');
        ?>
		</td></tr>
		<?php 
    }
    $t_menu_disabled = 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ? '' : ' disabled ';
    ?>

		<!-- Start date -->
		<tr>
			<td>
			<?php 
    echo lang_get('start_date');
    ?>
:
			</td>
			<td nowrap="nowrap">
			<?php 
    $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
    foreach ($t_chars as $t_char) {
        if (strcasecmp($t_char, "M") == 0) {
            echo '<select name="', FILTER_PROPERTY_START_MONTH, '"', $t_menu_disabled, '>';
            print_month_option_list($t_filter[FILTER_PROPERTY_START_MONTH]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "D") == 0) {
            echo '<select name="', FILTER_PROPERTY_START_DAY, '"', $t_menu_disabled, '>';
            print_day_option_list($t_filter[FILTER_PROPERTY_START_DAY]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "Y") == 0) {
            echo '<select name="', FILTER_PROPERTY_START_YEAR, '"', $t_menu_disabled, '>';
            print_year_option_list($t_filter[FILTER_PROPERTY_START_YEAR]);
            print "</select>\n";
        }
    }
    ?>
			</td>
		</tr>
		<!-- End date -->
		<tr>
			<td>
			<?php 
    echo lang_get('end_date');
    ?>
:
			</td>
			<td>
			<?php 
    $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
    foreach ($t_chars as $t_char) {
        if (strcasecmp($t_char, "M") == 0) {
            echo '<select name="', FILTER_PROPERTY_END_MONTH, '"', $t_menu_disabled, '>';
            print_month_option_list($t_filter[FILTER_PROPERTY_END_MONTH]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "D") == 0) {
            echo '<select name="', FILTER_PROPERTY_END_DAY, '"', $t_menu_disabled, '>';
            print_day_option_list($t_filter[FILTER_PROPERTY_END_DAY]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "Y") == 0) {
            echo '<select name="', FILTER_PROPERTY_END_YEAR, '"', $t_menu_disabled, '>';
            print_year_option_list($t_filter[FILTER_PROPERTY_END_YEAR]);
            print "</select>\n";
        }
    }
    ?>
			</td>
		</tr>
		</table>
		<?php 
}
Esempio n. 5
0
/**
 *  print filter by date fields
 */
function print_filter_do_filter_by_date($p_hide_checkbox = false)
{
    global $t_filter;
    ?>
		<table cellspacing="0" cellpadding="0">
<?php 
    if (!$p_hide_checkbox) {
        ?>
		<tr>
			<td colspan="2">
				<label><input type="checkbox" id="use_date_filters" name="<?php 
        echo FILTER_PROPERTY_FILTER_BY_DATE;
        ?>
"<?php 
        check_checked($t_filter[FILTER_PROPERTY_FILTER_BY_DATE], 'on');
        ?>
 /><?php 
        echo lang_get('use_date_filters');
        ?>
</label>
			</td>
		</tr>
<?php 
    }
    # Make sure the date selection controls are enabled by default
    # if we do not use javascript
    $t_menu_disabled = !config_get('use_javascript') || 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ? '' : ' disabled="disabled" ';
    ?>

		<!-- Start date -->
		<tr>
			<td>
			<?php 
    echo lang_get('start_date_label');
    ?>
			</td>
			<td class="nowrap">
			<?php 
    $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
    foreach ($t_chars as $t_char) {
        if (strcasecmp($t_char, "M") == 0) {
            echo '<select name="', FILTER_PROPERTY_START_MONTH, '"', $t_menu_disabled, '>';
            print_month_option_list($t_filter[FILTER_PROPERTY_START_MONTH]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "D") == 0) {
            echo '<select name="', FILTER_PROPERTY_START_DAY, '"', $t_menu_disabled, '>';
            print_day_option_list($t_filter[FILTER_PROPERTY_START_DAY]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "Y") == 0) {
            echo '<select name="', FILTER_PROPERTY_START_YEAR, '"', $t_menu_disabled, '>';
            print_year_option_list($t_filter[FILTER_PROPERTY_START_YEAR]);
            print "</select>\n";
        }
    }
    ?>
			</td>
		</tr>
		<!-- End date -->
		<tr>
			<td>
			<?php 
    echo lang_get('end_date_label');
    ?>
			</td>
			<td>
			<?php 
    $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
    foreach ($t_chars as $t_char) {
        if (strcasecmp($t_char, "M") == 0) {
            echo '<select name="', FILTER_PROPERTY_END_MONTH, '"', $t_menu_disabled, '>';
            print_month_option_list($t_filter[FILTER_PROPERTY_END_MONTH]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "D") == 0) {
            echo '<select name="', FILTER_PROPERTY_END_DAY, '"', $t_menu_disabled, '>';
            print_day_option_list($t_filter[FILTER_PROPERTY_END_DAY]);
            print "</select>\n";
        }
        if (strcasecmp($t_char, "Y") == 0) {
            echo '<select name="', FILTER_PROPERTY_END_YEAR, '"', $t_menu_disabled, '>';
            print_year_option_list($t_filter[FILTER_PROPERTY_END_YEAR]);
            print "</select>\n";
        }
    }
    ?>
			</td>
		</tr>
		</table>
		<?php 
}