Your IP : 216.73.216.224


Current Path : /var/www/html/administrator/components/com_community/views/themegeneral/
Upload File :
Current File : /var/www/html/administrator/components/com_community/views/themegeneral/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\Language\Text;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Toolbar\ToolbarHelper;

// Disallow direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view' );

/**
 * Configuration view for JomSocial
 */
class CommunityViewThemegeneral extends HtmlView
{
    public function display( $tpl = null )
    {
        // Set the titlebar text
        ToolbarHelper::title( Text::_('COM_COMMUNITY_CONFIGURATION_THEME_GENERAL'), 'general');
        ToolBarHelper::apply();
        ToolBarHelper::cancel();
        ToolBarHelper::custom('reset','undo-2','',Text::_('COM_COMMUNITY_THEME_GENERAL_RESET'),false);

        // Get Moods by type (preset & custom)
        $scssTable= Table::getInstance( 'Theme' , 'CommunityTable' );
        $this->set('scss', $scssTable->getByKey('scss'));
        $this->set('settings', $scssTable->getByKey('settings'));

        $defaults = array(
            'scss' => array(
                'scss-style'            => 'boxy',
                'scss-stream-position'  => 'right',
                'scss-button-style'     => 'flat',
                'scss-avatar-shape'     => 'circle',
                'scss-avatar-style'     => 'bordered',
                'scss-direction'        => 'ltr',
            ),
            'settings'=> array(
                'enable-frontpage-login'=> 1,
                'enable-frontpage-image'     => 1,
                'enable-frontpage-paragraph' => 1,
            ),
        );

        $this->set('defaults', $defaults);

        parent::display( $tpl );
    }

    /**
     * @param $key
     * @param $value
     * @param bool $scss
     *
     * @return void
     *
     * Renders a checkbox (radio) for given key and value
     * Prefill with value from $this->scss or $this->settings depending on scss flag
     */
    public function renderCheckbox($key, $value, $scss=true) {
        $checked = false;
        $isDefault = 'resetFalse';

        $setting = "settings";
        if($scss) $setting = "scss";

        if(isset($this->{$setting}['general'][$key]) && $this->{$setting}['general'][$key] == $value) $checked = true;
        if(!isset($this->{$setting}['general'][$key]) && $value===$this->defaults[$setting][$key]) $checked = true; // default values

        if($value===$this->defaults[$setting][$key]) $isDefault = 'resetTrue';
        ?>
        <div class="radio">
            <label>
                <input name="<?php echo ($scss) ? "scss" : "settings"   ;?>[<?php echo $key;?>]" id="<?php echo str_replace(' ', '-' , $key . $value);?>" value="<?php echo $value;?>" type="radio" class="ace <?php echo $isDefault;?>" <?php echo $checked ? "checked" : "";?>>
                <span class="lbl"> <?php
       echo isset($value) ? Text::_('COM_COMMUNITY_THEME_'.strtoupper($value)) : Text::_('COM_COMMUNITY_THEME_DEFAULT');
        ?></span>
            </label>
        </div>
    <?php
    }
}