本文整理匯總了PHP中comment::util_get_comments_array方法的典型用法代碼示例。如果您正苦於以下問題:PHP comment::util_get_comments_array方法的具體用法?PHP comment::util_get_comments_array怎麽用?PHP comment::util_get_comments_array使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類comment
的用法示例。
在下文中一共展示了comment::util_get_comments_array方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_list
public static function get_list($_FORM = array())
{
// Two modes, 1: get all comments for an entity, eg a task
if ($_FORM["entity"] && in_array($_FORM["entity"], array("project", "client", "task", "timeSheet")) && $_FORM["entityID"]) {
$e = new $_FORM["entity"]();
$e->set_id($_FORM["entityID"]);
if ($e->select()) {
// this ensures that the user can read the entity
return comment::util_get_comments_array($_FORM["entity"], $_FORM["entityID"], $_FORM);
}
// Or 2: get all starred comments
} else {
if ($_FORM["starred"]) {
$filter = comment::get_list_filter($_FORM);
if (is_array($filter) && count($filter)) {
$filter = " WHERE " . implode(" AND ", $filter);
}
$q = "SELECT comment.*, commentCreatedUser as personID, clientContact.clientContactName\n FROM comment \n LEFT JOIN clientContact on comment.commentCreatedUserClientContactID = clientContact.clientContactID\n " . $filter . " \n ORDER BY commentCreatedTime";
$db = new db_alloc();
$db->query($q);
$people =& get_cached_table("person");
while ($row = $db->next_record()) {
$e = new $row["commentMaster"]();
$e->set_id($row["commentMasterID"]);
$e->select();
$row["entity_link"] = $e->get_link();
$row["personID"] and $row["person"] = $people[$row["personID"]]["name"];
$row["clientContactName"] and $row["person"] = $row["clientContactName"];
$rows[] = $row;
}
has("timeSheetItem") and $tsi_rows = timeSheetItem::get_timeSheetItemComments(null, true);
foreach ((array) $tsi_rows as $row) {
$t = new task();
$t->set_id($row["taskID"]);
$t->select();
$row["entity_link"] = $t->get_link();
$row["commentMaster"] = "Task";
$row["commentMasterID"] = $row["taskID"];
$row["commentCreatedTime"] = $row["date"];
$row["personID"] and $row["person"] = $people[$row["personID"]]["name"];
$rows[] = $row;
}
return (array) $rows;
}
}
}
示例2: get_task_comments_array
function get_task_comments_array()
{
$rows = comment::util_get_comments_array("task", $this->get_id());
$rows or $rows = array();
return $rows;
}