Example #1
0
    function display($tpl = null)
    {
        JRequest::setVar('hidemainmenu', 1);
        $model =& $this->getModel();
        $extraField = $model->getData();
        if (!$extraField->id) {
            $extraField->published = 1;
        }
        $this->assignRef('row', $extraField);
        $lists = array();
        $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $extraField->published);
        $groups[] = JHTML::_('select.option', 0, JText::_('K2_CREATE_NEW_GROUP'));
        require_once JPATH_COMPONENT . DS . 'models' . DS . 'extrafields.php';
        $extraFieldModel = new K2ModelExtraFields();
        $uniqueGroups = $extraFieldModel->getGroups();
        foreach ($uniqueGroups as $group) {
            $groups[] = JHTML::_('select.option', $group->id, $group->name);
        }
        $lists['group'] = JHTML::_('select.genericlist', $groups, 'groups', '', 'value', 'text', $extraField->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, 'type', '', 'value', 'text', $extraField->type);
        $this->assignRef('lists', $lists);
        JRequest::getInt('cid') ? $title = JText::_('K2_EDIT_EXTRA_FIELD') : ($title = JText::_('K2_ADD_EXTRA_FIELD'));
        JToolBarHelper::title($title, 'k2.png');
        JToolBarHelper::save();
        JToolBarHelper::apply();
        JToolBarHelper::cancel();
        JHTML::_('behavior.calendar');
        $document =& JFactory::getDocument();
        $document->addScriptDeclaration('
		var K2Language = [
		"' . JText::_('K2_REMOVE', true) . '", 
		"' . JText::_('K2_OPTIONAL', true) . '",
		"' . JText::_('K2_COMMA_SEPARATED_VALUES', true) . '",
		"' . JText::_('K2_USE_EDITOR', true) . '",
		"' . JText::_('K2_ALL_SETTINGS_ABOVE_ARE_OPTIONAL', true) . '",
		"' . JText::_('K2_ADD_AN_OPTION', true) . '",
		"' . JText::_('K2_LINK_TEXT', true) . '",
		"' . JText::_('K2_URL', true) . '",
		"' . JText::_('K2_OPEN_IN', true) . '",
		"' . JText::_('K2_SAME_WINDOW', true) . '",
		"' . JText::_('K2_NEW_WINDOW', true) . '",
		"' . JText::_('K2_CLASSIC_JAVASCRIPT_POPUP', true) . '",
		"' . JText::_('K2_LIGHTBOX_POPUP', true) . '",
		"' . JText::_('K2_RESET_VALUE', true) . '",
		"' . JText::_('K2_CALENDAR', true) . '",
		"' . JText::_('K2_PLEASE_SELECT_A_FIELD_TYPE_FROM_THE_LIST_ABOVE', true) . '",
		];');
        parent::display($tpl);
    }
