Esempio n. 1
0
 function render_html()
 {
     // calcuate next/previous week/year
     if ($this->date_selected_weekofyear == 1) {
         $date_option_previousyear = $this->date_selected_year - 1;
         $date_option_previousweek = 52;
         $date_option_nextyear = $this->date_selected_year;
         $date_option_nextweek = 2;
     } elseif ($this->date_selected_weekofyear == 52) {
         $date_option_previousyear = $this->date_selected_year;
         $date_option_previousweek = 51;
         $date_option_nextyear = $this->date_selected_year + 1;
         $date_option_nextweek = 1;
     } else {
         $date_option_previousyear = $this->date_selected_year;
         $date_option_previousweek = $this->date_selected_weekofyear - 1;
         $date_option_nextyear = $this->date_selected_year;
         $date_option_nextweek = $this->date_selected_weekofyear + 1;
     }
     // Week view header
     print "<h3>TIME REGISTRATION</h3><br><br>";
     /*
     	Unbilled Time
     */
     if (user_permissions_get("projects_timegroup")) {
         /*
         	Create an array of all unbilled time records. We need to do the following to create this list:
         	1. Exclude any internal_only projects.
         	2. Include time which belongs to a time_group, but ONLY if the time group has not been added to an invoice.
         */
         $unbilled_ids = array();
         // select non-internal projects
         $sql_projects_obj = new sql_query();
         $sql_projects_obj->string = "SELECT projects.id as projectid, project_phases.id as phaseid FROM project_phases LEFT JOIN projects ON projects.id = project_phases.projectid WHERE projects.internal_only='0'";
         $sql_projects_obj->execute();
         if ($sql_projects_obj->num_rows()) {
             $sql_projects_obj->fetch_array();
             foreach ($sql_projects_obj->data as $project_data) {
                 // select non-group time records
                 $sql_obj = new sql_query();
                 $sql_obj->string = "SELECT id FROM timereg WHERE groupid='0' AND phaseid='" . $project_data["phaseid"] . "'";
                 $sql_obj->execute();
                 if ($sql_obj->num_rows()) {
                     $sql_obj->fetch_array();
                     foreach ($sql_obj->data as $data_tmp) {
                         // we store the ID inside an array key, since they are unique
                         // and this will prevent us needed to check for the existance of
                         // the ID already.
                         $unbilled_ids[$data_tmp["id"]] = "on";
                     }
                 }
                 unset($sql_obj);
                 // select unpaid group IDs
                 $sql_obj = new sql_query();
                 $sql_obj->string = "SELECT id FROM time_groups WHERE projectid='" . $project_data["projectid"] . "' AND invoiceid='0'";
                 $sql_obj->execute();
                 if ($sql_obj->num_rows()) {
                     $sql_obj->fetch_array();
                     foreach ($sql_obj->data as $data_group) {
                         // fetch all the time reg IDs belonging this group, but only select time entries marked as billable - we
                         // don't want to report a timegroup with unbillable time as being billed!
                         $sql_reg_obj = new sql_query();
                         $sql_reg_obj->string = "SELECT id FROM timereg WHERE groupid='" . $data_group["id"] . "' AND billable='1'";
                         $sql_reg_obj->execute();
                         if ($sql_reg_obj->num_rows()) {
                             $sql_reg_obj->fetch_array();
                             foreach ($sql_reg_obj->data as $data_tmp) {
                                 // we store the ID inside an array key, since they are unique
                                 // and this will prevent us needed to check for the existance of
                                 // the ID already.
                                 $unbilled_ids[$data_tmp["id"]] = "on";
                             }
                         }
                         unset($sql_reg_obj);
                     }
                 }
                 unset($sql_obj);
             }
         }
         // fetch amount of unbilled time
         $sql_obj = new sql_query();
         $sql_obj->prepare_sql_settable("timereg");
         $sql_obj->prepare_sql_addfield("timebooked", "SUM(timereg.time_booked)");
         if ($this->access_staff_ids) {
             $sql_obj->prepare_sql_addwhere("employeeid IN (" . format_arraytocommastring($this->access_staff_ids) . ")");
         }
         $sql_obj->prepare_sql_addjoin("LEFT JOIN time_groups ON timereg.groupid = time_groups.id");
         // provide list of valid IDs
         $unbilled_ids_keys = array_keys($unbilled_ids);
         $unbilled_ids_count = count($unbilled_ids_keys);
         $unbilled_ids_sql = "";
         if ($unbilled_ids_count) {
             $i = 0;
             foreach ($unbilled_ids_keys as $id) {
                 $i++;
                 if ($i == $unbilled_ids_count) {
                     $unbilled_ids_sql .= "timereg.id='{$id}' ";
                 } else {
                     $unbilled_ids_sql .= "timereg.id='{$id}' OR ";
                 }
             }
             $sql_obj->prepare_sql_addwhere("({$unbilled_ids_sql})");
             $sql_obj->generate_sql();
             $sql_obj->execute();
             $sql_obj->fetch_array();
             list($unbilled_time_hours, $unbilled_time_mins) = explode(":", time_format_hourmins($sql_obj->data[0]["timebooked"]));
             if ($unbilled_time_hours > 0 && $unbilled_time_mins > 0) {
                 $message = "There are currently {$unbilled_time_hours} hours and {$unbilled_time_mins} minutes of unbilled time to be processed. Click here to view.";
             } elseif ($unbilled_time_hours > 0) {
                 $message = "There are currently {$unbilled_time_hours} hours of unbilled time to be processed. Click here to view.";
             } elseif ($unbilled_time_mins > 0) {
                 $message = "There are currently {$unbilled_time_mins} minutes of unbilled time to be processed. Click here to view.";
             }
         } else {
             $message = "There is no unbilled time to be processed.";
         }
         // display
         print "<br>";
         format_linkbox("default", "index.php?page=timekeeping/unbilled.php", "<p><b>UNBILLED TIME</b></p><p>{$message}</p>");
     }
     /*end unbilled time*/
     print "<br />";
     /*
     Time booked
     */
     // fetch amount of time booked for today
     $sql_obj = new sql_query();
     $sql_obj->prepare_sql_settable("timereg");
     $sql_obj->prepare_sql_addfield("timebooked", "SUM(timereg.time_booked)");
     $sql_obj->prepare_sql_addwhere("date='" . date("Y-m-d") . "'");
     if ($this->access_staff_ids) {
         $sql_obj->prepare_sql_addwhere("employeeid IN (" . format_arraytocommastring($this->access_staff_ids) . ")");
     }
     $sql_obj->generate_sql();
     $sql_obj->execute();
     $sql_obj->fetch_array();
     list($booked_time_hours, $booked_time_mins) = explode(":", time_format_hourmins($sql_obj->data[0]["timebooked"]));
     if ($booked_time_hours > 0 && $booked_time_mins > 0) {
         $message = "<b>Time booked for today: {$booked_time_hours} hours and {$booked_time_mins} minutes.</b><br />Click here to add more time.";
     } elseif ($booked_time_hours > 0) {
         $message = "<b>Time booked for today: {$booked_time_hours} hours.</b><br />Click here to add more time.";
     } elseif ($booked_time_mins > 0) {
         $message = "<b>Time booked for today: {$booked_time_mins} minutes.</b><br />Click here to add more time.";
     } else {
         $message = "<b>No time has been booked for today</b><br />Click here to add time.</b>";
     }
     format_linkbox("default", "index.php?page=timekeeping/timereg-day-edit.php", "<p>{$message}</p>");
     print "<br />";
     print "<table class=\"table_highlight\" width=\"100%\"><tr>";
     // Week selection links
     print "<td width=\"70%\">";
     print "<b>WEEK " . $this->date_selected_weekofyear . ", " . $this->date_selected_year . "</b><br>";
     print "(" . time_format_humandate($this->date_selected_start) . " to " . time_format_humandate($this->date_selected_end) . ")<br>";
     print "<br>";
     print "<p><b>";
     print "<a class=\"button\" href=\"index.php?page=timekeeping/timereg.php&employeeid=" . $this->employeeid . "&weekofyear=" . $date_option_previousweek . "&year=" . $date_option_previousyear . "\">&lt;&lt; Previous Week</a>";
     // check for date in the future
     if ($this->config_timesheet_booktofuture == "disabled") {
         if (time_date_to_timestamp(time_calculate_weekstart($date_option_nextweek, $date_option_nextyear)) < time()) {
             // end date is in not in the future
             print " <a class=\"button\" href=\"index.php?page=timekeeping/timereg.php&employeeid=" . $this->employeeid . "&weekofyear=" . $date_option_nextweek . "&year=" . $date_option_nextyear . "\">Next Week &gt;&gt;</a>";
         }
     } else {
         print " <a class=\"button\" href=\"index.php?page=timekeeping/timereg.php&employeeid=" . $this->employeeid . "&weekofyear=" . $date_option_nextweek . "&year=" . $date_option_nextyear . "\">Next Week &gt;&gt;</a>";
     }
     print "</b></p>";
     print "</td>";
     // goto date form
     print "<td width=\"30%\">";
     print "<form method=\"get\" action=\"index.php\" class=\"form_standard\">";
     $this->obj_form_goto->render_field("date");
     print "<br>";
     $this->obj_form_goto->render_field("page");
     $this->obj_form_goto->render_field("submit");
     print "</form>";
     print "</td>";
     print "</tr></table><br>";
     // Employee selection form
     //
     // we use a custom form display method here, since the normal form
     // class will draw a fully styled form in a table.
     //
     if ($this->employeeid) {
         print "<table class=\"table_highlight\" width=\"100%\"><tr><td width=\"100%\">";
     } else {
         print "<table class=\"table_highlight_important\" width=\"100%\"><tr><td width=\"100%\">";
     }
     print "<form method=\"get\" action=\"index.php\" class=\"form_standard\">";
     print "<p><b>Select an employee to view:</b></p>";
     $this->obj_form_employee->render_field("employeeid");
     $this->obj_form_employee->render_field("weekofyear");
     $this->obj_form_employee->render_field("year");
     $this->obj_form_employee->render_field("page");
     $this->obj_form_employee->render_field("submit");
     print "</form>";
     print "</td></tr></table><br>";
     if ($this->employeeid) {
         // custom labels and links
         if ($this->config_timesheet_booktofuture == "disabled") {
             if (time_date_to_timestamp($this->date_selected_daysofweek[0]) < time()) {
                 $this->obj_table_week->custom_column_link("monday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[0] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[1]) < time()) {
                 $this->obj_table_week->custom_column_link("tuesday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[1] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[2]) < time()) {
                 $this->obj_table_week->custom_column_link("wednesday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[2] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[3]) < time()) {
                 $this->obj_table_week->custom_column_link("thursday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[3] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[4]) < time()) {
                 $this->obj_table_week->custom_column_link("friday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[4] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[5]) < time()) {
                 $this->obj_table_week->custom_column_link("saturday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[5] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[6]) < time()) {
                 $this->obj_table_week->custom_column_link("sunday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[6] . "");
             }
         } else {
             // add links
             $this->obj_table_week->custom_column_link("monday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[0] . "");
             $this->obj_table_week->custom_column_link("tuesday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[1] . "");
             $this->obj_table_week->custom_column_link("wednesday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[2] . "");
             $this->obj_table_week->custom_column_link("thursday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[3] . "");
             $this->obj_table_week->custom_column_link("friday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[4] . "");
             $this->obj_table_week->custom_column_link("saturday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[5] . "");
             $this->obj_table_week->custom_column_link("sunday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[6] . "");
         }
         // column labels
         $this->obj_table_week->custom_column_label("monday", "Monday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[0]) . ")</font>");
         $this->obj_table_week->custom_column_label("tuesday", "Tuesday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[1]) . ")</font>");
         $this->obj_table_week->custom_column_label("wednesday", "Wednesday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[2]) . ")</font>");
         $this->obj_table_week->custom_column_label("thursday", "Thursday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[3]) . ")</font>");
         $this->obj_table_week->custom_column_label("friday", "Friday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[4]) . ")</font>");
         $this->obj_table_week->custom_column_label("saturday", "Saturday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[5]) . ")</font>");
         $this->obj_table_week->custom_column_label("sunday", "Sunday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[6]) . ")</font>");
         // display week time table
         $this->obj_table_week->render_table_html();
         print "<table width=\"100%\">";
         // add time link
         if (user_permissions_staff_get("timereg_write", $this->employeeid)) {
             print "<td align=\"left\" valign=\"top\"><p><a class=\"button\" href=\"index.php?page=timekeeping/timereg-day-edit.php\">Add new time entry</a></p></td>";
         } else {
             print "<p><i>You have read-only access to this employee and therefore can not add any more time.</i></p>";
         }
         // display CSV/PDF download link
         print "<td align=\"right\">";
         print "<p><a class=\"button_export\" href=\"index-export.php?mode=csv&page=timekeeping/timereg.php\">Export as CSV</a></p>";
         print "<p><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=timekeeping/timereg.php\">Export as PDF</a></p>";
         print "</td>";
         print "</table>";
     }
 }
Esempio n. 2
0
 function render_field($fieldname)
 {
     log_debug("form", "Executing render_field({$fieldname})");
     $helpmessagestatus = "false";
     switch ($this->structure[$fieldname]["type"]) {
         case "input":
             // set default size
             if (!isset($this->structure[$fieldname]["options"]["width"])) {
                 $this->structure[$fieldname]["options"]["width"] = 250;
             }
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             // display
             print "<input id=\"{$fieldname}\" name=\"{$fieldname}\" ";
             $css_field_class = array();
             if (isset($this->structure[$fieldname]["defaultvalue"])) {
                 print "value=\"" . htmlentities($this->structure[$fieldname]["defaultvalue"], ENT_QUOTES, "UTF-8") . "\" ";
             } elseif (isset($this->structure[$fieldname]["options"]["help"])) {
                 print "value=\"" . $this->structure[$fieldname]["options"]["help"] . "\" ";
                 $helpmessagestatus = "true";
                 $css_field_class[] = "helpmessage";
             }
             if (isset($this->structure[$fieldname]["options"]["css_field_class"])) {
                 $css_field_class[] = $this->structure[$fieldname]["options"]["css_field_class"];
             }
             if (!empty($css_field_class)) {
                 print "class=\"";
                 foreach ($css_field_class as $css) {
                     print $css . " ";
                 }
                 print "\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["max_length"])) {
                 print "maxlength=\"" . $this->structure[$fieldname]["options"]["max_length"] . "\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["disabled"]) && $this->structure[$fieldname]["options"]["disabled"] == "yes") {
                 print "disabled=\"disabled\" ";
             }
             print "style=\"width: " . $this->structure[$fieldname]["options"]["width"] . "px;\">";
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             print "<input type=\"hidden\" name=\"" . $fieldname . "_helpmessagestatus\" value=\"" . $helpmessagestatus . "\">";
             if (isset($this->structure[$fieldname]["options"]["autofill"])) {
                 print "<input type=\"hidden\" name=\"" . $fieldname . "_autofill\" value=\"" . $this->structure[$fieldname]["options"]["autofill"] . "\">";
             }
             break;
         case "money":
             // set default size
             if (!isset($this->structure[$fieldname]["options"]["width"])) {
                 $this->structure[$fieldname]["options"]["width"] = 50;
             }
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             // check where to set the currency symbol
             $position = sql_get_singlevalue("SELECT value FROM config WHERE name='CURRENCY_DEFAULT_SYMBOL_POSITION'");
             if ($position == "before") {
                 print sql_get_singlevalue("SELECT value FROM config WHERE name='CURRENCY_DEFAULT_SYMBOL'") . " ";
             }
             // display
             print "<input name=\"{$fieldname}\" ";
             $css_field_class = array();
             if (isset($this->structure[$fieldname]["defaultvalue"])) {
                 print "value=\"" . htmlentities($this->structure[$fieldname]["defaultvalue"], ENT_QUOTES, "UTF-8") . "\" ";
             } elseif (isset($this->structure[$fieldname]["options"]["help"])) {
                 print "value=\"" . $this->structure[$fieldname]["options"]["help"] . "\" ";
                 $helpmessagestatus = "true";
                 $css_field_class[] = "helpmessage";
             }
             if (isset($this->structure[$fieldname]["options"]["css_field_class"])) {
                 $css_field_class[] = $this->structure[$fieldname]["options"]["css_field_class"];
             }
             if (!empty($css_field_class)) {
                 print "class=\"";
                 foreach ($css_field_class as $css) {
                     print $css . " ";
                 }
                 print "\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["max_length"])) {
                 print "maxlength=\"" . $this->structure[$fieldname]["options"]["max_length"] . "\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["disabled"]) && $this->structure[$fieldname]["options"]["disabled"] == "yes") {
                 print "disabled=\"disabled\" ";
             }
             print "style=\"width: " . $this->structure[$fieldname]["options"]["width"] . "px;\">";
             if ($position == "after") {
                 print " " . sql_get_singlevalue("SELECT value FROM config WHERE name='CURRENCY_DEFAULT_SYMBOL'");
             }
             print " " . sql_get_singlevalue("SELECT value FROM config WHERE name='CURRENCY_DEFAULT_NAME'");
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             print "<input type=\"hidden\" name=\"" . $fieldname . "_helpmessagestatus\" value=\"" . $helpmessagestatus . "\">";
             break;
         case "password":
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             // set default size
             if (empty($this->structure[$fieldname]["options"]["width"])) {
                 $this->structure[$fieldname]["options"]["width"] = 250;
             }
             // display
             print "<input type=\"password\" name=\"{$fieldname}\"";
             if (isset($this->structure[$fieldname]["defaultvalue"])) {
                 print " value=\"" . $this->structure[$fieldname]["defaultvalue"] . "\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["disabled"]) && $this->structure[$fieldname]["options"]["disabled"] == "yes") {
                 print "disabled=\"disabled\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["css_field_class"])) {
                 print "class=\"" . $this->structure[$fieldname]["options"]["css_field_class"] . "\" ";
             }
             print "style=\"width: " . $this->structure[$fieldname]["options"]["width"] . "px;\">";
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             break;
         case "hidden":
             if (!isset($this->structure[$fieldname]["defaultvalue"])) {
                 $this->structure[$fieldname]["defaultvalue"] = '';
             }
             print "<input type=\"hidden\" name=\"{$fieldname}\" value=\"" . $this->structure[$fieldname]["defaultvalue"] . "\">";
             break;
         case "text":
             if (!isset($this->structure[$fieldname]["defaultvalue"])) {
                 $this->structure[$fieldname]["defaultvalue"] = '';
             }
             $translation = language_translate_string($this->language, $this->structure[$fieldname]["defaultvalue"]);
             print "{$translation}";
             if (!isset($this->structure[$fieldname]["options"]["nohidden"])) {
                 print "<input type=\"hidden\" name=\"{$fieldname}\" value=\"" . $this->structure[$fieldname]["defaultvalue"] . "\">";
             }
             break;
         case "textarea":
             // set default size
             if (!isset($this->structure[$fieldname]["options"]["width"])) {
                 $this->structure[$fieldname]["options"]["width"] = 300;
             }
             if (!isset($this->structure[$fieldname]["options"]["height"])) {
                 $this->structure[$fieldname]["options"]["height"] = 35;
             }
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             // display
             print "<textarea name=\"{$fieldname}\" ";
             if (isset($this->structure[$fieldname]["options"]["wrap"])) {
                 print "wrap=\"" . $this->structure[$fieldname]["options"]["wrap"] . "\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["disabled"]) && $this->structure[$fieldname]["options"]["disabled"] == "yes") {
                 print "disabled=\"disabled\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["css_field_class"])) {
                 print "class=\"" . $this->structure[$fieldname]["options"]["css_field_class"] . "\" ";
             }
             print "style=\"width: " . $this->structure[$fieldname]["options"]["width"] . "px; height: " . $this->structure[$fieldname]["options"]["height"] . "px;\">";
             if (isset($this->structure[$fieldname]["defaultvalue"])) {
                 print $this->structure[$fieldname]["defaultvalue"];
             }
             print "</textarea>";
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             break;
         case "date":
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             if (isset($this->structure[$fieldname]["defaultvalue"])) {
                 if ($this->structure[$fieldname]["defaultvalue"] == "0000-00-00" || $this->structure[$fieldname]["defaultvalue"] == 0) {
                     $date_a = array("", "", "");
                 } else {
                     $date_a = explode("-", $this->structure[$fieldname]["defaultvalue"]);
                 }
             } else {
                 $date_a = array("", "", "");
             }
             // get the format the date field needs to be shown in
             if (isset($_SESSION["user"]["dateformat"])) {
                 // fetch from user preferences
                 $format = $_SESSION["user"]["dateformat"];
             } else {
                 // user hasn't chosen a default time format yet - use the system default
                 $format = sql_get_singlevalue("SELECT value FROM config WHERE name='DATEFORMAT' LIMIT 1");
             }
             switch ($format) {
                 case "mm-dd-yyyy":
                     print "<input name=\"" . $fieldname . "_mm\" style=\"width: 25px;\" maxlength=\"2\" value=\"" . $date_a[1] . "\"> ";
                     print "<input name=\"" . $fieldname . "_dd\" style=\"width: 25px;\" maxlength=\"2\" value=\"" . $date_a[2] . "\"> ";
                     print "<input name=\"" . $fieldname . "_yyyy\" style=\"width: 50px;\" maxlength=\"4\" value=\"" . $date_a[0] . "\">";
                     print " <i>(mm/dd/yyyy)</i>";
                     break;
                 case "dd-mm-yyyy":
                     print "<input name=\"" . $fieldname . "_dd\" style=\"width: 25px;\" maxlength=\"2\" value=\"" . $date_a[2] . "\"> ";
                     print "<input name=\"" . $fieldname . "_mm\" style=\"width: 25px;\" maxlength=\"2\" value=\"" . $date_a[1] . "\"> ";
                     print "<input name=\"" . $fieldname . "_yyyy\" style=\"width: 50px;\" maxlength=\"4\" value=\"" . $date_a[0] . "\">";
                     print " <i>(dd/mm/yyyy)</i>";
                     break;
                 case "yyyy-mm-dd":
                 default:
                     print "<input name=\"" . $fieldname . "_yyyy\" style=\"width: 50px;\" maxlength=\"4\" value=\"" . $date_a[0] . "\"> ";
                     print "<input name=\"" . $fieldname . "_mm\" style=\"width: 25px;\" maxlength=\"2\" value=\"" . $date_a[1] . "\"> ";
                     print "<input name=\"" . $fieldname . "_dd\" style=\"width: 25px;\" maxlength=\"2\" value=\"" . $date_a[2] . "\">";
                     print " <i>(yyyy/mm/dd)</i>";
                     break;
             }
             // TODO: it would be good to have a javascript calender pop-up to use here.
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             break;
         case "timestamp_date":
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             if (empty($this->structure[$fieldname]["defaultvalue"])) {
                 $date_a = array("", "", "");
             } else {
                 $date_a = explode("-", date("Y-m-d", $this->structure[$fieldname]["defaultvalue"]));
             }
             print "<input name=\"" . $fieldname . "_dd\" style=\"width: 25px;\" maxlength=\"2\" value=\"" . $date_a[2] . "\"> ";
             print "<input name=\"" . $fieldname . "_mm\" style=\"width: 25px;\" maxlength=\"2\" value=\"" . $date_a[1] . "\"> ";
             print "<input name=\"" . $fieldname . "_yyyy\" style=\"width: 50px;\" maxlength=\"4\" value=\"" . $date_a[0] . "\">";
             print " <i>(dd/mm/yyyy)</i>";
             // TODO: it would be good to have a javascript calender pop-up to use here.
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             break;
         case "hourmins":
             if (empty($this->structure[$fieldname]["defaultvalue"])) {
                 $time_hours = "";
                 $time_mins = "";
             } else {
                 $time_processed = explode(":", time_format_hourmins($this->structure[$fieldname]["defaultvalue"]));
                 $time_hours = $time_processed[0];
                 $time_mins = $time_processed[1];
             }
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             print "<input name=\"" . $fieldname . "_hh\" style=\"width: 25px;\" maxlength=\"2\" value=\"{$time_hours}\"> hours ";
             print "<input name=\"" . $fieldname . "_mm\" style=\"width: 25px;\" maxlength=\"2\" value=\"{$time_mins}\"> mins";
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             break;
         case "radio":
             /*
             	there are two ways to draw radio form entries
             	
             	1. Just pass it the array of values, and the code will translate them using the language DB
             
             	2. Pass it an array of translation values with the array keys matching the value names. This
             	   is useful when you want to populate the radio with data from a different table.
             */
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             if (isset($this->structure[$fieldname]["translations"])) {
                 $translations = $this->structure[$fieldname]["translations"];
             } else {
                 // get translation for all options
                 $translations = language_translate($this->language, $this->structure[$fieldname]["values"]);
             }
             // if there is only 1 option avaliable, see if we should auto-select it.
             if (isset($this->structure[$fieldname]["options"]["autoselect"]) && isset($this->structure[$fieldname]["values"])) {
                 if (count($this->structure[$fieldname]["values"]) == 1) {
                     $autoselect = 1;
                 }
             }
             // display all the radio buttons
             foreach ($this->structure[$fieldname]["values"] as $value) {
                 // is the current row, the one that is in use? If so, add the 'selected' tag to it
                 if (isset($this->structure[$fieldname]["defaultvalue"]) && $value == $this->structure[$fieldname]["defaultvalue"]) {
                     print "<input checked ";
                 } elseif (isset($autoselect)) {
                     print "<input checked ";
                 } else {
                     print "<input ";
                 }
                 // if actions enabled, configure all the actions that have been defined
                 if (isset($this->actions[$fieldname])) {
                     print "onclick=\"";
                     foreach (array_keys($this->actions[$fieldname]) as $target_field) {
                         if (isset($this->actions[$fieldname][$target_field][$value])) {
                             $action = $this->actions[$fieldname][$target_field][$value];
                         } else {
                             $action = $this->actions[$fieldname][$target_field]["default"];
                         }
                         switch ($action) {
                             case "show":
                                 print "obj_show('" . $target_field . "'); ";
                                 break;
                             case "hide":
                                 print "obj_hide('" . $target_field . "'); ";
                                 break;
                         }
                     }
                     print "\" ";
                 }
                 if (isset($this->structure[$fieldname]["options"]["disabled"]) && $this->structure[$fieldname]["options"]["disabled"] == "yes") {
                     print "disabled=\"disabled\" ";
                 }
                 if (isset($this->structure[$fieldname]["options"]["css_field_class"])) {
                     print "class=\"" . $this->structure[$fieldname]["options"]["css_field_class"] . "\" ";
                 }
                 if (isset($this->structure[$fieldname]["options"]["disabled"])) {
                     if ($this->structure[$fieldname]["options"]["disabled"] == "yes") {
                         print "disabled=\"disabled\" ";
                     }
                 }
                 print "type=\"radio\" style=\"border: 0px\" name=\"{$fieldname}\" value=\"{$value}\" id=\"" . $fieldname . "_" . $value . "\">";
                 print "<label for=\"" . $fieldname . "_" . $value . "\">" . $translations[$value] . "</label><br>";
             }
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             break;
         case "checkbox":
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             // render form field
             print "<input ";
             if (isset($this->structure[$fieldname]["defaultvalue"])) {
                 if ($this->structure[$fieldname]["defaultvalue"] == "on" || $this->structure[$fieldname]["defaultvalue"] == "1" || $this->structure[$fieldname]["defaultvalue"] == "enabled") {
                     print "checked ";
                 }
             }
             // if actions enabled, configure all the actions that have been defined
             if (isset($this->actions[$fieldname])) {
                 print "onclick=\"";
                 foreach (array_keys($this->actions[$fieldname]) as $target_field) {
                     if (isset($this->actions[$fieldname][$target_field]["1"])) {
                         $action = $this->actions[$fieldname][$target_field]["1"];
                     }
                     switch ($action) {
                         case "show":
                             print "obj_show('" . $target_field . "'); ";
                             break;
                         case "hide":
                             print "obj_hide('" . $target_field . "'); ";
                             break;
                     }
                 }
                 print "\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["disabled"]) && $this->structure[$fieldname]["options"]["disabled"] == "yes") {
                 print "disabled=\"disabled\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["css_field_class"])) {
                 print "class=\"" . $this->structure[$fieldname]["options"]["css_field_class"] . "\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["disabled"])) {
                 if ($this->structure[$fieldname]["options"]["disabled"] == "yes") {
                     print "disabled=\"disabled\" ";
                 }
             }
             print "type=\"checkbox\" style=\"border: 0px\" name=\"" . $fieldname . "\" id=\"" . $fieldname . "\">";
             // post field label
             if (!isset($this->structure[$fieldname]["options"]["nolabel"])) {
                 if (isset($this->structure[$fieldname]["options"]["label"])) {
                     $translation = $this->structure[$fieldname]["options"]["label"];
                 } else {
                     $translation = language_translate_string($this->language, $fieldname);
                 }
                 print "<label for=\"" . $fieldname . "\">" . $translation . "</label>";
             }
             break;
         case "dropdown":
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             /*
             	there are two ways to draw drop down tables:
             	
             	1. Just pass it the array of values, and the code will translate them using the language DB
             
             	2. Pass it an array of translation values with the array keys matching the value names. This
             	   is useful when you want to populate a dropdown with data from a different table.
             */
             // set default size
             if (!isset($this->structure[$fieldname]["options"]["width"])) {
                 $this->structure[$fieldname]["options"]["width"] = 250;
             }
             // create value array if the SQL has not been executed yet
             if (is_string($this->structure[$fieldname]["values"])) {
                 if (!empty($this->structure[$fieldname]["defaultvalue"])) {
                     $query = str_replace("CURRENTID", $this->structure[$fieldname]["defaultvalue"], $this->structure[$fieldname]["values"]);
                 } else {
                     $query = str_replace("CURRENTID", "0", $this->structure[$fieldname]["values"]);
                 }
                 $this->structure[$fieldname]["values"] = array();
                 $sql_obj = new sql_query();
                 $sql_obj->string = $query;
                 $sql_obj->execute();
                 if ($sql_obj->num_rows()) {
                     $sql_obj->fetch_array();
                     foreach ($sql_obj->data as $data) {
                         // merge multiple labels into a single label
                         $label = $data["label"];
                         for ($i = 0; $i < count(array_keys($data)); $i++) {
                             if (!empty($data["label{$i}"])) {
                                 $label .= " -- " . $data["label{$i}"];
                             }
                         }
                         // only add an option if there is an id and label for it
                         if ($data["id"] && $label) {
                             $this->structure[$fieldname]["values"][] = $data["id"];
                             $this->structure[$fieldname]["translations"][$data["id"]] = $label;
                         }
                     }
                 } else {
                     print "No " . language_translate_string($_SESSION["user"]["lang"], $fieldname) . " avaliable.";
                     print "<input type=\"hidden\" name=\"{$fieldname}\" value=\"" . "No " . language_translate_string($_SESSION["user"]["lang"], $fieldname) . " avaliable." . "\">";
                     break;
                 }
             }
             if (isset($this->structure[$fieldname]["translations"])) {
                 $translations = $this->structure[$fieldname]["translations"];
             } else {
                 // get translation for all options
                 $translations = language_translate($this->language, $this->structure[$fieldname]["values"]);
             }
             // input box for filtering
             if (isset($this->structure[$fieldname]["options"]["search_filter"])) {
                 // subtact filter width from form element width
                 $width_filter = 100;
                 // px
                 $width_element = $this->structure[$fieldname]["options"]["width"];
                 // total
                 $this->structure[$fieldname]["options"]["width"] = $width_element - $width_filter;
                 // write filter field
                 print "<input id=\"_" . $fieldname . "\" class=\"dropdown_filter\" style=\"width:" . $width_filter . "px\"";
                 if (isset($this->structure[$fieldname]["options"]["disabled"]) && $this->structure[$fieldname]["options"]["disabled"] == "yes") {
                     print "disabled=\"disabled\" ";
                 }
                 print "/>&nbsp;";
             }
             // start dropdown/select box
             print "<select name=\"{$fieldname}\" size=\"1\" style=\"width: " . $this->structure[$fieldname]["options"]["width"] . "px;\"";
             if (isset($this->structure[$fieldname]["options"]["disabled"]) && $this->structure[$fieldname]["options"]["disabled"] == "yes") {
                 print "disabled=\"disabled\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["css_field_class"])) {
                 print "class=\"" . $this->structure[$fieldname]["options"]["css_field_class"] . "\" ";
             }
             print "> ";
             // if there is only 1 option avaliable, see if we should auto-select it.
             if (!empty($this->structure[$fieldname]["options"]["noselectoption"])) {
                 $this->structure[$fieldname]["options"]["autoselect"];
                 log_write("warning", "inc_forms", "obsolete usage of noselectoption dropdown option for field {$fieldname}");
             }
             if (!empty($this->structure[$fieldname]["options"]["autoselect"]) && !empty($this->structure[$fieldname]["values"])) {
                 if (count($this->structure[$fieldname]["values"]) == 1) {
                     $autoselect = 1;
                 }
             }
             // if there is no current entry, add a select entry as default
             if ((!isset($this->structure[$fieldname]["defaultname"]) || $this->structure[$fieldname]["defaultname"] == null) && (!isset($autoselect) || $autoselect == null)) {
                 print "<option value=\"\">-- select --</option>";
             }
             //echo "</select>";
             // add all the options
             foreach ($this->structure[$fieldname]["values"] as $value) {
                 print "<option ";
                 // is the current row, the one that is in use? If so, add the 'selected' tag to it
                 if (isset($this->structure[$fieldname]["defaultvalue"]) && $value == $this->structure[$fieldname]["defaultvalue"]) {
                     print "selected='selected' ";
                 }
                 print "value=\"{$value}\">" . $translations[$value] . "</option>";
             }
             // end of select/drop down
             print "</select>";
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             break;
         case "submit":
             $translation = language_translate_string($this->language, $this->structure[$fieldname]["defaultvalue"]);
             print "<input name=\"{$fieldname}\" type=\"submit\" value=\"{$translation}\"";
             if (isset($this->structure[$fieldname]["options"]["disabled"])) {
                 if ($this->structure[$fieldname]["options"]["disabled"] == "yes") {
                     print "disabled=\"disabled\" ";
                 }
             }
             print ">";
             break;
         case "message":
             // sometimes message data is coming directly out of the SQL database, we should run HTML entities
             // conversion on it.
             $this->structure[$fieldname]["defaultvalue"] = nl2br($this->structure[$fieldname]["defaultvalue"]);
             //$this->structure[$fieldname]["defaultvalue"]	= htmlentities($this->structure[$fieldname]["defaultvalue"]);
             print $this->structure[$fieldname]["defaultvalue"];
             break;
         case "file":
             // get max upload size
             $upload_maxbytes = format_size_human(sql_get_singlevalue("SELECT value FROM config WHERE name='UPLOAD_MAXBYTES'"));
             // optional prefix label/description
             if (isset($this->structure[$fieldname]["options"]["prelabel"])) {
                 print $this->structure[$fieldname]["options"]["prelabel"];
             }
             // input field
             print "<input type=\"file\" name=\"{$fieldname}\"";
             if (isset($this->structure[$fieldname]["options"]["disabled"]) && $this->structure[$fieldname]["options"]["disabled"] == "yes") {
                 print "disabled=\"disabled\" ";
             }
             if (isset($this->structure[$fieldname]["options"]["css_field_class"])) {
                 print "class=\"" . $this->structure[$fieldname]["options"]["css_field_class"] . "\" ";
             }
             print "> <i>Note: File must be no larger than {$upload_maxbytes}.</i>";
             // optional label/description
             if (isset($this->structure[$fieldname]["options"]["label"])) {
                 print "<label for=\"" . $fieldname . "\">" . $this->structure[$fieldname]["options"]["label"] . "</label>";
             }
             break;
         default:
             log_debug("form", "Error: Unknown field type of " . $this->structure["fieldname"]["type"] . "");
             break;
     }
     return 1;
 }
Esempio n. 3
0
 function render_field($column, $row)
 {
     log_debug("table", "Executing render_field({$column}, {$row})");
     /*
     	See the add_column function for comments about
     	the different possible types.
     */
     if (!isset($this->structure[$column]["type"])) {
         $this->structure[$column]["type"] = "";
     }
     switch ($this->structure[$column]["type"]) {
         case "date":
             if ($this->data[$row][$column] == "0000-00-00" || $this->data[$row][$column] == 0) {
                 // no date in this field, add filler
                 $result = "---";
             } else {
                 // format the date and display
                 $result = time_format_humandate($this->data[$row][$column]);
             }
             break;
         case "timestamp":
             if ($this->data[$row][$column]) {
                 $result_1 = time_format_humandate(date("Y-m-d", $this->data[$row][$column]));
                 $result_2 = date("H:i:s", $this->data[$row][$column]);
                 $result = "{$result_1} {$result_2}";
             } else {
                 $result = "---";
             }
             break;
         case "timestamp_date":
             if ($this->data[$row][$column]) {
                 $result = time_format_humandate(date("Y-m-d", $this->data[$row][$column]));
             } else {
                 $result = "---";
             }
             break;
         case "price":
         case "money":
         case "money_float":
             // TODO: This exists here to work around a PHP bug - it seems that if
             // we don't have it, even though $row will equal 0, it will still match
             // the if statements below comparing it to "total".
             //
             // Bug was observed on PHP v4 on CentOS 4
             //
             $row = strval($row);
             // check if this field is a total or not, since we only
             // want to blank non-total spaces.
             $total = NULL;
             if ($row == "total") {
                 $total = "yes";
             }
             if ($column == "total") {
                 $total = "yes";
             }
             if (empty($this->data[$row][$column]) && !$total) {
                 // instead of 0.00, make blank, as long as this field is not a total
                 $result = "";
             } else {
                 if ($this->structure[$column]["type"] == "money_float") {
                     $result = format_money($this->data[$row][$column], NULL, 4);
                 } else {
                     $result = format_money($this->data[$row][$column]);
                 }
             }
             break;
         case "hourmins":
             // value is a number of seconds, we need to convert into an H:MM format.
             $result = @time_format_hourmins($this->data[$row][$column]);
             break;
         case "bool_tick":
             // label as Y or N. The render functions may perform further work such
             // as displaying icons instead
             if (!empty($this->data[$row][$column])) {
                 $result = "Y";
             } else {
                 $result = "N";
             }
             break;
         case "text":
             $result = format_text_display($this->data[$row][$column]);
             break;
         case "percentage":
             if (!empty($this->data[$row][$column])) {
                 $result = $this->data[$row][$column] . "%";
             } else {
                 $result = "";
             }
             break;
         case "standard":
         default:
             if (isset($this->data[$row][$column])) {
                 $result = $this->data[$row][$column];
             } else {
                 $result = "";
             }
             break;
     }
     // end of switch
     return $result;
 }
 function render_html()
 {
     // Title + Summary
     if ($this->groupid) {
         print "<h3>EDIT TIME GROUP</h3><br>";
         print "<p>This page allows you to modify a time grouping.</p>";
     } else {
         print "<h3>ADD NEW TIME GROUP</h3><br>";
         print "<p>This page allows you to add a new time group entry to a project.</p>";
     }
     /*
     	Display the form
     
     	Because we need all the columns for the different time items, we have to do
     	a custom display for this form.
     */
     if ($this->obj_sql_entries->num_rows()) {
         // start form
         print "<form enctype=\"multipart/form-data\" method=\"" . $this->obj_form->method . "\" action=\"" . $this->obj_form->action . "\" class=\"form_standard\">";
         // GENERAL INPUTS
         // start table
         print "<table class=\"form_table\" width=\"100%\" cellspacing=\"0\">";
         // form header
         print "<tr class=\"header\">";
         print "<td colspan=\"2\"><b>" . language_translate_string($this->obj_form->language, "timebilled_details") . "</b></td>";
         print "</tr>";
         // display all the rows
         $this->obj_form->render_row("name_group");
         $this->obj_form->render_row("customerid");
         if ($this->groupid) {
             $this->obj_form->render_row("code_invoice");
         }
         $this->obj_form->render_row("description");
         // end table
         print "</table><br>";
         // TIME SELECTION
         print "<table class=\"form_table\" width=\"100%\" cellspacing=\"0\">";
         print "<tr class=\"header\">";
         print "<td colspan=\"2\"><b>" . language_translate_string($this->obj_form->language, "timebilled_selection") . "</b></td>";
         print "</tr>";
         print "</table>";
         // start table
         print "<p>Select all the time that should belong to this group from the list below - this list only shows time currently unassigned to any group.</p>";
         print "<p>You can choose whether to add the time as billable or as unbillable. This is used to group hours that are unbilled, eg: internal paper work\n\t\t\tfor the customer's account or other administrative overheads so that they won't continue to show in this list.</p>";
         // display notice about limited access if suitable
         if ($this->access_staff_ids) {
             $sql_obj = new sql_query();
             $sql_obj->string = "SELECT id FROM staff";
             $sql_obj->execute();
             $sql_obj->num_rows();
             if (count($this->access_staff_ids) != $sql_obj->num_rows()) {
                 format_msgbox("info", "<p>Please note that the following list of hours only includes the specific employees whom you have been configured to view - to view all employees, ask your admin to enable the timekeeping_all_view permission.</p>");
                 print "<br>";
             }
         }
         print "<table class=\"table_content\" width=\"100%\" cellspacing=\"0\">";
         // form header
         print "<tr class=\"header\">";
         print "<td><b>" . language_translate_string($this->obj_form->language, "date") . "</b></td>";
         print "<td><b>" . language_translate_string($this->obj_form->language, "name_phase") . "</b></td>";
         print "<td><b>" . language_translate_string($this->obj_form->language, "name_staff") . "</b></td>";
         print "<td><b>" . language_translate_string($this->obj_form->language, "description") . "</b></td>";
         print "<td><b>" . language_translate_string($this->obj_form->language, "time_booked") . "</b></td>";
         print "<td><b>" . language_translate_string($this->obj_form->language, "time_bill") . "</b></td>";
         print "<td><b>" . language_translate_string($this->obj_form->language, "time_nobill") . "</b></td>";
         print "</tr>";
         // display all the rows
         foreach ($this->obj_sql_entries->data as $data) {
             print "<tr>";
             print "<td>" . time_format_humandate($data["date"]) . "</td>";
             print "<td>" . $data["name_phase"] . "</td>";
             print "<td>" . $data["name_staff"] . "</td>";
             print "<td>" . $data["description"] . "</td>";
             print "<td>" . time_format_hourmins($data["time_booked"]) . "</td>";
             print "<td>";
             $this->obj_form->render_field("time_" . $data["id"] . "_bill");
             print "</td>";
             print "<td>";
             $this->obj_form->render_field("time_" . $data["id"] . "_nobill");
             print "</td>";
             print "</tr>";
         }
         // end table
         print "</table><br>";
         // HIDDEN FIELDS
         $this->obj_form->render_field("projectid");
         $this->obj_form->render_field("groupid");
         // SUBMIT
         // start table
         print "<table class=\"form_table\" width=\"100%\" cellspacing=\"0\">";
         // form header
         print "<tr class=\"header\">";
         print "<td colspan=\"2\"><b>" . language_translate_string($this->obj_form->language, "submit") . "</b></td>";
         print "</tr>";
         // display all the rows
         if (!$this->locked) {
             $this->obj_form->render_row("submit");
         }
         // end table
         print "</table>";
         // end form
         print "</form>";
         // locked
         if ($this->locked) {
             format_msgbox("locked", "<p>This time group has now been locked and can no longer be adjusted.</p>");
         }
     } else {
         format_msgbox("important", "<p>There is currently no un-grouped time that can be selected.</p>");
     }
 }