public function getInput() { // Load javascript JHtml::_('jquery.framework'); $document = JFactory::getDocument(); $document->addScript(JURI::root(true) . '/media/k2app/assets/js/fields.js?v=3.0.0'); // Set values if are not set if (!is_array($this->value)) { $this->value = array(); } if (!isset($this->value['enabled'])) { $this->value['enabled'] = '0'; } if (!isset($this->value['categories'])) { $this->value['categories'] = ''; } if (!isset($this->value['recursive'])) { $this->value['recursive'] = ''; } // Get some variables from XML $this->multiple = (bool) $this->element['k2multiple']; $this->recursive = (string) $this->element['k2recursive']; $this->mode = (string) $this->element['k2mode']; $this->size = (int) $this->element['size']; // Build attributes string $attributes = ''; if ($this->multiple) { $attributes .= ' multiple="multiple"'; } if ($this->size) { $attributes .= ' size="' . $this->size . '"'; } if ($this->mode == 'menu') { $attributes .= ' data-mode="k2categoriesmenu"'; } // Init output $output = ''; // First show the category filter switch for multiple instances if ($this->multiple) { $options = array(); $options[] = JHtml::_('select.option', '0', JText::_('K2_ALL')); $options[] = JHtml::_('select.option', '1', JText::_('K2_SELECT')); $output .= K2HelperHTML::radiolist($options, $this->name . '[enabled]', $this->value['enabled'], false, 'data-categories="' . $this->name . '[categories][]"'); $placeholder = null; } else { $output .= '<input type="hidden" name="' . $this->name . '[enabled]" value="1" />'; $placeholder = 'K2_NONE_ONSELECTLISTS'; } // Then the categories list $output .= K2HelperHTML::categories($this->name . '[categories][]', $this->value['categories'], $placeholder, null, $attributes); // And finally the recursive switch if ($this->recursive == 'select') { $options = array(); $options[] = JHtml::_('select.option', '1', JText::_('K2_YES')); $options[] = JHtml::_('select.option', '0', JText::_('K2_NO')); $output .= '<label>' . JText::_('K2_APPLY_RECUSRIVELY') . '</label>' . K2HelperHTML::radiolist($options, $this->name . '[recursive]', $this->value['recursive'], true); } else { $output .= '<input type="hidden" name="' . $this->name . '[recursive]" value="' . $this->recursive . '" />'; } // Return return $output; }
protected function setBatchActions() { K2Response::addBatchAction('category', 'K2_CATEGORY', K2HelperHTML::categories('catid', null, 'K2_LEAVE_UNCHANGED')); K2Response::addBatchAction('author', 'K2_AUTHOR', '<input data-widget="user" data-null="' . JText::_('K2_LEAVE_UNCHANGED') . '" data-min="0" data-placeholder="' . JText::_('K2_LEAVE_UNCHANGED') . '" type="hidden" name="created_by" value="" />'); K2Response::addBatchAction('access', 'K2_ACCESS', JHtml::_('access.level', 'access', null, '', array(JHtml::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED'))))); K2Response::addBatchAction('language', 'K2_LANGUAGE', K2HelperHTML::language('language', '', 'K2_LEAVE_UNCHANGED')); }
protected function setFilters() { // Sorting filter $sortingOptions = array('K2_NONE' => '', 'K2_ID_ASC' => 'id', 'K2_ID_DESC' => 'id.reverse', 'K2_NAME_ASC' => 'name', 'K2_NAME_DESC' => 'name.reverse', 'K2_EMAIL_ASC' => 'email', 'K2_EMAIL_DESC' => 'email.reverse', 'K2_URL_ASC' => 'url', 'K2_URL_DESC' => 'url.reverse', 'K2_IP_ASC' => 'ip', 'K2_IP_DESC' => 'ip.reverse', 'K2_HOSTNAME_ASC' => 'hostname', 'K2_HOSTNAME_DESC' => 'hostname.reverse', 'K2_DATE_ASC' => 'date', 'K2_DATE_DESC' => 'date.reverse', 'K2_STATE_ASC' => 'state', 'K2_STATE_DESC' => 'state.reverse'); K2Response::addFilter('sorting', JText::_('K2_SORT_BY'), K2HelperHTML::sorting($sortingOptions), false, 'header'); // Search filter K2Response::addFilter('search', JText::_('K2_SEARCH'), K2HelperHTML::search(), false, 'sidebar'); // State filter K2Response::addFilter('state', JText::_('K2_STATE'), K2HelperHTML::state('state', null, 'K2_ANY', false), true, 'sidebar'); // Author filter K2Response::addFilter('author', JText::_('K2_USER'), '<input data-widget="user" data-null="' . JText::_('K2_ANY') . '" data-min="0" data-name="' . JText::_('K2_ANY') . '" type="hidden" name="userId" value="" />', false, 'header'); // Categories filter K2Response::addFilter('category', JText::_('K2_CATEGORY'), K2HelperHTML::categories('category', null, 'K2_ANY'), false, 'header'); }
protected function setBatchActions() { K2Response::addBatchAction('access', 'K2_ACCESS', JHtml::_('access.level', 'access', null, '', array(JHtml::_('select.option', '', JText::_('K2_LEAVE_UNCHANGED'))))); K2Response::addBatchAction('language', 'K2_LANGUAGE', K2HelperHTML::language('language', '', 'K2_LEAVE_UNCHANGED')); K2Response::addBatchAction('parent', 'K2_PARENT', K2HelperHTML::categories('parent_id', '', 'K2_LEAVE_UNCHANGED', false, '', false, 'id', false, true)); K2Response::addBatchAction('inheritance', 'K2_INHERITANCE', K2HelperHTML::categories('inheritance', '', 'K2_LEAVE_UNCHANGED', false, '', false, 'id', true)); }