本文整理汇总了PHP中JUDirectoryHelper::canEditJUDirectoryPluginParams方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDirectoryHelper::canEditJUDirectoryPluginParams方法的具体用法?PHP JUDirectoryHelper::canEditJUDirectoryPluginParams怎么用?PHP JUDirectoryHelper::canEditJUDirectoryPluginParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDirectoryHelper
的用法示例。
在下文中一共展示了JUDirectoryHelper::canEditJUDirectoryPluginParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
public function getForm($data = array(), $loadData = true)
{
if ($data) {
$data = (object) $data;
} else {
$data = $this->getItem();
}
JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
$category_xml_path = JPath::find(JForm::addFormPath(), 'category.xml');
$category_xml = JFactory::getXML($category_xml_path, true);
if ($data->id) {
$templateStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleOfCategory($data->id);
$templateFolder = trim($templateStyleObject->folder);
if ($templateFolder) {
$template_path = JPATH_SITE . "/components/com_judirectory/templates/" . $templateFolder . "/" . $templateFolder . '.xml';
if (JFile::exists($template_path)) {
$template_xml = JFactory::getXML($template_path, true);
if ($template_xml->cat_config) {
foreach ($template_xml->cat_config->children() as $child) {
$template_params_xpath = $category_xml->xpath('//fieldset[@name="template_params"]');
JUDirectoryHelper::appendXML($template_params_xpath[0], $child);
}
if ($template_xml->languages->count()) {
foreach ($template_xml->languages->children() as $language) {
$languageFile = (string) $language;
$first_pos = strpos($languageFile, '.');
$last_pos = strrpos($languageFile, '.');
$languageExtName = substr($languageFile, $first_pos + 1, $last_pos - $first_pos - 1);
$client = JApplicationHelper::getClientInfo((string) $language->attributes()->client, true);
$path = isset($client->path) ? $client->path : JPATH_BASE;
JUDirectoryFrontHelperLanguage::loadLanguageFile($languageExtName, $path);
}
}
}
}
}
}
$globalconfig_path = JPath::find(JForm::addFormPath(), 'globalconfig.xml');
$globalconfig_xml = JFactory::getXML($globalconfig_path, true);
if ($globalconfig_xml) {
foreach ($globalconfig_xml->children() as $child) {
$config_params_xpath = $category_xml->xpath('//fields[@name="config_params"]');
if (isset($config_params_xpath[0])) {
JUDirectoryHelper::appendXML($config_params_xpath[0], $child, true);
}
}
}
$display_params_fields_xpath = $globalconfig_xml->xpath('//fields[@name="display_params"]/fields[@name="cat"]');
$display_params_xml = $display_params_fields_xpath[0];
if ($display_params_xml) {
foreach ($display_params_xml->children() as $child) {
$display_params_xpath = $category_xml->xpath('//fields[@name="display_params"]');
JUDirectoryHelper::appendXML($display_params_xpath[0], $child, false, true);
}
}
$plugin_dir = JPATH_SITE . "/plugins/judirectory/";
$db = JFactory::getDbo();
$query = "SELECT * FROM #__extensions WHERE type = 'plugin' AND folder = 'judirectory' AND enabled = 1 ORDER BY ordering ASC";
$db->setQuery($query);
$elements = $db->loadObjectList();
if ($elements) {
foreach ($elements as $index => $element) {
$folder = $element->element;
$file_path = $plugin_dir . $folder . "/{$folder}.xml";
if (JFile::exists($file_path) && JUDirectoryHelper::canEditJUDirectoryPluginParams($folder, $index) === true) {
$xml = JFactory::getXML($file_path, true);
if ($xml->cat_config) {
$ruleXml = new SimpleXMLElement('<fields name="' . $folder . '"></fields>');
$plugin_params_xpath = $category_xml->xpath('//fields[@name="plugin_params"]');
JUDirectoryHelper::appendXML($plugin_params_xpath[0], $ruleXml);
$total_fieldsets = 0;
foreach ($xml->cat_config->children() as $child) {
$total_fieldsets++;
$child->addAttribute('plugin_name', $folder);
$jplugin_xpath = $category_xml->xpath('//fields[@name="' . $folder . '"]');
JUDirectoryHelper::appendXML($jplugin_xpath[0], $child);
}
if ($total_fieldsets) {
$pluginLabel = $xml->cat_config->attributes()->label ? $xml->cat_config->attributes()->label : $element->name;
$this->pluginsCanEdit[$folder] = array('label' => $pluginLabel, 'total_fieldsets' => $total_fieldsets);
}
if (isset($xml->languages)) {
JUDirectoryFrontHelperLanguage::loadLanguageFile($xml->languages, JPATH_ADMINISTRATOR);
}
}
}
}
}
$form = $this->loadForm('com_judirectory.category', $category_xml->asXML(), array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
if (!$this->canEditState($data)) {
$form->setFieldAttribute('featured', 'disabled', 'true');
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
$form->setFieldAttribute('publish_up', 'disabled', 'true');
$form->setFieldAttribute('publish_down', 'disabled', 'true');
$form->setFieldAttribute('featured', 'filter', 'unset');
//.........这里部分代码省略.........
示例2: getForm
public function getForm($data = array(), $loadData = true)
{
$storeId = md5(__METHOD__ . "::" . serialize($data) . "::" . (int) $loadData);
if (!isset($this->cache[$storeId])) {
if ($data) {
$data = (object) $data;
} else {
$data = $this->getItem();
}
JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_judirectory/models/forms');
JForm::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_judirectory/models/fields');
$listing_xml_path = JPath::find(JForm::addFormPath(), 'listing.xml');
$listing_xml = JFactory::getXML($listing_xml_path, true);
if ($data->id) {
$templateStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleOfListing($data->id);
$templateFolder = trim($templateStyleObject->folder);
if ($templateFolder) {
$template_path = JPATH_SITE . "/components/com_judirectory/templates/" . $templateFolder . "/" . $templateFolder . '.xml';
if (JFile::exists($template_path)) {
$template_xml = JFactory::getXML($template_path, true);
if ($template_xml->listing_config) {
foreach ($template_xml->listing_config->children() as $child) {
$template_params_xpath = $listing_xml->xpath('//fieldset[@name="template_params"]');
JUDirectoryHelper::appendXML($template_params_xpath[0], $child);
}
}
if ($template_xml->languages->count()) {
foreach ($template_xml->languages->children() as $language) {
$languageFile = (string) $language;
$first_pos = strpos($languageFile, '.');
$last_pos = strrpos($languageFile, '.');
$languageExtName = substr($languageFile, $first_pos + 1, $last_pos - $first_pos - 1);
$client = JApplicationHelper::getClientInfo((string) $language->attributes()->client, true);
$path = isset($client->path) ? $client->path : JPATH_BASE;
JUDirectoryFrontHelperLanguage::loadLanguageFile($languageExtName, $path);
}
}
}
}
}
$globalconfig_path = JPath::find(JForm::addFormPath(), 'globalconfig.xml');
$globalconfig_xml = JFactory::getXML($globalconfig_path, true);
$display_params_fields_xpath = $globalconfig_xml->xpath('//fields[@name="display_params"]/fields[@name="listing"]');
$display_params_xml = $display_params_fields_xpath[0];
if ($display_params_xml) {
foreach ($display_params_xml->children() as $child) {
$display_params_xpath = $listing_xml->xpath('//fields[@name="display_params"]');
JUDirectoryHelper::appendXML($display_params_xpath[0], $child, false, true);
}
}
$plugin_dir = JPATH_SITE . "/plugins/judirectory/";
$db = JFactory::getDbo();
$query = "SELECT * FROM #__extensions WHERE type = 'plugin' AND folder = 'judirectory' AND enabled = 1 ORDER BY ordering ASC";
$db->setQuery($query);
$elements = $db->loadObjectList();
if ($elements) {
foreach ($elements as $index => $element) {
$folder = $element->element;
$file_path = $plugin_dir . $folder . "/{$folder}.xml";
if (JFile::exists($file_path) && JUDirectoryHelper::canEditJUDirectoryPluginParams($folder, $index) === true) {
$xml = JFactory::getXML($file_path, true);
if ($xml->listing_config) {
$ruleXml = new SimpleXMLElement('<fields name="' . $folder . '"></fields>');
$plugin_params_xpath = $listing_xml->xpath('//fields[@name="plugin_params"]');
JUDirectoryHelper::appendXML($plugin_params_xpath[0], $ruleXml);
$total_fieldsets = 0;
foreach ($xml->listing_config->children() as $child) {
$total_fieldsets++;
$child->addAttribute('plugin_name', $folder);
$jplugin_xpath = $listing_xml->xpath('//fields[@name="' . $folder . '"]');
JUDirectoryHelper::appendXML($jplugin_xpath[0], $child);
}
if ($total_fieldsets) {
$pluginLabel = $xml->listing_config->attributes()->label ? $xml->listing_config->attributes()->label : $element->name;
$this->pluginsCanEdit[$folder] = array('label' => $pluginLabel, 'total_fieldsets' => $total_fieldsets);
}
if (isset($xml->languages)) {
JUDirectoryFrontHelperLanguage::loadLanguageFile($xml->languages, JPATH_ADMINISTRATOR);
}
}
}
}
}
$form = $this->loadForm('com_judirectory.listing', $listing_xml->asXML(), array('control' => 'jform', 'load_data' => $loadData));
if (!$loadData) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select("field.field_name");
$query->from("#__judirectory_fields AS field");
$query->join("LEFT", "#__judirectory_plugins AS plg ON field.plugin_id = plg.id");
$query->where("field.group_id = 1 AND field.field_name != ''");
$db->setQuery($query);
$fieldNames = $db->loadColumn();
foreach ($fieldNames as $fieldName) {
$form->removeField($fieldName);
}
}
if (empty($form)) {
$this->cache[$storeId] = false;
}
//.........这里部分代码省略.........