HEX
Server: LiteSpeed
System: Linux lp015.web24.net.au 2.6.32-954.3.5.lve1.4.93.el6.x86_64 #1 SMP Wed Oct 4 17:04:29 UTC 2023 x86_64
User: pgkdistr (10190)
PHP: 8.1.32
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/pgkdistribution.com.au/citisolar.com.au/tmp/admin/views/test/view.html.php
<?php
/**
* @Copyright Freestyle Joomla (C) 2010
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
*     
* This file is part of Freestyle Testimonials
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
**/
?>
<?php

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view' );
require_once( JPATH_SITE.DS.'components'.DS.'com_fst'.DS.'helper'.DS.'comments.php' );



class FstsViewTest extends JView
{

	function display($tpl = null)
	{
		$test		=& $this->get('Data');
		$isNew		= ($test->id < 1);
		
		$this->ident_to_name = array();
		
//
		$this->ident_to_name[5] = "test";
		
		$task = JRequest::getVar('task');
		if ($task == "ident")
			return $this->ShowItemList();

		$text = $isNew ? JText::_("NEW") : JText::_("EDIT");
		JToolBarHelper::title(   JText::_("MODERATION").': <small><small>[ ' . $text.' ]</small></small>' );
		JToolBarHelper::save();
		if ($isNew)  {
			JToolBarHelper::cancel();
		} else {
			// for existing items the button is renamed `close`
			JToolBarHelper::cancel( 'cancel', 'Close' );
		}
		JToolBarHelper::divider();
		JToolBarHelper::help("",false,"http://www.freestyle-joomla.com/comhelp/fst/" . JRequest::getVar('view'));

		$this->assignRef('test',		$test);

		$this->comment_objs = array();
		$comment_itemids = array();
	
		$sections = array();
//
		foreach($this->ident_to_name as $ident => $name)
		{
			$this->comment_objs[$ident] = new FST_Comments($name);		
			$sections[] = JHTML::_('select.option', $ident, $this->comment_objs[$ident]->handler->descriptions, 'id', 'title');
			
			if ($ident == $test->ident)
				$this->lists['comments'] = $this->comment_objs[$ident];
		}
		$this->lists['sections'] = JHTML::_('select.genericlist',  $sections, 'ident', 'class="inputbox" size="1" onchange="change_section();"', 'id', 'title', $test->ident);

		if ($test->ident)
		{
			$this->lists['itemid'] = $this->GetSelect($this->lists['comments']->handler, $test->ident, $test->itemid);
		} else {
			$this->lists['itemid'] = JText::_("PLEASE_SELECT_A_SECTION_FIRST");	
		}
		
		$pulished = array();
		$pulished[] = JHTML::_('select.option', '-1', "-- ".JText::_("MOD_STATUS") . " --", 'id', 'title');
		$pulished[] = JHTML::_('select.option', '0', JText::_("AWAITING_MODERATION"), 'id', 'title');
		$pulished[] = JHTML::_('select.option', '1', JText::_("ACCEPTED"), 'id', 'title');
		$pulished[] = JHTML::_('select.option', '2', JText::_("DECLINED"), 'id', 'title');
		$this->lists['published'] = JHTML::_('select.genericlist',  $pulished, 'published', 'class="inputbox" size="1"', 'id', 'title', $test->published);

		
		parent::display($tpl);
	}
	
	function ShowItemList()
	{
		$ident = JRequest::getVar('ident','');
		$name = $this->ident_to_name[$ident];
		$comments = new FST_Comments($name);
		
		$handler =& $comments->handler;
		
		$output['select'] = $this->GetSelect($handler, $ident, 0);
		$output['title'] = $handler->email_article_type;
		ob_clean();
		
		echo json_encode($output);
		
		exit;
	}
	
	function GetSelect(&$handler, $ident, $itemid)
	{
				
		$qry = "SELECT {$handler->field_title}, {$handler->field_id} FROM {$handler->table} ORDER BY {$handler->field_title}";
		$db = & JFactory::getDBO();
		$db->setQuery($qry);
		$items = $db->loadObjectList();
		if ($ident == 5)
		{
			$newitems[] = 	JHTML::_('select.option', '0', JText::_("GENERAL_TESTIMONIALS"), $handler->field_id, $handler->field_title);
			$items = array_merge($newitems, $items);
		}		
		return JHTML::_('select.genericlist',  $items, 'itemid', 'class="inputbox" size="1"', $handler->field_id, $handler->field_title, $itemid);
	}
}