本文整理汇总了PHP中JParameter::loadINI方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::loadINI方法的具体用法?PHP JParameter::loadINI怎么用?PHP JParameter::loadINI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JParameter
的用法示例。
在下文中一共展示了JParameter::loadINI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
JHTML::_('behavior.tooltip');
JRequest::setVar('hidemainmenu', 1);
$model =& $this->getModel();
$userGroup = $model->getData();
JFilterOutput::objectHTMLSafe($userGroup);
$this->assignRef('row', $userGroup);
$form = new JParameter('', JPATH_COMPONENT . DS . 'models' . DS . 'userGroup.xml');
$form->loadINI($userGroup->permissions);
$this->assignRef('form', $form);
$appliedCategories = $form->get('categories');
$this->assignRef('categories', $appliedCategories);
$lists = array();
require_once JPATH_COMPONENT . DS . 'models' . DS . 'categories.php';
$categoriesModel = new K2ModelCategories();
$categories = $categoriesModel->categoriesTree(NULL, true);
$categories_options = @array_merge($categories_option, $categories);
$lists['categories'] = JHTML::_('select.genericlist', $categories, 'params[categories][]', 'multiple="multiple" style="width:90%;" size="15"', 'value', 'text', $appliedCategories);
$lists['inheritance'] = JHTML::_('select.booleanlist', 'params[inheritance]', NULL, $form->get('inheritance'));
$this->assignRef('lists', $lists);
JRequest::getInt('cid') ? $title = JText::_('Edit user group') : ($title = JText::_('Add user group'));
JToolBarHelper::title(JText::_($title));
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
parent::display($tpl);
}
示例2: display
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);
}
示例3: display
function display($tpl = null)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
JHTML::_('behavior.tooltip');
//get vars
$cid = JRequest::getVar('cid');
$field_type = JRequest::getVar('field_type', 0);
//Get data from the model
$model = $this->getModel();
if (FLEXI_J16GE) {
$form = $this->get('Form');
} else {
$row =& $this->get('Field');
//Import File system
jimport('joomla.filesystem.file');
// Create the form
$pluginpath = JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . $field_type . '.xml';
if (JFile::exists($pluginpath)) {
$form = new JParameter('', $pluginpath);
} else {
$form = new JParameter('', JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . 'core.xml');
}
$form->loadINI($row->attribs);
}
$isnew = FLEXI_J16GE ? !$form->getValue('id') : !$row->id;
// fail if checked out not by 'me'
if (!$isnew) {
if ($model->isCheckedOut($user->get('id'))) {
JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
$app->redirect('index.php?option=com_flexicontent&view=fields');
}
}
if ($field_type) {
if (!FLEXI_J16GE) {
echo $form->render('params', 'group-' . $field_type);
} else {
foreach ($form->getFieldset('group-' . $field_type) as $field) {
echo '<fieldset class="panelform">' . $field->label . $field->input . '</fieldset>' . "\n";
}
}
} else {
echo "<br /><span style=\"padding-left:25px;\"'>" . JText::_('FLEXI_APPLY_TO_SEE_THE_PARAMETERS') . "</span><br /><br />";
}
//parent::display($tpl);
}
示例4: display
function display($tpl = null)
{
JHTML::_('behavior.tooltip');
JRequest::setVar('hidemainmenu', 1);
$model = $this->getModel();
$userGroup = $model->getData();
if (K2_JVERSION == '15') {
JFilterOutput::objectHTMLSafe($userGroup);
} else {
JFilterOutput::objectHTMLSafe($userGroup, ENT_QUOTES, 'permissions');
}
$this->assignRef('row', $userGroup);
if (K2_JVERSION == '15') {
$form = new JParameter('', JPATH_COMPONENT . DS . 'models' . DS . 'usergroup.xml');
$form->loadINI($userGroup->permissions);
$appliedCategories = $form->get('categories');
$inheritance = $form->get('inheritance');
} else {
jimport('joomla.form.form');
$form = JForm::getInstance('permissions', JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'usergroup.xml');
$values = array('params' => json_decode($userGroup->permissions));
$form->bind($values);
$inheritance = isset($values['params']->inheritance) ? $values['params']->inheritance : 0;
$appliedCategories = isset($values['params']->categories) ? $values['params']->categories : '';
}
$this->assignRef('form', $form);
$this->assignRef('categories', $appliedCategories);
$lists = array();
require_once JPATH_ADMINISTRATOR . '/components/com_k2/models/categories.php';
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
$categories = $categoriesModel->categoriesTree(NULL, true);
$categories_options = @array_merge($categories_option, $categories);
$lists['categories'] = JHTML::_('select.genericlist', $categories, 'params[categories][]', 'multiple="multiple" size="15"', 'value', 'text', $appliedCategories);
$lists['inheritance'] = JHTML::_('select.booleanlist', 'params[inheritance]', NULL, $inheritance);
$this->assignRef('lists', $lists);
JRequest::getInt('cid') ? $title = JText::_('K2_EDIT_USER_GROUP') : ($title = JText::_('K2_ADD_USER_GROUP'));
JToolBarHelper::title($title, 'k2.png');
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
parent::display($tpl);
}
示例5: getParameters
/**
* Renders a form using an xml path
*
* @param array $config
* @return void
*/
public function getParameters($config = array())
{
$config = new KConfig($config);
$config->append(array('data' => array(), 'element_paths' => array(dirname(__FILE__) . '/forms')));
$content = file_exists($config->path) ? file_get_contents($config->path) : '';
$paths = array();
//replace all the addpath="{KServiceIdentifier}" with real path
if (preg_match_all('/addpath="([^"]+)"/', $content, $paths)) {
$replaces = array();
foreach ($paths[1] as $path) {
if (strpos($path, '.')) {
$replaces[] = str_replace(JPATH_ROOT . '/', '', dirname(KLoader::path($path . '.dummy')));
} else {
$replaces[] = $path;
}
}
$content = str_replace($paths[1], $replaces, $content);
}
$xml =& JFactory::getXMLParser('Simple');
$parameter = new JParameter('');
$data = KConfig::unbox($config->data);
if ($data instanceof JParameter) {
$data = $data->toArray();
}
if (is_array($data)) {
$parameter->loadArray($data);
} else {
$parameter->loadINI($data);
}
$parameter->template_data = $config->template_data;
foreach ($config->element_paths as $path) {
$parameter->addElementPath($path);
}
if ($xml->loadString($content)) {
if ($params =& $xml->document->params) {
foreach ($params as $param) {
$parameter->setXML($param);
}
}
}
return $parameter;
}
示例6: edit
/**
* Edit a connection
*/
function edit()
{
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$row =& JTable::getInstance('Group', 'FabrikTable');
if ($this->_task == 'edit') {
$cid = JRequest::getVar('cid', array(0), 'method', 'array');
$cid = array((int) $cid[0]);
} else {
$cid = array(0);
}
$row->load($cid[0]);
if ($cid) {
$row->checkout($user->get('id'));
}
$model =& $this->getModel('Group');
// Create the form
$form = new JParameter('', JPATH_COMPONENT . DS . 'models' . DS . 'group.xml');
$form->loadINI($row->attribs);
require_once JPATH_COMPONENT . DS . 'views' . DS . 'group.php';
FabrikViewGroup::edit($row, $form);
}
示例7: display
//.........这里部分代码省略.........
$item->ratingCount = 0;
} else {
$item->ratingSum = (int) $rating->rating_sum;
$item->ratingCount = (int) $rating->rating_count;
}
} else {
$item->attachments = NULL;
$item->ratingSum = 0;
$item->ratingCount = 0;
}
if ($user->gid < 24 && $params->get('lockTags')) {
$params->set('taggingSystem', 0);
}
$tags = $model->getAvailableTags($item->id);
$lists['tags'] = JHTML::_('select.genericlist', $tags, 'tags', 'multiple="multiple" size="10" ', 'id', 'name');
if (isset($item->id)) {
$item->tags = $model->getCurrentTags($item->id);
$lists['selectedTags'] = JHTML::_('select.genericlist', $item->tags, 'selectedTags[]', 'multiple="multiple" size="10" ', 'id', 'name');
} else {
$lists['selectedTags'] = '<select size="10" multiple="multiple" id="selectedTags" name="selectedTags[]"></select>';
}
$lists['metadata'] = class_exists('JParameter') ? new JParameter($item->metadata) : new JRegistry($item->metadata);
$date = JFactory::getDate($item->modified);
$timestamp = '?t=' . $date->toUnix();
if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_L.jpg')) {
$item->image = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_L.jpg' . $timestamp;
}
if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_S.jpg')) {
$item->thumb = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_S.jpg' . $timestamp;
}
JPluginHelper::importPlugin('k2');
$dispatcher = JDispatcher::getInstance();
$K2PluginsItemContent = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'content'));
$this->assignRef('K2PluginsItemContent', $K2PluginsItemContent);
$K2PluginsItemImage = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'image'));
$this->assignRef('K2PluginsItemImage', $K2PluginsItemImage);
$K2PluginsItemGallery = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'gallery'));
$this->assignRef('K2PluginsItemGallery', $K2PluginsItemGallery);
$K2PluginsItemVideo = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'video'));
$this->assignRef('K2PluginsItemVideo', $K2PluginsItemVideo);
$K2PluginsItemExtraFields = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'extra-fields'));
$this->assignRef('K2PluginsItemExtraFields', $K2PluginsItemExtraFields);
$K2PluginsItemAttachments = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'attachments'));
$this->assignRef('K2PluginsItemAttachments', $K2PluginsItemAttachments);
$K2PluginsItemOther = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'other'));
$this->assignRef('K2PluginsItemOther', $K2PluginsItemOther);
if (version_compare(JVERSION, '1.6.0', 'ge')) {
jimport('joomla.form.form');
$form = JForm::getInstance('itemForm', JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'item.xml');
$values = array('params' => json_decode($item->params));
$form->bind($values);
} else {
$form = new JParameter('', JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'item.xml');
$form->loadINI($item->params);
}
$this->assignRef('form', $form);
$nullDate = $db->getNullDate();
$this->assignRef('nullDate', $nullDate);
$this->assignRef('extraFields', $extraFields);
$this->assignRef('options', $options);
$this->assignRef('row', $item);
$this->assignRef('lists', $lists);
$this->assignRef('params', $params);
$this->assignRef('user', $user);
JRequest::getInt('cid') ? $title = JText::_('K2_EDIT_ITEM') : ($title = JText::_('K2_ADD_ITEM'));
$this->assignRef('title', $title);
$this->assignRef('mainframe', $mainframe);
if ($mainframe->isAdmin()) {
$this->params->set('showImageTab', true);
$this->params->set('showImageGalleryTab', true);
$this->params->set('showVideoTab', true);
$this->params->set('showExtraFieldsTab', true);
$this->params->set('showAttachmentsTab', true);
$this->params->set('showK2Plugins', true);
JToolBarHelper::title($title, 'k2.png');
JToolBarHelper::save();
$saveNewIcon = version_compare(JVERSION, '2.5.0', 'ge') ? 'save-new.png' : 'save.png';
JToolBarHelper::custom('saveAndNew', $saveNewIcon, '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);
// SIG PRO v3 integration
if (JPluginHelper::isEnabled('k2', 'jw_sigpro')) {
$sigPro = true;
$sigProFolder = $this->row->id ? $this->row->id : uniqid();
$this->assignRef('sigProFolder', $sigProFolder);
} else {
$sigPro = false;
}
$this->assignRef('sigPro', $sigPro);
parent::display($tpl);
}
示例8: getlayoutparams
/**
* Logic to render an XML file as form parameters
* NOTE: this does not work with Request Data validation in J2.5+. The validation
* must be skipped or the parameters must be re-added after the validation
*
* @access public
* @return void
* @since 1.5
*/
function getlayoutparams()
{
jimport('joomla.filesystem.file');
$app = JFactory::getApplication();
$user = JFactory::getUser();
//get vars
$ext_option = JRequest::getVar('ext_option', '');
$ext_view = JRequest::getVar('ext_view', '');
$ext_id = JRequest::getInt('ext_id', 0);
$layout_name = JRequest::getVar('layout_name', 0);
$directory = JRequest::getVar('directory', 0);
$path = (!is_dir($directory) ? JPATH_ROOT : '') . $directory;
$db = JFactory::getDBO();
if ($ext_view == 'module') {
$query = 'SELECT params FROM #__modules WHERE id = ' . $ext_id;
// load english language file for 'mod_flexicontent' module then override with current language file
$module_name = basename(dirname($directory));
JFactory::getLanguage()->load($module_name, JPATH_SITE, 'en-GB', true);
JFactory::getLanguage()->load($module_name, JPATH_SITE, null, true);
} else {
if ($ext_view == 'field') {
$query = 'SELECT attribs FROM #__flexicontent_fields WHERE id = ' . $ext_id;
} else {
echo "not supported extension/view: " . $ext_view;
return;
}
}
if ($ext_option != 'com_flexicontent' && $ext_option != 'com_modules' && $ext_option != 'com_advancedmodules' && $ext_option != 'com_menus') {
echo '<div class="alert fcpadded fcinlineblock" style="">You are editing module via extension: <span class="label label-warning">' . $ext_option . '</span><br/> - If extension does not call Joomla event <span class="label label-warning">onExtensionBeforeSave</span> then custom layout parameters may not be saved</div>';
}
$db->setQuery($query);
$ext_params_str = $db->loadResult();
$layout_names = explode(':', $layout_name);
if (count($layout_names) > 1) {
$layout_name = $layout_names[1];
$layoutpath = JPATH_ROOT . DS . 'templates' . DS . $layout_names[0] . DS . 'html' . DS . 'mod_flexicontent/' . $layout_name . '.xml';
} else {
$layoutpath = $path . DS . $layout_name . '.xml';
}
if (!file_exists($layoutpath)) {
if (file_exists($path . DS . '_fallback' . DS . '_fallback.xml')) {
$layoutpath = $path . DS . '_fallback' . DS . '_fallback.xml';
echo '<div class="alert fcpadded fcinlineblock">Currently selected layout: <b>"' . $layout_name . '"</b> does not have a parameters XML file, using general defaults. if this is an old template then these parameters will allow to continue using it, but we recommend that you create parameter file: ' . $layout_name . '.xml</div><div class="clear"></div>';
} else {
echo !FLEXI_J16GE ? '<div style="font-size: 11px; color: gray; background-color: lightyellow; border: 1px solid lightgray; width: auto; padding: 4px 2%; margin: 1px 8px; height: auto;">' : '<p class="tip">';
echo ' Currently selected layout: <b>"' . $layout_name . '"</b> does not have layout specific parameters';
echo !FLEXI_J16GE ? '</div>' : '</p>';
exit;
}
}
//Get data from the model
if (FLEXI_J16GE) {
// Load XML file
if (FLEXI_J30GE) {
$xml = simplexml_load_file($layoutpath);
$xmldoc =& $xml;
} else {
$xml = JFactory::getXMLParser('Simple');
$xml->loadFile($layoutpath);
$xmldoc =& $xml->document;
}
// Create form object, (form name seems not to cause any problem)
$jform = new JForm('com_flexicontent.template.item', array('control' => 'jform', 'load_data' => true));
$tmpl_params = FLEXI_J30GE ? $xmldoc->asXML() : $xmldoc->toString();
$jform->load($tmpl_params);
// Load existing layout values into the object (that we got from DB)
$ext_params = new JRegistry($ext_params_str);
// and for J1.5: new JParameter($ext_params_str);
$grpname = 'params';
// this is the name of <fields> container
foreach ($jform->getGroup($grpname) as $field) {
$fieldname = $field->__get('fieldname');
$value = $ext_params->get($fieldname);
if (strlen($value)) {
$jform->setValue($fieldname, $grpname, $value);
}
}
} else {
// Create a parameters object
$form = new JParameter('', $layoutpath);
// Load existing layout values into the object (that we got from DB)
$form->loadINI($ext_params_str);
}
if ($layout_name) {
if (!FLEXI_J16GE) {
echo $form->render('params', 'layout');
} else {
?>
<fieldset class="panelform"><ul class="adminformlist">
<?php
$grpname = 'params';
//.........这里部分代码省略.........
示例9: editlink
function editlink($link_id, $cat_id, $for_approval = false, $option)
{
global $mainframe, $mtconf;
$database =& JFactory::getDBO();
$my =& JFactory::getUser();
$row = new mtLinks($database);
$row->load($link_id);
if ($row->link_id == 0) {
$createdate =& JFactory::getDate();
$row->cat_id = $cat_id;
$row->alias = '';
$row->link_hits = 0;
$row->link_visited = 0;
$row->link_votes = 0;
$row->link_rating = 0.0;
$row->link_featured = 0;
$row->link_created = $createdate->toUnix();
$row->publish_up = $createdate->toUnix();
$row->publish_down = JText::_('Never');
$row->link_published = 1;
$row->link_approved = 1;
$row->user_id = $my->id;
$row->owner = $my->username;
} else {
if ($row->user_id > 0) {
$database->setQuery('SELECT username FROM #__users WHERE id =' . $database->quote($row->user_id));
$row->owner = $database->loadResult();
} else {
$row->owner = $my->username;
}
}
if ($cat_id == 0 && $row->cat_id > 0) {
$cat_id = $row->cat_id;
}
# Load images
$database->setQuery('SELECT img_id, filename FROM #__mt_images WHERE link_id = ' . $database->quote($row->link_id) . ' ORDER BY ordering ASC');
$images = $database->loadObjectList();
$lists = array();
# Load all published CORE & custom fields
$sql = "SELECT cf.*, " . ($row->link_id ? $row->link_id : 0) . " AS link_id, cfv.value, cfv.attachment, cfv.counter, ft.ft_class FROM #__mt_customfields AS cf " . "\nLEFT JOIN #__mt_cfvalues AS cfv ON cf.cf_id=cfv.cf_id AND cfv.link_id = " . $database->quote($link_id) . "\nLEFT JOIN #__mt_fieldtypes AS ft ON ft.field_type=cf.field_type" . "\nWHERE cf.published='1' ORDER BY ordering ASC";
$database->setQuery($sql);
$fields = new mFields();
$fields->setCoresValue($row->link_name, $row->link_desc, $row->address, $row->city, $row->state, $row->country, $row->postcode, $row->telephone, $row->fax, $row->email, $row->website, $row->price, $row->link_hits, $row->link_votes, $row->link_rating, $row->link_featured, $row->link_created, $row->link_modified, $row->link_visited, $row->publish_up, $row->publish_down, $row->metakey, $row->metadesc, $row->user_id, $row->owner);
$fields->loadFields($database->loadObjectList());
# Get other categories
$database->setQuery('SELECT cl.cat_id FROM #__mt_cl AS cl WHERE cl.link_id = ' . $database->quote($link_id) . ' AND cl.main = 0');
$other_cats = $database->loadResultArray();
# Get Pathway
$pathWay = new mtPathWay($cat_id);
# Is this approval for modification?
if ($row->link_approved < 0) {
$row->original_link_id = -1 * $row->link_approved;
} else {
$row->original_link_id = '';
}
# Compile list of categories
if ($cat_id > 0) {
$database->setQuery('SELECT cat_parent FROM #__mt_cats WHERE cat_id = ' . $database->quote($cat_id));
$browse_cat_parent = $database->loadResult();
}
$categories = array();
if ($cat_id > 0) {
$categories[] = JHTML::_('select.option', $browse_cat_parent, JText::_('Arrow back'));
}
$database->setQuery('SELECT cat_id AS value, cat_name AS text FROM #__mt_cats' . "\nWHERE cat_parent = " . $database->quote($cat_id) . " AND cat_approved = '1' AND cat_published = '1' ORDER BY cat_name ASC");
$categories = array_merge($categories, $database->loadObjectList());
$lists['cat_id'] = JHTML::_('select.genericlist', $categories, 'new_cat_id', 'size="8" class="text_area" style="display:block;width:50%;margin-top:6px;"', 'value', 'text', $row->getCatID(), 'browsecat');
# Get Return task - Used by listpending_links
$returntask = JRequest::getCmd('returntask', '', 'post');
# Get params definitions
$form = new JParameter($row->attribs, JPATH_COMPONENT . DS . 'models' . DS . 'listing.xml');
$form->set('owner', $row->owner);
$form->set('alias', $row->alias);
$form->set('link_approved', $row->link_approved);
$form->set('link_published', $row->link_published);
$form->set('link_featured', $row->link_featured);
$form->set('link_created', JHTML::_('date', $row->link_created, '%Y-%m-%d %H:%M:%S'));
$form->set('publish_up', JHTML::_('date', $row->publish_up, '%Y-%m-%d %H:%M:%S'));
if (JHTML::_('date', $row->publish_down, '%Y') <= 1969 || $row->publish_down == $database->getNullDate()) {
$form->set('publish_down', JText::_('Never'));
} else {
$form->set('publish_down', JHTML::_('date', $row->publish_down, '%Y-%m-%d %H:%M:%S'));
}
$form->set('link_template', $row->link_template);
$form->set('metakey', $row->metakey);
$form->set('metadesc', $row->metadesc);
$form->set('link_rating', $row->link_rating);
$form->set('link_votes', $row->link_votes);
$form->set('link_hits', $row->link_hits);
$form->set('link_visited', $row->link_visited);
$form->set('internal_notes', $row->internal_notes);
$form->loadINI($row->attribs);
if ($row->link_approved <= 0) {
$database->setQuery('SELECT link_id FROM #__mt_links WHERE link_approved <= 0 ORDER BY link_created ASC, link_modified DESC');
$links = $database->loadResultArray();
$number_of_prev = array_search($row->link_id, $links);
$number_of_next = count($links) - 1 - $number_of_prev;
} else {
$number_of_prev = 0;
$number_of_next = 0;
//.........这里部分代码省略.........
示例10: display
//.........这里部分代码省略.........
$_attribs = ' class="use_select2_lib fc_skip_highlight" ';
if ($row->iscore == 1) {
$_attribs .= ' disabled="disabled" ';
} else {
$_field_id = 'jform_field_type';
$_row_id = $form->getValue("id");
$_ctrl_task = 'task=fields.getfieldspecificproperties';
$document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('#" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\t" . (FLEXI_J30GE ? "\n\t\t\t\t\t\t\t\t\tjQuery('.hasTooltip').tooltip({'html': true,'container': jQuery('#fieldspecificproperties')});\n\t\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tvar tipped_elements = jQuery('#fieldspecificproperties .hasTip');\n\t\t\t\t\t\t\t\ttipped_elements.each(function() {\n\t\t\t\t\t\t\t\t\tvar title = this.get('title');\n\t\t\t\t\t\t\t\t\tif (title) {\n\t\t\t\t\t\t\t\t\t\tvar parts = title.split('::', 2);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:title', parts[0]);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:text', parts[1]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tvar ajax_JTooltips = new Tips(\$('fieldspecificproperties').getElements('.hasTip'), { maxTitleChars: 50, fixed: false});\n\t\t\t\t\t\t\t\t") . "\n\t\t\t\t\t\t\t\ttabberAutomatic(tabberOptions, 'fieldspecificproperties');\n\t\t\t\t\t\t\t\tfc_bindFormDependencies('#fieldspecificproperties', 0, '');\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('#" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t");
}
//build field select list
$fieldtypes = flexicontent_db::getFieldTypes($_grouped = true, $_usage = false, $_published = true);
$fftypes = array();
foreach ($fieldtypes as $field_group => $ft_types) {
$fftypes[] = $field_group;
foreach ($ft_types as $field_type => $ftdata) {
$fftypes[] = array('value' => $ftdata->field_type, 'text' => $ftdata->friendly);
}
$fftypes[] = '';
}
$lists['field_type'] = flexicontent_html::buildfieldtypeslist($fftypes, 'jform[field_type]', $row->field_type, $_grouped ? 1 : 0, $_attribs);
//build type select list
$attribs = 'class="use_select2_lib" multiple="multiple" size="6"';
$attribs .= $row->iscore ? ' disabled="disabled"' : '';
$types_fieldname = FLEXI_J16GE ? 'jform[tid][]' : 'tid[]';
$lists['tid'] = flexicontent_html::buildtypesselect($types, $types_fieldname, $typesselected, false, $attribs);
// **************************************************************************
// Create fields for J1.5 (J2.5+ uses JForm XML file for most of form fields)
// **************************************************************************
if (!FLEXI_J16GE) {
//build formhidden selector
$formhidden[] = JHTML::_('select.option', 0, JText::_('FLEXI_NO'));
$formhidden[] = JHTML::_('select.option', 1, JText::_('FLEXI_FRONTEND'));
$formhidden[] = JHTML::_('select.option', 2, JText::_('FLEXI_BACKEND'));
$formhidden[] = JHTML::_('select.option', 3, JText::_('FLEXI_BOTH'));
$formhidden_fieldname = FLEXI_J16GE ? 'jform[formhidden]' : 'formhidden';
$lists['formhidden'] = JHTML::_('select.radiolist', $formhidden, $formhidden_fieldname, '', 'value', 'text', $row->formhidden);
if (FLEXI_ACCESS) {
$valueseditable[] = JHTML::_('select.option', 0, JText::_('FLEXI_ANY_EDITOR'));
$valueseditable[] = JHTML::_('select.option', 1, JText::_('FLEXI_USE_ACL_PERMISSION'));
$valueseditable_fieldname = FLEXI_J16GE ? 'jform[valueseditable]' : 'valueseditable';
$lists['valueseditable'] = JHTML::_('select.radiolist', $valueseditable, $valueseditable_fieldname, '', 'value', 'text', $row->valueseditable);
}
$edithelp[] = JHTML::_('select.option', 0, JText::_('FLEXI_EDIT_HELP_NONE'));
$edithelp[] = JHTML::_('select.option', 1, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP'));
$edithelp[] = JHTML::_('select.option', 2, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP_WICON'));
$edithelp[] = JHTML::_('select.option', 3, JText::_('FLEXI_EDIT_HELP_INLINE'));
$edithelp_fieldname = FLEXI_J16GE ? 'jform[edithelp]' : 'edithelp';
$lists['edithelp'] = JHTML::_('select.radiolist', $edithelp, $edithelp_fieldname, '', 'value', 'text', $row->edithelp);
// build the html select list for ordering
$query = 'SELECT ordering AS value, label AS text' . ' FROM #__flexicontent_fields' . ' WHERE published >= 0' . ' ORDER BY ordering';
$row->ordering = @$row->ordering;
$lists['ordering'] = $row->id ? JHTML::_('list.specificordering', $row, $row->id, $query) : JHTML::_('list.specificordering', $row, '', $query);
//build access level list
if (FLEXI_ACCESS) {
$lang = JFactory::getLanguage();
$lang->_strings['FLEXIACCESS_PADD'] = 'Edit-Value';
$lists['access'] = FAccess::TabGmaccess($row, 'field', 1, 1, 0, 1, 0, 1, 0, 1, 1);
} else {
$lists['access'] = JHTML::_('list.accesslevel', $row);
}
}
if (!FLEXI_J16GE) {
// Create the parameter 's form object parsing the file XML
$pluginpath = JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . $row->field_type . '.xml';
if (JFile::exists($pluginpath)) {
$form = new JParameter('', $pluginpath);
} else {
$form = new JParameter('', JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . 'core.xml');
}
// Special and Core Groups
$form->loadINI($row->attribs);
}
// fail if checked out not by 'me'
if ($row->id) {
if ($model->isCheckedOut($user->get('id'))) {
JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
$app->redirect('index.php?option=com_flexicontent&view=fields');
}
}
//clean data
JFilterOutput::objectHTMLSafe($row, ENT_QUOTES);
// assign permissions for J2.5
$permission = FlexicontentHelperPerm::getPerm();
$this->assignRef('permission', $permission);
//assign data to template
$this->assignRef('document', $document);
$this->assignRef('row', $row);
$this->assignRef('lists', $lists);
$this->assignRef('form', $form);
$this->assignRef('typesselected', $typesselected);
$this->assignRef('supportsearch', $supportsearch);
$this->assignRef('supportadvsearch', $supportadvsearch);
$this->assignRef('supportfilter', $supportfilter);
$this->assignRef('supportadvfilter', $supportadvfilter);
$this->assignRef('supportuntranslatable', $supportuntranslatable);
$this->assignRef('supportvalueseditable', $supportvalueseditable);
$this->assignRef('supportformhidden', $supportformhidden);
$this->assignRef('supportedithelp', $supportedithelp);
parent::display($tpl);
}
示例11: display
//.........这里部分代码省略.........
$published = JText::_('FLEXI_IN_PROGRESS');
break;
case -4:
default:
$published = JText::_('FLEXI_TO_WRITE');
break;
}
// **************************************************************
// Handle Item Parameters Creation and Load their values for J1.5
// In J1.6+ we declare them in the item form XML file
// **************************************************************
if (!FLEXI_J16GE) {
// Create the form parameters object
if (FLEXI_ACCESS) {
$formparams = new JParameter('', JPATH_COMPONENT . DS . 'models' . DS . 'item2.xml');
} else {
$formparams = new JParameter('', JPATH_COMPONENT . DS . 'models' . DS . 'item.xml');
}
// Details Group
$active = intval($item->created_by) ? intval($item->created_by) : $user->get('id');
if (!FLEXI_ACCESS) {
$formparams->set('access', $item->access);
}
$formparams->set('created_by', $active);
$formparams->set('created_by_alias', $item->created_by_alias);
$formparams->set('created', JHTML::_('date', $item->created, '%Y-%m-%d %H:%M:%S'));
$formparams->set('publish_up', JHTML::_('date', $item->publish_up, '%Y-%m-%d %H:%M:%S'));
if (JHTML::_('date', $item->publish_down, '%Y') <= 1969 || $item->publish_down == $db->getNullDate() || empty($item->publish_down)) {
$formparams->set('publish_down', JText::_('FLEXI_NEVER'));
} else {
$formparams->set('publish_down', JHTML::_('date', $item->publish_down, '%Y-%m-%d %H:%M:%S'));
}
// Advanced Group
$formparams->loadINI($item->attribs);
//echo "<pre>"; print_r($formparams->_xml['themes']->_children[0]); echo "<pre>"; print_r($formparams->_xml['themes']->param[0]); exit;
foreach ($formparams->_xml['themes']->_children as $i => $child) {
if (isset($child->_attributes['enableparam']) && !$params->get($child->_attributes['enableparam'])) {
unset($formparams->_xml['themes']->_children[$i]);
unset($formparams->_xml['themes']->param[$i]);
}
}
// Metadata Group
$formparams->set('description', $item->metadesc);
$formparams->set('keywords', $item->metakey);
$formparams->loadINI($item->metadata);
} else {
if (JHTML::_('date', $item->publish_down, 'Y') <= 1969 || $item->publish_down == $db->getNullDate() || empty($item->publish_down)) {
$form->setValue('publish_down', null, JText::_('FLEXI_NEVER'));
}
}
// ****************************
// Handle Template related work
// ****************************
// (a) Get the templates structures used to create form fields for template parameters
$themes = flexicontent_tmpl::getTemplates();
$tmpls_all = $themes->items;
// (b) Get Content Type allowed templates
$allowed_tmpls = $tparams->get('allowed_ilayouts');
$type_default_layout = $tparams->get('ilayout', 'default');
if (empty($allowed_tmpls)) {
$allowed_tmpls = array();
} else {
if (!is_array($allowed_tmpls)) {
$allowed_tmpls = explode("|", $allowed_tmpls);
}
}
示例12: getData
//.........这里部分代码省略.........
$rows2 = array();
foreach ($cat_list as $cat) {
if ($cat->section == $section->id) {
$rows2[] = $cat;
}
}
foreach ($rows2 as $row2) {
$sectioncategories[$section->id][] = JHTML::_('select.option', $row2->id, $row2->title, 'id', 'title');
}
}
$sectioncategories['-1'][] = JHTML::_('select.option', '-1', JText::_('Select Category'), 'id', 'title');
$categories = array();
foreach ($cat_list as $cat) {
$categories[] = $cat;
}
$categories[] = JHTML::_('select.option', '-1', JText::_('Select Category'), 'id', 'title');
if (is_array($article)) {
$loaded = $table->load($article['id']);
if ($loaded) {
// Convert to the JObject before adding other data.
$properties = $table->getProperties(1);
$item = JArrayHelper::toObject($properties, 'JObject');
$form->set('created_by', $item->created_by);
$form->set('access', $item->access);
$form->set('created_by_alias', $item->created_by_alias);
$form->set('created', JHTML::_('date', $item->created, '%Y-%m-%d %H:%M:%S'));
$form->set('publish_up', JHTML::_('date', $item->publish_up, '%Y-%m-%d %H:%M:%S'));
if (JHTML::_('date', $item->publish_down, '%Y') <= 1969 || $item->publish_down == $this->_db->getNullDate()) {
$form->set('publish_down', JText::_('Never'));
} else {
$form->set('publish_down', JHTML::_('date', $item->publish_down, '%Y-%m-%d %H:%M:%S'));
}
// Advanced Group
$form->loadINI($item->attribs);
// Metadata Group
$form->set('description', $item->metadesc);
$form->set('keywords', $item->metakey);
$form->loadINI($item->metadata);
$lists['state'] = JHTML::_('select.booleanlist', 'state', '', $item->state);
$query = 'SELECT COUNT(content_id)' . ' FROM #__content_frontpage' . ' WHERE content_id = ' . (int) $item->id;
$this->_db->setQuery($query);
$item->frontpage = $this->_db->loadResult();
if (!$item->frontpage) {
$item->frontpage = 0;
}
$lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', $item->frontpage);
$lists['sectionid'] = JHTML::_('select.genericlist', $sections, 'sectionid', 'class="inputbox" size="1" ' . $javascript, 'id', 'title', intval($item->sectionid));
$lists['catid'] = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1"', 'id', 'title', intval($item->catid));
$query = 'SELECT ordering AS value, title AS text FROM #__content WHERE catid = ' . (int) $data->default_category . ' AND state > ' . (int) "-1" . ' ORDER BY ordering';
$lists['ordering'] = JHTML::_('list.specificordering', $table, $article['id'], $query, 1);
$data->sectioncategories = $sectioncategories;
$data->row = $item;
// special for 1.5
$data->lists = $lists;
} else {
$data->sectioncategories = $sectioncategories;
$data->row = $table;
// special for 1.5
$fplist = JHTML::_('select.booleanlist', 'frontpage', '', 0);
$sectionid = JHTML::_('select.genericlist', $sections, 'sectionid', 'class="inputbox" size="1" ' . $javascript, 'id', 'title', intval($item->sectionid));
$catid = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1"', 'id', 'title', 0);
// Select List: Category Ordering
$query = 'SELECT ordering AS value, title AS text FROM #__content WHERE catid = ' . (int) $data->default_category . ' AND state > ' . (int) "-1" . ' ORDER BY ordering';
$olist = JHTML::_('list.specificordering', $table, 0, $query, 1);
$data->lists = array('ordering' => $olist, 'state' => '', 'frontpage' => $fplist, 'sectionid' => $sectionid, 'catid' => $catid);
// special for 1.5
示例13: display
//.........这里部分代码省略.........
$supportedithelp = $ft_support->supportedithelp;
//build selectlists, (for J1.6+ most of these are defined via XML file and custom form field classes)
$lists = array();
//build field_type list
if (!$row->field_type) {
$row->field_type = 'text';
}
if ($row->iscore == 1) {
$class = 'disabled="disabled"';
} else {
$class = '';
$_field_id = '#' . (FLEXI_J16GE ? 'jform_' : '') . 'field_type';
$_row_id = FLEXI_J16GE ? $form->getValue("id") : $row->id;
$_ctrl_task = FLEXI_J16GE ? 'task=fields.getfieldspecificproperties' : 'controller=fields&task=getfieldspecificproperties';
$document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\tvar JTooltips = new Tips(jQuery('#fieldspecificproperties .hasTip'), { maxTitleChars: 50, fixed: false});\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t");
}
//build field select list
$lists['field_type'] = flexicontent_html::buildfieldtypeslist('field_type', $class, $row->field_type, $group = true);
//build type select list
$attribs = 'class="use_select2_lib" multiple="multiple" size="6"';
$attribs .= $row->iscore ? ' disabled="disabled"' : '';
$types_fieldname = FLEXI_J16GE ? 'jform[tid][]' : 'tid[]';
$lists['tid'] = flexicontent_html::buildtypesselect($types, $types_fieldname, $typesselected, false, $attribs);
// **************************************************************************
// Create fields for J1.5 (J2.5+ uses JForm XML file for most of form fields)
// **************************************************************************
if (!FLEXI_J16GE) {
//build formhidden selector
$formhidden[] = JHTML::_('select.option', 0, JText::_('FLEXI_NO'));
$formhidden[] = JHTML::_('select.option', 1, JText::_('FLEXI_FRONTEND'));
$formhidden[] = JHTML::_('select.option', 2, JText::_('FLEXI_BACKEND'));
$formhidden[] = JHTML::_('select.option', 3, JText::_('FLEXI_BOTH'));
$formhidden_fieldname = FLEXI_J16GE ? 'jform[formhidden]' : 'formhidden';
$lists['formhidden'] = JHTML::_('select.radiolist', $formhidden, $formhidden_fieldname, '', 'value', 'text', $row->formhidden);
if (FLEXI_ACCESS) {
$valueseditable[] = JHTML::_('select.option', 0, JText::_('FLEXI_ANY_EDITOR'));
$valueseditable[] = JHTML::_('select.option', 1, JText::_('FLEXI_USE_ACL_PERMISSION'));
$valueseditable_fieldname = FLEXI_J16GE ? 'jform[valueseditable]' : 'valueseditable';
$lists['valueseditable'] = JHTML::_('select.radiolist', $valueseditable, $valueseditable_fieldname, '', 'value', 'text', $row->valueseditable);
}
$edithelp[] = JHTML::_('select.option', 0, JText::_('FLEXI_EDIT_HELP_NONE'));
$edithelp[] = JHTML::_('select.option', 1, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP'));
$edithelp[] = JHTML::_('select.option', 2, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP_WICON'));
$edithelp[] = JHTML::_('select.option', 3, JText::_('FLEXI_EDIT_HELP_INLINE'));
$edithelp_fieldname = FLEXI_J16GE ? 'jform[edithelp]' : 'edithelp';
$lists['edithelp'] = JHTML::_('select.radiolist', $edithelp, $edithelp_fieldname, '', 'value', 'text', $row->edithelp);
// build the html select list for ordering
$query = 'SELECT ordering AS value, label AS text' . ' FROM #__flexicontent_fields' . ' WHERE published >= 0' . ' ORDER BY ordering';
$row->ordering = @$row->ordering;
$lists['ordering'] = $row->id ? JHTML::_('list.specificordering', $row, $row->id, $query) : JHTML::_('list.specificordering', $row, '', $query);
//build access level list
if (FLEXI_ACCESS) {
$lang = JFactory::getLanguage();
$lang->_strings['FLEXIACCESS_PADD'] = 'Edit-Value';
$lists['access'] = FAccess::TabGmaccess($row, 'field', 1, 1, 0, 1, 0, 1, 0, 1, 1);
} else {
$lists['access'] = JHTML::_('list.accesslevel', $row);
}
}
if (!FLEXI_J16GE) {
// Create the parameter 's form object parsing the file XML
$pluginpath = JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . $row->field_type . '.xml';
if (JFile::exists($pluginpath)) {
$form = new JParameter('', $pluginpath);
} else {
$form = new JParameter('', JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . 'core.xml');
}
// Special and Core Groups
$form->loadINI($row->attribs);
}
// fail if checked out not by 'me'
if ($row->id) {
if ($model->isCheckedOut($user->get('id'))) {
JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
$app->redirect('index.php?option=com_flexicontent&view=fields');
}
}
//clean data
JFilterOutput::objectHTMLSafe($row, ENT_QUOTES);
// assign permissions for J2.5
if (FLEXI_J16GE) {
$permission = FlexicontentHelperPerm::getPerm();
$this->assignRef('permission', $permission);
}
//assign data to template
$this->assignRef('document', $document);
$this->assignRef('row', $row);
$this->assignRef('lists', $lists);
$this->assignRef('form', $form);
$this->assignRef('typesselected', $typesselected);
$this->assignRef('supportsearch', $supportsearch);
$this->assignRef('supportadvsearch', $supportadvsearch);
$this->assignRef('supportfilter', $supportfilter);
$this->assignRef('supportadvfilter', $supportadvfilter);
$this->assignRef('supportuntranslatable', $supportuntranslatable);
$this->assignRef('supportvalueseditable', $supportvalueseditable);
$this->assignRef('supportformhidden', $supportformhidden);
$this->assignRef('supportedithelp', $supportedithelp);
parent::display($tpl);
}
示例14: edit
//.........这里部分代码省略.........
$params->set('thb_width', '150');
$params->set('thb_height', '120');
$params->set('popup_engine', 'mootools_slimbox');
$params->set('enabledownload', '0');
$item->text = $item->gallery;
$dispatcher->trigger('onPrepareContent', array(&$item, &$params, null));
$item->gallery = $item->text;
if (!$embedVideo) {
$params->set('vfolder', 'media/k2/videos');
$item->text = $item->video;
$dispatcher->trigger('onPrepareContent', array(&$item, &$params, null));
$item->video = $item->text;
} else {
$item->video = '<div>' . $item->video . '</div>';
}
if (isset($item->created_by)) {
$author =& JUser::getInstance($item->created_by);
$item->author = $author->name;
}
if (isset($item->modified_by)) {
$moderator =& JUser::getInstance($item->modified_by);
$item->moderator = $moderator->name;
}
if ($task == 'edit') {
$item->editor = $item->author;
} else {
$item->editor = $user->name;
}
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'categories.php';
$categoriesModel = new K2ModelCategories();
$categories_option[] = JHTML::_('select.option', 0, JText::_('- Select category -'));
$categories = $categoriesModel->categoriesTree();
if (($task == 'add' || $task == 'edit') && !$user->authorize('com_k2', 'add', 'category', 'all')) {
for ($i = 0; $i < sizeof($categories); $i++) {
if (!$user->authorize('com_k2', 'add', 'category', $categories[$i]->value)) {
$categories[$i]->disable = true;
}
}
}
$categories_options = @array_merge($categories_option, $categories);
$lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'catid', '', 'value', 'text', $item->catid);
JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables');
$category =& JTable::getInstance('K2Category', 'Table');
$category->load($item->catid);
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'extrafield.php';
$extraFieldModel = new K2ModelExtraField();
if ($category->extraFieldsGroup) {
$extraFields = $extraFieldModel->getExtraFieldsByGroup($category->extraFieldsGroup);
} else {
$extraFields = NULL;
}
for ($i = 0; $i < sizeof($extraFields); $i++) {
$extraFields[$i]->element = $extraFieldModel->renderExtraField($extraFields[$i], $item->id);
}
if ($item->id) {
$item->attachments = $model->getAttachments($item->id);
} else {
$item->attachments = NULL;
}
$tags = $model->getAvailableTags($item->id);
$lists['tags'] = JHTML::_('select.genericlist', $tags, 'tags', 'multiple="multiple" size="10" ', 'id', 'name');
if (isset($item->id)) {
$item->tags = $model->getCurrentTags($item->id);
$lists['selectedTags'] = JHTML::_('select.genericlist', $item->tags, 'selectedTags[]', 'multiple="multiple" size="10" ', 'id', 'name');
} else {
$lists['selectedTags'] = '<select size="10" multiple="multiple" id="selectedTags" name="selectedTags[]"></select>';
}
if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_L.jpg')) {
$item->image = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_L.jpg';
}
if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $item->id) . '_S.jpg')) {
$item->thumb = JURI::root() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_S.jpg';
}
$lists['metadata'] = new JParameter($item->metadata);
JPluginHelper::importPlugin('k2');
$dispatcher =& JDispatcher::getInstance();
$K2PluginsItemContent = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'content'));
$this->assignRef('K2PluginsItemContent', $K2PluginsItemContent);
$K2PluginsItemImage = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'image'));
$this->assignRef('K2PluginsItemImage', $K2PluginsItemImage);
$K2PluginsItemGallery = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'gallery'));
$this->assignRef('K2PluginsItemGallery', $K2PluginsItemGallery);
$K2PluginsItemVideo = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'video'));
$this->assignRef('K2PluginsItemVideo', $K2PluginsItemVideo);
$K2PluginsItemExtraFields = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'extra-fields'));
$this->assignRef('K2PluginsItemExtraFields', $K2PluginsItemExtraFields);
$K2PluginsItemAttachments = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'attachments'));
$this->assignRef('K2PluginsItemAttachments', $K2PluginsItemAttachments);
$K2PluginsItemOther = $dispatcher->trigger('onRenderAdminForm', array(&$item, 'item', 'other'));
$this->assignRef('K2PluginsItemOther', $K2PluginsItemOther);
$form = new JParameter('', JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'item.xml');
$form->loadINI($item->params);
$this->assignRef('form', $form);
$this->assignRef('extraFields', $extraFields);
$this->assignRef('options', $options);
$this->assignRef('row', $item);
$this->assignRef('lists', $lists);
$this->assignRef('params', $params);
parent::display();
}
示例15: displayDefault
function displayDefault()
{
global $mainframe, $hgconf;
//Load pane behavior
jimport('joomla.html.pane');
JHTML::_('behavior.tooltip');
//initialise variables
$editor =& JFactory::getEditor();
$document =& JFactory::getDocument();
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$lang =& JFactory::getLanguage();
$tabs =& JPane::getInstance('tabs');
$pane =& JPane::getInstance('sliders');
$nullDate = $db->getNullDate();
$cid = JRequest::getVar('cid');
$document->addScript(JURI::base() . 'components/com_hotelguide/assets/js/itemscreen.js');
//create the toolbar
if ($cid) {
JToolBarHelper::title(JText::_('HG_EDIT_ACCOMMODATION'), 'hotelguide');
} else {
JToolBarHelper::title(JText::_('HG_NEW_ACCOMMODATION'), 'hotelguide');
}
JToolBarHelper::apply();
JToolBarHelper::save();
JToolBarHelper::custom('saveandnew', 'savenew.png', 'savenew.png', 'HG_SAVE_AND_NEW', false);
JToolBarHelper::cancel();
//Get data from the model
$model =& $this->getModel();
$row =& $this->get('Item');
$images =& $this->get('Gallery');
$rooms =& $this->get('Rooms');
$promotions =& $this->get('Promotions');
$restaurants =& $this->get('Restaurants');
$spas =& $this->get('Spas');
// fail if checked out not by 'me'
if ($row->id) {
if ($model->isCheckedOut($user->get('id'))) {
JError::raiseWarning('SOME_ERROR_CODE', $row->title . ' ' . JText::_('HG_EDITED_BY_ANOTHER_ADMIN'));
$mainframe->redirect('index.php?option=com_hotelguide&view=hotelguide');
}
}
//clean data
JFilterOutput::objectHTMLSafe($row, ENT_QUOTES);
//build selectlists
$lists = array();
// Create the form
$form = new JParameter('', HOTELGUIDE_MODELS . DS . 'hotelitem.xml');
// Details Group
$active = intval($row->created_by) ? intval($row->created_by) : $user->get('id');
$form->set('created_by', $active);
$form->set('user_id_hotel', $row->user_id_hotel);
$form->set('created_by_alias', $row->created_by_alias);
$form->set('created', JHTML::_('date', $row->created, '%Y-%m-%d %H:%M:%S'));
// Metadata Group
if (!$row->meta_description && $row->id > 0) {
$form->set('description', $row->title);
} else {
$form->set('description', $row->meta_description);
}
if (!$row->meta_keywords && $row->id > 0) {
$form->set('keywords', $row->title);
} else {
$form->set('keywords', $row->meta_keywords);
}
$form->loadINI($row->metadata);
//build state list
$published[] = JHTML::_('select.option', 1, JText::_('HG_PUBLISHED'));
$published[] = JHTML::_('select.option', 0, JText::_('HG_UNPUBLISHED'));
$lists['published'] = JHTML::_('select.genericlist', $published, 'published', '', 'value', 'text', $row->published);
//build stear rate list
$starrate[] = JHTML::_('select.option', 0, JText::_('HG_NONE'));
$starrate[] = JHTML::_('select.option', 1, JText::_('HG_1STAR'));
$starrate[] = JHTML::_('select.option', 2, JText::_('HG_2STARS'));
$starrate[] = JHTML::_('select.option', 3, JText::_('HG_3STARS'));
$starrate[] = JHTML::_('select.option', 4, JText::_('HG_4STARS'));
$starrate[] = JHTML::_('select.option', 5, JText::_('HG_5STARS'));
$lists['starrate'] = JHTML::_('select.genericlist', $starrate, 'starrate', '', 'value', 'text', $row->starrate);
//assign data to template
$this->assignRef('hgconf', $hgconf);
$this->assignRef('lists', $lists);
$this->assignRef('row', $row);
$this->assignRef('tabs', $tabs);
$this->assignRef('pane', $pane);
$this->assignRef('nullDate', $nullDate);
$this->assignRef('form', $form);
$this->assignRef('images', $images);
$this->assignRef('rooms', $rooms);
$this->assignRef('promotions', $promotions);
$this->assignRef('restaurants', $restaurants);
$this->assignRef('spas', $spas);
/*
echo "<pre>";
echo "view=";
print_r($row);
echo "</pre>";
*/
}