本文整理汇总了PHP中CsviHelper::getComponents方法的典型用法代码示例。如果您正苦于以下问题:PHP CsviHelper::getComponents方法的具体用法?PHP CsviHelper::getComponents怎么用?PHP CsviHelper::getComponents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsviHelper
的用法示例。
在下文中一共展示了CsviHelper::getComponents方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Available fields view display method
*
* @copyright
* @author RolandD
* @todo Replace JError
* @see
* @access public
* @param
* @return
* @since 3.0
*/
public function display($tpl = null)
{
// Get the list of available fields
$this->availablefields = $this->get('Items');
// Load the pagination
$this->pagination = $this->get('Pagination');
// Load the user state
$this->state = $this->get('State');
if (!$this->get('FieldCheck')) {
throw new Exception(JText::_('COM_CSVI_NO_AVAILABLE_FIELDS'), 0);
}
// Get the list of actions
$options = array();
$options[] = JHtml::_('select.option', 'import', JText::_('COM_CSVI_IMPORT'));
$options[] = JHtml::_('select.option', 'export', JText::_('COM_CSVI_EXPORT'));
$this->actions = JHtml::_('select.genericlist', $options, 'jform_options_action', 'onchange="Csvi.loadTemplateTypes();"', 'value', 'text', $this->state->get('filter.action', ''));
// Get the list of supported components
$this->components = JHtml::_('select.genericlist', CsviHelper::getComponents(), 'jform_options_component', 'onchange="Csvi.loadTemplateTypes();"', 'value', 'text', $this->state->get('filter.component'), false, true);
// Get the list of template types
$model = $this->getModel();
$templates_model = $model->getModel('templates');
$operations = $templates_model->getTemplateTypes($this->state->get('filter.action', 'import'), $this->state->get('filter.component', false));
// Create the operations list
$this->operations = JHtml::_('select.genericlist', $operations, 'jform_options_operation', '', 'value', 'name', $this->state->get('filter.operation'), false, true);
// Get the panel
$this->loadHelper('panel');
// Show the toolbar
$this->addToolbar();
// Display it all
parent::display($tpl);
}
示例2: prepareAvailableFields
/**
* Prepare for available fields importing.
*
* 1. Set all tables to be indexed
* 2. Empty the available fields table
* 3. Import the extra availablefields sql file
* 4. Find what tables need to be imported and store them in the session
*
* @copyright
* @author RolandD
* @todo
* @see CsviModelSettings::save
* @access public
* @param
* @return
* @since 3.5
*/
public function prepareAvailableFields()
{
$db = JFactory::getDbo();
$jinput = JFactory::getApplication()->input;
// Load the session data
$session = JFactory::getSession();
$option = $jinput->get('option');
$csvilog = $jinput->get('csvilog', null, null);
// Clean the session
$session->set($option . '.csvilog', serialize('0'));
// Set all tables to be indexed
$query = $db->getQuery(true);
$query->update('#__csvi_template_tables');
$query->set('indexed = 0');
$db->setQuery($query);
$db->query();
// Empty the available fields first
$q = "TRUNCATE TABLE " . $db->qn('#__csvi_available_fields');
$db->setQuery($q);
if ($db->query()) {
$csvilog->AddStats('empty', JText::_('COM_CSVI_AVAILABLE_FIELDS_TABLE_EMPTIED'));
} else {
$csvilog->AddStats('error', JText::_('COM_CSVI_AVAILABLE_FIELDS_TABLE_COULD_NOT_BE_EMPTIED'));
}
// Do component specific updates
$override = new stdClass();
$override->value = 'override';
$components = CsviHelper::getComponents();
$components[] = $override;
jimport('joomla.filesystem.file');
foreach ($components as $component) {
switch ($component->value) {
case 'mod_vm_cherry_picker':
// Delete any existing entries
$query = $db->getQuery(true);
$query->delete('#__csvi_template_tables')->where($db->qn('component') . ' = ' . $db->q('mod_vm_cherry_picker'))->where($db->qn('template_table') . ' REGEXP ' . $db->q('vm_product_type_[0-9]'));
$db->setQuery($query);
$db->query();
// Add new entries
$name_tables = $db->getTableList();
$query = $db->getQuery(true);
$validq = false;
$query->insert('#__csvi_template_tables')->columns(array('template_type_name', 'template_table', 'component', 'indexed'));
foreach ($name_tables as $nkey => $name_table) {
if (strpos($name_table, $db->getPrefix() . 'vm_product_type') !== false) {
if (stristr('0123456789', substr($name_table, -1))) {
$validq = true;
$name = str_ireplace($db->getPrefix(), '', $name_table);
$query->values($db->q('producttypenamesexport') . ',' . $db->q($name) . ',' . $db->q('mod_vm_cherry_picker') . ',0');
$query->values($db->q('producttypenamesimport') . ',' . $db->q($name) . ',' . $db->q('mod_vm_cherry_picker') . ',0');
}
}
}
if ($validq) {
$db->setQuery($query);
$db->query();
}
break;
}
// Process all extra available fields
$filename = JPATH_COMPONENT_ADMINISTRATOR . '/install/availablefields/' . $component->value . '.sql';
if (JFile::exists($filename)) {
// Check if the component is installed
$ext_id = false;
$query = $db->getQuery(true)->select($db->qn('extension_id'))->from($db->qn('#__extensions'))->where($db->qn('element') . '=' . $db->q($component->value));
$db->setQuery($query);
$ext_id = $db->loadResult();
if ($ext_id) {
$queries = JInstallerHelper::splitSql(JFile::read($filename));
foreach ($queries as $q) {
$db->setQuery($q);
if ($db->query()) {
$result = true;
} else {
$result = false;
}
}
if ($result) {
$csvilog->AddStats('added', JText::sprintf('COM_CSVI_CUSTOM_AVAILABLE_FIELDS_HAVE_BEEN_ADDED', JText::_('COM_CSVI_' . $component->value)));
} else {
$csvilog->AddStats('error', JText::sprintf('COM_CSVI_CUSTOM_AVAILABLE_FIELDS_HAVE_NOT_BEEN_ADDED', JText::_('COM_CSVI_' . $component->value)));
}
}
//.........这里部分代码省略.........
示例3: defined
*
* @author Roland Dalmulder
* @link http://www.csvimproved.com
* @copyright Copyright (C) 2006 - 2013 RolandD Cyber Produksi. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* @version $Id: default.php 2390 2013-03-23 16:54:46Z RolandD $
*/
defined('_JEXEC') or die;
$listOrder = $this->state->get('list.ordering');
$listDirn = $this->state->get('list.direction');
$saveOrder = $listOrder == 'ordering';
$state = $this->state->get('filter.published');
if (strlen($state) == 0) {
$state = '*';
}
$components = CsviHelper::getComponents();
array_unshift($components, JHtml::_('select.option', '', JText::_('JALL')));
$check = version_compare(JVERSION, '3.0', '<') ? 'checkAll(' . count($this->templatetypes) . ');' : 'Joomla.checkAll(this);';
?>
<div class="span1">
<?php
echo $this->sidebar;
?>
</div>
<div class="span11">
<form action="<?php
echo JRoute::_('index.php?option=com_csvi&view=templatetypes');
?>
" method="post" name="adminForm" id="adminForm">
<table class="adminlist table table-condensed table-striped">
<thead>
示例4: getComponents
/**
* Get a list of available components
*
* @copyright
* @author RolandD
* @todo
* @see
* @access public
* @param
* @return
* @since 4.0
*/
public function getComponents()
{
$components = CsviHelper::getComponents(array('#__extensions.type' => 'component'));
$options = JHtml::_('select.option', '', JText::_('COM_CSVI_MAKE_CHOICE'), 'value', 'text', true);
array_unshift($components, $options);
return $components;
}
示例5: prepareAvailableFields
/**
* Prepare for available fields importing.
*
* 1. Set all tables to be indexed
* 2. Empty the available fields table
* 3. Import the extra availablefields sql file
* 4. Find what tables need to be imported and store them in the session
*
* @copyright
* @author RolandD
* @todo
* @see CsviModelSettings::save
* @access public
* @param
* @return
* @since 3.5
*/
public function prepareAvailableFields()
{
$db = JFactory::getDbo();
$jinput = JFactory::getApplication()->input;
// Load the session data
$session = JFactory::getSession();
$option = $jinput->get('option');
$csvilog = $jinput->get('csvilog', null, null);
// Clean the session
$session->set($option . '.csvilog', serialize('0'));
// Set all tables to be indexed
$query = $db->getQuery(true);
$query->update('#__csvi_template_tables');
$query->set('indexed = 0');
$db->setQuery($query);
$db->query();
// Empty the available fields first
$q = "TRUNCATE TABLE `#__csvi_available_fields`";
$db->setQuery($q);
if ($db->query()) {
$csvilog->AddStats('empty', JText::_('COM_CSVI_AVAILABLE_FIELDS_TABLE_EMPTIED'));
} else {
$csvilog->AddStats('error', JText::_('COM_CSVI_AVAILABLE_FIELDS_TABLE_COULD_NOT_BE_EMPTIED'));
}
// Do component specific updates
$components = CsviHelper::getComponents();
foreach ($components as $component) {
switch ($component->value) {
case 'com_virtuemart':
// Add custom fields as available field to product import
$query = "INSERT IGNORE INTO " . $db->quoteName('#__csvi_available_fields') . "(csvi_name, component_name, component_table, component) \n\t\t\t\t\t\t\t(SELECT TRIM(custom_title), TRIM(custom_title), 'productimport', 'com_virtuemart' FROM #__virtuemart_customs WHERE field_type = 'S')";
$db->setQuery($query);
$db->query();
break;
}
}
// Add some extra fields
jimport('joomla.filesystem.file');
if (JFile::exists(JPATH_COMPONENT_ADMINISTRATOR . '/install/availablefields_extra.sql')) {
$q = JFile::read(JPATH_COMPONENT_ADMINISTRATOR . '/install/availablefields_extra.sql');
$db->setQuery($q);
if ($db->query()) {
$csvilog->AddStats('added', JText::_('COM_CSVI_CUSTOM_AVAILABLE_FIELDS_HAVE_BEEN_ADDED'));
} else {
$csvilog->AddStats('error', JText::_('COM_CSVI_CUSTOM_AVAILABLE_FIELDS_HAVE_NOT_BEEN_ADDED'));
}
} else {
$csvilog->AddStats('error', JText::sprintf('AVAILABLEFIELDS_EXTRA_NOT_FOUND', JPATH_COMPONENT_ADMINISTRATOR . '/install/availablefields_extra.sql'));
}
// Add the log the session
$session->set($option . '.csvilog', serialize($csvilog));
}