/** * get html for footer * @return string returned html */ function get_footer($creator_modifier_array) { global $user; global $logging; $logging->trace("getting footer"); $ts_created = get_date_str(DATE_FORMAT_DATETIME, $creator_modifier_array[DB_TS_CREATED_FIELD_NAME], $user->get_date_format()); $ts_modified = get_date_str(DATE_FORMAT_DATETIME, $creator_modifier_array[DB_TS_MODIFIED_FIELD_NAME], $user->get_date_format()); $html_str = ""; $html_str .= translate("LABEL_CREATED_BY") . " <strong>" . $creator_modifier_array[DB_CREATOR_FIELD_NAME]; $html_str .= "</strong> " . translate("LABEL_AT") . " <strong>" . $ts_created; $html_str .= "</strong>, " . translate("LABEL_LAST_MODIFICATION_BY") . " <strong>" . $creator_modifier_array[DB_MODIFIER_FIELD_NAME]; $html_str .= "</strong> " . translate("LABEL_AT") . " <strong>" . $ts_modified . "</strong>"; $logging->trace("got footer"); return $html_str; }
/** * get html value of specified type of field * @param $field_type string type of field * @param $field_options string options for given field * @param $db_field_name string db field name * @param $record array array of record name and values * @return string returned html */ function get_field_value($field_type, $field_options, $db_field_name, $record) { $field_value = $record[$db_field_name]; $this->_log->trace("get field value (field_type={$field_type}, field_options={$field_options}, db_field_name={$db_field_name}, field_value={$field_value})"); if ($field_type == FIELD_TYPE_DEFINITION_BOOL) { if ($field_value == 0) { $html_str = translate("LABEL_NO"); } else { $html_str = translate("LABEL_YES"); } } else { if (stristr($field_type, "DATE")) { $html_str = str_replace('-', '‑', get_date_str(DATE_FORMAT_FANCY, $field_value, $this->_user->get_date_format())); } else { if ($field_type == FIELD_TYPE_DEFINITION_AUTO_CREATED) { if ($field_options == NAME_DATE_OPTION_NAME) { $html_str = str_replace('-', '‑', $record[DB_CREATOR_FIELD_NAME]); } else { if ($field_options == NAME_DATE_OPTION_DATE) { $html_str = str_replace('-', '‑', get_date_str(DATE_FORMAT_FANCY, $record[DB_TS_CREATED_FIELD_NAME], $this->_user->get_date_format())); } else { if ($field_options == NAME_DATE_OPTION_DATE_NAME) { $html_str = str_replace('-', '‑', get_date_str(DATE_FORMAT_NORMAL, $record[DB_TS_CREATED_FIELD_NAME], $this->_user->get_date_format())); $html_str .= " (" . $record[DB_CREATOR_FIELD_NAME] . ")"; } } } } else { if ($field_type == FIELD_TYPE_DEFINITION_AUTO_MODIFIED) { if ($field_options == NAME_DATE_OPTION_NAME) { $html_str = str_replace('-', '‑', $record[DB_MODIFIER_FIELD_NAME]); } else { if ($field_options == NAME_DATE_OPTION_DATE) { $html_str = str_replace('-', '‑', get_date_str(DATE_FORMAT_FANCY, $record[DB_TS_MODIFIED_FIELD_NAME], $this->_user->get_date_format())); } else { if ($field_options == NAME_DATE_OPTION_DATE_NAME) { $html_str = str_replace('-', '‑', get_date_str(DATE_FORMAT_NORMAL, $record[DB_TS_MODIFIED_FIELD_NAME], $this->_user->get_date_format())); $html_str .= " (" . $record[DB_MODIFIER_FIELD_NAME] . ")"; } } } } else { if ($field_type == FIELD_TYPE_DEFINITION_NOTES_FIELD) { if (count($field_value) > 0) { $html_str = "\n"; foreach ($field_value as $note_array) { $html_str .= " <p><span class=\"note_creator\">"; $html_str .= str_replace('-', '‑', get_date_str(DATE_FORMAT_NORMAL, $note_array[DB_TS_CREATED_FIELD_NAME], $this->_user->get_date_format())); $html_str .= " (" . $note_array[DB_CREATOR_FIELD_NAME] . ")</span> "; $html_str .= transform_str($note_array["_note"]) . "</p>"; } } else { $html_str = "-"; } } else { if ($field_type == FIELD_TYPE_DEFINITION_TEXT_FIELD) { $html_str = transform_str($field_value); } else { if ($field_type == FIELD_TYPE_DEFINITION_PASSWORD) { $html_str = "********"; } else { if ($field_type == FIELD_TYPE_DEFINITION_ATTACHMENTS) { if ($field_value == 0) { $html_str = " "; } else { $html_str = "<span class=\"icon icon_attachment\"> </span>"; } } else { if ($field_type == FIELD_TYPE_DEFINITION_SELECTION) { if ($this->configuration[HTML_TABLE_PAGE_TYPE] != PAGE_TYPE_LIST) { $html_str = translate($field_value); } else { $html_str = $field_value; } } else { $html_str = $field_value; } } } } } } } } } $this->_log->trace("got field value"); return $html_str; }
} } //$general[$j][$i++] = get_date_str($t_month + 1, $k + 1, "days", $t_year); if ($gt == "last_month" || $gt == "last_week") { foreach ($years as $y => $month_arr) { foreach ($month_arr as $m => $days_arr) { //foreach($days_arr as $k => $v) $general[$j][$i++] = get_date_str($m+1, $k+1, "days", $y); foreach ($days_arr as $k => $v) { $general[$j][$i++] = get_date_str($m + 1, $k, "days", $y); } } } } if ($gt == "day") { foreach ($days as $k => $v) { $general[$j][$i++] = get_date_str("", $k, "hours"); } } for ($a = 1; $a < 5; $a++) { $i = 0; switch ($a) { case 1: //$general[$a][$i++]="Year stats"; $general[$a][$i++] = ""; break; case 2: //$general[$a][$i++]="Month stats"; $general[$a][$i++] = ""; break; case 3: //$general[$a][$i++]="Day stats";
/** * generate html for one note * this function is called only by function get_list_record_notes * @todo list of arguments is too long * @param string $db_field_name name of the field that contains this note * @param int $count the index number of this note * @param int $is_last indicates that this is the last existing note when set to 1 * @param int $id the id number of this note * @param array $note_array array describing a single note * @return string resulting html */ function get_list_record_note($db_field_name, $count, $is_last, $id, $note_array) { global $user; global $logging; $html_str = ""; # display the first note only if ($count == 0) { $class_name = ""; } else { $class_name = "invisible_collapsed"; } # set the previous and next count $previous_count = $count - 1; $next_count = $count + 1; if ($id == 0) { $next_count = -1; } # set the id's for current, previous and next note $td_id = $db_field_name . "_" . $count; $previous_td_id = $db_field_name . "_" . $previous_count; $next_td_id = $db_field_name . "_" . $next_count; # set name of textarea $textarea_name = $db_field_name . GENERAL_SEPARATOR . FIELD_TYPE_DEFINITION_NOTES_FIELD . GENERAL_SEPARATOR . $id; # set the text of note when this is not a new note if ($id != 0) { $note_str = str_replace("\n", "\\n", $note_array["_note"]); } else { $note_str = ""; } $logging->trace("getting list_record_note (count={$count}, is_last={$is_last}, id={$id})"); $html_str .= " <td id=\"{$td_id}\" class=\"{$class_name}\">\n"; # create a box around the actual note and the various buttons $html_str .= " <div class=\"note_box\">\n"; # first we will create the delete button with its containers $html_str .= " <div class=\"note_box_top_buttons\">\n"; # show reference to previous note $html_str .= " <div id=\"" . $td_id . "_ref_prev\" class=\"invisible_collapsed\">" . $previous_count . "</div>\n"; # show reference to next note $html_str .= " <div id=\"" . $td_id . "_ref_next\" class=\"invisible_collapsed\">" . $next_count . "</div>\n"; # set to 1 when this note has an add button $html_str .= " <div id=\"" . $td_id . "_ref_add\" class=\"invisible_collapsed\">" . $is_last . "</div>\n"; $html_str .= " <div id=\"" . $td_id . "_delete\" class=\"note_box_top_buttons_right\">"; # only display delete button when this is an existing note if ($id != 0) { $html_str .= get_href(get_onclick(ACTION_DELETE_NOTE, HTML_NO_PERMISSION_CHECK, "", "", "('{$db_field_name}', {$count}, \$('#" . $td_id . "_ref_prev').html(), \$('#" . $td_id . "_ref_next').html(), \$('#" . $td_id . "_ref_add').html())"), translate("BUTTON_DELETE_NOTE"), "icon_delete"); } else { $html_str .= get_inactive_button(translate("BUTTON_DELETE_NOTE")); } $html_str .= "</div>\n"; $html_str .= " </div>\n"; # next we will display info about the creator of this note only when this is not a new note $html_str .= " <div class=\"note_box_header\">"; if ($id != 0) { $html_str .= str_replace('-', '‑', get_date_str(DATE_FORMAT_NORMAL, $note_array[DB_TS_CREATED_FIELD_NAME], $user->get_date_format())); $html_str .= " (" . $note_array[DB_CREATOR_FIELD_NAME] . ")"; } else { $html_str .= translate("LABEL_NEW_NOTE") . " (" . $user->get_name() . ")"; } $html_str .= "</div>\n"; $html_str .= " <textarea cols=60 rows=4 name=\"{$textarea_name}\" id=\"" . $td_id . "_note\" class=\"note_text\">{$note_str}</textarea>\n"; $html_str .= " <div class=\"note_box_bottom_buttons\">\n"; $html_str .= " <div id=\"" . $td_id . "_previous" . "\" class=\"note_box_bottom_buttons_left\">"; # display button to go to the previous note when this is note the first note if ($count != 0) { $html_str .= get_href(get_onclick(ACTION_PREVIOUS_NOTE, HTML_NO_PERMISSION_CHECK, "", "", "('{$db_field_name}', {$count}, \$('#" . $td_id . "_ref_prev').html())"), translate("BUTTON_PREVIOUS_NOTE"), "icon_back"); } else { $html_str .= get_inactive_button(translate("BUTTON_PREVIOUS_NOTE")); } $html_str .= "</div>\n"; $html_str .= " <div id=\"" . $td_id . "_next" . "\" class=\"note_box_bottom_buttons_right\">"; # display inactive buttion when there is no next note if ($id == 0) { $html_str .= get_inactive_button(translate("BUTTON_ADD_NOTE")); } else { if ($is_last == 1) { $html_str .= get_href(get_onclick(ACTION_ADD_NOTE, HTML_NO_PERMISSION_CHECK, "", "", "('{$db_field_name}', {$count}, \$('#" . $td_id . "_ref_next').html())"), translate("BUTTON_ADD_NOTE"), "icon_add"); } else { $html_str .= get_href(get_onclick(ACTION_NEXT_NOTE, HTML_NO_PERMISSION_CHECK, "", "", "('{$db_field_name}', {$count}, \$('#" . $td_id . "_ref_next').html())"), translate("BUTTON_NEXT_NOTE"), "icon_next"); } } $html_str .= " </div>\n"; $html_str .= " </div>\n"; $html_str .= " </div>\n"; $html_str .= " </td>\n"; $logging->trace("got list_record_note"); return $html_str; }