/** * pubstates. * * @param string $selected The key that is selected * @param string $name The name for the field * @param array $attribs Additional HTML attributes for the <select> tag* * @param string $idTag Param * @param bool $isFilter Param * * @return string HTML */ public static function pubstates($selected = null, $name = 'type', $attribs = array(), $idTag = null, $isFilter = false) { $platform = F0FPlatform::getInstance(); $input = new F0FInput(); $editstate = $platform->authorise('core.edit.state', $input->getCmd('option', 'com_foobar')); if ($editstate || $isFilter) { if (!$isFilter && $selected === null) { $selected = 'approve'; } $options = array(); $options[] = JHTML::_('select.option', null, '-' . JText::_('JSELECT') . '-'); // Get media modes $modes = self::getPubstateEnum(); // Generate html foreach ($modes as $mode) { $options[] = JHtml::_('select.option', $mode, JText::_(self::getTextForEnum($mode)), 'value', 'text'); } return EHtmlSelect::customGenericList($options, $name, $attribs, $selected, $name); } else { if (!$selected) { $selected = 'approve'; } $tag = JText::_(self::getTextForEnum($selected)); $control = EHtml::readonlyText($tag, $name . '-readonly'); $control .= '<input type="hidden" value="' . $selected . '" name="' . $name . '" id="' . $idTag . '">'; return $control; } }
/** * userSelect * * @param string $selected Value * @param string $name The name for the field * @param array $idTag Additional HTML attributes for the <select> tag * * @return string HTML */ public static function userSelect($selected, $name, $idTag = null) { if (!$idTag) { $idTag = EHtml::generateIdTag(); } $username = ''; $userid = null; $user = F0FPlatform::getInstance()->getUser($selected); if ($user) { $username = $user->name; $userid = $user->id; } $bogusNameTag = EHtml::generateIdTag(); $control = '<input type="hidden" name="' . $name . '" id="' . $idTag . '" value="' . $userid . '" />'; $control .= EHtml::readonlyText($username, $bogusNameTag, $idTag . '_username'); $isAdmin = JFactory::getApplication()->isAdmin(); if ($isAdmin) { $control .= ' <a class="btn modal" id="' . $idTag . '_userselect" href="index.php?option=com_users&view=users&layout=modal&tmpl=component&field=' . $idTag . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><i class="xticon xticon-search"></i></a>'; } return $control; }