Файловый менеджер - Редактировать - /var/www/html/administrator/components/com_community/views/moods/view.html.php
Ðазад
<?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <webmaster@ijoomla.com> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView; use Joomla\CMS\Table\Table; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Uri\Uri; use Joomla\CMS\Version; // Disallow direct access to this file defined('_JEXEC') or die('Restricted access'); jimport( 'joomla.application.component.view' ); /** * Configuration view for JomSocial */ class CommunityViewMoods extends HtmlView { public function display( $tpl = null ) { if( $this->getLayout() == 'edit' ) { $this->_displayEditLayout( $tpl ); return; } // Set the titlebar text ToolbarHelper::title( Text::_('COM_COMMUNITY_CONFIGURATION_MOODS'), 'moods'); // Add the necessary buttons ToolBarHelper::addNew( 'newMood' , Text::_('COM_COMMUNITY_MOODS_NEW_MOOD') ); ToolBarHelper::deleteList( Text::_('COM_COMMUNITY_MOODS_DELETION_WARNING') , 'deleteMood' , Text::_('COM_COMMUNITY_DELETE') ); ToolBarHelper::divider(); ToolBarHelper::publishList( 'publish' , Text::_('COM_COMMUNITY_PUBLISH') ); ToolBarHelper::unpublishList( 'unpublish' , Text::_('COM_COMMUNITY_UNPUBLISH') ); // Get Moods by type (preset & custom) $moodsTable = Table::getInstance( 'Moods' , 'CommunityTable' ); $this->set('moods', $this->prepare($moodsTable->getMoods())); $mainframe = Factory::getApplication(); $filter_order = $mainframe->getUserStateFromRequest( "com_community.moods.filter_order", 'filter_order', 'a.title', 'cmd' ); $filter_order_Dir = $mainframe->getUserStateFromRequest( "com_community.moods.filter_order_Dir", 'filter_order_Dir', '', 'word' ); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $this->set('lists', $lists); parent::display( $tpl ); } public function _displayEditLayout( $tpl ) { // Load frontend language file. $lang = Factory::getLanguage(); $lang->load( 'com_community' , JPATH_ROOT ); $jinput = Factory::getApplication()->input; // Add the necessary buttons ToolBarHelper::back(Text::_('COM_COMMUNITY_BACK') , 'index.php?option=com_community&view=moods'); ToolBarHelper::divider(); ToolBarHelper::apply(); ToolBarHelper::save(); $mood = Table::getInstance( 'Moods' , 'CommunityTable' ); $mood->load( $jinput->getInt( 'moodid') ); // Set the titlebar text ToolBarHelper::title( Text::_('COM_COMMUNITY_MOODS_ADD'), 'moods'); if($mood->id) { ToolBarHelper::title( Text::_('COM_COMMUNITY_MOODS_EDIT'), 'moods'); $mood->image = $this->getImage($mood); } $post = $jinput->post->getArray(); $mood->bind( $post ); $this->set( 'mood' , $mood); parent::display( $tpl ); } public function getImage($mood) { if($mood->custom) { $filename = "mood_".$mood->id.".".$mood->image; if(file_exists(COMMUNITY_PATH_ASSETS.$filename)) { return Uri::root().str_replace(JPATH_ROOT,'',COMMUNITY_PATH_ASSETS).$filename; } } return null; } /** * Method to get the publish status HTML * * @param object Field object * @param string Type of the field * @param string The ajax task that it should call * @return string HTML source **/ public function getPublish( &$row , $type , $ajaxTask ) { $version = new Version(); $currentV = $version->getHelpVersion(); $class = 'jgrid'; $alt = $row->$type ? Text::_('COM_COMMUNITY_PUBLISHED') : Text::_('COM_COMMUNITY_UNPUBLISH'); $state = $row->$type == 1 ? 'publish' : 'unpublish'; $span = '<span class="state '.$state.'"><span class="text">'.$alt.'</span></span></a>'; if($currentV >= '0.30') { $class = $row->$type == 1 ? 'jgrid': ''; $span = '<i class="icon-'.$state.'""></i>'; } $href = '<a class="'.$class.'" href="javascript:void(0);" onclick="azcommunity.togglePublish(\'' . $ajaxTask . '\',\'' . $row->id . '\',\'' . $type . '\');">'; $href .= $span; return $href; } /** * Loop through mood array and apply translations and image URLs to titles and descriptions * * @param $moods * @return mixed */ private function prepare($moods) { // @todo maybe the model should handle the translations? $lang = Factory::getLanguage(); $lang->load( 'com_community' , JPATH_ROOT ); foreach($moods as $id=>$mood){ if(!$mood->custom) { $moods[$id]->title = Text::_('COM_COMMUNITY_MOOD_SHORT_'.$mood->title); } else { $moods[$id]->title = Text::_($mood->title); $moods[$id]->image = $this->getImage($mood); } $moods[$id]->description = Text::_($mood->description); } return $moods; } }
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка