if ($has_write_permission) {
            $dropbox = new dropbox();
            $dropbox->add_arrays($hours, $hours);
            $dropbox->print_dropbox('view_start_hour', $view['start_hour']);
        } else {
            echo $view['start_hour'];
        }
        ?>
	&nbsp;<?php 
        echo $sc_to;
        ?>
&nbsp;
	<?php 
        if ($has_write_permission) {
            $dropbox = new dropbox();
            $dropbox->add_arrays($hours, $hours);
            $dropbox->print_dropbox('view_end_hour', $view['end_hour']);
        } else {
            echo $view['end_hour'];
        }
        ?>
	</td>
</tr>
<tr>
	<td valign><?php 
        echo $sc_calendars;
        ?>
:</td>
	<td>
	<table border="0">
	<tr>
 print_head();
 if (isset($feedback)) {
     echo $feedback . '<br /><br />';
 }
 ?>
 <input type="hidden" name="task" value="theme" />
 Select the default theme for Group-Office and whether users are allowed to change the theme or not.
 <br /><br />
 <table style="border-width: 0px;font-family: Arial,Helvetica; font-size: 12px;">
 <tr>
 <td>Default theme:</td>
 <td>
 <?php 
 $themes = $GO_THEME->get_themes();
 $dropbox = new dropbox();
 $dropbox->add_arrays($themes, $themes);
 $dropbox->print_dropbox("theme", $GO_CONFIG->theme);
 ?>
 </td>
 </tr>
 <tr>
 <td align="right">Allow:</td>
 <td>
 <?php 
 $allow_themes = isset($_POST['allow_themes']) ? $_POST['allow_themes'] : $GO_CONFIG->allow_themes;
 $allow_themes = $allow_themes ? 'true' : 'false';
 $dropbox = new dropbox();
 $dropbox->add_value('true', 'Yes');
 $dropbox->add_value('false', 'No');
 $dropbox->print_dropbox('allow_themes', $allow_themes);
 ?>
echo '</td></tr>';
echo '<tr><td colspan="2">&nbsp;</td></tr>';
echo '<tr><td>';
$checkbox = new checkbox('completed', 'true', $cal_completed . ':', $todo['completed'], false, 'onclick="javascript:disable_completion_time(!this.checked);"');
echo '</td><td>';
echo '<table border="0" cellpadding="0" cellspacing="0"><tr><td>';
$disabled = $todo['completed'] ? '' : 'disabled';
$status_disabled = $todo['completed'] ? 'disabled' : '';
$datepicker->print_date_picker('completion_date', $_SESSION['GO_SESSION']['date_format'], $todo['completion_date'], '', '', '', !$todo['completed']);
echo '</td><td>&nbsp;&nbsp;';
$dropbox = new dropbox();
$dropbox->add_arrays($hours, $hours);
$dropbox->print_dropbox("completion_hour", $todo['completion_hour'], $disabled);
echo '&nbsp;:&nbsp;';
$dropbox = new dropbox();
$dropbox->add_arrays($mins, $mins);
$dropbox->print_dropbox("completion_min", $todo['completion_min'], $disabled);
echo '&nbsp;&nbsp;&nbsp;&nbsp;';
$dropbox = new dropbox();
for ($i = 0; $i < 101; $i = $i + 10) {
    $dropbox->add_value($i, "{$i}");
}
$dropbox->print_dropbox('status', $todo['status'], $status_disabled);
echo '&nbsp;&nbsp;';
echo $cal_percent_completed;
echo '</td></tr></table>';
echo '<tr><td colspan="2">&nbsp;</td></tr>';
echo '<tr><td nowrap>' . $sc_background . ':&nbsp;</td><td>';
$color_selector = new color_selector();
$color_selector->add_color('FFFFCC');
$color_selector->add_color('FF6666');
 }
 $dropbox->print_dropbox('repeat_every', $event['repeat_every']);
 $dropbox = new dropbox();
 $dropbox->add_value('0', $sc_types1[REPEAT_NONE]);
 $dropbox->add_value('1', $sc_types1[REPEAT_DAILY]);
 $dropbox->add_value('2', $sc_types1[REPEAT_WEEKLY]);
 $dropbox->add_value('3', $sc_types1[REPEAT_MONTH_DATE]);
 $dropbox->add_value('4', $sc_types1[REPEAT_MONTH_DAY]);
 $dropbox->add_value('5', $sc_types1[REPEAT_YEARLY]);
 $dropbox->print_dropbox('repeat_type', $event['repeat_type'], 'onclick="javascript:toggle_repeat(this.value);"');
 echo '</td></tr>';
 echo '<tr><td>' . $sc_at_days . ':</td><td>';
 echo '<table border="0" cellpadding="0" cellspacing="0"><tr>';
 echo '<td>';
 $dropbox = new dropbox();
 $dropbox->add_arrays(array(1, 2, 3, 4), $month_times);
 $dropbox->print_dropbox("month_time", $event['month_time']);
 echo '</td>';
 $day_data_field[0] = 'sun';
 $day_data_field[1] = 'mon';
 $day_data_field[2] = 'tue';
 $day_data_field[3] = 'wed';
 $day_data_field[4] = 'thu';
 $day_data_field[5] = 'fri';
 $day_data_field[6] = 'sat';
 $day_number = $_SESSION['GO_SESSION']['first_weekday'];
 for ($i = 0; $i < 7; $i++) {
     if ($day_number == 7) {
         $day_number = 0;
     }
     echo '<td>';
            $j++;
            $cate_arr[] = $attach->f('name');
            $cate_id_arr[] = $attach->f('attach_cate_id');
            $text_arr[$j][] = $sc_no_select;
            $value_arr[$j][] = 0;
            $price_arr[$j][] = 0;
        }
        $text_arr[$j][] = $attach->f('attachment_name');
        $value_arr[$j][] = $attach->f('attachment_id');
        $price_arr[$j][] = $attach->f('attachment_price');
        $VAT_arr[$j][] = $attach->f('attachment_VAT');
    }
    for ($j = 0; $j < count($cate_arr); $j++) {
        $dropbox = new dropbox();
        $pricebox = new dropbox();
        $dropbox->add_arrays($value_arr[$j], $text_arr[$j]);
        for ($k = 0; $k < count($price_arr[$j]); $k++) {
            $pricebox->add_value($price_arr[$j][$k], sprintf("%s ", $price_arr[$j][$k]));
        }
        $pid = $value_arr[$j];
        $pprice = $price_arr[$j][0];
        $pVAT = $VAT_arr[$j][0];
        $pamount = $pprice * $pquantity + $pprice * $pquantity * $pVAT / 100;
        $psumamount += $pamount;
        $ptotal += $pprice * $pquantity;
        ?>
			
	<tr>
      <td align="center">&nbsp;  </td>
	  <td nowrap>
	  	&nbsp;&nbsp;-&nbsp;<?php 
function showrecords()
{
    global $Ticket_Number, $name, $tts, $prefix, $hlpdsk_prefix, $hlpdsk_theme, $nuke_user_table, $nuke_user_last_name_fieldname, $nuke_username_fieldname, $hours, $mins, $javascript, $nuke_user_id_fieldname, $nuke_user_first_name_fieldname, $datepicker, $cmdOk, $cmdReset, $GO_SECURITY, $acl_read, $acl_write, $GO_LANGUAGE;
    require $GO_LANGUAGE->get_language_file('opentts');
    $acl_read = get_cross_value("{$prefix}{$hlpdsk_prefix}_tickets", 'acl_read', "where ticket_number='{$Ticket_Number}'");
    $acl_write = get_cross_value("{$prefix}{$hlpdsk_prefix}_tickets", 'acl_write', "where ticket_number='{$Ticket_Number}'");
    if ($GO_SECURITY->user_in_acl(whoami(), $acl_read) or $GO_SECURITY->user_in_acl(whoami(), $acl_write) or Security::is_action_allowed("view_all_tickets")) {
        $query_condition = " ";
    } else {
        $query_condition = " and (t_from='" . whoami() . "' or t_assigned='" . whoami() . "')";
    }
    $querytext = "select * from {$prefix}{$hlpdsk_prefix}_tickets where Ticket_Number='{$Ticket_Number}' {$query_condition} ";
    $tts->query($querytext);
    $recordcount = $tts->num_rows();
    $row = 0;
    if ($recordcount = 0) {
        return 'missing';
    }
    while ($tts->next_record()) {
        $post_date = $tts->f('post_date');
        $due_date = $tts->f('due_date');
        $end_date = $tts->f('end_date');
        $complete = $tts->f('complete');
        $t_from = $tts->f('t_from');
        $t_stage = $tts->f('t_stage');
        $t_category = $tts->f('t_category');
        $t_priority = $tts->f('t_priority');
        $t_subject = htmlspecialchars($tts->f('t_subject'));
        $t_description = htmlspecialchars($tts->f('t_description'));
        #$t_description=str_replace("\n"," <br> ",$t_description);
        $t_assigned = $tts->f('t_assigned');
        $t_email = $tts->f('t_email');
        $t_sms = $tts->f('t_sms');
        $t_status = $tts->f('t_status');
        $change_date = htmlspecialchars($tts->f('change_date'));
        $activity_id = $tts->f('activity_id');
        $project_id = $tts->f('project_id');
        $due_date = date("Y/m/d H:i", $due_date);
        $end_date = date("Y/m/d H:i", $end_date);
        $action_changes = $javascript;
        if ($t_sms == "on") {
            $t_sms = " CHECKED";
        }
        if ($t_email == "on") {
            $t_email = " CHECKED";
        }
        if ($GO_SECURITY->user_in_acl(whoami(), $acl_write)) {
            $button = new button();
            $action_changes .= $button->get_button($cmdOk, "javascript:document.change_status.submit()");
            $action_changes .= $button->get_button($cmdReset, "javascript:document.change_status.reset()");
        } else {
            $action_changes .= '';
        }
        $action_changes .= "</form></center>";
        $tts_lang_ticket_number = "Ticket Number:";
        $tts_lang_post_date_value = date("{$_SESSION['GO_SESSION']['date_format']} H:i", $post_date);
        $fullname = opentts::get_fullname($t_from);
        if (Security::is_action_allowed("imperson", 0, $acl_write)) {
            $select = new select('user', 'change_status', 't_from', $t_from);
            $tts_lang_issuer = $select->get_link("{$tts_lang_issuer}");
            $tts_lang_issuer_value = $select->get_field();
        } else {
            $tts_lang_issuer_value = "{$fullname}";
        }
        $stage_name = Security::htmlsecure(get_cross_value("{$prefix}{$hlpdsk_prefix}_stages", "stage_name", " where stage_id='{$t_stage}'"));
        $category_name = Security::htmlsecure(get_cross_value("{$prefix}{$hlpdsk_prefix}_categories", "category_name", " where category_id='{$t_category}'"));
        $project_name = Security::htmlsecure(get_cross_value("{$prefix}{$hlpdsk_prefix}_projects", "project_name", " where project_id='{$project_id}'"));
        $select_complete = "<select name='complete' class=textbox>" . "<option value='0' >0%</option>" . "<option value='10'>10%</option>" . "<option value='20'>20%</option>" . "<option value='30'>30%</option>" . "<option value='40'>40%</option>" . "<option value='50'>50%</option>" . "<option value='60'>60%</option>" . "<option value='70'>70%</option>" . "<option value='80'>80%</option>" . "<option value='90'>90%</option>" . "<option value='100'>100%</option>" . "</select>";
        $t_assigned_name = Security::whatsmyname($t_assigned);
        if (Security::is_action_allowed("change_subject", 0, $acl_write)) {
            $tts_lang_subject_value = "<input name=t_subject value=\"" . Security::sqlsecure($t_subject) . "\" class=textbox max=80 size=80>";
        } else {
            $tts_lang_subject_value = "<input name=t_subject value=\"" . Security::sqlsecure($t_subject) . "\" class=textbox max=80 size=80 readonly>";
        }
        $tts_lang_description_value = "<textarea name=t_description cols=80 rows=12 class=textbox readonly>" . Security::sqlsecure($t_description) . "</textarea>";
        $tts_lang_change_date_VALUE = date("{$_SESSION['GO_SESSION']['date_format']} H:i", $change_date);
        $tts_lang_email = "Email {$tts_lang_issuer}: <input type=checkbox name=t_email_issuer value=1><br>Email {$tts_lang_assigned} <input type=checkbox name=t_email_agent value=1>";
        $post_changes = "<form name=\"change_status\" method=\"POST\" action=\"change_ticket.php?Ticket_Number={$Ticket_Number}&func=change_status\">";
        if (Security::is_action_allowed("change_project", 0, $acl_write)) {
            $project_name = select_option("{$project_id}", fill_select("project_id", "{$prefix}{$hlpdsk_prefix}_projects", "project_id", "project_name", " order by project_id"));
            $tts_lang_project_value = "{$project_name}";
        } else {
            $project_name = Security::htmlsecure(get_cross_value("{$prefix}{$hlpdsk_prefix}_projects", "project_name", " where project_id='{$project_id}'"));
            $tts_lang_project_value = "{$project_name}";
        }
        $fullname = opentts::get_fullname($t_assigned);
        if (Security::is_action_allowed("change_assigned", 0, $acl_write)) {
            $select = new select('user', 'change_status', 't_assigned', $t_assigned);
            $tts_lang_assign_to = $select->get_link("{$tts_lang_assign_to}");
            $tts_lang_assign_to_value = $select->get_field();
        } else {
            $tts_lang_assign_to_value = "{$fullname}";
        }
        if (Security::is_action_allowed("change_end_date", 0, $acl_write)) {
            $time = strtotime($end_date);
            #$end_date_d_m_y=date("Y/m/d",$time);
            $end_date_h = date("H", $time);
            $end_date_i = date("i", $time);
            $today = date($_SESSION['GO_SESSION']['date_format'], $time);
            $end_date = $datepicker->get_date_picker('end_date_d_m_y', $_SESSION['GO_SESSION']['date_format'], $today);
            $dropbox = new dropbox();
            $dropbox->add_arrays($hours, $hours);
            $end_date .= '<td>';
            $end_date_h_value = $dropbox->get_dropbox("end_date_h", $end_date_h);
            $dropbox = new dropbox();
            $dropbox->add_arrays($mins, $mins);
            $end_date_i_value = $dropbox->get_dropbox("end_date_i", $end_date_i);
            if ($htmldirection == 'rtl') {
                $end_date .= "{$end_date_i_value}:{$end_date_h_value}";
            } else {
                $end_date .= "{$end_date_h_value}:{$end_date_i_value}";
            }
            $tts_lang_end_date_value = "{$end_date}&nbsp;";
        } else {
            $tts_lang_end_date_value = "{$end_date}";
        }
        if (Security::is_action_allowed("change_complete", 0, $acl_write)) {
            $_PERCENTAGE_COMPLETE_VALUE = select_option("{$complete}", "{$select_complete}");
        } else {
            $_PERCENTAGE_COMPLETE_VALUE = "{$complete} %";
        }
        if (Security::is_action_allowed("change_due_date", 0, $acl_write)) {
            $time = strtotime($due_date);
            $due_date_d_m_y = date($_SESSION['GO_SESSION']['date_format'], $time);
            $due_date_h = date("H", $time);
            $due_date_i = date("i", $time);
            $today = date($_SESSION['GO_SESSION']['date_format'], $time);
            $due_date = $datepicker->get_date_picker('due_date_d_m_y', $_SESSION['GO_SESSION']['date_format'], $today, '', '', 'onchange="javascript:document.change_status.end_date_d_m_y.value=this.value;"');
            $dropbox = new dropbox();
            $dropbox->add_arrays($hours, $hours);
            $due_date .= '<td>';
            $due_date_h_value = $dropbox->get_dropbox("due_date_h", $due_date_h, 'onchange="javascript:update_end_hour(this.value);"');
            $dropbox = new dropbox();
            $dropbox->add_arrays($mins, $mins);
            $due_date_i_value = $dropbox->get_dropbox("due_date_i", $due_date_i, 'onchange="javascript:update_end_min(this.value);"');
            if ($htmldirection == 'rtl') {
                $due_date .= "{$due_date_i_value}:{$due_date_h_value}";
            } else {
                $due_date .= "{$due_date_h_value}:{$due_date_i_value}";
            }
            $tts_lang_due_date_value = "{$due_date}&nbsp;";
        } else {
            $tts_lang_due_date_value = "{$tts_lang_due_date}{$due_date}";
        }
        if (Security::is_action_allowed("change_activity", 0, $acl_write)) {
            $activity = select_option("{$activity_id}", fill_select("activity_id", "{$prefix}{$hlpdsk_prefix}_activities", "activity_id", "activity_name", " "));
            $tts_lang_activity_value = "<br>{$activity}&nbsp;";
        } else {
            $tts_lang_activity_value = Security::htmlsecure(get_cross_value("{$prefix}{$hlpdsk_prefix}_activities", "activity_name", "where activity_id='{$activity_id}'"));
        }
        if (Security::is_action_allowed("change_status", 0, $acl_write)) {
            $t_status_sel = select_option("{$t_status}", fill_select("t_status", "{$prefix}{$hlpdsk_prefix}_status", "status_id", "status_name", " "));
            $tts_lang_status_value = "<br>{$t_status_sel}";
        } else {
            $status_name = Security::htmlsecure(get_cross_value("{$prefix}{$hlpdsk_prefix}_status", "status_name", " where status_id='{$t_status}'"));
            $tts_lang_status_value = "{$status_name}";
        }
        if (Security::is_action_allowed("change_priority", 0, $acl_write)) {
            $t_priorities = select_option("{$t_priority}", fill_select("t_priority", "{$prefix}{$hlpdsk_prefix}_priorities", "priority_id", "priority_name", " "));
            $tts_lang_priority_value = "{$t_priorities}<br>";
        } else {
            $t_priority_name = Security::htmlsecure(get_cross_value("{$prefix}{$hlpdsk_prefix}_priorities", "priority_name", " where priority_id={$t_priority}"));
            $tts_lang_priority_value = "{$t_priority_name}";
        }
        if (Security::is_action_allowed("change_category", 0, $acl_write)) {
            $t_category = select_option("{$t_category}", fill_select("t_category", "{$prefix}{$hlpdsk_prefix}_categories", "category_id", "category_name", " "));
            $tts_lang_category_value = "{$t_category}<br>";
        } else {
            $tts_lang_category_value = "{$category_name}";
        }
        if (Security::is_action_allowed("change_stage", 0, $acl_write)) {
            $t_stage = select_option("{$t_stage}", fill_select("t_stage", "{$prefix}{$hlpdsk_prefix}_stages", "stage_id", "stage_name", " "));
            $tts_lang_stage_value = "<br>{$t_stage}<br>";
        } else {
            $tts_lang_stage_value = Security::htmlsecure("{$stage_name}");
        }
        $mailto_subject = "?subject=" . addslashes("Ticket Task  {$Ticket_Number}: ") . addslashes($t_subject);
        $mailto_body = "&body=" . addslashes("Ticket/Task:   {$Ticket_Number} / ") . addslashes($t_description);
        $mailto = $mailto_subject . $mailto_body;
        $tts_lang_mail_this = "<a href=\"mailto:{$mailto}\">Send email</a>";
        $tts_lang_estimated_time = $_MONEY = '';
        $tts_lang_mail_this = "";
        $file = "themes/{$hlpdsk_theme}/showline_ticket.html";
        $file = addslashes(implode("", file($file)));
        eval("\$content=stripslashes(\" {$file}\");");
        echo $content;
        $row++;
    }
}