本文整理汇总了PHP中result2hash函数的典型用法代码示例。如果您正苦于以下问题:PHP result2hash函数的具体用法?PHP result2hash怎么用?PHP result2hash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了result2hash函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
print "<a href=\"?m=ticketsmith&type={$type}";
print "&column=" . $fields["columns"][$loop];
if ($column != $fields["columns"][$loop]) {
$new_direction = "ASC";
} else {
if ($direction == "ASC") {
$new_direction = "DESC";
} else {
$new_direction == "ASC";
}
}
print "&direction={$new_direction}";
print '" class="hdr">' . $AppUI->_($fields["headings"][$loop]) . "</a></th>\n";
}
print "</tr>\n";
while ($row = result2hash($result)) {
print "<tr style='height:25px;'>\n";
for ($loop = 0; $loop < count($fields["headings"]); $loop++) {
print "<td bgcolor='white' align=" . $fields["aligns"][$loop] . ">\n";
//translate some information, some not
if ($fields["headings"][$loop] == "Status") {
print $AppUI->_(format_field($row[$fields["columns"][$loop]], $fields["types"][$loop], $row[$fields["columns"][0]])) . "\n";
} else {
print format_field($row[$fields["columns"][$loop]], $fields["types"][$loop], $row[$fields["columns"][0]]) . "\n";
}
print "</td>\n";
}
print "</tr>\n";
}
} else {
print "<tr style='height:25px;'>\n";
示例2: format_field
function format_field($value, $type, $ticket = NULL)
{
global $CONFIG;
global $AppUI;
global $canEdit;
switch ($type) {
case "user":
if ($value) {
$output = query2result("SELECT CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id WHERE user_id = '{$value}'");
} else {
$output = "-";
}
break;
case "status":
if ($canEdit) {
$output = create_selectbox("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
} else {
$output = chooseSelectedValue("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
}
break;
case "priority_view":
$priority = $CONFIG["priority_names"][$value];
$color = $CONFIG["priority_colors"][$value];
if ($value == 3) {
$priority = "<strong>{$priority}</strong>";
}
if ($value == 4) {
$priority = "<blink><strong>{$priority}</strong></blink>";
}
$output = "<font color=\"{$color}\">{$priority}</font>";
break;
case "priority_select":
if ($canEdit) {
$output = create_selectbox("priority_toggle", $CONFIG["priority_names"], $value);
} else {
$output = chooseSelectedValue("priority_toggle", $CONFIG["priority_names"], $value);
}
break;
case "assignment":
$options[0] = "-";
$query = "SELECT user_id as id, CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id ORDER BY name";
$result = do_query($query);
while ($row = result2hash($result)) {
$options[$row["id"]] = $row["name"];
}
if ($canEdit) {
$output = create_selectbox("assignment_toggle", $options, $value);
} else {
$output = chooseSelectedValue("assignment_toggle", $options, $value);
}
break;
case "view":
if ($CONFIG["index_link"] == "latest") {
$latest_value = query2result("SELECT ticket FROM tickets WHERE parent = '{$value}' ORDER BY ticket DESC LIMIT 1");
if ($latest_value) {
$value = $latest_value;
}
}
$output = "<a href=index.php?m=ticketsmith&a=view&ticket={$value}>{$value} ";
$output .= "<img src=images/icons/pencil.gif border=0></a>";
break;
case "attach":
$output = "<A href=index.php?m=ticketsmith&a=attach&ticket={$value}>";
$output .= "Link</a>";
break;
case "doattach":
$output = "<A href=index.php?m=ticketsmith&a=attach&newparent={$value}&dosql=reattachticket&ticket={$ticket}>";
$output .= "Link</a>";
break;
case "open_date":
$output = get_time_ago($value);
if ($CONFIG["warning_active"]) {
if (time() - $value > $CONFIG["warning_age"] * 3600) {
$output = "<font color=\"" . $CONFIG["warning_color"] . "\"><xb>" . $output . "</strong></font>";
}
}
break;
case "activity_date":
if (!$value) {
$output = "<em>" . $AppUI->_('none') . "</em>";
} else {
$output = get_time_ago($value);
}
$latest_followup_type = query2result("SELECT type FROM tickets WHERE parent = '{$ticket}' ORDER BY timestamp DESC LIMIT 1");
if ($latest_followup_type) {
$latest_followup_type = preg_replace("/(\\w+)\\s.*/", "\\1", $latest_followup_type);
$output .= " [{$latest_followup_type}]";
}
break;
case "elapsed_date":
$output = date($CONFIG["date_format"], $value);
$time_ago = get_time_ago($value);
$output .= " <em>({$time_ago})</em>";
break;
case "body":
if ($CONFIG["wordwrap"]) {
$value = word_wrap($value, 78);
}
$value = htmlspecialchars($value);
$output = "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"10\">\n";
//.........这里部分代码省略.........