HEX
Server: Apache
System: Linux webm010.cluster103.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: iestorre (46869)
PHP: 8.0.30
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/iestorre/www/modules/mod_smartcountdown/fields/sessiondeadline.php
<?php
/**
 * @package Module Smart Countdown for Joomla! 2.5 -3.0
 * @version 2.2.9: sessiondeadline.php
 * @author Alex Polonski
 * @copyright (C) 2012 - Alex Polonski
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('JPATH_BASE') or die;

JFormHelper::loadFieldClass('groupedlist');

/*
 * Only show a limited set of options if companion plugin is not installed or enabled
 */
class JFormFieldSessionDeadline extends JFormFieldGroupedList
{
	public $type = 'sessiondeadline';
	
	protected function getGroups()
	{
		$groups = parent::getGroups();
		if(!self::isPluginEnabled())
		{
			// this groupedlist is defined in config XML as two top-level
			// options ("no" and "count up from session start") and
			// a group with several countdown mode options. We have to
			// remove all options in this group if comanion plugin is
			// not enabled
			foreach($groups as $label => $group)
			{
				if(!is_integer($label))
				{
					// non-integer label means a group title, so this is the
					// group to remove. All options are elements of the group
					// array, so unsetting the group will delete the options
					unset($groups[$label]);
				}
			}
		}
		return $groups;
	}
	
	private static function isPluginEnabled()
	{
		$scsession_plugin = JPluginHelper::getPlugin('system', 'scsession');
		return !empty($scsession_plugin) ? true : false;
	}
}