function _displayDefault($tpl) { $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->getCmd('option'); $db = JFactory::getDbo(); $uri = JFactory::getURI(); $node = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); $model = $this->getModel(); $projectws = $this->get('Data', 'project'); $treetows = $this->get('Data', 'treeto'); //build the html options for teams $team_id[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_TEAM')); if ($projectteams = $model->getProjectTeamsOptions()) { $team_id = array_merge($team_id, $projectteams); } $lists['team'] = $team_id; unset($team_id); $style = 'style="background-color: #dddddd; '; $style .= 'border: 0px solid white;'; $style .= 'font-weight: normal; '; $style .= 'font-size: 8pt; '; $style .= 'width: 150px; '; $style .= 'font-family: verdana; '; $style .= 'text-align: center;"'; $path = 'media/com_joomleague/treebracket/onwhite/'; // build the html radio for adding into new round / exist round $createYesNo = array(0 => JText::_('COM_JOOMLEAGUE_GLOBAL_NO'), 1 => JText::_('COM_JOOMLEAGUE_GLOBAL_YES')); $createLeftRight = array(0 => JText::_('L'), 1 => JText::_('R')); $ynOptions = array(); $lrOptions = array(); foreach ($createYesNo as $key => $value) { $ynOptions[] = JHtmlSelect::option($key, $value); } foreach ($createLeftRight as $key => $value) { $lrOptions[] = JHtmlSelect::option($key, $value); } $lists['addToRound'] = JHtmlSelect::radiolist($ynOptions, 'addToRound', 'class="inputbox"', 'value', 'text', 1); // build the html radio for auto publish new matches $lists['autoPublish'] = JHtmlSelect::radiolist($ynOptions, 'autoPublish', 'class="inputbox"', 'value', 'text', 0); // build the html radio for Left or Right redepth $lists['LRreDepth'] = JHtmlSelect::radiolist($lrOptions, 'LRreDepth', 'class="inputbox"', 'value', 'text', 0); // build the html radio for create new treeto $lists['createNewTreeto'] = JHtmlSelect::radiolist($ynOptions, 'createNewTreeto', 'class="inputbox"', 'value', 'text', 1); $this->lists = $lists; $this->node = $node; // @todo fix! // $this->roundcode',$roundcode); $this->style = $style; $this->path = $path; $this->projectws = $projectws; $this->treetows = $treetows; $this->total = $total; $this->pagination = $pagination; $this->request_url = $uri->toString(); parent::display($tpl); }
function display($tpl = null) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $params = JComponentHelper::getParams($option); $filter_state = $mainframe->getUserStateFromRequest($option . 'mc_filter_state', 'filter_state', '', 'word'); $filter_order = $mainframe->getUserStateFromRequest($option . 'mc_filter_order', 'filter_order', 'mc.match_number', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'mc_filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . 'mc_search', 'search', '', 'string'); $search_mode = $mainframe->getUserStateFromRequest($option . 'mc_search_mode', 'search_mode', '', 'string'); $division = $mainframe->getUserStateFromRequest($option . 'mc_division', 'division', '', 'string'); $project_id = $mainframe->getUserState($option . 'project'); $search = JString::strtolower($search); $matches = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); $model = $this->getModel(); $projectteams = $model->getProjectTeams(); // state filter $lists['state'] = JHtml::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $lists['search_mode'] = $search_mode; $projectws = $this->get('Data', 'project'); $roundws = $this->get('Data', 'round'); //build the html options for teams foreach ($matches as $row) { $teams[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_TEAM')); $divhomeid = 0; //apply the filter only if both teams are from the same division //teams are not from the same division in tournament mode with divisions if ($row->divhomeid == $row->divawayid) { $divhomeid = $row->divhomeid; } else { $row->divhomeid = 0; $row->divawayid = 0; } if ($projectteams = $model->getProjectTeamsOptions($divhomeid)) { $teams = array_merge($teams, $projectteams); } $lists['teams_' + $divhomeid] = $teams; unset($teams); } //build the html selectlist for rounds $model = $this->getModel('project'); $ress = JoomleagueHelper::getRoundsOptions($model->_id, 'ASC', true); $project_roundslist = array(); foreach ($ress as $res) { $project_roundslist[] = JHtml::_('select.option', $res->id, $this->getRoundDescription($res)); } $lists['project_rounds'] = JHtml::_('select.genericList', $project_roundslist, 'rid[]', 'class="inputbox" ' . 'onChange="document.getElementById(\'short_act\').value=\'rounds\';' . 'document.roundForm.submit();" ', 'value', 'text', $roundws->id); $lists['project_rounds2'] = JHtml::_('select.genericList', $project_roundslist, 'rid', 'class="inputbox" ', 'value', 'text', $roundws->id); //build the html selectlist for matches $overall_config = $model->getTemplateConfig('overall'); if (isset($overall_config['use_jl_substitution']) && $overall_config['use_jl_substitution'] || isset($overall_config['use_jl_events']) && $overall_config['use_jl_events']) { $match_list = array(); $mdd[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_MATCH')); foreach ($matches as $row) { $mdd[] = JHtml::_('select.option', 'index3.php?option=com_joomleague&task=match.editEvents&cid[0]=' . $row->id, $row->team1 . '-' . $row->team2); } $RosterEventMessage = isset($overall_config['use_jl_substitution']) && $overall_config['use_jl_substitution'] ? JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_LINEUP') : ''; if (isset($overall_config['use_jl_events']) && $overall_config['use_jl_events']) { if (isset($overall_config['use_jl_events']) && $overall_config['use_jl_substitution']) { $RosterEventMessage .= ' / '; } $RosterEventMessage .= JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_EVENTS'); } $RosterEventMessage .= $RosterEventMessage != '' ? ':' : ''; $lists['RosterEventMessage'] = $RosterEventMessage; $lists['round_matches'] = JHtml::_('select.genericList', $mdd, 'mdd', 'id="mdd" class="inputbox" onchange="jl_load_new_match_events(this,\'eventscontainer\')"', 'value', 'text', '0'); } //build the html options for extratime $match_result_type[] = JHtmlSelect::option('0', JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_RT')); $match_result_type[] = JHtmlSelect::option('1', JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_OT')); $match_result_type[] = JHtmlSelect::option('2', JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_SO')); $lists['match_result_type'] = $match_result_type; unset($match_result_type); //build the html options for massadd create type $createTypes = array(0 => JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_MASSADD'), 1 => JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_MASSADD_1'), 2 => JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_MASSADD_2')); $ctOptions = array(); foreach ($createTypes as $key => $value) { $ctOptions[] = JHtmlSelect::option($key, $value); } $lists['createTypes'] = JHtmlSelect::genericlist($ctOptions, 'ct[]', 'class="inputbox" onchange="javascript:displayTypeView();"', 'value', 'text', 1, 'ct'); unset($createTypes); // build the html radio for adding into one round / all rounds $createYesNo = array(0 => JText::_('COM_JOOMLEAGUE_GLOBAL_NO'), 1 => JText::_('COM_JOOMLEAGUE_GLOBAL_YES')); $ynOptions = array(); foreach ($createYesNo as $key => $value) { $ynOptions[] = JHtmlSelect::option($key, $value); } $lists['addToRound'] = JHtmlSelect::radiolist($ynOptions, 'addToRound', 'class="inputbox"', 'value', 'text', 0); // build the html radio for auto publish new matches $lists['autoPublish'] = JHtmlSelect::radiolist($ynOptions, 'autoPublish', 'class="inputbox"', 'value', 'text', 0); //build the html options for divisions $divisions[] = JHtmlSelect::option('0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_DIVISION')); $mdlDivisions = JModelLegacy::getInstance("divisions", "JoomLeagueModel"); if ($res = $mdlDivisions->getDivisions($project_id)) { $divisions = array_merge($divisions, $res); } $lists['divisions'] = $divisions; unset($divisions); $this->division = $division; $this->user = JFactory::getUser(); $this->lists = $lists; $this->matches = $matches; $this->ress = $ress; $this->projectws = $projectws; $this->roundws = $roundws; $this->pagination = $pagination; $this->teams = $projectteams; $this->request_url = $uri->toString(); $this->prefill = $params->get('use_prefilled_match_roster', 0); $this->addToolbar(); parent::display($tpl); }
/** * Test the radiolist method. * * @param string $expected Expected generated HTML of radio list. * @param array $data An array of objects * @param string $name The value of the HTML name attribute * @param string $attribs Additional HTML attributes for the <select> tag * @param mixed $optKey The key that is selected * @param string $optText The name of the object variable for the option value * @param string $selected The name of the object variable for the option text * @param boolean $idtag Value of the field id or null by default * @param boolean $translate True if options will be translated * * @return void * * @dataProvider getRadiolistData * @since 3.2 */ public function testRadiolist($expected, $data, $name, $attribs = null, $optKey = 'value', $optText = 'text', $selected = null, $idtag = false, $translate = false) { foreach ($data as $arr) { $dataObject[] = (object) $arr; } $data = $dataObject; if (func_num_args() == 4) { $this->assertEquals($expected, JHtmlSelect::radiolist((object) $data, $name, $attribs)); } else { $this->assertEquals($expected, JHtmlSelect::radiolist((object) $data, $name, $attribs, $optKey, $optText, $selected, $idtag, $translate)); } }