当前位置: 首页>>代码示例>>PHP>>正文


PHP Web::partial方法代码示例

本文整理汇总了PHP中Web::partial方法的典型用法代码示例。如果您正苦于以下问题:PHP Web::partial方法的具体用法?PHP Web::partial怎么用?PHP Web::partial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Web的用法示例。


在下文中一共展示了Web::partial方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ajaxSaveComment_POST

function ajaxSaveComment_POST(Web $w)
{
    $p = $w->pathMatch('parent_id');
    $comment = new Comment($w);
    $comment->obj_table = "comment";
    $comment->obj_id = $p['parent_id'];
    $comment->comment = strip_tags($w->request('comment'));
    $comment->insert();
    $w->setLayout(null);
    echo $w->partial("displaycomment", array("object" => $comment, 'redirect' => $w->request('redirect')), "admin");
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:11,代码来源:ajaxSaveComment.php

示例2: task_comment_comment_added_comment

/**
 * Hook to notify relevant people when a task has been updated
 * 
 * @param Web $w
 * @param Task $object
 */
function task_comment_comment_added_comment(Web $w, $object)
{
    $w->Log->setLogger("TASK")->debug("task_comment_comment_added_comment");
    // Check if the parent comment is attached to a task
    $comment = $object;
    while (strtolower($comment->obj_table) == "comment" && $comment->obj_id != NULL) {
        $comment = $w->Comment->getComment($comment->obj_id);
        // Check if the comment could not be found
        if (empty($comment->id)) {
            $w->Log->setLogger("TASK")->debug("Comment not found");
            return;
        }
    }
    // We only want task comments!
    if (strtolower($comment->obj_table) != "task") {
        $w->Log->setLogger("TASK")->debug("Comment parent not a task");
        return;
    }
    $task = $w->Task->getTask($comment->obj_id);
    if (empty($task->id)) {
        $w->Log->setLogger("TASK")->debug("Task not found");
        return;
    }
    $users_to_notify = $w->Task->getNotifyUsersForTask($task, TASK_NOTIFICATION_TASK_COMMENTS);
    if (!in_array($task->assignee_id, $users_to_notify)) {
        $users_to_notify[$task->assignee_id] = $task->assignee_id;
    }
    // Add all users in comment thread to the notification
    $reply_comment = $object;
    $comment_thread_users = array();
    while (strtolower($reply_comment->obj_table) == "comment" && $comment->obj_id != NULL) {
        if (!in_array($reply_comment->creator_id, $users_to_notify)) {
            $comment_thread_users[$reply_comment->creator_id] = $reply_comment->creator_id;
        }
        $reply_comment = $w->Comment->getComment($comment->obj_id);
        // Check if the comment could not be found
        if (empty($comment->id)) {
            return;
        }
    }
    $users_to_notify = array_merge($comment_thread_users, $users_to_notify);
    $comment_user = $w->Auth->getUser($object->creator_id);
    if (!empty($users_to_notify)) {
        $event_title = $object->getHumanReadableAttributeName(TASK_NOTIFICATION_TASK_COMMENTS);
        // send it to the inbox of the user's on our send list
        foreach ($users_to_notify as $user) {
            // prepare our message, add heading, add URL to task, add notification advice in messgae footer
            $subject = $comment_user->getFullName() . " replied to a comment " . (in_array($w->Auth->user()->id, $comment_thread_users) ? "that you're a part of " : "") . "for " . $task->title;
            $message = "<p>Comment</p>";
            $message .= $w->partial("displaycomment", array("object" => $object, "displayOnly" => true, 'redirect' => '/inbox'), "admin");
            $user_object = $w->Auth->getUser($user);
            if ($task->canView($user_object)) {
                $message .= "<a href='/task/edit/" . $task->id . "?scroll_comment_id=" . $object->id . "#comments'><p>Click here to view the comment</p></a>";
            } else {
                $message .= "<p><b>You are unable to view this task</b></p>";
            }
            $message .= "<br/><br/><b>Note</b>: Go to " . Html::a(WEBROOT . "/task/tasklist#notifications", "Task > Task List > Notifications") . ", to edit the types of notifications you will receive.";
            $w->Inbox->addMessage($subject, $message, $user, null, null, true);
        }
    }
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:67,代码来源:task.hooks.php


注:本文中的Web::partial方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。