public function getInput() { if (!is_array($this->value)) { $this->value = $this->value ? array($this->value) : array(); } return '<div data-widget="extrafieldgroups" data-value="' . implode('|', $this->value) . '">' . K2HelperHTML::extraFieldsGroups($this->name, null, ' ', array('data-role' => 'extra-field-groups-selector'), 'item') . '<div data-role="list"></div></div>'; }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', '', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $model = $this->getModel(); $total = $model->getTotalGroups(); if ($limitstart > $total - $limit) { $limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit); JRequest::setVar('limitstart', $limitstart); } $extraFieldGroups = $model->getGroups(); $this->assignRef('rows', $extraFieldGroups); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); JToolBarHelper::title(JText::_('K2_EXTRA_FIELD_GROUPS'), 'k2.png'); JToolBarHelper::deleteList('', 'remove', 'K2_DELETE'); JToolBarHelper::editList(); JToolBarHelper::addNew(); if (K2_JVERSION != '15') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar = JToolBar::getInstance('toolbar'); $toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings'); } $this->loadHelper('html'); K2HelperHTML::subMenu(); parent::display($tpl); }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $document = JFactory::getDocument(); $document->addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css'); $document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/theme.css?v=2.6.8'); $document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/elfinder.min.css?v=2.6.8'); $type = JRequest::getCmd('type'); $fieldID = JRequest::getCmd('fieldID'); if ($type == 'video') { $mimes = "'video','audio'"; } elseif ($type == 'image') { $mimes = "'image'"; } else { $mimes = ''; } $this->assignRef('mimes', $mimes); $this->assignRef('type', $type); $this->assignRef('fieldID', $fieldID); if ($mainframe->isAdmin()) { $toolbar = JToolBar::getInstance('toolbar'); if (K2_JVERSION != '15') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings'); } JToolBarHelper::title(JText::_('K2_MEDIA_MANAGER'), 'k2.png'); $this->loadHelper('html'); K2HelperHTML::subMenu(); } parent::display($tpl); }
protected function setFilters() { // Sorting filter $sortingOptions = array('K2_NONE' => 'ordering', 'K2_ID_ASC' => 'id', 'K2_ID_DESC' => 'id.reverse', 'K2_TITLE_ASC' => 'title', 'K2_TITLE_DESC' => 'title.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'); }
function fetchElement($name, $value, &$node, $control_name) { JHTML::_('behavior.modal'); $params = JComponentHelper::getParams('com_k2'); $document = JFactory::getDocument(); if (version_compare(JVERSION, '1.6.0', 'ge')) { JHtml::_('behavior.framework'); } else { JHTML::_('behavior.mootools'); } K2HelperHTML::loadjQuery(); $mainframe = JFactory::getApplication(); if (K2_JVERSION != '15') { $fieldName = $name; if (!$node->attributes()->multiple) { $fieldName .= '[]'; } $image = JURI::root(true) . '/administrator/templates/' . $mainframe->getTemplate() . '/images/admin/publish_x.png'; } else { $fieldName = $control_name . '[' . $name . '][]'; $image = JURI::root(true) . '/administrator/images/publish_x.png'; } $js = "\n\t\tfunction jSelectCategory(id, title, object) {\n\t\t\tvar exists = false;\n\t\t\t\$K2('#categoriesList input').each(function(){\n\t\t\t\t\tif(\$K2(this).val()==id){\n\t\t\t\t\t\talert('" . JText::_('K2_THE_SELECTED_CATEGORY_IS_ALREADY_IN_THE_LIST', true) . "');\n\t\t\t\t\t\texists = true;\n\t\t\t\t\t}\n\t\t\t});\n\t\t\tif(!exists){\n\t\t\t\tvar container = \$K2('<li/>').appendTo(\$K2('#categoriesList'));\n\t\t\t\tvar img = \$K2('<img/>',{class:'remove', src:'" . $image . "'}).appendTo(container);\n\t\t\t\timg.click(function(){\$K2(this).parent().remove();});\n\t\t\t\tvar span = \$K2('<span/>',{class:'handle'}).html(title).appendTo(container);\n\t\t\t\tvar input = \$K2('<input/>',{value:id, type:'hidden', name:'" . $fieldName . "'}).appendTo(container);\n\t\t\t\tvar div = \$K2('<div/>',{style:'clear:both;'}).appendTo(container);\n\t\t\t\t\$K2('#categoriesList').sortable('refresh');\n\t\t\t\talert('" . JText::_('K2_CATEGORY_ADDED_IN_THE_LIST', true) . "');\n\t\t\t}\n\t\t}\n\n\t\t\$K2(document).ready(function(){\n\t\t\t\$K2('#categoriesList').sortable({\n\t\t\t\tcontainment: '#categoriesList',\n\t\t\t\titems: 'li',\n\t\t\t\thandle: 'span.handle'\n\t\t\t});\n\t\t\t\$K2('body').css('overflow-y', 'scroll');\n\t\t\t\$K2('#categoriesList .remove').click(function(){\n\t\t\t\t\$K2(this).parent().remove();\n\t\t\t});\n\t\t});\n\t\t"; $document->addScriptDeclaration($js); $document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/k2.modules.css?v=2.6.0'); $current = array(); if (is_string($value) && !empty($value)) { $current[] = $value; } if (is_array($value)) { $current = $value; } $output = ' <div class="button2-left"> <div class="blank"> <a class="modal btn" title="' . JText::_('K2_CLICK_TO_SELECT_ONE_OR_MORE_CATEGORIES') . '" href="index.php?option=com_k2&view=categories&task=element&tmpl=component" rel="{handler: \'iframe\', size: {x: 700, y: 450}}">' . JText::_('K2_CLICK_TO_SELECT_ONE_OR_MORE_CATEGORIES') . '</a> </div> </div> <div style="clear:both;"></div> '; JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'tables'); $output .= '<ul id="categoriesList">'; foreach ($current as $id) { $row = JTable::getInstance('K2Category', 'Table'); $row->load($id); $output .= ' <li> <img class="remove" src="' . $image . '"/> <span class="handle">' . $row->name . '</span> <input type="hidden" value="' . $row->id . '" name="' . $fieldName . '"/> <span style="clear:both;"></span> </li> '; } $output .= '</ul>'; return $output; }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'id', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); $model = $this->getModel(); $total = $model->getTotal(); $task = JRequest::getCmd('task'); if ($limitstart > $total - $limit) { $limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit); JRequest::setVar('limitstart', $limitstart); } $tags = $model->getData(); foreach ($tags as $key => $tag) { $tag->numOfItems = $model->countTagItems($tag->id); $tag->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $tag, $key) : JHtml::_('jgrid.published', $tag->published, $key, '', $task != 'element'); } $this->assignRef('rows', $tags); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); $lists = array(); $lists['search'] = $search; $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); $this->assignRef('lists', $lists); JToolBarHelper::title(JText::_('K2_TAGS'), 'k2.png'); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::deleteList('', 'remove', 'K2_DELETE'); JToolBarHelper::editList(); JToolBarHelper::addNew(); if (K2_JVERSION != '15') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar = JToolBar::getInstance('toolbar'); $toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings'); } $this->loadHelper('html'); K2HelperHTML::subMenu(); parent::display($tpl); }
public function display($cachable = false, $urlparams = array()) { $user = JFactory::getUser(); if ($user->guest) { $uri = JFactory::getURI(); if (K2_JVERSION != '15') { $url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString()); } else { $url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString()); } $application = JFactory::getApplication(); $application->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST')); } JRequest::setVar('tmpl', 'component'); $params = JComponentHelper::getParams('com_k2'); $document = JFactory::getDocument(); if (version_compare(JVERSION, '1.6.0', 'ge')) { JHtml::_('behavior.framework'); } else { JHTML::_('behavior.mootools'); } // Language $language = JFactory::getLanguage(); $language->load('com_k2', JPATH_ADMINISTRATOR); // CSS $document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.css?v=2.6.6'); // JS K2HelperHTML::loadjQuery(true); $document->addScript(JURI::root(true).'/media/k2/assets/js/k2.js?v=2.6.6&sitepath='.JURI::root(true).'/'); $this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'); $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models'); $view = $this->getView('comments', 'html'); $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'comments'.DS.'tmpl'); $view->addHelperPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'); $view->display(); }
function fetchElement($name, $value, &$node, $control_name) { $params = JComponentHelper::getParams('com_k2'); $document = JFactory::getDocument(); if (version_compare(JVERSION, '1.6.0', 'ge')) { JHtml::_('behavior.framework'); } else { JHTML::_('behavior.mootools'); } K2HelperHTML::loadjQuery(); $mainframe = JFactory::getApplication(); if (K2_JVERSION != '15') { $fieldName = $name; $attribute = K2_JVERSION == '25' ? $node->getAttribute('multiple') : $node->attributes()->multiple; if (!$attribute) { $fieldName .= '[]'; } $image = JURI::root(true) . '/administrator/templates/' . $mainframe->getTemplate() . '/images/admin/publish_x.png'; } else { $fieldName = $control_name . '[' . $name . '][]'; $image = JURI::root(true) . '/administrator/images/publish_x.png'; } $js = "\n\t\tfunction jSelectItem(id, title, object) {\n\t\t\tvar exists = false;\n\t\t\t\$K2('#itemsList input').each(function(){\n\t\t\t\t\tif(\$K2(this).val()==id){\n\t\t\t\t\t\talert('" . JText::_('K2_THE_SELECTED_ITEM_IS_ALREADY_IN_THE_LIST') . "');\n\t\t\t\t\t\texists = true;\n\t\t\t\t\t}\n\t\t\t});\n\t\t\tif(!exists){\n\t\t\t\tvar container = \$K2('<li/>').appendTo(\$K2('#itemsList'));\n\t\t\t\tvar img = \$K2('<img/>',{'class':'remove', src:'" . $image . "'}).appendTo(container);\n\t\t\t\timg.click(function(){\$K2(this).parent().remove();});\n\t\t\t\tvar span = \$K2('<span/>',{'class':'handle'}).html(title).appendTo(container);\n\t\t\t\tvar input = \$K2('<input/>',{value:id, type:'hidden', name:'" . $fieldName . "'}).appendTo(container);\n\t\t\t\tvar div = \$K2('<div/>',{style:'clear:both;'}).appendTo(container);\n\t\t\t\t\$K2('#itemsList').sortable('refresh');\n\t\t\t\talert('" . JText::_('K2_ITEM_ADDED_IN_THE_LIST', true) . "');\n\t\t\t}\n\t\t}\n\t\t\n\t\t\$K2(document).ready(function(){\n\t\t\t\$K2('#itemsList').sortable({\n\t\t\t\tcontainment: '#itemsList',\n\t\t\t\titems: 'li',\n\t\t\t\thandle: 'span.handle'\n\t\t\t});\n\t\t\t\$K2('#itemsList .remove').click(function(){\n\t\t\t\t\$K2(this).parent().remove();\n\t\t\t});\n\t\t});\n\t\t"; $document->addScriptDeclaration($js); $document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/k2.modules.css?v=2.6.8'); $current = array(); if (is_string($value) && !empty($value)) { $current[] = $value; } if (is_array($value)) { $current = $value; } JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'tables'); $output = '<div style="clear:both"></div><ul id="itemsList">'; foreach ($current as $id) { $row = JTable::getInstance('K2Item', 'Table'); $row->load($id); $output .= ' <li> <img class="remove" src="' . $image . '" alt="' . JText::_('K2_REMOVE_ENTRY_FROM_LIST') . '" /> <span class="handle">' . $row->title . '</span> <input type="hidden" value="' . $row->id . '" name="' . $fieldName . '"/> <span style="clear:both;"></span> </li> '; } $output .= '</ul>'; return $output; }
function fetchElement($name, $value, &$node, $control_name) { $params = JComponentHelper::getParams('com_k2'); $document = JFactory::getDocument(); if (version_compare(JVERSION, '1.6.0', 'ge')) { JHtml::_('behavior.framework'); } else { JHTML::_('behavior.mootools'); } K2HelperHTML::loadjQuery(); $db = JFactory::getDBO(); $query = 'SELECT m.* FROM #__k2_categories m WHERE trash = 0 ORDER BY parent, ordering'; $db->setQuery($query); $mitems = $db->loadObjectList(); $children = array(); if ($mitems) { foreach ($mitems as $v) { if (K2_JVERSION != '15') { $v->title = $v->name; $v->parent_id = $v->parent; } $pt = $v->parent; $list = @$children[$pt] ? $children[$pt] : array(); array_push($list, $v); $children[$pt] = $list; } } $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0); $mitems = array(); foreach ($list as $item) { $item->treename = JString::str_ireplace(' ', '- ', $item->treename); $mitems[] = JHTML::_('select.option', $item->id, ' ' . $item->treename); } $doc = JFactory::getDocument(); if (K2_JVERSION != '15') { $js = "\n\t\t\t\$K2(document).ready(function(){\n\t\t\t\t\n\t\t\t\t\$K2('#jform_params_catfilter0').click(function(){\n\t\t\t\t\t\$K2('#jformparamscategory_id').attr('disabled', 'disabled');\n\t\t\t\t\t\$K2('#jformparamscategory_id option').each(function() {\n\t\t\t\t\t\t\$K2(this).attr('selected', 'selected');\n\t\t\t\t\t});\n\t\t\t\t\t\$K2('#jformparamscategory_id').trigger('liszt:updated');\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t\$K2('#jform_params_catfilter1').click(function(){\n\t\t\t\t\t\$K2('#jformparamscategory_id').removeAttr('disabled');\n\t\t\t\t\t\$K2('#jformparamscategory_id option').each(function() {\n\t\t\t\t\t\t\$K2(this).removeAttr('selected');\n\t\t\t\t\t});\n\t\t\t\t\t\$K2('#jformparamscategory_id').trigger('liszt:updated');\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tif (\$K2('#jform_params_catfilter0').attr('checked')) {\n\t\t\t\t\t\$K2('#jformparamscategory_id').attr('disabled', 'disabled');\n\t\t\t\t\t\$K2('#jformparamscategory_id option').each(function() {\n\t\t\t\t\t\t\$K2(this).attr('selected', 'selected');\n\t\t\t\t\t});\n\t\t\t\t\t\$K2('#jformparamscategory_id').trigger('liszt:updated');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (\$K2('#jform_params_catfilter1').attr('checked')) {\n\t\t\t\t\t\$K2('#jformparamscategory_id').removeAttr('disabled');\n\t\t\t\t\t\$K2('#jformparamscategory_id').trigger('liszt:updated');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t});\n\t\t\t"; } else { $js = "\n\t\t\t\$K2(document).ready(function(){\n\t\t\t\t\n\t\t\t\t\$K2('#paramscatfilter0').click(function(){\n\t\t\t\t\t\$K2('#paramscategory_id').attr('disabled', 'disabled');\n\t\t\t\t\t\$K2('#paramscategory_id option').each(function() {\n\t\t\t\t\t\t\$K2(this).attr('selected', 'selected');\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t\$K2('#paramscatfilter1').click(function(){\n\t\t\t\t\t\$K2('#paramscategory_id').removeAttr('disabled');\n\t\t\t\t\t\$K2('#paramscategory_id option').each(function() {\n\t\t\t\t\t\t\$K2(this).removeAttr('selected');\n\t\t\t\t\t});\n\t\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tif (\$K2('#paramscatfilter0').attr('checked')) {\n\t\t\t\t\t\$K2('#paramscategory_id').attr('disabled', 'disabled');\n\t\t\t\t\t\$K2('#paramscategory_id option').each(function() {\n\t\t\t\t\t\t\$K2(this).attr('selected', 'selected');\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (\$K2('#paramscatfilter1').attr('checked')) {\n\t\t\t\t\t\$K2('#paramscategory_id').removeAttr('disabled');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t});\n\t\t\t"; } if (K2_JVERSION != '15') { $fieldName = $name . '[]'; } else { $fieldName = $control_name . '[' . $name . '][]'; } $doc->addScriptDeclaration($js); $output = JHTML::_('select.genericlist', $mitems, $fieldName, 'class="inputbox" multiple="multiple" size="10"', 'value', 'text', $value); return $output; }
function display($tpl = null) { jimport('joomla.filesystem.file'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $db_version = $db->getVersion(); $php_version = phpversion(); $server = $this->get_server_software(); $gd_check = extension_loaded('gd'); $mb_check = extension_loaded('mbstring'); $media_folder_check = is_writable(JPATH_ROOT . DS . 'media' . DS . 'k2'); $attachments_folder_check = is_writable(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'attachments'); $categories_folder_check = is_writable(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'categories'); $galleries_folder_check = is_writable(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'galleries'); $items_folder_check = is_writable(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'items'); $users_folder_check = is_writable(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'users'); $videos_folder_check = is_writable(JPATH_ROOT . DS . 'media' . DS . 'k2' . DS . 'videos'); $cache_folder_check = is_writable(JPATH_ROOT . DS . 'cache'); $this->assignRef('server', $server); $this->assignRef('php_version', $php_version); $this->assignRef('db_version', $db_version); $this->assignRef('gd_check', $gd_check); $this->assignRef('mb_check', $mb_check); $this->assignRef('media_folder_check', $media_folder_check); $this->assignRef('attachments_folder_check', $attachments_folder_check); $this->assignRef('categories_folder_check', $categories_folder_check); $this->assignRef('galleries_folder_check', $galleries_folder_check); $this->assignRef('items_folder_check', $items_folder_check); $this->assignRef('users_folder_check', $users_folder_check); $this->assignRef('videos_folder_check', $videos_folder_check); $this->assignRef('cache_folder_check', $cache_folder_check); JToolBarHelper::title(JText::_('K2_INFORMATION'), 'k2.png'); if (K2_JVERSION != '15') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar = JToolBar::getInstance('toolbar'); $toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings'); } $this->loadHelper('html'); K2HelperHTML::subMenu(); parent::display($tpl); }
protected function setFormFields(&$form, $row) { $form->scope = K2HelperHTML::extraFieldsScopes('scope', $row->scope); }
echo $row->id; ?> " class="closeComment"><?php echo JText::_('K2_CANCEL'); ?> </a> <div class="clr"></div> </div> <input type="hidden" name="currentValue[]" value="<?php echo $row->commentText; ?> " /> </td> <td class="k2Center"> <?php echo $this->mainframe->isSite() ? K2HelperHTML::stateToggler($row, $key) : JHTML::_('grid.published', $row, $key); ?> </td> <td> <?php if ($this->mainframe->isAdmin() && $row->userID) { ?> <a href="<?php echo $this->userEditLink . $row->userID; ?> "><?php echo $row->userName; ?> </a> <?php } else {
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 setFormFields(&$form, $row) { require_once JPATH_ADMINISTRATOR . '/components/com_k2/helpers/html.php'; $form->state = K2HelperHTML::state('state', $row->state, false, false, 'radio', true); }
protected function setFormFields(&$form, $row) { $form->state = K2HelperHTML::state('state', $row->state, false, false, 'radio', true); $form->group = K2HelperHTML::extraFieldsGroups('group', $row->group); $form->type = K2HelperHTML::extraFieldsTypes('type', $row->type, 'K2_SELECT_TYPE'); $definitions = K2HelperExtraFields::getDefinitions(); if ($row->id) { $definitions[$row->type] = $row->getDefinition(); } $form->definitions = $definitions; }
/** * Hook for children views to allow them attach fields to the form object. * Children views usually should override this method. * * @return void */ protected function setFormFields(&$_form, $row) { $language = JFactory::getLanguage(); $language->load('', JPATH_ADMINISTRATOR); $language->load('com_users', JPATH_ADMINISTRATOR); // Import JForm jimport('joomla.form.form'); // Determine form name and path $formName = 'K2' . ucfirst($this->getName()) . 'Form'; $formPath = JPATH_ADMINISTRATOR . '/components/com_users/models/forms/user.xml'; // Convert JRegistry instances to plain object so JForm can bind them if ($row->id) { $row->params = $row->params->toObject(); } // Get the form instance $form = JForm::getInstance($formName, $formPath); // Bind values $form->bind($row); $form->setValue('password', null); $form->setValue('password2', null); // Attach the JForm fields to the form foreach ($form->getFieldsets() as $fieldset) { $array = array(); foreach ($form->getFieldset($fieldset->name) as $field) { $tmp = new stdClass(); $tmp->label = $field->label; $tmp->input = $field->input; $array[$field->name] = $tmp; } $name = $fieldset->name; $_form->{$name} = $array; } JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models'); $model = JModelLegacy::getInstance('User', 'UsersModel'); if ($row->id) { $assignedGroups = $model->getAssignedGroups($row->id); } else { $assignedGroups = null; } $_form->groups = JHtml::_('access.usergroups', 'groups', $assignedGroups, true); require_once JPATH_ADMINISTRATOR . '/components/com_k2/helpers/html.php'; $_form->gender = K2HelperHTML::gender('gender', $row->gender); require_once JPATH_ADMINISTRATOR . '/components/com_k2/helpers/extrafields.php'; $_form->extraFields = K2HelperExtraFields::getUserExtraFieldsGroups($row->extra_fields); require_once JPATH_ADMINISTRATOR . '/components/com_k2/classes/editor.php'; $config = JFactory::getConfig(); $editor = K2Editor::getInstance($config->get('editor')); $_form->description = $editor->display('description', $row->description, '100%', '300', '40', '5'); }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'groupname', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'); $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); $filter_type = $mainframe->getUserStateFromRequest($option . $view . 'filter_type', 'filter_type', '', 'string'); $filter_group = $mainframe->getUserStateFromRequest($option . $view . 'filter_group', 'filter_group', '', 'string'); $model = $this->getModel(); $total = $model->getTotal(); if ($limitstart > $total - $limit) { $limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit); JRequest::setVar('limitstart', $limitstart); } $extraFields = $model->getData(); require_once JPATH_COMPONENT . DS . 'lib' . DS . 'JSON.php'; $json = new Services_JSON(); foreach ($extraFields as $key => $extraField) { $extraField->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $extraField, $key) : JHtml::_('jgrid.published', $extraField->published, $key); $values = $json->decode($extraField->value); if (isset($values[0]->alias) && !empty($values[0]->alias)) { $extraField->alias = $values[0]->alias; } else { $filter = JFilterInput::getInstance(); $extraField->alias = $filter->clean($extraField->name, 'WORD'); } } $this->assignRef('rows', $extraFields); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); $lists = array(); $lists['search'] = $search; $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); $extraFieldGroups = $model->getGroups(true); $groups[] = JHTML::_('select.option', '0', JText::_('K2_SELECT_GROUP')); foreach ($extraFieldGroups as $extraFieldGroup) { $groups[] = JHTML::_('select.option', $extraFieldGroup->id, $extraFieldGroup->name); } $lists['group'] = JHTML::_('select.genericlist', $groups, 'filter_group', '', 'value', 'text', $filter_group); $typeOptions[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_TYPE')); $typeOptions[] = JHTML::_('select.option', 'textfield', JText::_('K2_TEXT_FIELD')); $typeOptions[] = JHTML::_('select.option', 'textarea', JText::_('K2_TEXTAREA')); $typeOptions[] = JHTML::_('select.option', 'select', JText::_('K2_DROPDOWN_SELECTION')); $typeOptions[] = JHTML::_('select.option', 'multipleSelect', JText::_('K2_MULTISELECT_LIST')); $typeOptions[] = JHTML::_('select.option', 'radio', JText::_('K2_RADIO_BUTTONS')); $typeOptions[] = JHTML::_('select.option', 'link', JText::_('K2_LINK')); $typeOptions[] = JHTML::_('select.option', 'csv', JText::_('K2_CSV_DATA')); $typeOptions[] = JHTML::_('select.option', 'labels', JText::_('K2_SEARCHABLE_LABELS')); $typeOptions[] = JHTML::_('select.option', 'date', JText::_('K2_DATE')); $typeOptions[] = JHTML::_('select.option', 'image', JText::_('K2_IMAGE')); $typeOptions[] = JHTML::_('select.option', 'header', JText::_('K2_HEADER')); $lists['type'] = JHTML::_('select.genericlist', $typeOptions, 'filter_type', '', 'value', 'text', $filter_type); $this->assignRef('lists', $lists); JToolBarHelper::title(JText::_('K2_EXTRA_FIELDS'), 'k2.png'); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_EXTRA_FIELDS', 'remove', 'K2_DELETE'); JToolBarHelper::editList(); JToolBarHelper::addNew(); if (K2_JVERSION != '15') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar = JToolBar::getInstance('toolbar'); $toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings'); } $this->loadHelper('html'); K2HelperHTML::subMenu(); $ordering = $this->lists['order'] == 'ordering'; $this->assignRef('ordering', $ordering); // Joomla! 3.0 drag-n-drop sorting variables if (K2_JVERSION == '30') { if ($ordering) { JHtml::_('sortablelist.sortable', 'k2ExtraFieldsList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2&view=extrafields&task=saveorder&format=raw'); } $document = JFactory::getDocument(); $document->addScriptDeclaration(' Joomla.orderTable = function() { table = document.getElementById("sortTable"); direction = document.getElementById("directionTable"); order = table.options[table.selectedIndex].value; if (order != \'' . $this->lists['order'] . '\') { dirn = \'asc\'; } else { dirn = direction.options[direction.selectedIndex].value; } Joomla.tableOrdering(order, dirn, ""); }'); } parent::display($tpl); }
protected function setFormFields(&$form, $row) { require_once JPATH_ADMINISTRATOR . '/components/com_k2/helpers/html.php'; $form->state = K2HelperHTML::state('state', $row->state, false, false, 'radio', true); require_once JPATH_ADMINISTRATOR . '/components/com_k2/helpers/extrafields.php'; $form->extraFields = K2HelperExtraFields::getTagExtraFieldsGroups($row->extra_fields); }
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')); }
function display($tpl = null) { jimport('joomla.filesystem.file'); $mainframe =& JFactory::getApplication(); $user =& JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'i.id', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); $filter_trash = $mainframe->getUserStateFromRequest($option . $view . 'filter_trash', 'filter_trash', 0, 'int'); $filter_featured = $mainframe->getUserStateFromRequest($option . $view . 'filter_featured', 'filter_featured', -1, 'int'); $filter_category = $mainframe->getUserStateFromRequest($option . $view . 'filter_category', 'filter_category', 0, 'int'); $filter_author = $mainframe->getUserStateFromRequest($option . $view . 'filter_author', 'filter_author', 0, 'int'); $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); $tag = $mainframe->getUserStateFromRequest($option . $view . 'tag', 'tag', 0, 'int'); $language = $mainframe->getUserStateFromRequest($option . $view . 'language', 'language', '', 'string'); $params =& JComponentHelper::getParams('com_k2'); $model =& $this->getModel(); $items = $model->getData(); $this->assignRef('rows', $items); $lists = array(); $lists['search'] = $search; if (!$filter_order) { $filter_order = 'category'; } $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_trash_options[] = JHTML::_('select.option', 0, JText::_('K2_CURRENT')); $filter_trash_options[] = JHTML::_('select.option', 1, JText::_('K2_TRASHED')); $lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash); require_once JPATH_COMPONENT . DS . 'models' . DS . 'categories.php'; $categoriesModel = new K2ModelCategories(); $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY')); $categories = $categoriesModel->categoriesTree(NULL, false, false); $categories_options = @array_merge($categories_option, $categories); $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category); $authors = $model->getItemsAuthors(); $options = array(); $options[] = JHTML::_('select.option', 0, '- ' . JText::_('K2_NO_USER') . ' -'); foreach ($authors as $author) { $name = $author->name; if ($author->block) { $name .= ' [' . JText::_('K2_USER_DISABLED') . ']'; } $options[] = JHTML::_('select.option', $author->id, $name); } $lists['authors'] = JHTML::_('select.genericlist', $options, 'filter_author', '', 'value', 'text', $filter_author); $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_PUBLISHING_STATE')); $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); $filter_featured_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_FEATURED_STATE')); $filter_featured_options[] = JHTML::_('select.option', 1, JText::_('K2_FEATURED')); $filter_featured_options[] = JHTML::_('select.option', 0, JText::_('K2_NOT_FEATURED')); $lists['featured'] = JHTML::_('select.genericlist', $filter_featured_options, 'filter_featured', '', 'value', 'text', $filter_featured); if ($params->get('showTagFilter')) { require_once JPATH_COMPONENT . DS . 'models' . DS . 'tags.php'; $tagsModel = new K2ModelTags(); $options = $tagsModel->getFilter(); $option = new JObject(); $option->id = 0; $option->name = JText::_('K2_SELECT_TAG'); array_unshift($options, $option); $lists['tag'] = JHTML::_('select.genericlist', $options, 'tag', '', 'id', 'name', $tag); } if (version_compare(JVERSION, '1.6.0', 'ge')) { $languages = JHTML::_('contentlanguage.existing', true, true); array_unshift($languages, JHTML::_('select.option', '', JText::_('K2_SELECT_LANGUAGE'))); $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language); } $this->assignRef('lists', $lists); $total = $model->getTotal(); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); JToolBarHelper::title(JText::_('K2_ITEMS'), 'k2.png'); if ($filter_trash == 1) { JToolBarHelper::custom('restore', 'restore.png', 'restore_f2.png', 'K2_RESTORE', true); JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_ITEMS', 'remove', 'K2_DELETE'); } else { $params =& JComponentHelper::getParams('com_k2'); $toolbar =& JToolBar::getInstance('toolbar'); JToolBarHelper::customX('featured', 'default.png', 'default_f2.png', 'K2_TOGGLE_FEATURED_STATE'); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::customX('move', 'move.png', 'move_f2.png', 'K2_MOVE'); JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', 'K2_COPY'); JToolBarHelper::editList(); JToolBarHelper::addNew(); JToolBarHelper::trash('trash'); } $toolbar =& JToolBar::getInstance('toolbar'); if (K2_JVERSION == '16') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings'); } // Import Joomla! content button if ($user->gid > 23 && !$params->get('hideImportButton')) { $buttonUrl = JURI::base() . 'index.php?option=com_k2&view=items&task=import'; $buttonText = JText::_('K2_IMPORT_JOOMLA_CONTENT'); $button = '<a id="K2ImportContentButton" href="' . $buttonUrl . '"><span class="icon-32-archive" title="' . $buttonText . '"></span>' . $buttonText . '</a>'; $toolbar->appendButton('Custom', $button); } $this->loadHelper('html'); K2HelperHTML::subMenu(); $template = $mainframe->getTemplate(); $this->assignRef('template', $template); $this->assignRef('filter_featured', $filter_featured); $this->assignRef('filter_trash', $filter_trash); $this->assignRef('user', $user); if (K2_JVERSION == '16') { $dateFormat = JText::_('K2_J16_DATE_FORMAT'); } else { $dateFormat = JText::_('K2_DATE_FORMAT'); } $this->assignRef('dateFormat', $dateFormat); $db =& JFactory::getDBO(); $nullDate = $db->getNullDate(); $this->assignRef('nullDate', $nullDate); $ordering = ($this->lists['order'] == 'i.ordering' || $this->lists['order'] == 'category' || $this->filter_featured) && !$this->filter_trash; $this->assignRef('ordering', $ordering); parent::display($tpl); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $params =& JComponentHelper::getParams('com_k2'); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', '', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_status = $mainframe->getUserStateFromRequest($option . $view . 'filter_status', 'filter_status', -1, 'int'); $filter_group = $mainframe->getUserStateFromRequest($option . $view . 'filter_group', 'filter_group', 1, 'filter_group'); $filter_group_k2 = $mainframe->getUserStateFromRequest($option . $view . 'filter_group_k2', 'filter_group_k2', '', 'filter_group_k2'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models'); $model =& JModel::getInstance('Users', 'K2Model'); $users = $model->getData(); for ($i = 0; $i < sizeof($users); $i++) { $users[$i]->loggedin = $model->checkLogin($users[$i]->id); $users[$i]->profileID = $model->hasProfile($users[$i]->id); if ($users[$i]->lastvisitDate == "0000-00-00 00:00:00") { $users[$i]->lvisit = false; } else { $users[$i]->lvisit = $users[$i]->lastvisitDate; } $users[$i]->link = JRoute::_('index.php?option=com_k2&view=user&cid=' . $users[$i]->id); } $this->assignRef('rows', $users); $total = $model->getTotal(); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); $lists = array(); $lists['search'] = $search; $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_status_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); $filter_status_options[] = JHTML::_('select.option', 0, JText::_('K2_ENABLED')); $filter_status_options[] = JHTML::_('select.option', 1, JText::_('K2_BLOCKED')); $lists['status'] = JHTML::_('select.genericlist', $filter_status_options, 'filter_status', '', 'value', 'text', $filter_status); $userGroups = $model->getUserGroups(); $groups[] = JHTML::_('select.option', '0', JText::_('K2_SELECT_JOOMLA_GROUP')); foreach ($userGroups as $userGroup) { $groups[] = JHTML::_('select.option', $userGroup->value, $userGroup->text); } $lists['filter_group'] = JHTML::_('select.genericlist', $groups, 'filter_group', '', 'value', 'text', $filter_group); $K2userGroups = $model->getUserGroups('k2'); $K2groups[] = JHTML::_('select.option', '0', JText::_('K2_SELECT_K2_GROUP')); foreach ($K2userGroups as $K2userGroup) { $K2groups[] = JHTML::_('select.option', $K2userGroup->id, $K2userGroup->name); } $lists['filter_group_k2'] = JHTML::_('select.genericlist', $K2groups, 'filter_group_k2', '', 'value', 'text', $filter_group_k2); $this->assignRef('lists', $lists); if (K2_JVERSION == '16') { $dateFormat = JText::_('K2_J16_DATE_FORMAT'); } else { $dateFormat = JText::_('K2_DATE_FORMAT'); } $this->assignRef('dateFormat', $dateFormat); $template = $mainframe->getTemplate(); $this->assignRef('template', $template); if ($mainframe->isAdmin()) { JToolBarHelper::title(JText::_('K2_USERS'), 'k2.png'); JToolBarHelper::customX('move', 'move.png', 'move_f2.png', 'K2_MOVE'); JToolBarHelper::deleteList('K2_WARNING_YOU_ARE_ABOUT_TO_DELETE_THE_SELECTED_USERS_PERMANENTLY_FROM_THE_SYSTEM', 'delete', 'K2_DELETE'); JToolBarHelper::publishList('enable', 'K2_ENABLE'); JToolBarHelper::unpublishList('disable', 'K2_DISABLE'); JToolBarHelper::editList(); JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_RESET_SELECTED_USERS', 'remove', 'K2_RESET_USER_DETAILS'); $toolbar =& JToolBar::getInstance('toolbar'); if (K2_JVERSION == '16') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings'); } $this->loadHelper('html'); K2HelperHTML::subMenu(); $user =& JFactory::getUser(); if ($user->gid > 23) { if (!$params->get('hideImportButton')) { $buttonUrl = JURI::base() . 'index.php?option=com_k2&view=users&task=import'; $buttonText = JText::_('K2_IMPORT_JOOMLA_USERS'); $button = '<a id="K2ImportUsersButton" href="' . $buttonUrl . '"><span class="icon-32-archive" title="' . $buttonText . '"></span>' . $buttonText . '</a>'; $toolbar->appendButton('Custom', $button); } } } $isAdmin = $mainframe->isAdmin(); $this->assignRef('isAdmin', $isAdmin); if ($mainframe->isSite()) { // CSS $document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/k2.frontend.css'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/general.css'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/system.css'); if (K2_JVERSION == '16') { $document->addStyleSheet(JURI::root(true) . '/administrator/templates/bluestork/css/template.css'); $document->addStyleSheet(JURI::root(true) . '/media/system/css/system.css'); } else { $document->addStyleSheet(JURI::root(true) . '/administrator/templates/khepri/css/general.css'); } } parent::display($tpl); }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'c.ordering', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_trash = $mainframe->getUserStateFromRequest($option . $view . 'filter_trash', 'filter_trash', 0, 'int'); $filter_category = $mainframe->getUserStateFromRequest($option . $view . 'filter_category', 'filter_category', 0, 'int'); $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int'); $language = $mainframe->getUserStateFromRequest($option . $view . 'language', 'language', '', 'string'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); $model = $this->getModel(); $total = $model->getTotal(); $task = JRequest::getCmd('task'); if ($limitstart > $total - $limit) { $limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit); JRequest::setVar('limitstart', $limitstart); } $categories = $model->getData(); $categoryModel = K2Model::getInstance('Category', 'K2Model'); $params = JComponentHelper::getParams('com_k2'); $this->assignRef('params', $params); if (K2_JVERSION != '15') { $langs = JLanguageHelper::getLanguages(); $langsMapping = array(); $langsMapping['*'] = JText::_('K2_ALL'); foreach ($langs as $lang) { $langsMapping[$lang->lang_code] = $lang->title; } } for ($i = 0; $i < sizeof($categories); $i++) { $categories[$i]->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $categories[$i], $i) : JHtml::_('jgrid.published', $categories[$i]->published, $i, '', $filter_trash == 0 && $task != 'element'); if ($params->get('showItemsCounterAdmin')) { $categories[$i]->numOfItems = $categoryModel->countCategoryItems($categories[$i]->id); $categories[$i]->numOfTrashedItems = $categoryModel->countCategoryItems($categories[$i]->id, 1); } if (K2_JVERSION == '30') { $categories[$i]->canChange = $user->authorise('core.edit.state', 'com_k2.category.' . $categories[$i]->id); } // Detect the category template if (K2_JVERSION != '15') { $categoryParams = json_decode($categories[$i]->params); $categories[$i]->template = $categoryParams->theme; $categories[$i]->language = $categories[$i]->language ? $categories[$i]->language : '*'; if (isset($langsMapping)) { $categories[$i]->language = $langsMapping[$categories[$i]->language]; } } else { if (function_exists('parse_ini_string')) { $categoryParams = parse_ini_string($categories[$i]->params); $categories[$i]->template = $categoryParams['theme']; } else { $categoryParams = new JParameter($categories[$i]->params); $categories[$i]->template = $categoryParams->get('theme'); } } if (!$categories[$i]->template) { $categories[$i]->template = 'default'; } } $this->assignRef('rows', $categories); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); $lists = array(); $lists['search'] = $search; $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_trash_options[] = JHTML::_('select.option', 0, JText::_('K2_CURRENT')); $filter_trash_options[] = JHTML::_('select.option', 1, JText::_('K2_TRASHED')); $lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash); $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); require_once JPATH_ADMINISTRATOR . '/components/com_k2/models/categories.php'; $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY')); $categoriesFilter = $categoriesModel->categoriesTree(NULL, true, false); $categories_options = @array_merge($categories_option, $categoriesFilter); $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category); if (version_compare(JVERSION, '1.6.0', 'ge')) { $languages = JHTML::_('contentlanguage.existing', true, true); array_unshift($languages, JHTML::_('select.option', '', JText::_('K2_SELECT_LANGUAGE'))); $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language); } $this->assignRef('lists', $lists); JToolBarHelper::title(JText::_('K2_CATEGORIES'), 'k2.png'); if ($filter_trash == 1) { JToolBarHelper::custom('restore', 'publish.png', 'publish_f2.png', 'K2_RESTORE', true); JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_CATEGORIES', 'remove', 'K2_DELETE'); } else { JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::custom('move', 'move.png', 'move_f2.png', 'K2_MOVE', true); JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'K2_COPY', true); JToolBarHelper::editList(); JToolBarHelper::addNew(); JToolBarHelper::trash('trash'); } if (K2_JVERSION != '15') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar = JToolBar::getInstance('toolbar'); $toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings'); } $this->loadHelper('html'); K2HelperHTML::subMenu(); $this->assignRef('filter_trash', $filter_trash); $template = $mainframe->getTemplate(); $this->assignRef('template', $template); $ordering = ($this->lists['order'] == 'c.ordering' || $this->lists['order'] == 'c.parent, c.ordering') && !$this->filter_trash; $this->assignRef('ordering', $ordering); // Joomla! 3.0 drag-n-drop sorting variables if (K2_JVERSION == '30') { if ($ordering) { JHtml::_('sortablelist.sortable', 'k2CategoriesList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2&view=categories&task=saveorder&format=raw'); } $document = JFactory::getDocument(); $document->addScriptDeclaration(' Joomla.orderTable = function() { table = document.getElementById("sortTable"); direction = document.getElementById("directionTable"); order = table.options[table.selectedIndex].value; if (order != \'' . $this->lists['order'] . '\') { dirn = \'asc\'; } else { dirn = direction.options[direction.selectedIndex].value; } Joomla.tableOrdering(order, dirn, ""); }'); } parent::display($tpl); }
function users() { $itemID = JRequest::getInt('itemID'); JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables'); $item = JTable::getInstance('K2Item', 'Table'); $item->load($itemID); if (!K2HelperPermissions::canAddItem() && !K2HelperPermissions::canEditItem($item->created_by, $item->catid)) { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); } $K2Permissions = K2Permissions::getInstance(); if (!$K2Permissions->permissions->get('editAll')) { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); } JRequest::setVar('tmpl', 'component'); $mainframe = JFactory::getApplication(); $params = JComponentHelper::getParams('com_k2'); $language = JFactory::getLanguage(); $language->load('com_k2', JPATH_ADMINISTRATOR); $document = JFactory::getDocument(); if (version_compare(JVERSION, '1.6.0', 'ge')) { JHtml::_('behavior.framework'); } else { JHTML::_('behavior.mootools'); } // CSS $document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/k2.css?v=2.6.8'); // JS K2HelperHTML::loadjQuery(true); $document->addScript(JURI::root(true) . '/media/k2/assets/js/k2.js?v=2.6.8&sitepath=' . JURI::root(true) . '/'); $this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'views'); $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models'); $view = $this->getView('users', 'html'); $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'users' . DS . 'tmpl'); $view->setLayout('element'); $view->display(); }
function display($tpl = null) { JHTML::_('behavior.modal'); jimport('joomla.filesystem.file'); $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'i.id', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); $filter_trash = $mainframe->getUserStateFromRequest($option . $view . 'filter_trash', 'filter_trash', 0, 'int'); $filter_featured = $mainframe->getUserStateFromRequest($option . $view . 'filter_featured', 'filter_featured', -1, 'int'); $filter_category = $mainframe->getUserStateFromRequest($option . $view . 'filter_category', 'filter_category', 0, 'int'); $filter_author = $mainframe->getUserStateFromRequest($option . $view . 'filter_author', 'filter_author', 0, 'int'); $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); $tag = $mainframe->getUserStateFromRequest($option . $view . 'tag', 'tag', 0, 'int'); $language = $mainframe->getUserStateFromRequest($option . $view . 'language', 'language', '', 'string'); $params = JComponentHelper::getParams('com_k2'); $db = JFactory::getDBO(); $nullDate = $db->getNullDate(); $this->assignRef('nullDate', $nullDate); $model = $this->getModel(); $total = $model->getTotal(); if ($limitstart > $total - $limit) { $limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit); JRequest::setVar('limitstart', $limitstart); } $items = $model->getData(); if (K2_JVERSION != '15') { $langs = JLanguageHelper::getLanguages(); $langsMapping = array(); $langsMapping['*'] = JText::_('K2_ALL'); foreach ($langs as $lang) { $langsMapping[$lang->lang_code] = $lang->title; } } foreach ($items as $key => $item) { if (K2_JVERSION != '15') { $item->status = JHtml::_('jgrid.published', $item->published, $key, '', $filter_trash == 0, 'cb', $item->publish_up, $item->publish_down); $states = array(1 => array('featured', 'K2_FEATURED', 'K2_REMOVE_FEATURED_FLAG', 'K2_FEATURED', false, 'publish', 'publish'), 0 => array('featured', 'K2_NOT_FEATURED', 'K2_FLAG_AS_FEATURED', 'K2_NOT_FEATURED', false, 'unpublish', 'unpublish')); $item->featuredStatus = JHtml::_('jgrid.state', $states, $item->featured, $key, '', $filter_trash == 0); $item->canChange = $user->authorise('core.edit.state', 'com_k2.item.' . $item->id); $item->language = $item->language ? $item->language : '*'; if (isset($langsMapping)) { $item->language = $langsMapping[$item->language]; } } else { $now = JFactory::getDate(); $config = JFactory::getConfig(); $publish_up = JFactory::getDate($item->publish_up); $publish_down = JFactory::getDate($item->publish_down); $publish_up->setOffset($config->getValue('config.offset')); $publish_down->setOffset($config->getValue('config.offset')); $img = 'tick.png'; if ($now->toUnix() <= $publish_up->toUnix() && $item->published == 1) { $img = 'publish_y.png'; } else { if (($now->toUnix() <= $publish_down->toUnix() || $item->publish_down == $nullDate) && $item->published == 1) { $img = 'tick.png'; } else { if ($now->toUnix() > $publish_down->toUnix() && $item->published == 1) { $img = 'publish_r.png'; } } } $item->status = JHTML::_('grid.published', $item, $key, $img); if ($filter_trash) { $item->status = strip_tags($item->status, '<img>'); } $item->featuredStatus = ''; if (!$filter_trash) { $tmpTitle = $item->featured ? JText::_('K2_REMOVE_FEATURED_FLAG') : JText::_('K2_FLAG_AS_FEATURED'); $item->featuredStatus .= '<a href="javascript:void(0);" onclick="return listItemTask(\'cb' . $key . '\',\'featured\')" title="' . $tmpTitle . '">'; } $item->state = $item->published; $item->published = $item->featured; $item->featuredStatus .= strip_tags(JHTML::_('grid.published', $item, $key), '<img>'); $item->published = $item->state; if (!$filter_trash) { $item->featuredStatus .= '</a>'; } } } $this->assignRef('rows', $items); $lists = array(); $lists['search'] = $search; if (!$filter_order) { $filter_order = 'category'; } $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_trash_options[] = JHTML::_('select.option', 0, JText::_('K2_CURRENT')); $filter_trash_options[] = JHTML::_('select.option', 1, JText::_('K2_TRASHED')); $lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash); require_once JPATH_ADMINISTRATOR . '/components/com_k2/models/categories.php'; $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY')); $categories = $categoriesModel->categoriesTree(NULL, true, false); $categories_options = @array_merge($categories_option, $categories); $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category); $authors = $model->getItemsAuthors(); $options = array(); $options[] = JHTML::_('select.option', 0, '- ' . JText::_('K2_NO_USER') . ' -'); foreach ($authors as $author) { $name = $author->name; if ($author->block) { $name .= ' [' . JText::_('K2_USER_DISABLED') . ']'; } $options[] = JHTML::_('select.option', $author->id, $name); } $lists['authors'] = JHTML::_('select.genericlist', $options, 'filter_author', '', 'value', 'text', $filter_author); $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_PUBLISHING_STATE')); $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); $filter_featured_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_FEATURED_STATE')); $filter_featured_options[] = JHTML::_('select.option', 1, JText::_('K2_FEATURED')); $filter_featured_options[] = JHTML::_('select.option', 0, JText::_('K2_NOT_FEATURED')); $lists['featured'] = JHTML::_('select.genericlist', $filter_featured_options, 'filter_featured', '', 'value', 'text', $filter_featured); if ($params->get('showTagFilter')) { $tagsModel = K2Model::getInstance('Tags', 'K2Model'); $options = $tagsModel->getFilter(); $option = new JObject(); $option->id = 0; $option->name = JText::_('K2_SELECT_TAG'); array_unshift($options, $option); $lists['tag'] = JHTML::_('select.genericlist', $options, 'tag', '', 'id', 'name', $tag); } if (version_compare(JVERSION, '1.6.0', 'ge')) { $languages = JHTML::_('contentlanguage.existing', true, true); array_unshift($languages, JHTML::_('select.option', '', JText::_('K2_SELECT_LANGUAGE'))); $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language); } $this->assignRef('lists', $lists); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); $filters = array(); $columns = array(); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $dispatcher->trigger('onK2BeforeAssignFilters', array(&$filters)); $this->assignRef('filters', $filters); $dispatcher->trigger('onK2BeforeAssignColumns', array(&$columns)); $this->assignRef('columns', $columns); JToolBarHelper::title(JText::_('K2_ITEMS'), 'k2.png'); if ($filter_trash == 1) { JToolBarHelper::custom('restore', 'publish.png', 'publish_f2.png', 'K2_RESTORE', true); JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_ITEMS', 'remove', 'K2_DELETE'); } else { $params = JComponentHelper::getParams('com_k2'); $toolbar = JToolBar::getInstance('toolbar'); K2_JVERSION == '30' ? JToolBarHelper::custom('featured', 'featured.png', 'featured_f2.png', 'K2_TOGGLE_FEATURED_STATE', true) : JToolBarHelper::custom('featured', 'default.png', 'default_f2.png', 'K2_TOGGLE_FEATURED_STATE', true); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::custom('move', 'move.png', 'move_f2.png', 'K2_MOVE', true); JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'K2_COPY', true); JToolBarHelper::editList(); JToolBarHelper::addNew(); JToolBarHelper::trash('trash'); } $toolbar = JToolBar::getInstance('toolbar'); if (K2_JVERSION != '15') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings'); } // Import Joomla! content button if ($user->gid > 23 && !$params->get('hideImportButton')) { $buttonUrl = JURI::base() . 'index.php?option=com_k2&view=items&task=import'; $buttonText = JText::_('K2_IMPORT_JOOMLA_CONTENT'); if (K2_JVERSION == '30') { $button = '<a id="K2ImportContentButton" class="btn btn-small" href="' . $buttonUrl . '"><i class="icon-archive "></i>' . $buttonText . '</a>'; } else { $button = '<a id="K2ImportContentButton" href="' . $buttonUrl . '"><span class="icon-32-archive" title="' . $buttonText . '"></span>' . $buttonText . '</a>'; } $toolbar->appendButton('Custom', $button); } $this->loadHelper('html'); K2HelperHTML::subMenu(); $template = $mainframe->getTemplate(); $this->assignRef('template', $template); $this->assignRef('filter_featured', $filter_featured); $this->assignRef('filter_trash', $filter_trash); $this->assignRef('user', $user); if (K2_JVERSION != '15') { $dateFormat = JText::_('K2_J16_DATE_FORMAT'); } else { $dateFormat = JText::_('K2_DATE_FORMAT'); } $this->assignRef('dateFormat', $dateFormat); $ordering = ($this->lists['order'] == 'i.ordering' || $this->lists['order'] == 'category' || $this->filter_featured > 0 && $this->lists['order'] == 'i.featured_ordering') && !$this->filter_trash; $this->assignRef('ordering', $ordering); JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables'); $table = JTable::getInstance('K2Item', 'Table'); $this->assignRef('table', $table); // Joomla! 3.0 drag-n-drop sorting variables if (K2_JVERSION == '30') { if ($ordering) { $action = $this->filter_featured == 1 ? 'savefeaturedorder' : 'saveorder'; JHtml::_('sortablelist.sortable', 'k2ItemsList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2&view=items&task=' . $action . '&format=raw'); } $document = JFactory::getDocument(); $document->addScriptDeclaration(' Joomla.orderTable = function() { table = document.getElementById("sortTable"); direction = document.getElementById("directionTable"); order = table.options[table.selectedIndex].value; if (order != \'' . $this->lists['order'] . '\') { dirn = \'asc\'; } else { dirn = direction.options[direction.selectedIndex].value; } Joomla.tableOrdering(order, dirn, ""); }'); } parent::display($tpl); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $user =& JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'c.ordering', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_trash = $mainframe->getUserStateFromRequest($option . $view . 'filter_trash', 'filter_trash', 0, 'int'); $filter_category = $mainframe->getUserStateFromRequest($option . $view . 'filter_category', 'filter_category', 0, 'int'); $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int'); $language = $mainframe->getUserStateFromRequest($option . $view . 'language', 'language', '', 'string'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); $model =& $this->getModel(); $total = $model->getTotal(); if ($limitstart > $total - $limit) { $limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit); JRequest::setVar('limitstart', $limitstart); } $categories = $model->getData(); require_once JPATH_COMPONENT . DS . 'models' . DS . 'category.php'; $categoryModel = new K2ModelCategory(); $params =& JComponentHelper::getParams('com_k2'); $this->assignRef('params', $params); if ($params->get('showItemsCounterAdmin')) { for ($i = 0; $i < sizeof($categories); $i++) { $categories[$i]->numOfItems = $categoryModel->countCategoryItems($categories[$i]->id); $categories[$i]->numOfTrashedItems = $categoryModel->countCategoryItems($categories[$i]->id, 1); } } $this->assignRef('rows', $categories); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); $lists = array(); $lists['search'] = $search; $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_trash_options[] = JHTML::_('select.option', 0, JText::_('K2_CURRENT')); $filter_trash_options[] = JHTML::_('select.option', 1, JText::_('K2_TRASHED')); $lists['trash'] = JHTML::_('select.genericlist', $filter_trash_options, 'filter_trash', '', 'value', 'text', $filter_trash); $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); $categoriesModel = JModel::getInstance('Categories', 'K2Model'); $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY')); $categoriesFilter = $categoriesModel->categoriesTree(NULL, true, false); $categories_options = @array_merge($categories_option, $categoriesFilter); $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category); if (version_compare(JVERSION, '1.6.0', 'ge')) { $languages = JHTML::_('contentlanguage.existing', true, true); array_unshift($languages, JHTML::_('select.option', '', JText::_('K2_SELECT_LANGUAGE'))); $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $language); } $this->assignRef('lists', $lists); JToolBarHelper::title(JText::_('K2_CATEGORIES'), 'k2.png'); if ($filter_trash == 1) { JToolBarHelper::custom('restore', 'restore.png', 'restore_f2.png', 'K2_RESTORE', true); JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_CATEGORIES', 'remove', 'K2_DELETE'); } else { JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::customX('move', 'move.png', 'move_f2.png', 'K2_MOVE'); JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', 'K2_COPY'); JToolBarHelper::editList(); JToolBarHelper::addNew(); JToolBarHelper::trash('trash'); } if (K2_JVERSION == '16') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar =& JToolBar::getInstance('toolbar'); $toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings'); } $this->loadHelper('html'); K2HelperHTML::subMenu(); $this->assignRef('filter_trash', $filter_trash); $template = $mainframe->getTemplate(); $this->assignRef('template', $template); $ordering = ($this->lists['order'] == 'c.ordering' || $this->lists['order'] == 'c.parent, c.ordering') && !$this->filter_trash; $this->assignRef('ordering', $ordering); parent::display($tpl); }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'c.id', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int'); $filter_category = $mainframe->getUserStateFromRequest($option . $view . 'filter_category', 'filter_category', 0, 'int'); $filter_author = $mainframe->getUserStateFromRequest($option . $view . 'filter_author', 'filter_author', 0, 'int'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); if ($mainframe->isSite()) { $filter_author = $user->id; JRequest::setVar('filter_author', $user->id); } $this->loadHelper('html'); K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models'); $model = K2Model::getInstance('Comments', 'K2Model'); $params = JComponentHelper::getParams('com_k2'); $total = $model->getTotal(); if ($limitstart > $total - $limit) { $limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit); JRequest::setVar('limitstart', $limitstart); } $comments = $model->getData(); $reportLink = $mainframe->isAdmin() ? 'index.php?option=com_k2&view=user&task=report&id=' : 'index.php?option=com_k2&view=comments&task=reportSpammer&id='; foreach ($comments as $key => $comment) { $comment->reportUserLink = false; $comment->commenterLastVisitIP = NULL; if ($comment->userID) { $db = JFactory::getDBO(); $db->setQuery("SELECT ip FROM #__k2_users WHERE userID = " . $comment->userID); $comment->commenterLastVisitIP = $db->loadResult(); $commenter = JFactory::getUser($comment->userID); if ($commenter->name) { $comment->userName = $commenter->name; } if ($mainframe->isSite()) { if (K2_JVERSION != '15') { if ($user->authorise('core.admin', 'com_k2')) { $comment->reportUserLink = JRoute::_($reportLink . $comment->userID); } } else { if ($user->gid > 24) { $comment->reportUserLink = JRoute::_($reportLink . $comment->userID); } } } else { $comment->reportUserLink = JRoute::_($reportLink . $comment->userID); } } if ($mainframe->isSite()) { $comment->status = K2HelperHTML::stateToggler($comment, $key); } else { $comment->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $comment, $key) : JHtml::_('jgrid.published', $comment->published, $key); } } $this->assignRef('rows', $comments); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); $lists = array(); $lists['search'] = $search; $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); $categoriesModel = K2Model::getInstance('Categories', 'K2Model'); $categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY')); $categories = $categoriesModel->categoriesTree(null, true, false); $categories_options = @array_merge($categories_option, $categories); $lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'filter_category', '', 'value', 'text', $filter_category); $lists['authors'] = JHTML::_('list.users', 'filter_author', $filter_author, true, ''); $this->assignRef('lists', $lists); $this->assignRef('mainframe', $mainframe); if (K2_JVERSION != '15') { $dateFormat = JText::_('K2_J16_DATE_FORMAT'); } else { $dateFormat = JText::_('K2_DATE_FORMAT'); } $this->assignRef('dateFormat', $dateFormat); if ($mainframe->isAdmin()) { JToolBarHelper::title(JText::_('K2_COMMENTS'), 'k2.png'); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::deleteList('', 'remove', 'K2_DELETE'); JToolBarHelper::custom('deleteUnpublished', 'delete', 'delete', 'K2_DELETE_ALL_UNPUBLISHED', false); $toolbar = JToolBar::getInstance('toolbar'); if (K2_JVERSION != '15') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings'); } K2HelperHTML::subMenu(); if (K2_JVERSION != '15') { $userEditLink = JURI::base() . 'index.php?option=com_k2&view=user&cid='; } else { $userEditLink = JURI::base() . 'index.php?option=com_k2&view=user&cid='; } $this->assignRef('userEditLink', $userEditLink); } $document = JFactory::getDocument(); $document->addScriptDeclaration('var K2Language = ["' . JText::_('K2_YOU_CANNOT_EDIT_TWO_COMMENTS_AT_THE_SAME_TIME', true) . '", "' . JText::_('K2_THIS_WILL_PERMANENTLY_DELETE_ALL_UNPUBLISHED_COMMENTS_ARE_YOU_SURE', true) . '", "' . JText::_('K2_REPORT_USER_WARNING', true) . '"];'); if ($mainframe->isSite()) { // CSS $document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/k2.frontend.css?v=2.6.2'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/general.css'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/system.css'); if (K2_JVERSION != '15') { $document->addStyleSheet(JURI::root(true) . '/administrator/templates/bluestork/css/template.css'); $document->addStyleSheet(JURI::root(true) . '/media/system/css/system.css'); } else { $document->addStyleSheet(JURI::root(true) . '/administrator/templates/khepri/css/general.css'); } } parent::display($tpl); }
} else { $user->gid = 1; } if ($params->get('lockTags') && !$user->authorise('core.admin', 'com_k2') && ($view == 'tags' || $view == 'tag') || !$user->authorise('core.admin', 'com_k2') && ($view == 'extrafield' || $view == 'extrafields' || $view == 'extrafieldsgroup' || $view == 'extrafieldsgroups' || $view == 'user' || $view == 'users' && $task != 'element' || $view == 'usergroup' || $view == 'usergroups')) { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); } } $document = JFactory::getDocument(); if (version_compare(JVERSION, '1.6.0', 'ge')) { JHtml::_('behavior.framework'); } else { JHTML::_('behavior.mootools'); } // CSS $document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/k2.css?v=2.6.9'); K2HelperHTML::loadjQuery(true, JRequest::getCmd('view') == 'media'); // JS if (K2_JVERSION == '30') { JHtml::_('formbehavior.chosen', 'select'); } $document->addScriptDeclaration('K2JVersion = "' . K2_JVERSION . '";'); $document->addScript(JURI::root(true) . '/media/k2/assets/js/k2.js?v=2.6.9&sitepath=' . JURI::root(true) . '/'); // Container CSS class definition if (K2_JVERSION == '15') { $k2CSSContainerClass = ' isJ15'; } elseif (K2_JVERSION == '25') { $k2CSSContainerClass = ' isJ25'; } elseif (K2_JVERSION == '30') { $k2CSSContainerClass = ' isJ25 isJ30'; } else { $k2CSSContainerClass = '';
function display($tpl = null) { $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $db = JFactory::getDBO(); $params = JComponentHelper::getParams('com_k2'); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'juser.name', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_status = $mainframe->getUserStateFromRequest($option . $view . 'filter_status', 'filter_status', -1, 'int'); $filter_group = $mainframe->getUserStateFromRequest($option . $view . 'filter_group', 'filter_group', '', 'string'); $filter_group_k2 = $mainframe->getUserStateFromRequest($option . $view . 'filter_group_k2', 'filter_group_k2', '', 'string'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models'); $model = K2Model::getInstance('Users', 'K2Model'); $total = $model->getTotal(); if ($limitstart > $total - $limit) { $limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit); JRequest::setVar('limitstart', $limitstart); } $users = $model->getData(); $task = JRequest::getCmd('task'); for ($i = 0; $i < sizeof($users); $i++) { $users[$i]->loggedin = $model->checkLogin($users[$i]->id); $users[$i]->profileID = $model->hasProfile($users[$i]->id); if ($users[$i]->profileID) { $db->setQuery("SELECT ip FROM #__k2_users WHERE id = " . $users[$i]->profileID); $users[$i]->ip = $db->loadResult(); } else { $users[$i]->ip = ''; } if ($users[$i]->lastvisitDate == "0000-00-00 00:00:00") { $users[$i]->lvisit = false; } else { $users[$i]->lvisit = $users[$i]->lastvisitDate; } $users[$i]->link = JRoute::_('index.php?option=com_k2&view=user&cid=' . $users[$i]->id); if (K2_JVERSION == '15') { $users[$i]->published = $users[$i]->loggedin; $users[$i]->loggedInStatus = strip_tags(JHTML::_('grid.published', $users[$i], $i), '<img>'); $users[$i]->blockStatus = ''; if ($users[$i]->block) { $users[$i]->blockStatus .= '<a title="' . JText::_('K2_ENABLE') . '" onclick="return listItemTask(\'cb' . $i . ',\'enable\')" href="#"><img alt="' . JText::_('K2_ENABLED') . '" src="images/publish_x.png"></a>'; } else { $users[$i]->blockStatus .= '<a title="' . JText::_('K2_DISABLE') . '" onclick="return listItemTask(\'cb' . $i . ',\'disable\')" href="#"><img alt="' . JText::_('K2_DISABLED') . '" src="images/tick.png"></a>'; } if ($task == 'element') { $users[$i]->blockStatus = strip_tags($users[$i]->blockStatus, '<img>'); } } else { $states = array(1 => array('', 'K2_LOGGED_IN', 'K2_LOGGED_IN', 'K2_LOGGED_IN', false, 'publish', 'publish'), 0 => array('', 'K2_NOT_LOGGED_IN', 'K2_NOT_LOGGED_IN', 'K2_NOT_LOGGED_IN', false, 'unpublish', 'unpublish')); $users[$i]->loggedInStatus = JHtml::_('jgrid.state', $states, $users[$i]->loggedin, $i, '', false); $states = array(0 => array('disable', 'K2_ENABLED', 'K2_DISABLE', 'K2_ENABLED', false, 'publish', 'publish'), 1 => array('enable', 'K2_DISABLED', 'K2_ENABLE', 'K2_DISABLED', false, 'unpublish', 'unpublish')); $users[$i]->blockStatus = JHtml::_('jgrid.state', $states, $users[$i]->block, $i, '', $task != 'element'); } } $this->assignRef('rows', $users); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); $lists = array(); $lists['search'] = $search; $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_status_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); $filter_status_options[] = JHTML::_('select.option', 0, JText::_('K2_ENABLED')); $filter_status_options[] = JHTML::_('select.option', 1, JText::_('K2_BLOCKED')); $lists['status'] = JHTML::_('select.genericlist', $filter_status_options, 'filter_status', '', 'value', 'text', $filter_status); $userGroups = $model->getUserGroups(); $groups[] = JHTML::_('select.option', '0', JText::_('K2_SELECT_JOOMLA_GROUP')); foreach ($userGroups as $userGroup) { $groups[] = JHTML::_('select.option', $userGroup->value, $userGroup->text); } $lists['filter_group'] = JHTML::_('select.genericlist', $groups, 'filter_group', '', 'value', 'text', $filter_group); $K2userGroups = $model->getUserGroups('k2'); $K2groups[] = JHTML::_('select.option', '0', JText::_('K2_SELECT_K2_GROUP')); foreach ($K2userGroups as $K2userGroup) { $K2groups[] = JHTML::_('select.option', $K2userGroup->id, $K2userGroup->name); } $lists['filter_group_k2'] = JHTML::_('select.genericlist', $K2groups, 'filter_group_k2', '', 'value', 'text', $filter_group_k2); $this->assignRef('lists', $lists); if (K2_JVERSION != '15') { $dateFormat = JText::_('K2_J16_DATE_FORMAT'); } else { $dateFormat = JText::_('K2_DATE_FORMAT'); } $this->assignRef('dateFormat', $dateFormat); $template = $mainframe->getTemplate(); $this->assignRef('template', $template); if ($mainframe->isAdmin()) { JToolBarHelper::title(JText::_('K2_USERS'), 'k2.png'); JToolBarHelper::custom('move', 'move.png', 'move_f2.png', 'K2_MOVE', true); JToolBarHelper::deleteList('K2_WARNING_YOU_ARE_ABOUT_TO_DELETE_THE_SELECTED_USERS_PERMANENTLY_FROM_THE_SYSTEM', 'delete', 'K2_DELETE'); JToolBarHelper::publishList('enable', 'K2_ENABLE'); JToolBarHelper::unpublishList('disable', 'K2_DISABLE'); JToolBarHelper::editList(); JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_RESET_SELECTED_USERS', 'remove', 'K2_RESET_USER_DETAILS'); $toolbar = JToolBar::getInstance('toolbar'); if (K2_JVERSION != '15') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings'); } $this->loadHelper('html'); K2HelperHTML::subMenu(); $user = JFactory::getUser(); $canImport = false; if (K2_JVERSION == '15') { $canImport = $user->gid > 23; } else { $canImport = $user->authorise('core.admin', 'com_k2'); } if ($canImport) { if (!$params->get('hideImportButton')) { $buttonUrl = JURI::base() . 'index.php?option=com_k2&view=users&task=import'; $buttonText = JText::_('K2_IMPORT_JOOMLA_USERS'); if (K2_JVERSION == '30') { $button = '<a id="K2ImportUsersButton" class="btn btn-small" href="' . $buttonUrl . '"><i class="icon-archive "></i>' . $buttonText . '</a>'; } else { $button = '<a id="K2ImportUsersButton" href="' . $buttonUrl . '"><span class="icon-32-archive" title="' . $buttonText . '"></span>' . $buttonText . '</a>'; } $toolbar->appendButton('Custom', $button); } } $document = JFactory::getDocument(); $document->addScriptDeclaration('var K2Language = ["' . JText::_('K2_REPORT_USER_WARNING', true) . '"];'); } $isAdmin = $mainframe->isAdmin(); $this->assignRef('isAdmin', $isAdmin); if ($mainframe->isSite()) { // CSS $document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/k2.frontend.css?v=2.7.0'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/general.css'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/system.css'); if (K2_JVERSION != '15') { $document->addStyleSheet(JURI::root(true) . '/administrator/templates/bluestork/css/template.css'); $document->addStyleSheet(JURI::root(true) . '/media/system/css/system.css'); } else { $document->addStyleSheet(JURI::root(true) . '/administrator/templates/khepri/css/general.css'); } } parent::display($tpl); }
function onAfterRoute() { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $basepath = $mainframe->isSite() ? JPATH_SITE : JPATH_ADMINISTRATOR; JPlugin::loadLanguage('com_k2', $basepath); if (K2_JVERSION != '15') { JPlugin::loadLanguage('com_k2.j16', JPATH_ADMINISTRATOR, null, true); } if ($mainframe->isAdmin()) { return; } if ((JRequest::getCmd('task') == 'add' || JRequest::getCmd('task') == 'edit') && JRequest::getCmd('option') == 'com_k2') { return; } // Joomla! modal trigger if (!$user->guest || JRequest::getCmd('option') == 'com_k2' && JRequest::getCmd('view') == 'item' || defined('K2_JOOMLA_MODAL_REQUIRED')) { JHTML::_('behavior.modal'); } $params = JComponentHelper::getParams('com_k2'); $document = JFactory::getDocument(); // jQuery and K2 JS loading K2HelperHTML::loadjQuery(); $document->addScript(JURI::root(true) . '/components/com_k2/js/k2.js?v2.7.0&sitepath=' . JURI::root(true) . '/'); //$document->addScriptDeclaration("var K2SitePath = '".JURI::root(true)."/';"); if (JRequest::getCmd('task') == 'search' && $params->get('googleSearch')) { $language = JFactory::getLanguage(); $lang = $language->getTag(); // Fallback to the new container ID without breaking things $googleSearchContainerID = trim($params->get('googleSearchContainer', 'k2GoogleSearchContainer')); if ($googleSearchContainerID == 'k2Container') { $googleSearchContainerID = 'k2GoogleSearchContainer'; } $document->addScript('http://www.google.com/jsapi'); $js = ' //<![CDATA[ google.load("search", "1", {"language" : "' . $lang . '"}); function OnLoad(){ var searchControl = new google.search.SearchControl(); var siteSearch = new google.search.WebSearch(); siteSearch.setUserDefinedLabel("' . $mainframe->getCfg('sitename') . '"); siteSearch.setUserDefinedClassSuffix("k2"); options = new google.search.SearcherOptions(); options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN); siteSearch.setSiteRestriction("' . JURI::root() . '"); searchControl.addSearcher(siteSearch, options); searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET); searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF); searchControl.draw(document.getElementById("' . $googleSearchContainerID . '")); searchControl.execute("' . JRequest::getString('searchword') . '"); } google.setOnLoadCallback(OnLoad); //]]> '; $document->addScriptDeclaration($js); } // Add related CSS to the <head> if ($document->getType() == 'html' && $params->get('enable_css')) { jimport('joomla.filesystem.file'); // k2.css if (JFile::exists(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'css' . DS . 'k2.css')) { $document->addStyleSheet(JURI::root(true) . '/templates/' . $mainframe->getTemplate() . '/css/k2.css'); } else { $document->addStyleSheet(JURI::root(true) . '/components/com_k2/css/k2.css'); } // k2.print.css if (JRequest::getInt('print') == 1) { if (JFile::exists(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'css' . DS . 'k2.print.css')) { $document->addStyleSheet(JURI::root(true) . '/templates/' . $mainframe->getTemplate() . '/css/k2.print.css', 'text/css', 'print'); } else { $document->addStyleSheet(JURI::root(true) . '/components/com_k2/css/k2.print.css', 'text/css', 'print'); } } } }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $user =& JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'groupname', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'); $filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int'); $search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string'); $search = JString::strtolower($search); $filter_type = $mainframe->getUserStateFromRequest($option . $view . 'filter_type', 'filter_type', '', 'string'); $filter_group = $mainframe->getUserStateFromRequest($option . $view . 'filter_group', 'filter_group', '', 'string'); $model =& $this->getModel(); $extraFields = $model->getData(); $this->assignRef('rows', $extraFields); $total = $model->getTotal(); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $this->assignRef('page', $pageNav); $lists = array(); $lists['search'] = $search; $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE')); $filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED')); $filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED')); $lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state); $extraFieldGroups = $model->getGroups(); $groups[] = JHTML::_('select.option', '0', JText::_('K2_SELECT_GROUP')); foreach ($extraFieldGroups as $extraFieldGroup) { $groups[] = JHTML::_('select.option', $extraFieldGroup->id, $extraFieldGroup->name); } $lists['group'] = JHTML::_('select.genericlist', $groups, 'filter_group', '', 'value', 'text', $filter_group); $typeOptions[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_TYPE')); $typeOptions[] = JHTML::_('select.option', 'textfield', JText::_('K2_TEXT_FIELD')); $typeOptions[] = JHTML::_('select.option', 'textarea', JText::_('K2_TEXTAREA')); $typeOptions[] = JHTML::_('select.option', 'select', JText::_('K2_DROPDOWN_SELECTION')); $typeOptions[] = JHTML::_('select.option', 'multipleSelect', JText::_('K2_MULTISELECT_LIST')); $typeOptions[] = JHTML::_('select.option', 'radio', JText::_('K2_RADIO_BUTTONS')); $typeOptions[] = JHTML::_('select.option', 'link', JText::_('K2_LINK')); $typeOptions[] = JHTML::_('select.option', 'csv', JText::_('K2_CSV_DATA')); $typeOptions[] = JHTML::_('select.option', 'labels', JText::_('K2_SEARCHABLE_LABELS')); $typeOptions[] = JHTML::_('select.option', 'date', JText::_('K2_DATE')); $lists['type'] = JHTML::_('select.genericlist', $typeOptions, 'filter_type', '', 'value', 'text', $filter_type); $this->assignRef('lists', $lists); JToolBarHelper::title(JText::_('K2_EXTRA_FIELDS'), 'k2.png'); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::deleteList('K2_ARE_YOU_SURE_YOU_WANT_TO_DELETE_SELECTED_EXTRA_FIELDS', 'remove', 'K2_DELETE'); JToolBarHelper::editList(); JToolBarHelper::addNew(); if (K2_JVERSION == '16') { JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS'); } else { $toolbar =& JToolBar::getInstance('toolbar'); $toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings'); } $this->loadHelper('html'); K2HelperHTML::subMenu(); parent::display($tpl); }