| Current Path : /var/www/html/components/com_jchat/Controller/ |
| Current File : /var/www/html/components/com_jchat/Controller/TicketController.php |
<?php
namespace JExtstore\Component\JChat\Site\Controller;
/**
* @package JCHAT::LAMESSAGES::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 JExtstore\Component\JChat\Administrator\Framework\Controller as JChatController;
use JExtstore\Component\JChat\Administrator\Framework\Helpers\Mailer as JChatMailer;
/**
* Tickets controller class
*
* @package JCHAT::LAMESSAGES::components::com_jchat
* @subpackage controllers
* @since 1.0
*/
class TicketController extends JChatController {
/**
* Save new contact user for public conversation
*
* @access public
* @return bool
*/
public function saveEntity(): bool {
// Initialization
$coreName = $this->getName ();
// Load della model e bind store
$model = $this->getModel ('Ticket', null, array('name'=>'Sessionstatus'));
// Root controller -> dependency injection
$mailer = JChatMailer::getInstance('Joomla');
if (!$model->storeEntity ($mailer)) {
// Model set exceptions for something gone wrong, so enqueue exceptions and levels on application object then set redirect and exit
$modelException = $model->getException ( null, false );
$response['storing'] = array('status'=>false, 'details'=>$modelException->getMessage());
} else {
$response['storing'] = array('status'=>true);
}
// Get view and pushing model
$view = $this->getView ( $coreName, 'json', '', array ('base_path' => $this->basePath ) );
// Format response for JS client as requested
$view->display($response);
return true;
}
}