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


PHP Permissions::canDeleteConversationMessage方法代码示例

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


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

示例1: foreach

                <tbody>
                <?php 
if (count($messages) > 0) {
    $dh = Core::make('date');
    foreach ($messages as $msg) {
        $cnv = $msg->getConversationObject();
        if (is_object($cnv)) {
            $page = $cnv->getConversationPageObject();
        }
        $msgID = $msg->getConversationMessageID();
        $cnvID = $cnv->getConversationID();
        $p = new Permissions($cnv);
        $author = $msg->getConversationMessageAuthorObject();
        $formatter = $author->getFormatter();
        $displayUnflagOption = $p->canFlagConversationMessage() && $msg->isConversationMessageFlagged();
        $displayUndeleteOption = $p->canDeleteConversationMessage() && $msg->isConversationMessageDeleted();
        $displayApproveOption = $p->canApproveConversationMessage() && (!$msg->isConversationMessageDeleted() && !$msg->isConversationMessageApproved() && !$msg->isConversationMessageFlagged());
        if (!$displayUnflagOption) {
            $displayFlagOption = $p->canFlagConversationMessage() && !$msg->isConversationMessageDeleted();
        }
        $displayDeleteOption = $p->canDeleteConversationMessage() && !$msg->isConversationMessageDeleted();
        ?>
                        <tr>
                            <!-- <td><?php 
        echo $form->checkbox('cnvMessageID[]', $msg->getConversationMessageID());
        ?>
</td> -->
                            <td>
                                <?php 
        echo $dh->formatDateTime(strtotime($msg->getConversationMessageDateTime()));
        ?>
开发者ID:ceko,项目名称:concrete5-1,代码行数:31,代码来源:messages.php

示例2: undelete_message

 public function undelete_message()
 {
     $e = Core::make('error');
     $message = ConversationMessage::getByID($this->post('cnvMessageID'));
     if (!is_object($message)) {
         $e->add(t('Invalid message'));
     } else {
         $mp = new \Permissions($message);
         if (!$mp->canDeleteConversationMessage()) {
             $e->add(t('You do not have permission to restore this message.'));
         }
     }
     $er = new EditResponse($e);
     if (!$e->has()) {
         $message->restore();
         $er->setMessage(t('Message restored.'));
     }
     $er->outputJSON();
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:19,代码来源:messages.php

示例3: die

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$im = Loader::helper('image');
$mp = new Permissions($message);
$canDeleteMessage = $mp->canDeleteConversationMessage();
$canFlagMessage = $mp->canFlagConversationMessage();
$canEditMessage = $mp->canEditConversationMessage();
$canRateMessage = $mp->canRateConversationMessage();
$ui = $message->getConversationMessageUserObject();
$class = 'message ccm-conversation-message ccm-conversation-message-level' . $message->getConversationMessageLevel();
if ($message->isConversationMessageDeleted()) {
    $class .= ' ccm-conversation-message-deleted';
}
if ($dateFormat == 'custom' && $customDateFormat) {
    $dateFormat = array($customDateFormat);
}
if (!$message->isConversationMessageApproved()) {
    $class .= ' ccm-conversation-message-flagged';
}
$cnvMessageID = $message->getConversationMessageID();
$cnvID = $message->getConversationID();
$c = Page::getByID($_REQUEST['cID']);
$cnvMessageURL = urlencode($c->getCollectionLink(true) . '#cnv' . $cnvID . 'Message' . $cnvMessageID);
if (!$message->isConversationMessageDeleted() && $message->isConversationMessageApproved() || $message->conversationMessageHasActiveChildren()) {
    $author = $message->getConversationMessageAuthorObject();
    $formatter = $author->getFormatter();
    ?>
	<div data-conversation-message-id="<?php 
    echo $message->getConversationMessageID();
    ?>
开发者ID:yakamoz-fang,项目名称:concrete,代码行数:31,代码来源:message.php

示例4: die

<?php

defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Conversation\Message\Message as ConversationMessage;
$ax = Loader::helper('ajax');
$vs = Loader::helper('validation/strings');
$ve = Loader::helper('validation/error');
if (Loader::helper('validation/numbers')->integer($_POST['cnvMessageID']) && $_POST['cnvMessageID'] > 0) {
    $message = ConversationMessage::getByID($_POST['cnvMessageID']);
    if (is_object($message)) {
        $mp = new Permissions($message);
        if ($mp->canDeleteConversationMessage()) {
            $message->delete();
            $r = Request::getInstance();
            $types = $r->getAcceptableContentTypes();
            if ($types[0] == 'application/json') {
                $r = new \Concrete\Core\Application\EditResponse();
                $r->setMessage(t('Message deleted successfully.'));
                $r->outputJSON();
            } else {
                Loader::element('conversation/message', array('message' => $message));
            }
        }
    }
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:25,代码来源:delete_message.php


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