本文整理匯總了PHP中date::build_views_sql方法的典型用法代碼示例。如果您正苦於以下問題:PHP date::build_views_sql方法的具體用法?PHP date::build_views_sql怎麽用?PHP date::build_views_sql使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類date
的用法示例。
在下文中一共展示了date::build_views_sql方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _asset_get_rows
function _asset_get_rows()
{
$t =& $GLOBALS["t"];
$tname = $t["title"];
$tview = $t["view"];
$mode = $t["views"][$tview]["SCHEMA_MODE"];
$vars = array("handler" => $t["handler"], "sqlvarsnoquote" => $t["sqlvarsnoquote"], "default_sql" => $t["default_sql"], "custom_name" => $t["custom_name"]);
$rows = db_select($tname, $t["fields_query"], $t["sqlwhere"], $t["sqlorder"], $t["sqllimit"], $t["sqlvars"], $vars);
if (!empty($GLOBALS["current_view"]["ENABLE_CALENDAR"]) and is_array($rows) and count($rows) > 0) {
$rows = date::build_views_sql($rows);
}
$i = 0;
$total_row = array();
$has_total_row = false;
if ($mode == "edit" and is_array($rows) and !empty($t["sqlvars"]["item"]) and count($rows) < count($t["sqlvars"]["item"])) {
sys_warning("{t}Item(s) not found or access denied.{/t}");
}
if (is_array($rows) and count($rows) > 1 and empty($_REQUEST["preview"]) and empty($_REQUEST["iframe"])) {
$total_row = array("_bgstyle" => "", "_fgstyle" => "", "issum" => 1);
$first_row = array_slice($rows, 0, 1);
foreach ($first_row[0] as $field => $value) {
if (isset($t["fields"][$field]["SUM"]) or isset($t["fields"][$field]["AVG"])) {
if (empty($_REQUEST["iframe"]) or isset($t["fields"][$field]["AVG"])) {
$has_total_row = true;
}
$total_row[$field] = array("data" => array(0), "filter" => array(0));
} else {
if (isset($t["fields"][$field])) {
$total_row[$field] = array("data" => array(""), "filter" => array(""));
}
}
}
}
if (is_array($rows)) {
foreach ($rows as $row) {
if (empty($row["id"])) {
$row["id"] = $i++;
}
while (isset($t["data"][$row["id"]])) {
$row["id"] .= " ";
}
$row["_id"] = $row["id"];
$row["_folder"] = isset($row["folder"]) ? $row["folder"] : "";
$row["_table"] = $tname;
$row["_bgstyle"] = "";
$row["_fgstyle"] = "";
if (!isset($t["fields"]["id"])) {
unset($row["id"]);
}
if (isset($t["views"][$tview]["CHANGESEEN"]) and empty($row["seen"])) {
$vars = $t["sqlvars"];
$vars["id"] = $row["_id"];
db_update($tname, array("seen" => 1), array("id=@id@"), $vars, array("handler" => $t["handler"]));
}
foreach ($row as $field => $value) {
if (isset($t["fields"][$field])) {
$value = $row[$field];
$row[$field] = array();
$row["_bgstyle"] = "";
$row["_fgstyle"] = "";
if ($has_total_row and is_numeric($value)) {
if (isset($t["fields"][$field]["SUM"])) {
$total_row[$field]["filter"][0] += $value;
} else {
if (isset($t["fields"][$field]["AVG"])) {
$total_row[$field]["filter"][0] += round($value / count($rows), 4);
}
}
}
if ($value != "") {
switch ($t["fields"][$field]["SIMPLE_TYPE"]) {
case "dateselect":
case "select":
$value = explode("|", trim($value, "|"));
break;
case "files":
$value = explode("|", trim($value, "|"));
foreach ($value as $key => $file) {
$locked = file_exists($file . ".lck");
$row[$field]["locked"][$key] = $locked;
if ($GLOBALS["sel_folder"]["rights"]["write"] and $locked) {
$row[$field]["can_unlock"][$key] = sys_can_unlock($file, $_SESSION["username"]);
} else {
if ($GLOBALS["sel_folder"]["rights"]["write"]) {
$row[$field]["can_lock"][$key] = sys_can_lock($file);
}
}
}
break;
case "multitext":
$value = _asset_explode($value, ", ");
break;
case "text":
if (!empty($t["fields"][$field]["SEPARATOR"])) {
$value = _asset_explode($value, $t["fields"][$field]["SEPARATOR"]);
}
break;
}
}
if (!is_array($value)) {
//.........這裏部分代碼省略.........