Example #2
0
 function display($tpl = null)
 {
     JRequest::setVar('hidemainmenu', 1);
     $model =& $this->getModel();
     $category = $model->getData();
     JFilterOutput::objectHTMLSafe($category);
     if (!$category->id) {
         $category->published = 1;
     }
     $this->assignRef('row', $category);
     $wysiwyg =& JFactory::getEditor();
     $editor = $wysiwyg->display('description', $category->description, '100%', '250', '40', '5', array('pagebreak', 'readmore'));
     $this->assignRef('editor', $editor);
     $lists = array();
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $category->published);
     $lists['access'] = JHTML::_('list.accesslevel', $category);
     $query = 'SELECT ordering AS value, name AS text FROM #__k2_categories ORDER BY ordering';
     $lists['ordering'] = JHTML::_('list.specificordering', $category, $category->id, $query);
     $categories[] = JHTML::_('select.option', '0', JText::_('-- None --'));
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'categories.php';
     $categoriesModel = new K2ModelCategories();
     $tree = $categoriesModel->categoriesTree($category);
     $categories = array_merge($categories, $tree);
     $lists['parent'] = JHTML::_('select.genericlist', $categories, 'parent', 'class="inputbox"', 'value', 'text', $category->parent);
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'extrafields.php';
     $extraFieldsModel = new K2ModelExtraFields();
     $groups = $extraFieldsModel->getGroups();
     $group[] = JHTML::_('select.option', '0', JText::_('-- None --'), 'id', 'name');
     $group = array_merge($group, $groups);
     $lists['extraFieldsGroup'] = JHTML::_('select.genericlist', $group, 'extraFieldsGroup', 'class="inputbox" size="1" ', 'id', 'name', $category->extraFieldsGroup);
     JPluginHelper::importPlugin('k2');
     $dispatcher =& JDispatcher::getInstance();
     $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$category, 'category'));
     $this->assignRef('K2Plugins', $K2Plugins);
     $params =& JComponentHelper::getParams('com_k2');
     $this->assignRef('params', $params);
     $form = new JParameter('', JPATH_COMPONENT . DS . 'models' . DS . 'category.xml');
     $form->loadINI($category->params);
     $this->assignRef('form', $form);
     $categories[0] = JHTML::_('select.option', '0', JText::_('-- None --'));
     $lists['inheritFrom'] = JHTML::_('select.genericlist', $categories, 'params[inheritFrom]', 'class="inputbox"', 'value', 'text', $form->get('inheritFrom'));
     $this->assignRef('lists', $lists);
     JRequest::getInt('cid') ? $title = JText::_('Edit Category') : ($title = JText::_('Add Category'));
     JToolBarHelper::title($title, 'k2.png');
     JToolBarHelper::save();
     JToolBarHelper::custom('saveAndNew', 'save.png', 'save_f2.png', 'Save & New', false);
     JToolBarHelper::apply();
     JToolBarHelper::cancel();
     parent::display($tpl);
 }
Example #3
0
 function display($tpl = null)
 {
     JRequest::setVar('hidemainmenu', 1);
     $model =& $this->getModel();
     $extraField = $model->getData();
     if (!$extraField->id) {
         $extraField->published = 1;
     }
     $this->assignRef('row', $extraField);
     $lists = array();
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $extraField->published);
     $groups[] = JHTML::_('select.option', 0, JText::_('Create new group'));
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'extrafields.php';
     $extraFieldModel = new K2ModelExtraFields();
     $uniqueGroups = $extraFieldModel->getGroups();
     foreach ($uniqueGroups as $group) {
         $groups[] = JHTML::_('select.option', $group->id, $group->name);
     }
     $lists['group'] = JHTML::_('select.genericlist', $groups, 'groups', '', 'value', 'text', $extraField->group);
     $typeOptions[] = JHTML::_('select.option', 0, JText::_('-- Select Type --'));
     $typeOptions[] = JHTML::_('select.option', 'textfield', JText::_('Text field'));
     $typeOptions[] = JHTML::_('select.option', 'textarea', JText::_('Textarea'));
     $typeOptions[] = JHTML::_('select.option', 'select', JText::_('Drop-down selection'));
     $typeOptions[] = JHTML::_('select.option', 'multipleSelect', JText::_('Multi-select list'));
     $typeOptions[] = JHTML::_('select.option', 'radio', JText::_('Radio buttons'));
     $typeOptions[] = JHTML::_('select.option', 'link', JText::_('Link'));
     $typeOptions[] = JHTML::_('select.option', 'csv', JText::_('CSV Data'));
     $typeOptions[] = JHTML::_('select.option', 'labels', JText::_('Searchable Labels'));
     $lists['type'] = JHTML::_('select.genericlist', $typeOptions, 'type', '', 'value', 'text', $extraField->type);
     $this->assignRef('lists', $lists);
     JRequest::getInt('cid') ? $title = JText::_('Edit extra field') : ($title = JText::_('Add extra field'));
     JToolBarHelper::title($title, 'k2.png');
     JToolBarHelper::save();
     JToolBarHelper::apply();
     JToolBarHelper::cancel();
     parent::display($tpl);
 }
