本文整理汇总了PHP中K2HelperHTML::categories方法的典型用法代码示例。如果您正苦于以下问题:PHP K2HelperHTML::categories方法的具体用法?PHP K2HelperHTML::categories怎么用?PHP K2HelperHTML::categories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类K2HelperHTML
的用法示例。
在下文中一共展示了K2HelperHTML::categories方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
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;
}
示例2: setBatchActions
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'));
}
示例3: setFilters
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');
}
示例4: setBatchActions
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));
}