| Current Path : /var/www/html/components/com_jchat/Controller/ |
| Current File : /var/www/html/components/com_jchat/Controller/GroupchatController.php |
<?php
namespace JExtstore\Component\JChat\Site\Controller;
/**
* @package JCHAT::GROUPCHAT::components::com_jchat
* @subpackage controllers
* @author Joomla! Extensions Store
* @copyright (C) 2024 - Joomla! Extensions Store
* @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use JExtstore\Component\JChat\Administrator\Framework\Controller as JChatController;
use JExtstore\Component\JChat\Administrator\Framework\Helpers\Users as JChatHelpersUsers;
/**
* Group public chat controller class
* The entity in this MVC core is the contact user managed for group public conversation
*
* @package JCHAT::GROUPCHAT::components::com_jchat
* @subpackage controllers
* @since 1.0
*/
class GroupchatController extends JChatController {
/**
* Save new contact user for public conversation
*
* @access public
* @return bool
*/
public function saveEntity(): bool {
// Initialization
$document = Factory::getApplication()->getDocument();
$viewType = $document->getType ();
$coreName = $this->getName ();
// Instantiate model object with Dependency Injection
$userSessionTable = JChatHelpersUsers::getSessiontable ();
$model = $this->getModel($coreName, null, array('sessiontable'=>$userSessionTable));
$contactID = $this->app->getInput()->getString('id', null);
// Try to load record from model
$response = $model->storeEntity($contactID);
// Get view and pushing model
$view = $this->getView ( $coreName, $viewType, '', array ('base_path' => $this->basePath ) );
// Format response for JS client as requested
$view->display($response);
return true;
}
/**
* Remove existing contact user from public conversation
*
* @access public
* @return bool
*/
public function deleteEntity(): bool {
// Initialization
$document = Factory::getApplication()->getDocument();
$viewType = $document->getType ();
$coreName = $this->getName ();
// Instantiate model object with Dependency Injection
$userSessionTable = JChatHelpersUsers::getSessiontable ();
$model = $this->getModel($coreName, null, array('sessiontable'=>$userSessionTable));
$contactID = $this->app->getInput()->getString('id', null);
// Try to load record from model
$response = $model->deleteEntity($contactID);
// Get view and pushing model
$view = $this->getView ( $coreName, $viewType, '', array ('base_path' => $this->basePath ) );
// Format response for JS client as requested
$view->display($response);
return true;
}
}