| 1 |
<? |
<?php |
| 2 |
function load_section_list(array & $result, callable $filter, callable $udf_value_gen, mysqli $db_conn) : bool |
function load_section_list(array & $result, callable $filter, callable $udf_value_gen, mysqli $db_conn, array $filter_param = array()) : bool |
| 3 |
{ |
{ |
| 4 |
$sql = "SELECT SID, section_config.CID, section_config.title AS s_title, section_class.title AS c_title |
$sql = "SELECT SID, section_config.CID, section_config.title AS s_title, section_config.comment, |
| 5 |
|
section_class.title AS c_title, section_config.recommend |
| 6 |
FROM section_config INNER JOIN section_class ON section_config.CID = section_class.CID |
FROM section_config INNER JOIN section_class ON section_config.CID = section_class.CID |
| 7 |
WHERE section_class.enable AND section_config.enable |
WHERE section_class.enable AND section_config.enable |
| 8 |
ORDER BY section_class.sort_order, section_config.sort_order"; |
ORDER BY section_class.sort_order, section_config.sort_order"; |
| 35 |
$last_c_title = $row["c_title"]; |
$last_c_title = $row["c_title"]; |
| 36 |
} |
} |
| 37 |
|
|
| 38 |
if (call_user_func($filter, $row["SID"])) |
if (call_user_func($filter, $row, $filter_param)) |
| 39 |
{ |
{ |
| 40 |
array_push($section_list, array( |
array_push($section_list, array( |
| 41 |
"sid" => $row["SID"], |
"sid" => $row["SID"], |
| 42 |
"title" => $row["s_title"], |
"title" => $row["s_title"], |
| 43 |
"udf_values" => call_user_func($udf_value_gen, $row["SID"]), |
"comment" => $row["comment"], |
| 44 |
|
"udf_values" => call_user_func($udf_value_gen, $row, $filter_param), |
| 45 |
)); |
)); |
| 46 |
} |
} |
| 47 |
} |
} |