Example #4
0
 function display($tpl = null)
 {
     JRequest::setVar('hidemainmenu', 1);
     $model =& $this->getModel();
     $category = $model->getData();
     if (K2_JVERSION == '15') {
         JFilterOutput::objectHTMLSafe($category);
     } else {
         JFilterOutput::objectHTMLSafe($category, ENT_QUOTES, array('params', 'plugins'));
     }
     if (!$category->id) {
         $category->published = 1;
     }
     $this->assignRef('row', $category);
     $wysiwyg =& JFactory::getEditor();
     $editor = $wysiwyg->display('description', $category->description, '100%', '250px', '', '', array('pagebreak', 'readmore'));
     $this->assignRef('editor', $editor);
     $document =& JFactory::getDocument();
     $js = "\n\t\tvar K2SitePath = '" . JURI::root(true) . "/';\n\t\tvar K2BasePath = '" . JURI::base(true) . "/';\n\t\t";
     $document->addScriptDeclaration($js);
     $lists = array();
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $category->published);
     $lists['access'] = JHTML::_('list.accesslevel', $category);
     $query = 'SELECT ordering AS value, name AS text FROM #__k2_categories ORDER BY ordering';
     $lists['ordering'] = JHTML::_('list.specificordering', $category, $category->id, $query);
     $categories[] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS'));
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'categories.php';
     $categoriesModel = new K2ModelCategories();
     $tree = $categoriesModel->categoriesTree($category);
     $categories = array_merge($categories, $tree);
     $lists['parent'] = JHTML::_('select.genericlist', $categories, 'parent', 'class="inputbox"', 'value', 'text', $category->parent);
     require_once JPATH_COMPONENT . DS . 'models' . DS . 'extrafields.php';
     $extraFieldsModel = new K2ModelExtraFields();
     $groups = $extraFieldsModel->getGroups();
     $group[] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS'), 'id', 'name');
     $group = array_merge($group, $groups);
     $lists['extraFieldsGroup'] = JHTML::_('select.genericlist', $group, 'extraFieldsGroup', 'class="inputbox" size="1" ', 'id', 'name', $category->extraFieldsGroup);
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $languages = JHTML::_('contentlanguage.existing', true, true);
         $lists['language'] = JHTML::_('select.genericlist', $languages, 'language', '', 'value', 'text', $category->language);
     }
     JPluginHelper::importPlugin('k2');
     $dispatcher =& JDispatcher::getInstance();
     $K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$category, 'category'));
     $this->assignRef('K2Plugins', $K2Plugins);
     $params =& JComponentHelper::getParams('com_k2');
     $this->assignRef('params', $params);
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         jimport('joomla.form.form');
         $form = JForm::getInstance('categoryForm', JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'category.xml');
         $values = array('params' => json_decode($category->params));
         $form->bind($values);
         $inheritFrom = isset($values['params']->inheritFrom) ? $values['params']->inheritFrom : 0;
     } else {
         $form = new JParameter('', JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'category.xml');
         $form->loadINI($category->params);
         $inheritFrom = $form->get('inheritFrom');
     }
     $this->assignRef('form', $form);
     $categories[0] = JHTML::_('select.option', '0', JText::_('K2_NONE_ONSELECTLISTS'));
     $lists['inheritFrom'] = JHTML::_('select.genericlist', $categories, 'params[inheritFrom]', 'class="inputbox"', 'value', 'text', $inheritFrom);
     $this->assignRef('lists', $lists);
     JRequest::getInt('cid') ? $title = JText::_('K2_EDIT_CATEGORY') : ($title = JText::_('K2_ADD_CATEGORY'));
     JToolBarHelper::title($title, 'k2.png');
     JToolBarHelper::save();
     JToolBarHelper::custom('saveAndNew', 'save.png', 'save_f2.png', 'K2_SAVE_AND_NEW', false);
     JToolBarHelper::apply();
     JToolBarHelper::cancel();
     // ACE ACL integration
     $definedConstants = get_defined_constants();
     if (!empty($definedConstants['ACEACL']) && AceaclApi::authorize('permissions', 'com_aceacl')) {
         $aceAclFlag = true;
     } else {
         $aceAclFlag = false;
     }
     $this->assignRef('aceAclFlag', $aceAclFlag);
     parent::display($tpl);
 }