當前位置: 首頁>>代碼示例>>PHP>>正文


PHP comment::get_pagination方法代碼示例

本文整理匯總了PHP中comment::get_pagination方法的典型用法代碼示例。如果您正苦於以下問題:PHP comment::get_pagination方法的具體用法?PHP comment::get_pagination怎麽用?PHP comment::get_pagination使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在comment的用法示例。


在下文中一共展示了comment::get_pagination方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

                    }
                }
            }
        }
        break;
    case 'delete':
        $result = $comment->delete($commentid);
        if ($result === true) {
            echo json_encode(array('client_id' => $client_id, 'commentid' => $commentid));
        } else {
            if ($result == COMMENT_ERROR_INSUFFICIENT_CAPS) {
                $err->error = get_string('nopermissiontoeditcomment');
                echo json_encode($err);
            } else {
                if ($result == COMMENT_ERROR_DB) {
                    $err->error = get_string('dbupdatefailed');
                    echo json_encode($err);
                }
            }
        }
        break;
    case 'get':
    default:
        $ret = array();
        $comments = $comment->get_comments($page);
        $ret['list'] = $comments;
        $ret['pagination'] = $comment->get_pagination($page);
        $ret['client_id'] = $client_id;
        echo json_encode($ret);
        exit;
}
開發者ID:ajv,項目名稱:Offline-Caching,代碼行數:31,代碼來源:comment_ajax.php

示例2: array

                echo json_encode($result);
                die;
            }
        }
        break;
    case 'delete':
        $comment_record = $DB->get_record('comments', array('id' => $commentid));
        if ($manager->can_delete($commentid) || $comment_record->userid == $USER->id) {
            if ($manager->delete($commentid)) {
                $result = array('client_id' => $client_id, 'commentid' => $commentid);
                echo json_encode($result);
                die;
            }
        }
        break;
    case 'get':
    default:
        if ($manager->can_view()) {
            $comments = $manager->get_comments($page);
            $result = array('list' => $comments, 'count' => $manager->count(), 'pagination' => $manager->get_pagination($page), 'client_id' => $client_id);
            echo json_encode($result);
            die;
        }
        break;
}
if (!isloggedin()) {
    // tell user to log in to view comments
    echo json_encode(array('error' => 'require_login'));
}
// ignore request
die;
開發者ID:evltuma,項目名稱:moodle,代碼行數:31,代碼來源:comment_ajax.php

示例3: comment

    $args->ignore_permission = $ignore_permission;
    $manager = new comment($args);
} else {
    die;
}
// process ajax request
switch ($action) {
    case 'add':
        $result = $manager->add($content);
        if (!empty($result) && is_object($result)) {
            $result->count = $manager->count();
            $result->client_id = $client_id;
            echo json_encode($result);
        }
        break;
    case 'delete':
        $result = $manager->delete($commentid);
        if ($result === true) {
            echo json_encode(array('client_id' => $client_id, 'commentid' => $commentid));
        }
        break;
    case 'get':
    default:
        $result = array();
        $comments = $manager->get_comments($page);
        $result['list'] = $comments;
        $result['count'] = $manager->count();
        $result['pagination'] = $manager->get_pagination($page);
        $result['client_id'] = $client_id;
        echo json_encode($result);
}
開發者ID:vuchannguyen,項目名稱:web,代碼行數:31,代碼來源:comment_ajax.php


注:本文中的comment::get_pagination方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。