本文整理汇总了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;
}