function _createfilterHTML() { $params = JComponentHelper::getParams(JEV_COM_COMPONENT); $separator = $params->get("catseparator", "|"); $catidsIn = JRequest::getVar('catids', 'NONE'); $catidsIn = explode($separator, $catidsIn); JArrayHelper::toInteger($catidsIn); $filterList = array(); $filterList["title"] = JText::_("Select_Category"); //$filterList["html"] = JEventsHTML::buildCategorySelect( $filter_value, 'multiple="multiple" size="5" onchange="if ($(\'catidsfv\')) $(\'catidsfv\').value=this.value;submit(this.form)" ',$this->allAccessibleCategories,false,false,0,$this->filterType.'_fv' ); // Not auto submitting $content = '<script type="text/javascript">'; $content .= "function setmulticatfilter(){\n\t\t\t\tvar selects = \$('multicatfilter');\n\t\t\t\tvar catids = \$('multicatcatids');\n\t\t\t\tcatids.value = '';\n\t\t\t\t\$A(selects.options).each(function(opt) {\n\t\t\t\t\tif (opt.selected) {\n\t\t\t\t\t\tif (catids.value == ''){\n\t\t\t\t\t\t\tcatids.value = opt.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tcatids.value += '{$separator}'+opt.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}"; $content .= '</script>'; $filterList["html"] = JEventsHTML::buildCategorySelect($catidsIn, 'multiple="multiple" size="5" id="multicatfilter" onchange="setmulticatfilter()" ', $this->allAccessibleCategories, false, false, 0, $this->filterType . '_fv[]'); $filterList["html"] .= '<br/><input type="text" name="catids" id="multicatcatids" value="' . implode($separator, $catidsIn) . '" />'; $filterList["html"] .= $content; //$script = "function reset".$this->filterType."_fvs(){document.getElements('option',\$('".$this->filterType."_fv')).each(function(item){item.selected=(item.value==0)?true:false;})};\n"; //$script .= "try {JeventsFilters.filters.push({action:'reset".$this->filterType."_fvs()',id:'".$this->filterType."_fv',value:".$this->filterNullValue."});} catch (e) {}\n"; // try/catch incase this is called without a filter module! $script = "try {JeventsFilters.filters.push({id:'" . $this->filterType . "_fv',value:0});} catch (e) {}\n"; $document = JFactory::getDocument(); $document->addScriptDeclaration($script); return $filterList; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { if ($this->form->jevdata[$this->name]["repeatId"] == 0) { if (!isset($this->form->jevdata[$this->name]["excats"])) { $this->form->jevdata[$this->name]["excats"] = false; } $input = JEventsHTML::buildCategorySelect($this->value, 'id="catid" ', $this->form->jevdata[$this->name]["dataModel"]->accessibleCategoryList(), $this->form->jevdata[$this->name]["with_unpublished_cat"], true, 0, 'catid', JEV_COM_COMPONENT, $this->form->jevdata[$this->name]["excats"], "ordering", true); } else { $input = ""; } JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php"); JEVHelper::ConditionalFields($this->element, $this->form->getName()); return $input; }
/** * Creates javascript session memory reset action * */ function _createfilterHTML() { if (!$this->filterField) { return ""; } $filterList = array(); $filterList["title"] = JText::_("Select_Category"); $filterList["html"] = JEventsHTML::buildCategorySelect($this->filter_value, 'onchange="submit(this.form)" style="font-size:10px;"', $this->allAccessibleCategories, false, false, 0, $this->filterType . '_fv'); //$script = "function reset".$this->filterType."_fvs(){document.getElements('option',\$('".$this->filterType."_fv')).each(function(item){item.selected=(item.value==0)?true:false;})};\n"; //$script .= "try {JeventsFilters.filters.push({action:'reset".$this->filterType."_fvs()',id:'".$this->filterType."_fv',value:".$this->filterNullValue."});} catch (e) {}\n"; // try/catch incase this is called without a filter module! $script = "try {JeventsFilters.filters.push({id:'" . $this->filterType . "_fv',value:0});} catch (e) {}\n"; $document = JFactory::getDocument(); $document->addScriptDeclaration($script); return $filterList; }
/** * List Ical Events * */ function overview() { // get the view $this->view =& $this->getView("icalevent", "html"); $this->_checkValidCategories(); $showUnpublishedICS = true; $showUnpublishedCategories = true; $db =& JFactory::getDBO(); $icsFile = intval(JFactory::getApplication()->getUserStateFromRequest("icsFile", "icsFile", 0)); $catid = intval(JFactory::getApplication()->getUserStateFromRequest("catidIcalEvents", 'catid', 0)); $catidtop = $catid; $state = intval(JFactory::getApplication()->getUserStateFromRequest("stateIcalEvents", 'state', 0)); $limit = intval(JFactory::getApplication()->getUserStateFromRequest("viewlistlimit", 'limit', 10)); $limitstart = intval(JFactory::getApplication()->getUserStateFromRequest("view{" . JEV_COM_COMPONENT . "}limitstart", 'limitstart', 0)); $search = JFactory::getApplication()->getUserStateFromRequest("search{" . JEV_COM_COMPONENT . "}", 'search', ''); $search = $db->getEscaped(trim(strtolower($search))); $created_by = JFactory::getApplication()->getUserStateFromRequest("createdbyIcalEvents", 'created_by', 0); // Is this a large dataset ? $query = "SELECT count(rpt.rp_id) from #__jevents_repetition as rpt "; $db->setQuery($query); $totalrepeats = $db->loadResult(); $this->_largeDataSet = 0; $cfg =& JEVConfig::getInstance(); if ($totalrepeats > $cfg->get('largeDataSetLimit', 100000)) { $this->_largeDataSet = 1; } $cfg =& JEVConfig::getInstance(); $cfg->set('largeDataSet', $this->_largeDataSet); $where = array(); $join = array(); if ($search) { $where[] = "LOWER(detail.summary) LIKE '%{$search}%'"; } if (JVersion::isCompatible("1.6.0")) { $user =& JFactory::getUser(); $params =& JComponentHelper::getParams(JEV_COM_COMPONENT); $authorisedonly = $params->get("authorisedonly", 0); $cats = $user->getAuthorisedCategories('com_jevents', 'core.create'); if (isset($user->id) && !$user->authorise('core.create', 'com_jevents') && !$authorisedonly) { if ($cats > 0 && $catid < 1) { for ($i = 0; $i < count($cats); $i++) { $whereCats[$i] = "ev.catid='{$cats[$i]}'"; } $where[] = '(' . implode(" OR ", $whereCats) . ')'; } else { if ($cats > 0 && $catid > 0 && in_array($catid, $cats)) { $where[] = "ev.catid='{$catid}'"; } else { $where[] = "ev.catid=''"; } } } else { if ($catid > 0) { $where[] = "ev.catid='{$catid}'"; } } } else { if ($catid > 0) { $where[] = "ev.catid='{$catid}'"; } } if ($created_by === "") { $where[] = "ev.created_by=0"; } else { $created_by = intval($created_by); if ($created_by > 0) { $where[] = "ev.created_by=" . $db->Quote($created_by); } } if ($icsFile > 0) { $join[] = " #__jevents_icsfile as icsf ON icsf.ics_id = ev.icsid"; $where[] = "\n icsf.ics_id = {$icsFile}"; if (!$showUnpublishedICS) { $where[] = "\n icsf.state=1"; } } else { if (!$showUnpublishedICS) { $join[] = " #__jevents_icsfile as icsf ON icsf.ics_id = ev.icsid"; $where[] = "\n icsf.state=1"; } else { $icsFrom = ""; } } $hidepast = intval(JFactory::getApplication()->getUserStateFromRequest("hidepast", "hidepast", 1)); if ($hidepast) { $datenow =& JevDate::getDate("-1 day"); if (!$this->_largeDataSet) { $where[] = "\n rpt.endrepeat>'" . $datenow->toMysql() . "'"; } } if ($state == 1) { $where[] = "\n ev.state=1"; } else { if ($state == 2) { $where[] = "\n ev.state=0"; } } // keep this incase we use filters in category lists $where[] = "\n ev.catid IN(" . $this->queryModel->accessibleCategoryList() . ")"; // get the total number of records $query = "SELECT count(distinct rpt.eventid)" . "\n FROM #__jevents_vevent AS ev " . "\n LEFT JOIN #__jevents_vevdetail as detail ON ev.detail_id=detail.evdet_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . (count($join) ? "\n LEFT JOIN " . implode(' LEFT JOIN ', $join) : '') . (count($where) ? "\n WHERE " . implode(' AND ', $where) : ''); $db->setQuery($query); //echo $db->_sql; $total = $db->loadResult(); echo $db->getErrorMsg(); if ($limit > $total) { $limitstart = 0; } // if anon user plugin enabled then include this information $anonfields = ""; $anonjoin = ""; if (JPluginHelper::importPlugin("jevents", "jevanonuser")) { $anonfields = ", ac.name as anonname, ac.email as anonemail"; $anonjoin = "\n LEFT JOIN #__jev_anoncreator as ac on ac.ev_id = ev.ev_id"; } $orderdir = JRequest::getCmd("filter_order_Dir", 'asc'); $order = JRequest::getCmd("filter_order", 'start'); $dir = $orderdir == "asc" ? "asc" : "desc"; if ($order == 'start' || $order == 'starttime') { $order = $this->_largeDataSet ? "\n ORDER BY detail.dtstart {$dir}" : "\n GROUP BY ev.ev_id ORDER BY rpt.startrepeat {$dir}"; } else { if ($order == 'created') { $order = $this->_largeDataSet ? "\n ORDER BY ev.created {$dir}" : "\n GROUP BY ev.ev_id ORDER BY ev.created {$dir}"; } else { $order = $this->_largeDataSet ? "\n ORDER BY detail.summary {$dir}" : "\n GROUP BY ev.ev_id ORDER BY detail.summary {$dir}"; } } if (JVersion::isCompatible("1.6.0")) { $query = "SELECT ev.*, ev.state as evstate, detail.*, ev.created as created, a.title as _groupname " . $anonfields . "\n , rr.rr_id, rr.freq,rr.rinterval" . ($this->_largeDataSet ? "" : "\n ,MAX(rpt.endrepeat) as endrepeat ,MIN(rpt.startrepeat) as startrepeat" . "\n , YEAR(rpt.startrepeat) as yup, MONTH(rpt.startrepeat ) as mup, DAYOFMONTH(rpt.startrepeat ) as dup" . "\n , YEAR(rpt.endrepeat ) as ydn, MONTH(rpt.endrepeat ) as mdn, DAYOFMONTH(rpt.endrepeat ) as ddn" . "\n , HOUR(rpt.startrepeat) as hup, MINUTE(rpt.startrepeat ) as minup, SECOND(rpt.startrepeat ) as sup" . "\n , HOUR(rpt.endrepeat ) as hdn, MINUTE(rpt.endrepeat ) as mindn, SECOND(rpt.endrepeat ) as sdn") . "\n FROM #__jevents_vevent as ev " . ($this->_largeDataSet ? "" : "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id") . $anonjoin . "\n LEFT JOIN #__jevents_vevdetail as detail ON ev.detail_id=detail.evdet_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n LEFT JOIN #__viewlevels AS a ON a.id = ev.access" . (count($join) ? "\n LEFT JOIN " . implode(' LEFT JOIN ', $join) : '') . (count($where) ? "\n WHERE " . implode(' AND ', $where) : '') . $order; } else { $query = "SELECT ev.*, ev.state as evstate, detail.*, ev.created as created, g.name AS _groupname " . $anonfields . "\n , rr.rr_id, rr.freq,rr.rinterval" . ($this->_largeDataSet ? "" : "\n ,MAX(rpt.endrepeat) as endrepeat ,MIN(rpt.startrepeat) as startrepeat" . "\n , YEAR(rpt.startrepeat) as yup, MONTH(rpt.startrepeat ) as mup, DAYOFMONTH(rpt.startrepeat ) as dup" . "\n , YEAR(rpt.endrepeat ) as ydn, MONTH(rpt.endrepeat ) as mdn, DAYOFMONTH(rpt.endrepeat ) as ddn" . "\n , HOUR(rpt.startrepeat) as hup, MINUTE(rpt.startrepeat ) as minup, SECOND(rpt.startrepeat ) as sup" . "\n , HOUR(rpt.endrepeat ) as hdn, MINUTE(rpt.endrepeat ) as mindn, SECOND(rpt.endrepeat ) as sdn") . "\n FROM #__jevents_vevent as ev " . ($this->_largeDataSet ? "" : "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id") . $anonjoin . "\n LEFT JOIN #__jevents_vevdetail as detail ON ev.detail_id=detail.evdet_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n LEFT JOIN #__groups AS g ON g.id = ev.access" . (count($join) ? "\n LEFT JOIN " . implode(' LEFT JOIN ', $join) : '') . (count($where) ? "\n WHERE " . implode(' AND ', $where) : '') . $order; } if ($limit > 0) { $query .= "\n LIMIT {$limitstart}, {$limit}"; } $db->setQuery($query); //echo $db->explain(); $rows = $db->loadObjectList(); foreach ($rows as $key => $val) { // set state variable to the event value not the event detail value $rows[$key]->state = $rows[$key]->evstate; if (JVersion::isCompatible("1.6.0")) { $groupname = $rows[$key]->_groupname; $rows[$key] = new jIcalEventRepeat($rows[$key]); $rows[$key]->_groupname = $groupname; } else { $groupname = $rows[$key]->_groupname; $rows[$key] = new jIcalEventRepeat($rows[$key]); $rows[$key]->_groupname = $groupname; } } if ($this->_debug) { echo '[DEBUG]<br />'; echo 'query:'; echo '<pre>'; echo $query; echo '-----------<br />'; echo 'option "' . JEV_COM_COMPONENT . '"<br />'; echo '</pre>'; //die( 'userbreak - mic ' ); } if ($db->getErrorNum()) { echo $db->stderr(); return false; } // get list of categories $attribs = 'class="inputbox" size="1" onchange="document.adminForm.submit();"'; $clist = JEventsHTML::buildCategorySelect($catid, $attribs, null, $showUnpublishedCategories, false, $catidtop, "catid"); // get list of ics Files $icsfiles = array(); //$icsfiles[] = JHTML::_('select.option', '0', "Choose ICS FILE" ); $icsfiles[] = JHTML::_('select.option', '-1', JText::_('ALL_ICS_FILES')); $query = "SELECT ics.ics_id as value, ics.label as text FROM #__jevents_icsfile as ics "; if (!$showUnpublishedICS) { $query .= " WHERE ics.state=1"; } $query .= " ORDER BY ics.isdefault DESC, ics.label ASC"; $db->setQuery($query); $result = $db->loadObjectList(); $icsfiles = array_merge($icsfiles, $result); $icslist = JHTML::_('select.genericlist', $icsfiles, 'icsFile', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $icsFile); // get list of creators $sql = "SELECT distinct u.id, u.* FROM #__jevents_vevent as jev LEFT JOIN #__users as u on u.id=jev.created_by order by u.name "; $db =& JFactory::getDBO(); $db->setQuery($sql); $users = $db->loadObjectList(); $userOptions = array(); $userOptions[] = JHTML::_('select.option', 0, JText::_("JEV_EVENT_CREATOR")); foreach ($users as $user) { $userOptions[] = JHTML::_('select.option', $user->id, $user->name . " ({$user->username})"); } $userlist = JHTML::_('select.genericlist', $userOptions, 'created_by', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $created_by); $options[] = JHTML::_('select.option', '0', JText::_('JEV_NO')); $options[] = JHTML::_('select.option', '1', JText::_('JEV_YES')); $plist = JHTML::_('select.genericlist', $options, 'hidepast', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $hidepast); $options = array(); $options[] = JHTML::_('select.option', '0', JText::_('ALL_EVENTS')); $options[] = JHTML::_('select.option', '1', JText::_('PUBLISHED')); $options[] = JHTML::_('select.option', '2', JText::_('UNPUBLISHED')); $statelist = JHTML::_('select.genericlist', $options, 'state', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $state); $catData = JEV_CommonFunctions::getCategoryData(); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); // Set the layout $this->view->setLayout('overview'); $this->view->assign('rows', $rows); $this->view->assign('userlist', $userlist); $this->view->assign('clist', $clist); $this->view->assign('plist', $plist); $this->view->assign('statelist', $statelist); $this->view->assign('search', $search); $this->view->assign('icsList', $icslist); $this->view->assign('pageNav', $pageNav); $this->view->display(); }
/** * List Icals * */ function overview() { // get the view $this->view =& $this->getView("icals", "html"); $this->_checkValidCategories(); $option = JEV_COM_COMPONENT; $db =& JFactory::getDBO(); $catid = intval(JFactory::getApplication()->getUserStateFromRequest("catid{$option}", 'catid', 0)); $limit = intval(JFactory::getApplication()->getUserStateFromRequest("viewlistlimit", 'limit', 10)); $limitstart = intval(JFactory::getApplication()->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0)); $search = JFactory::getApplication()->getUserStateFromRequest("search{$option}", 'search', ''); $search = $db->getEscaped(trim(strtolower($search))); $where = array(); if ($search) { $where[] = "LOWER(icsf.label) LIKE '%{$search}%'"; } if ($catid > 0) { $where[] = "catid = {$catid}"; } // get the total number of records $query = "SELECT count(*)" . "\n FROM #__jevents_icsfile AS icsf" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : ''); $db->setQuery($query); $total = $db->loadResult(); echo $db->getErrorMsg(); if ($limitstart > $total) { $limitstart = 0; } if (JVersion::isCompatible("1.6.0")) { $query = "SELECT icsf.*, a.title as _groupname" . "\n FROM #__jevents_icsfile as icsf " . "\n LEFT JOIN #__viewlevels AS a ON a.id = icsf.access" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : ''); } else { $query = "SELECT icsf.*, g.name AS _groupname" . "\n FROM #__jevents_icsfile as icsf " . "\n LEFT JOIN #__groups AS g ON g.id = icsf.access" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : ''); } $query .= "\n ORDER BY icsf.isdefault DESC, icsf.label ASC"; if ($limit > 0) { $query .= "\n LIMIT {$limitstart}, {$limit}"; } $db->setQuery($query); $rows = $db->loadObjectList(); $catData = JEV_CommonFunctions::getCategoryData(); for ($s = 0; $s < count($rows); $s++) { $row =& $rows[$s]; if (array_key_exists($row->catid, $catData)) { $row->category = $catData[$row->catid]->name; } else { $row->category = "?"; } } if ($this->_debug) { echo '[DEBUG]<br />'; echo 'query:'; echo '<pre>'; echo $query; echo '-----------<br />'; echo 'option "' . $option . '"<br />'; echo '</pre>'; //die( 'userbreak - mic ' ); } if ($db->getErrorNum()) { echo $db->stderr(); return false; } // get list of categories $attribs = 'class="inputbox" size="1" onchange="document.adminForm.submit();"'; $clist = JEventsHTML::buildCategorySelect($catid, $attribs, null, true, false, 0, 'catid'); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); // Set the layout $this->view->setLayout('overview'); $this->view->assign('option', JEV_COM_COMPONENT); $this->view->assign('rows', $rows); $this->view->assign('clist', $clist); $this->view->assign('search', $search); $this->view->assign('pageNav', $pageNav); $this->view->display(); }
<td style="font-weight:bold"> <?php echo JText::_("JEV_CALENDAR_OWNER"); ?> </td> <td><?php echo $this->users; ?> </td> </tr> <tr> <td style="font-weight:bold" > <?php echo JText::_("Select_Default_Category"); ?> </td> <td><?php echo JEventsHTML::buildCategorySelect($catid, "", null, $this->with_unpublished_cat, true, 0, 'catid'); ?> </td> </tr> <tr> <td style="font-weight:bold"><?php echo JText::_('JEV_EVENT_ACCESSLEVEL'); ?> </td> <td><?php echo $glist; ?> </td> </tr> <?php if (!isset($this->editItem->ignoreembedcat) || $this->editItem->ignoreembedcat == 0) {
echo "<td>" . JText::_("JEV_LOCK_EVENT") . "</td>"; echo "<td colspan='3'><label>" . JText::_("JEV_YES") . "<input type=\"radio\" name=\"lockevent\" value=\"1\" " . ($this->row->lockevent() ? "checked=\"checked\"" : "") . " /></label><label>" . JText::_("JEV_NO") . "<input type=\"radio\" name=\"lockevent\" value=\"0\" " . (!$this->row->lockevent() ? "checked=\"checked\"" : "") . " /></label></td>"; echo "</tr>\n"; } ?> <tr> <?php if ($this->repeatId == 0) { ?> <td valign="top" align="left" class="jevcategory"><?php echo JText::_('JEV_EVENT_CATEGORY'); ?> </td> <td style="width:200px" class="jevcategory"> <?php echo JEventsHTML::buildCategorySelect($catid, 'id="catid" ', $this->dataModel->accessibleCategoryList(), $this->with_unpublished_cat, true, 0, 'catid', JEV_COM_COMPONENT, $this->excats, "ordering", true); ?> </td> <?php } if (isset($this->glist)) { ?> <td align="left" class="accesslevel"><?php echo JText::_('JEV_EVENT_ACCESSLEVEL'); ?> </td> <td class="accesslevel"><?php echo $this->glist; ?> </td> <?php
</script> <strong><?php echo JText::_("Select Ical (from raw icals)"); ?> </strong><br/> <?php } echo $this->clist; ?> <br/><br/> <strong><?php echo JText::_('SELECT_CATEGORY'); ?> </strong><br/> <?php echo JEventsHTML::buildCategorySelect(0, '', $this->dataModel->accessibleCategoryList(), false, true, 0, 'catid', JEV_COM_COMPONENT, $this->excats); ?> <br/><br/> <strong><?php echo JText::_('JEV_IGNORE_EMBEDDED_CATEGORIES'); ?> </strong><br/> <input id="ignoreembedcat0" type="radio" value="0" name="ignoreembedcat" checked="checked"/> <label for="ignoreembedcat0"><?php echo JText::_('JEV_NO'); ?> </label> <input id="ignoreembedcat1" type="radio" value="1" name="ignoreembedcat" /> <label for="ignoreembedcat1"><?php echo JText::_('JEV_YES');
function createfilterHTML($allowAutoSubmit = true) { if (!$this->filterField) { return ""; } $filter_value = $this->filter_value; // if catids come from the URL then use this if filter is blank if ($filter_value == $this->filterNullValue || $filter_value == "") { if (JRequest::getInt("catids", 0) > 0) { $filter_value = JRequest::getInt("catids", 0); } } $filterList = array(); $filterList["title"] = JText::_("Select_Category"); if ($allowAutoSubmit) { $filterList["html"] = JEventsHTML::buildCategorySelect($filter_value, 'onchange="if (document.getElementById(\'catidsfv\')) document.getElementById(\'catidsfv\').value=this.value;submit(this.form)" ', $this->allAccessibleCategories, false, false, 0, $this->filterType . '_fv'); } else { $filterList["html"] = JEventsHTML::buildCategorySelect($filter_value, 'onchange="if (document.getElementById(\'catidsfv\')) document.getElementById(\'catidsfv\').value=this.value;" ', $this->allAccessibleCategories, false, false, 0, $this->filterType . '_fv'); } //$script = "function reset".$this->filterType."_fvs(){document.getElements('option',\$('".$this->filterType."_fv')).each(function(item){item.selected=(item.value==0)?true:false;})};\n"; //$script .= "try {JeventsFilters.filters.push({action:'reset".$this->filterType."_fvs()',id:'".$this->filterType."_fv',value:".$this->filterNullValue."});} catch (e) {}\n"; // try/catch incase this is called without a filter module! $script = "try {JeventsFilters.filters.push({id:'" . $this->filterType . "_fv',value:0});} catch (e) {}\n"; $script .= "function reset" . $this->filterType . "_fvs(){if (document.getElementById('catidsfv')) document.getElementById('catidsfv').value=0;document.getElements('option',\$('" . $this->filterType . "_fv')).each(function(item){item.selected=(item.value==0)?true:false;})};\n"; $script .= "try {JeventsFilters.filters.push({action:'reset" . $this->filterType . "_fvs()',id:'" . $this->filterType . "_fv',value:" . $this->filterNullValue . "});} catch (e) {}\n"; $document = JFactory::getDocument(); $document->addScriptDeclaration($script); return $filterList; }
function createfilterHTML($allowAutoSubmit = true) { if (!$this->filterField) { return ""; } $filter_value = $this->filter_value; // if catids come from the URL then use this if filter is blank if ($filter_value == $this->filterNullValue || $filter_value == "") { if (JRequest::getInt("catids", 0) > 0) { $filter_value = JRequest::getInt("catids", 0); } } $filterList = array(); $filterList["title"] = JText::_("Select_Category"); if ($allowAutoSubmit) { $filterList["html"] = JEventsHTML::buildCategorySelect($filter_value, 'onchange="if (document.getElementById(\'catidsfv\')) document.getElementById(\'catidsfv\').value=this.value;submit(this.form)" ', $this->allAccessibleCategories, false, false, 0, $this->filterType . '_fv'); } else { $filterList["html"] = JEventsHTML::buildCategorySelect($filter_value, 'onchange="if (document.getElementById(\'catidsfv\')) document.getElementById(\'catidsfv\').value=this.value;" ', $this->allAccessibleCategories, false, false, 0, $this->filterType . '_fv'); } // try/catch incase this is called without a filter module! $script = <<<SCRIPT try { \tJeventsFilters.filters.push( \t\t{ \t\t\tid:'{$this->filterType}_fv', \t\t\tvalue:0 \t\t} \t); } catch (e) {} function reset{$this->filterType}_fvs(){ \tif (document.getElementById('catidsfv')) { \t\tdocument.getElementById('catidsfv').value=0; \t} \tjQuery('#{$this->filterType}_fv option').each(function(idx, item){ \t\titem.selected=(item.value==0)?true:false; \t}) }; try { \tJeventsFilters.filters.push( \t\t{ \t\t\taction:'reset{$this->filterType}_fvs()', \t\t\tid:'{$this->filterType}_fv', \t\t\tvalue:{$this->filterNullValue} \t\t} \t); } catch (e) {} SCRIPT; $document = JFactory::getDocument(); $document->addScriptDeclaration($script); return $filterList; }