/** * Method to create a select list of possible Open Graph object types * * @access public * @param int ID of current item * @param string name of select list * @param boolean if true, changing selected item will submit the form (assume is an "adminForm") * @param boolean, if true, a line 'Select all' is inserted at the start of the list * @param string the "Select all" to be displayed, if $addSelectAll is true * @return string HTML output */ public static function buildOpenGraphTypesList($current, $name, $autoSubmit = false, $addSelectDefault = false, $selectDefaultTitle = '', $customSubmit = '') { // build html options $data = array(); foreach (self::getDefinitions() as $typeDef) { $data[] = array('id' => $typeDef['name'], 'title' => JText::_($typeDef['title'])); } // add select all option if ($addSelectDefault) { $selectDefault = array('id' => SH404SEF_OPTION_VALUE_USE_DEFAULT, 'title' => $selectDefaultTitle); array_unshift($data, $selectDefault); } // use helper to build html $list = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit, $addSelectAll = false, $selectAllTitle = '', $customSubmit); // return list return $list; }
private function _makeOptionsSelect($options) { $selects = new StdClass(); // component list $current = $options->filter_component; $name = 'filter_component'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_COMPONENTS'); $selects->components = Sh404sefHelperHtml::buildComponentsSelectList($current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // language list $current = $options->filter_language; $name = 'filter_language'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_LANGUAGES'); $selects->languages = Sh404sefHelperHtml::buildLanguagesSelectList($current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select custom $current = $options->filter_url_type; $name = 'filter_url_type'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_URL_TYPES'); $data = array(array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_CUSTOM, 'title' => JText::_('COM_SH404SEF_ONLY_CUSTOM')), array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_AUTO, 'title' => JText::_('COM_SH404SEF_ONLY_AUTO'))); $selects->filter_url_type = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); return $selects; }
/** * prepare html filters to allow user to select the way she likes * to view reports */ protected function _prepareFilters() { // array to hold various filters $filters = array(); // find if we must display all filters. On dashboard, only a reduced set $allFilters = $this->_options['showFilters'] == 'yes'; // select account to retrieve data for (or rather, profile $customSubmit = ' onchange="shSetupAnalytics({' . ($allFilters ? '' : 'showFilters:\'no\'') . '});"'; $select = Sh404sefHelperHtml::buildSelectList($this->_accounts, $this->_options['accountId'], 'accountId', $autoSubmit = false, $addSelectAll = false, $selectAllTitle = '', $customSubmit); $filters[] = JText::_('COM_SH404SEF_ANALYTICS_ACCOUNT') . ': ' . $select; // dashboard only has account selection, no room for anything else // only shows main selection drop downs on analytics view if ($allFilters) { // select start date $select = JHTML::_('calendar', $this->_options['startDate'], 'startDate', 'startDate', '%Y-%m-%d', 'class="textinput"'); $filters[] = ' ' . JText::_('COM_SH404SEF_ANALYTICS_START_DATE') . ': ' . $select; // select end date $select = JHTML::_('calendar', $this->_options['endDate'], 'endDate', 'endDate', '%Y-%m-%d', 'class="textinput"'); $filters[] = ' ' . JText::_('COM_SH404SEF_ANALYTICS_END_DATE') . ': ' . $select; // select groupBy (day, week, month) $select = Sh404sefHelperAnalytics::buildAnalyticsGroupBySelectList($this->_options['groupBy'], 'groupBy', $autoSubmit = false, $addSelectAll = false, $selectAllTitle = '', $customSubmit); $filters[] = ' ' . JText::_('COM_SH404SEF_ANALYTICS_GROUP_BY') . ': ' . $select; // add a click to update link $filters[] = ' <a href="javascript: void(0);" onclick="javascript: shSetupAnalytics({forced:1' . ($allFilters ? '' : ',showFilters:\'no\'') . '});" > [' . JText::_('COM_SH404SEF_CHECK_ANALYTICS') . ']</a>'; } else { // on dashboard, there is no date select, so we must display the date range $filters[] = ' ' . JText::_('COM_SH404SEF_ANALYTICS_DATE_RANGE') . ' <div class="largertext">' . $this->_options['startDate'] . ' >> ' . $this->_options['endDate'] . '</div>'; } return $filters; }
/** * Method to create a select list of possible ways to group data on analytics reports * * @access public * @param int ID of current item * @param string name of select list * @param boolean if true, changing selected item will submit the form (assume is an "adminForm") * @param boolean, if true, a line 'Select all' is inserted at the start of the list * @param string the "Select all" to be displayed, if $addSelectAll is true * @return string HTML output */ public static function buildAnalyticsGroupBySelectList($current, $name, $autoSubmit = false, $addSelectAll = false, $selectAllTitle = '', $customSubmit = '') { // available reports, should not be hardcoded though ! $data = array(array('id' => 'ga:year,ga:month,ga:week,ga:day', 'title' => JText::_('Day')), array('id' => 'ga:year,ga:month,ga:week', 'title' => JText::_('Week')), array('id' => 'ga:year,ga:month', 'title' => JText::_('Month'))); // use helper to build html $list = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit, $addSelectAll, $selectAllTitle, $customSubmit); // return list return $list; }
private function _makeOptionsSelect($options) { $selects = new StdClass(); // component list $current = $options->filter_component; $name = 'filter_component'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_COMPONENTS'); $selects->components = Sh404sefHelperHtml::buildComponentsSelectList($current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // language list $current = $options->filter_language; $name = 'filter_language'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_LANGUAGES'); $selects->languages = Sh404sefHelperHtml::buildLanguagesSelectList($current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select aliases $current = $options->filter_alias; $name = 'filter_alias'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_ALIASES'); $data = array(array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_ALIASES, 'title' => JText::_('COM_SH404SEF_ONLY_ALIASES')), array('id' => Sh404sefHelperGeneral::COM_SH404SEF_NO_ALIASES, 'title' => JText::_('COM_SH404SEF_ONLY_NO_ALIASES'))); $selects->filter_alias = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select custom $current = $options->filter_url_type; $name = 'filter_url_type'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_URL_TYPES'); $data = array(array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_CUSTOM, 'title' => JText::_('COM_SH404SEF_ONLY_CUSTOM')), array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_AUTO, 'title' => JText::_('COM_SH404SEF_ONLY_AUTO'))); $selects->filter_url_type = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select similar urls or all $current = $options->filter_similar_urls; $name = 'filter_similar_urls'; $data = array(array('id' => 1, 'title' => JText::_('COM_SH404SEF_NOT_FOUND_SHOW_SIMILAR_URLS')), array('id' => 0, 'title' => JText::_('COM_SH404SEF_NOT_FOUND_SHOW_ALL_URLS'))); $selects->filter_similar_urls = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = false); // return set of select lists return $selects; }
private function _makeOptionsSelect($options) { $selects = new StdClass(); // component list $current = $options->filter_component; $name = 'filter_component'; $selectAllTitle = JText16::_('COM_SH404SEF_ALL_COMPONENTS'); $selects->components = Sh404sefHelperHtml::buildComponentsSelectList($current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // language list $current = $options->filter_language; $name = 'filter_language'; $selectAllTitle = JText16::_('COM_SH404SEF_ALL_LANGUAGES'); $selects->languages = Sh404sefHelperHtml::buildLanguagesSelectList($current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select aliases $current = $options->filter_alias; $name = 'filter_alias'; $selectAllTitle = JText16::_('COM_SH404SEF_ALL_ALIASES'); $data = array(array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_ALIASES, 'title' => JText16::_('COM_SH404SEF_ONLY_ALIASES')), array('id' => Sh404sefHelperGeneral::COM_SH404SEF_NO_ALIASES, 'title' => JText16::_('COM_SH404SEF_ONLY_NO_ALIASES'))); $selects->filter_alias = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select custom $current = $options->filter_url_type; $name = 'filter_url_type'; $selectAllTitle = JText16::_('COM_SH404SEF_ALL_URL_TYPES'); $data = array(array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_CUSTOM, 'title' => JText16::_('COM_SH404SEF_ONLY_CUSTOM')), array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_AUTO, 'title' => JText16::_('COM_SH404SEF_ONLY_AUTO'))); $selects->filter_url_type = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select similar urls or all $current = $options->filter_similar_urls; $name = 'filter_similar_urls'; $data = array(array('id' => 1, 'title' => JText16::_('COM_SH404SEF_NOT_FOUND_SHOW_SIMILAR_URLS')), array('id' => 0, 'title' => JText16::_('COM_SH404SEF_NOT_FOUND_SHOW_ALL_URLS'))); $selects->filter_similar_urls = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = false); // if similar urls, disable other selectors if ($current == 1) { $selects->components = str_replace('<select name="filter_component"', '<select disabled="disabled" name="filter_component"', $selects->components); $selects->languages = str_replace('<select name="filter_language"', '<select disabled="disabled" name="filter_language"', $selects->languages); $selects->filter_alias = str_replace('<select name="filter_alias"', '<select disabled="disabled" name="filter_alias"', $selects->filter_alias); $selects->filter_url_type = str_replace('<select name="filter_url_type"', '<select disabled="disabled" name="filter_url_type"', $selects->filter_url_type); $this->assign('disable_search_all', 'disabled="disabled"'); } else { $this->assign('disable_search_all', ''); } // return set of select lists return $selects; }