Файловый менеджер - Редактировать - /var/www/html/administrator/components/com_jchat/View/Lamessages/HtmlView.php
Ðазад
<?php namespace JExtstore\Component\JChat\Administrator\View\Lamessages; /** * @package JCHAT::LAMESSAGES::administrator::components::com_jchat * @subpackage views * @subpackage lamessages * @author Joomla! Extensions Store * @Copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ defined ( '_JEXEC' ) or die ( 'Restricted access' ); use Joomla\CMS\Language\Text; use Joomla\CMS\Factory; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Uri\Uri; use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\Pagination\Pagination; use Joomla\CMS\Editor\Editor; use JExtstore\Component\JChat\Administrator\Framework\View as JChatView; define ( 'INDEX_WORKED', 'worked'); define ( 'INDEX_CLOSED', 'closed_ticket'); define ( 'INDEX_RESPONSES', 'responses'); /** * User leaved messages view implementation * * @package FBCHAT::MESSAGES::administrator::components::com_jchat * @subpackage views * @since 1.0 */ class HtmlView extends JChatView { // Template view variables protected $joomlaConfig; protected $pagination; protected $order; protected $searchword; protected $lists; protected $orders; protected $items; protected $dates; protected $phoneNumberEnabled; protected $record; protected $editor; protected $nameOfUser; /** * Add the page title and toolbar. * * @since 1.6 */ protected function addEditEntityToolbar() { ToolbarHelper::title(Text::_('COM_JCHAT_MAINTITLE_TOOLBAR') . Text::_( 'COM_JCHAT_TICKET_DETAILS' ), 'jchat' ); ToolbarHelper::apply('lamessages.applyEntity', 'JAPPLY'); ToolbarHelper::save('lamessages.saveEntity', 'JSAVE'); ToolbarHelper::custom('lamessages.responsemessage', 'upload', 'upload', 'COM_JCHAT_RESPONSE_LEAVED_MESSAGES', false); ToolbarHelper::custom('lamessages.cancelEntity', 'cancel', 'cancel', 'JCANCEL', false); } /** * Add the page title and toolbar. * * @since 1.6 */ protected function addDisplayToolbar() { ToolbarHelper::title( Text::_('COM_JCHAT_MAINTITLE_TOOLBAR') . Text::_( 'COM_JCHAT_LIST_TICKETS' ), 'jchat' ); ToolbarHelper::editList('lamessages.editentity', 'COM_JCHAT_TICKET_DETAILS'); ToolbarHelper::deleteList(Text::_('COM_JCHAT_DELETE_TICKETS'), 'lamessages.deleteentity'); ToolbarHelper::custom('lamessages.exportMessages', 'download', 'download', 'COM_JCHAT_EXPORT_TICKETS', false); ToolbarHelper::custom('cpanel.display', 'home', 'home', 'COM_JCHAT_CPANEL', false); } /** * Default listEntities * @access public */ public function display($tpl = 'list') { $doc = $this->app->getDocument (); $this->loadJQuery($doc); $this->loadJQueryUI($doc); $this->loadBootstrap($doc); $doc->getWebAssetManager()->addInlineScript(" Joomla.submitbutton = function(pressbutton) { Joomla.submitform( pressbutton ); if (pressbutton == 'lamessages.exportMessages') { jQuery('#adminForm input[name=task]').val('lamessages.display'); } return true; } "); $doc->getWebAssetManager()->addInlineStyle('@media (max-width: 767px) { body.admin.com_jchat { min-width: 767px; }} @media (max-width: 1360px) and (min-width: 768px) { body.admin.com_jchat { min-width: 1360px; }}'); // Get main records $rows = $this->get('Data'); $lists = $this->get('Filters'); $total = $this->get('Total'); $orders = array(); $orders['order'] = $this->getModel()->getState('order'); $orders['order_Dir'] = $this->getModel()->getState('order_dir'); // Pagination view object model state populated $pagination = new Pagination( $total, $this->getModel()->getState('limitstart'), $this->getModel()->getState('limit') ); $dates = array('start'=>$this->getModel()->getState('fromPeriod'), 'to'=>$this->getModel()->getState('toPeriod')); $this->pagination = $pagination; $this->order = $this->getModel()->getState('order'); $this->searchword = $this->getModel()->getState('searchword'); $this->lists = $lists; $this->orders = $orders; $this->items = $rows; $this->option = $this->getModel()->getState('option'); $this->dates = $dates; $this->phoneNumberEnabled = $this->getModel()->getComponentParams()->get('tickets_form_include_phonenumber', 0); // Add toolbar $this->addDisplayToolbar(); parent::display($tpl); } /** * Mostra la visualizzazione dettaglio del record singolo * @param Object& $row * @access public */ public function editEntity(&$row) { // Sanitize HTML Object2Form OutputFilter::objectHTMLSafe( $row ); // Load JS Client App dependencies $doc = $this->app->getDocument(); $base = Uri::root(); $this->loadJQuery($doc); $this->loadJQueryUI($doc); $this->loadBootstrap($doc); $this->loadValidation($doc); // Load specific JS code $doc->getWebAssetManager()->addInlineScript(" jQuery(function($) { $('input[data-role=calendar]').datepicker({ dateFormat:'yy-mm-dd', firstDay:1 }).prev('span').on('click', function(){ $(this).datepicker('show'); }); }); "); // Inject js translations $translations = array( 'COM_JCHAT_VALIDATION_ERROR', 'COM_JCHAT_VALIDATION_ERROR_SUBJECT' ); $this->injectJsTranslations($translations, $doc); // Load specific JS code $doc->getWebAssetManager()->addInlineScript(" Joomla.submitbutton = function(pressbutton) { if(!jQuery.fn.validation) { jQuery.extend(jQuery.fn, jchatjQueryBackup.fn); } jQuery('#adminForm').validation(); if (pressbutton == 'lamessages.cancelEntity') { Joomla.submitform( pressbutton ); return true; } if (pressbutton != 'lamessages.responsemessage') { jQuery('input[name=email_subject]').attr('data-validation', ''); } if(jQuery('#adminForm').validate()) { Joomla.submitform( pressbutton ); return true; } return false; } "); $lists = $this->getModel()->getLists($row); $this->record = $row; $this->lists = $lists; $this->editor = Editor::getInstance(Factory::getApplication()->getConfig()->get('editor')); $this->nameOfUser = $this->user->name; $this->phoneNumberEnabled = $this->getModel()->getComponentParams()->get('tickets_form_include_phonenumber', 0); // Aggiunta toolbar $this->addEditEntityToolbar(); parent::display ( 'edit' ); } /** * Effettua l'output view del file in attachment al browser * * @access public * @param string $contents * @param int $size * @param array& $fieldsFunctionTransformation * @return void */ public function sendCSVMessages($data, &$fieldsFunctionTransformation) { $delimiter = ';'; $enclosure = '"'; // Clean dirty buffer ob_end_clean(); // Open buffer ob_start(); // Open out stream $outstream = fopen("php://output", "w"); // Funzione di scrittura nell'output stream function __outputCSV(&$vals, $key, $userData) { // Fields value transformations if(isset($vals[INDEX_WORKED])) { $vals[INDEX_WORKED] = $vals[INDEX_WORKED] == 1 ? Text::_('COM_JCHAT_YESWORKED') : Text::_('COM_JCHAT_NOWORKED'); } if(isset($vals[INDEX_CLOSED])) { $vals[INDEX_CLOSED] = $vals[INDEX_CLOSED] == 1 ? Text::_('JYES') : Text::_('JNO'); } if(isset($vals[INDEX_RESPONSES])) { $formattedData = null; $unserializedData = unserialize($vals[INDEX_RESPONSES]); if(!empty($unserializedData)) { foreach ($unserializedData as $responseData) { $formattedData .= ' (' . preg_replace("/[\n\r]/", " ", strip_tags($responseData[1])) . ' - ' . $responseData[2] . ' - ' . $responseData[0] . ') '; } } $vals[INDEX_RESPONSES] = $formattedData; } fputcsv($userData[0], $vals, $userData[1], $userData[2]); // add parameters if you want } // Echo delle intestazioni __outputCSV($fieldsFunctionTransformation, null, array($outstream, $delimiter, $enclosure)); // Output di tutti i records array_walk($data, "\JExtstore\Component\JChat\Administrator\View\Lamessages\__outputCSV", array($outstream, $delimiter, $enclosure)); fclose($outstream); // Recupero output buffer content $contents = ob_get_clean(); $size = strlen($contents); header ( 'Pragma: public' ); header ( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); header ( 'Expires: ' . gmdate ( 'D, d M Y H:i:s' ) . ' GMT' ); header ( 'Content-Disposition: attachment; filename="tickets.csv"' ); header ( 'Content-Type: text/plain' ); header ( "Content-Length: " . $size ); echo $contents; exit (); } /** * Class constructor * * @param array $config */ public function __construct($config = array()) { // Parent view object parent::__construct ( $config ); $joomlaConfig = $this->app->getConfig (); $this->joomlaConfig = $this->user->getParam ( 'timezone', $joomlaConfig->get ( 'offset' ) ); } }
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка