Вход Регистрация
Файл: concrete5.7.5.6/concrete/controllers/dialog/conversation/subscribe.php
Строк: 92
<?php
namespace ConcreteControllerDialogConversation;

use 
ConcreteCoreApplicationEditResponse;
use 
ConcreteCoreControllerController;

class 
Subscribe extends Controller
{

    protected 
$controllerActionPath '/ccm/system/dialogs/conversation/subscribe';

    protected function 
loadConversation($cnvID)
    {
        
$conversation Conversation::getByID($cnvID);
        if (
is_object($conversation) && $conversation->getConversationSubscriptionEnabled()) {
            
$cp = new Permissions($conversation);
            if (
$cp->canViewConversation()) {
                
$u = new User();
                
$this->user $u;
                
$this->conversation $conversation;
                
$this->set('conversation'$conversation);
                
$this->set('isSubscribed'$conversation->isUserSubscribed($u));
                
$this->setViewObject(new View('/dialogs/conversation/subscribe'));
            }
        }

        if (!
$conversation) {
            throw new 
Exception(t('Access Denied.'));
        }
    }

    public function 
view($cnvID)
    {
        
$this->loadConversation($cnvID);
    }

    public function 
subscribe($cnvID)
    {
        
$this->loadConversation($cnvID);
        
$this->conversation->subscribeUser($this->user);
        
$o = new EditResponse();
        
$o->setAdditionalDataAttribute('subscribed'true);
        
$o->outputJSON();
    }

    public function 
unsubscribe($cnvID)
    {
        
$this->loadConversation($cnvID);
        
$this->conversation->unsubscribeUser($this->user);
        
$o = new EditResponse();
        
$o->setAdditionalDataAttribute('subscribed'false);
        
$o->outputJSON();
    }

}
Онлайн: 1
Реклама