当前位置: 首页>>代码示例>>PHP>>正文


PHP CsviHelper类代码示例

本文整理汇总了PHP中CsviHelper的典型用法代码示例。如果您正苦于以下问题:PHP CsviHelper类的具体用法?PHP CsviHelper怎么用?PHP CsviHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CsviHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 /**
  * CSVI VirtueMart view display method
  *
  * @return void
  */
 function display($tpl = null)
 {
     // Show the toolbar
     JToolBarHelper::title(JText::_('COM_CSVI_CONTROL_PANEL'), 'csvi_logo_48.png');
     // Options button.
     if (JFactory::getUser()->authorise('core.admin', 'com_csvi')) {
         JToolBarHelper::preferences('com_csvi');
     }
     //JToolBarHelper::help('control_panel.html', true);
     // Assign data for display
     $helper = new CsviHelper();
     $this->cpanel_images = $helper->getButtons();
     // Display the page
     parent::display($tpl);
 }
开发者ID:spiridonov-oa,项目名称:SheinCandles,代码行数:20,代码来源:view.html.php

示例2: display

 /**
  * Template types display method
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return
  * @since 		4.0
  */
 public function display($tpl = null)
 {
     // Load the template types
     $this->items = $this->get('Items');
     // Get the pagination
     $this->pagination = $this->get('Pagination');
     // Load the user state
     $this->state = $this->get('State');
     // Render the submenu
     if (version_compare(JVERSION, '3.0', '>=')) {
         CsviHelper::addSubmenu('replacements');
         $this->sidebar = JHtmlSidebar::render();
     } else {
         // Get the panel
         $this->loadHelper('panel');
         $this->sidebar = '';
     }
     // Show the toolbar
     JToolBarHelper::title(JText::_('COM_CSVI_REPLACEMENTS'), 'csvi_replacement_48');
     JToolBarHelper::addNew('replacement.add');
     JToolBarHelper::editList('replacement.edit');
     JToolBarHelper::deleteList('', 'replacements.delete');
     //JToolBarHelper::help('about.html', true);
     // Display it all
     parent::display($tpl);
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:38,代码来源:view.html.php

示例3: 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);
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:43,代码来源:view.html.php

示例4: __construct

 /**
  * Table constructor
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		public
  * @param 		$db	object	A database connector object
  * @return
  * @since 		3.0
  */
 public function __construct($db)
 {
     $jinput = JFactory::getApplication()->input;
     $template = $jinput->get('template', null, null);
     // Find which table we are importing
     $tbl = $template->get('custom_table');
     // Find the primare key for this table
     $pk = CsviHelper::getPrimaryKey($tbl);
     parent::__construct('#__' . $tbl, $pk, $db);
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:22,代码来源:custom_table.php

示例5: getStart

 /**
  * Customfields tables export
  *
  * Exports category details data to either csv, xml or HTML format
  *
  * @copyright
  * @author		RolandD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return 		void
  * @since 		3.0
  */
 public function getStart()
 {
     // Get some basic data
     $db = JFactory::getDbo();
     $csvidb = new CsviDb();
     $jinput = JFactory::getApplication()->input;
     $csvilog = $jinput->get('csvilog', null, null);
     $template = $jinput->get('template', null, null);
     $exportclass = $jinput->get('export.class', null, null);
     $export_fields = $jinput->get('export.fields', array(), 'array');
     // Build something fancy to only get the fieldnames the user wants
     $userfields = array();
     foreach ($export_fields as $column_id => $field) {
         switch ($field->field_name) {
             case 'id':
                 $userfields[] = $db->qn('c.id');
                 break;
             case 'custom_title':
                 $userfields[] = $db->qn('c.vm_custom_id');
                 break;
             case 'display_type':
                 $userfields[] = $db->qn('c.type_id');
                 $userfields[] = $db->qn('f.type', 'display_type');
                 break;
             case 'smart_search':
             case 'expanded':
             case 'scrollbar_after':
                 $userfields[] = $db->qn('c.params');
                 break;
             case 'custom':
                 break;
             default:
                 $userfields[] = $db->qn($field->field_name);
                 break;
         }
     }
     // Export SQL Query
     // Build the query
     $userfields = array_unique($userfields);
     $query = $db->getQuery(true);
     $query->select(implode(",\n", $userfields));
     $query->from($db->qn("#__cf_customfields", "c"));
     $query->leftJoin($db->qn("#__cf_filtertypes", "f") . " ON " . $db->qn("c") . '.' . $db->qn("type_id") . ' = ' . $db->qn("f") . '.' . $db->qn("id"));
     // Ingore fields
     $ignore = array('custom', 'custom_title', 'display_type', 'smart_search', 'smart_search', 'expanded', 'scrollbar_after');
     // Check if we need to group the orders together
     $groupby = $template->get('groupby', 'general', false, 'bool');
     if ($groupby) {
         $filter = $this->getFilterBy('groupby', $ignore);
         if (!empty($filter)) {
             $query->group($filter);
         }
     }
     // Order by set field
     $orderby = $this->getFilterBy('sort', $ignore);
     if (!empty($orderby)) {
         $query->order($orderby);
     }
     // Add a limit if user wants us to
     $limits = $this->getExportLimit();
     // Execute the query
     $csvidb->setQuery($query, $limits['offset'], $limits['limit']);
     $csvilog->addDebug(JText::_('COM_CSVI_EXPORT_QUERY'), true);
     // There are no records, write SQL query to log
     if (!is_null($csvidb->getErrorMsg())) {
         $this->addExportContent(JText::sprintf('COM_CSVI_ERROR_RETRIEVING_DATA', $csvidb->getErrorMsg()));
         $this->writeOutput();
         $csvilog->AddStats('incorrect', $csvidb->getErrorMsg());
     } else {
         $logcount = $csvidb->getNumRows();
         $jinput->set('logcount', $logcount);
         if ($logcount > 0) {
             while ($record = $csvidb->getRow()) {
                 if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') {
                     $this->addExportContent($exportclass->NodeStart());
                 }
                 foreach ($export_fields as $column_id => $field) {
                     $fieldname = $field->field_name;
                     $fieldreplace = $field->field_name . $field->column_header;
                     // Add the replacement
                     if (isset($record->{$fieldname})) {
                         $fieldvalue = CsviHelper::replaceValue($field->replace, $record->{$fieldname});
                     } else {
                         $fieldvalue = '';
                     }
                     switch ($fieldname) {
//.........这里部分代码省略.........
开发者ID:alesconti,项目名称:FF_2015,代码行数:101,代码来源:customfieldsexport.php

示例6: getStart


//.........这里部分代码省略.........
     if ($groupby) {
         $filter = $this->getFilterBy('groupby', $ignore);
         if (!empty($filter)) {
             $query->group($filter);
         }
     }
     // Order by set field
     $orderby = $this->getFilterBy('sort', $ignore);
     if (!empty($orderby)) {
         $query->order($orderby);
     }
     // Add a limit if user wants us to
     $limits = $this->getExportLimit();
     // Execute the query
     $csvidb->setQuery($query, $limits['offset'], $limits['limit']);
     $csvilog->addDebug(JText::_('COM_CSVI_EXPORT_QUERY'), true);
     // There are no records, write SQL query to log
     if (!is_null($csvidb->getErrorMsg())) {
         $this->addExportContent(JText::sprintf('COM_CSVI_ERROR_RETRIEVING_DATA', $csvidb->getErrorMsg()));
         $this->writeOutput();
         $csvilog->AddStats('incorrect', $csvidb->getErrorMsg());
     } else {
         $logcount = $csvidb->getNumRows();
         $jinput->set('logcount', $logcount);
         if ($logcount > 0) {
             while ($record = $csvidb->getRow()) {
                 if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') {
                     $this->addExportContent($exportclass->NodeStart());
                 }
                 foreach ($export_fields as $column_id => $field) {
                     $fieldname = $field->field_name;
                     // Add the replacement
                     if (isset($record->{$fieldname})) {
                         $fieldvalue = CsviHelper::replaceValue($field->replace, $record->{$fieldname});
                     } else {
                         $fieldvalue = '';
                     }
                     switch ($fieldname) {
                         case 'money_owed':
                             $query1 = $db->getQuery(true);
                             $query1->select('akeebasubs_affiliate_id, SUM(affiliate_comission) AS money_owed');
                             $query1->from('#__akeebasubs_subscriptions');
                             $query1->where('state = ' . $db->Quote('C'));
                             $query1->where('akeebasubs_affiliate_id = ' . $record->akeebasubs_affiliate_id);
                             $query1->group('akeebasubs_affiliate_id');
                             $query2 = $db->getQuery(true);
                             $query2->select('akeebasubs_affiliate_id, SUM(amount) AS money_paid');
                             $query2->from('#__akeebasubs_affpayments');
                             $query2->where('akeebasubs_affiliate_id = ' . $record->akeebasubs_affiliate_id);
                             $query2->group('akeebasubs_affiliate_id');
                             $query = $db->getQuery(true);
                             $query->select('money_owed-money_paid AS balance');
                             $query->from('#__akeebasubs_affiliates');
                             $query->leftJoin('(' . $query1 . ') AS o USING (' . $db->quoteName('akeebasubs_affiliate_id') . ')');
                             $query->leftJoin('(' . $query2 . ') AS p USING (' . $db->quoteName('akeebasubs_affiliate_id') . ')');
                             $query->where('akeebasubs_affiliate_id = ' . $record->akeebasubs_affiliate_id);
                             $db->setQuery($query);
                             $fieldvalue = $db->loadResult();
                             $fieldvalue = number_format($fieldvalue, $template->get('export_price_format_decimal', 'general', 2, 'int'), $template->get('export_price_format_decsep', 'general'), $template->get('export_price_format_thousep', 'general'));
                             if (strlen(trim($fieldvalue)) == 0) {
                                 $fieldvalue = $field->default_value;
                             }
                             $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header);
                             break;
                         case 'money_paid':
                             $query = $db->getQuery(true);
开发者ID:spiridonov-oa,项目名称:SheinCandles,代码行数:67,代码来源:affiliateexport.php

示例7: getStart

    /**
     * Product export
     *
     * Exports product data to either csv, xml or HTML format
     *
     * @copyright
     * @author		RolandD
     * @todo
     * @see
     * @access 		public
     * @param
     * @return 		void
     * @since 		3.0
     */
    public function getStart()
    {
        // Get some basic data
        $jinput = JFactory::getApplication()->input;
        $db = JFactory::getDbo();
        $csvidb = new CsviDb();
        $jinput = JFactory::getApplication()->input;
        $csvilog = $jinput->get('csvilog', null, null);
        $template = $jinput->get('template', null, null);
        $exportclass = $jinput->get('export.class', null, null);
        $export_fields = $jinput->get('export.fields', array(), 'array');
        $this->_domainname = CsviHelper::getDomainName();
        $helper = new Com_VirtueMart();
        $sef = new CsviSef();
        // Build something fancy to only get the fieldnames the user wants
        $userfields = array();
        foreach ($export_fields as $column_id => $field) {
            if ($field->process) {
                switch ($field->field_name) {
                    case 'created_on':
                    case 'modified_on':
                    case 'locked_on':
                    case 'created_by':
                    case 'modified_by':
                    case 'locked_by':
                    case 'virtuemart_product_id':
                    case 'virtuemart_vendor_id':
                    case 'hits':
                    case 'metaauthor':
                    case 'metarobot':
                    case 'published':
                        $userfields[] = $db->quoteName('#__virtuemart_products') . '.' . $db->quoteName($field->field_name);
                        break;
                    case 'category_id':
                    case 'category_path':
                        $userfields[] = $db->quoteName('#__virtuemart_product_categories') . '.' . $db->quoteName('virtuemart_category_id');
                        $userfields[] = $db->quoteName('#__virtuemart_products') . '.' . $db->quoteName('virtuemart_product_id');
                        break;
                    case 'product_name':
                    case 'product_s_desc':
                    case 'product_desc':
                    case 'metadesc':
                    case 'metakey':
                    case 'slug':
                    case 'customtitle':
                    case 'custom_value':
                    case 'custom_price':
                    case 'custom_param':
                    case 'custom_title':
                    case 'file_url':
                    case 'file_url_thumb':
                        $userfields[] = $db->quoteName('#__virtuemart_products') . '.' . $db->quoteName('virtuemart_product_id');
                        break;
                    case 'product_parent_sku':
                        $userfields[] = $db->quoteName('#__virtuemart_products') . '.' . $db->quoteName('product_parent_id');
                        break;
                    case 'related_products':
                        $userfields[] = $db->quoteName('#__virtuemart_products') . '.' . $db->quoteName('virtuemart_product_id') . ' AS main_product_id';
                        break;
                    case 'product_box':
                        $userfields[] = $db->quoteName('#__virtuemart_products') . '.' . $db->quoteName('product_packaging');
                        break;
                    case 'product_price':
                    case 'price_with_tax':
                        $userfields[] = $db->quoteName('#__virtuemart_product_prices') . '.' . $db->quoteName('product_price');
                        $userfields[] = $db->quoteName('#__virtuemart_currencies') . '.' . $db->quoteName('currency_code_3');
                        break;
                    case 'product_url':
                        $userfields[] = $db->quoteName('#__virtuemart_products') . '.' . $db->quoteName('virtuemart_product_id');
                        $userfields[] = $db->quoteName('#__virtuemart_products') . '.' . $db->quoteName('product_url');
                        $userfields[] = $db->quoteName('#__virtuemart_products') . '.' . $db->quoteName('product_parent_id');
                        break;
                    case 'price_with_discount':
                        $userfields[] = $db->quoteName('#__virtuemart_product_prices') . '.' . $db->quoteName('product_price');
                        $userfields[] = $db->quoteName('#__virtuemart_currencies') . '.' . $db->quoteName('currency_code_3');
                        //$userfields[] = $db->quoteName('#__virtuemart_calcs').'.'.$db->quoteName('calc_value');
                        //$userfields[] = $db->quoteName('#__virtuemart_calcs').'.'.$db->quoteName('calc_value_mathop');
                        //$userfields[] = $db->quoteName('#__virtuemart_calcs').'.'.$db->quoteName('calc_kind');
                        break;
                    case 'product_currency':
                        $userfields[] = $db->quoteName('#__virtuemart_currencies') . '.' . $db->quoteName('currency_code_3');
                        break;
                    case 'custom_shipping':
                        $userfields[] = $db->quoteName('#__virtuemart_product_prices') . '.' . $db->quoteName('product_price');
                        $userfields[] = '1 AS tax_rate';
                        break;
//.........这里部分代码省略.........
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:productexport.php

示例8: runCron

 /**
  * Initialise some settings
  */
 public function runCron()
 {
     // Buffer all output to prevent conflicts with external software
     ob_start();
     // Start the clock
     $starttime = time();
     $db = JFactory::getDbo();
     // First check if we deal with a valid user
     if ($this->Login()) {
         // Set some global values
         $jinput = JFactory::getApplication()->input;
         $jfilter = new JFilterInput();
         // Get the parameters
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/settings.php';
         $settings = new CsviSettings();
         // Check if we are running cron mode and set some necessary variables
         $_SERVER['SERVER_ADDR'] = $_SERVER['HTTP_HOST'] = $settings->get('site.hostname');
         $_SERVER['SCRIPT_NAME'] = '/index.php';
         $_SERVER['REQUEST_URI'] = '/';
         $_SERVER['PHP_SELF'] = '/index.php';
         // Get the task to do
         if (isset($this->_variables['task'])) {
             $task = $jfilter->clean($this->_variables['task']);
         } else {
             $task = '';
         }
         // Perform the requested task
         switch ($task) {
             case 'maintenance':
                 $jinput->set('task', 'maintenance.' . $this->_variables['operation']);
                 // Fire CSVI VirtueMart
                 $this->ExecuteJob();
                 break;
             default:
                 // Second check if any template is set to process
                 if (array_key_exists('template_id', $this->_variables)) {
                     $template_id = $jfilter->clean($this->_variables['template_id'], 'int');
                 } else {
                     $template_id = false;
                 }
                 if (array_key_exists('template_name', $this->_variables)) {
                     $template_name = $jfilter->clean($this->_variables['template_name']);
                 } else {
                     $template_name = false;
                 }
                 if ($template_id || $template_name) {
                     // There is a template_id or template name, get some details to streamline processing
                     $where = empty($template_id) ? 'name=' . $db->Quote($template_name) : 'id=' . $template_id;
                     // There is a template name, get some details to streamline processing
                     $q = "SELECT id AS template_id, name AS template_name, settings\r\n\t\t\t\t\t\t\tFROM #__csvi_template_settings\r\n\t\t\t\t\t\t\tWHERE " . $where;
                     $db->setQuery($q);
                     $row = $db->loadObject();
                     if (is_object($row)) {
                         echo JText::sprintf('COM_CSVI_PROCESSING_STARTED', date('jS F Y, g:i a')) . "\n";
                         echo JText::sprintf('COM_CSVI_TEMPLATE', $row->template_name) . "\n";
                         // Set the template ID
                         $jinput->set('select_template', $row->template_id);
                         $jinput->set('template_name', $row->template_name);
                         // Set the settings
                         if (array_key_exists('jform', $this->_variables)) {
                             $settings = CsviHelper::arrayExtend(json_decode($row->settings, true), $this->_variables['jform']);
                         } else {
                             $settings = json_decode($row->settings, true);
                         }
                         // Set some export settings
                         if ($settings['options']['action'] == 'export') {
                             // Export settings
                             $jinput->set('task', 'exportfile.process');
                             // Set export to
                             if ($settings['general']['exportto'] == 'todownload') {
                                 $settings['general']['exportto'] = 'tofile';
                             }
                         } else {
                             if ($settings['options']['action'] == 'import') {
                                 // Import settings
                                 $jinput->set('task', 'importfile.doimport');
                                 // Turn off preview
                                 $settings['general']['show_preview'] = 0;
                             }
                         }
                         // Post the settings
                         $jinput->set('jform', $settings, 'post');
                         // Fire CSVI
                         $this->ExecuteJob();
                     } else {
                         if ($template_name) {
                             echo JText::sprintf('COM_CSVI_NO_TEMPLATE_FOUND', $template_name) . "\n";
                         } else {
                             if ($template_id) {
                                 echo JText::sprintf('COM_CSVI_NO_TEMPLATE_FOUND', $template_id) . "\n";
                             }
                         }
                     }
                 } else {
                     echo JText::_('COM_CSVI_NO_TEMPLATE_SPECIFIED') . "\n";
                 }
                 break;
//.........这里部分代码省略.........
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:cron.php

示例9: validateInput

 /**
  * Validate input data
  *
  * Checks if the field has a value, if not check if the user wants us to
  * use the default value
  *
  * @copyright
  * @author		RolandD
  * @todo
  * @see
  * @access 		protected
  * @param 		string 	$fieldname 	the fieldname to validate
  * @param		int		$replaceid	the ID of the replacement rule
  * @return		true returns validated value | return false if the column count does not match
  * @since
  */
 protected function validateInput($fieldname, $replaceid = null)
 {
     $jinput = JFactory::getApplication()->input;
     $csvilog = $jinput->get('csvilog', null, null);
     $template = $jinput->get('template', null, null);
     $newvalue = '';
     // Check if the user wants ICEcat data
     if ($template->get('use_icecat', 'product', false, 'bool') && !empty($this->icecat_data) && array_key_exists($fieldname, $this->icecat_data)) {
         $csvilog->addDebug(JText::sprintf('COM_CSVI_USE_ICECAT_FIELD', $fieldname));
         $newvalue = $this->icecat_data[$fieldname];
     } else {
         if (isset($this->_csvifields[$fieldname])) {
             // Check if the field has a value
             if (array_key_exists($this->_csvifields[$fieldname]["order"], $this->csvi_data) && strlen($this->csvi_data[$this->_csvifields[$fieldname]["order"]]) > 0) {
                 $csvilog->addDebug(JText::_('COM_CSVI_USE_FIELD_VALUE'));
                 $newvalue = trim($this->csvi_data[$this->_csvifields[$fieldname]["order"]]);
             } else {
                 if (!$this->_skip_default_value) {
                     $csvilog->addDebug(JText::_('COM_CSVI_USE_DEFAULT_VALUE'));
                     $newvalue = $this->_csvifields[$fieldname]["default_value"];
                 } else {
                     $csvilog->addDebug(JText::_('COM_CSVI_USE_NO_VALUE'));
                     return '';
                 }
             }
         } else {
             return false;
         }
     }
     // Replace the value and return
     if (!empty($newvalue) && !empty($replaceid)) {
         return CsviHelper::replaceValue($replaceid, $newvalue);
     } else {
         return $newvalue;
     }
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:52,代码来源:importfile.php

示例10: getAvailableFieldsSingle

 /**
  * Import the available fields in steps
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return
  * @since 		3.5
  */
 public function getAvailableFieldsSingle()
 {
     $db = JFactory::getDbo();
     $jinput = JFactory::getApplication()->input;
     $queries = array();
     // Load the session data
     $session = JFactory::getSession();
     $option = $jinput->get('option');
     $csvilog = unserialize($session->get($option . '.csvilog'));
     $lines = unserialize($session->get($option . '.linesprocessed'));
     if (empty($lines)) {
         $lines = 0;
     }
     $lines++;
     // Set the line number
     $csvilog->setLinenumber($lines);
     $errors = false;
     $process = false;
     // Load a table to index
     while (!$process) {
         $query = $db->getQuery(true);
         $query->select('template_table, component')->from('#__csvi_template_tables')->where('indexed = 0')->where($db->qn('template_table') . ' != ' . $db->qn('template_type_name'))->group($db->qn('template_table'));
         $db->setQuery($query, 0, 1);
         $table = $db->loadObject();
         if (is_object($table)) {
             // Set the table name
             $showtable = $table->template_table;
             // Check if the table exists
             $tables = $db->getTableList();
             if (in_array($db->getPrefix() . $showtable, $tables)) {
                 // Get the primary key for the table
                 $primarykey = CsviHelper::getPrimaryKey($showtable);
                 $fields = $this->DbFields($showtable, true);
                 if (is_array($fields)) {
                     $process = true;
                     // Process all fields
                     foreach ($fields as $name => $value) {
                         // Check if the field is a primary field
                         if ($primarykey == $name) {
                             $primary = 1;
                         } else {
                             $primary = 0;
                         }
                         if ($name) {
                             $q = "INSERT IGNORE INTO " . $db->qn('#__csvi_available_fields') . " VALUES (" . "0," . $db->q($name) . "," . $db->q($name) . "," . $db->q($value) . "," . $db->q($table->component) . "," . $db->q($primary) . ")";
                             $db->setQuery($q);
                             if (!$db->query()) {
                                 $errors = true;
                             }
                         }
                     }
                     // foreach
                     // Check for any errors
                     if (!$errors) {
                         $jinput->set('updatetable', $showtable);
                         $csvilog->AddStats('added', JText::sprintf('COM_CSVI_AVAILABLE_FIELDS_HAVE_BEEN_ADDED', $showtable));
                     } else {
                         $csvilog->AddStats('error', JText::_('COM_CSVI_AVAILABLE_FIELDS_HAVE_NOT_BEEN_ADDED'));
                     }
                 }
                 // is_array
             }
             // Set the table to indexed
             $query = $db->getQuery(true);
             $query->update('#__csvi_template_tables')->set('indexed = 1')->where('template_table = ' . $db->quote($showtable))->where('component = ' . $db->quote($table->component));
             $db->setQuery($query);
             $db->query();
             // Assign the tables to the session
             $session->set($option . '.linesprocessed', serialize($lines));
             $continue = true;
         } else {
             $jinput->set('csvilog', $csvilog);
             // Clear the session
             $session->set($option . '.csvilog', serialize('0'));
             $session->set($option . '.linesprocessed', serialize('0'));
             // Set the run ID
             $jinput->set('run_id', $csvilog->getId());
             $continue = false;
             $process = true;
         }
         // Assign the log to the session
         $session->set($option . '.csvilog', serialize($csvilog));
     }
     return $continue;
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:97,代码来源:availablefields.php

示例11: getStart

 /**
  * Property tables export
  *
  * Exports category details data to either csv, xml or HTML format
  *
  * @copyright
  * @author		RolandD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return 		void
  * @since 		3.4
  */
 public function getStart()
 {
     // Get some basic data
     $db = JFactory::getDbo();
     $csvidb = new CsviDb();
     $jinput = JFactory::getApplication()->input;
     $csvilog = $jinput->get('csvilog', null, null);
     $template = $jinput->get('template', null, null);
     $exportclass = $jinput->get('export.class', null, null);
     $export_fields = $jinput->get('export.fields', array(), 'array');
     $this->_domainname = CsviHelper::getDomainName();
     $classname = 'CsviCom_Ezrealty_Config';
     if (class_exists($classname)) {
         $config = new $classname();
     }
     // Build something fancy to only get the fieldnames the user wants
     $userfields = array();
     foreach ($export_fields as $column_id => $field) {
         switch ($field->field_name) {
             case 'id':
             case 'alias':
             case 'checked_out':
             case 'checked_out_time':
             case 'editor':
             case 'ordering':
             case 'published':
                 $userfields[] = $db->qn('e.' . $field->field_name);
                 break;
             case 'category':
                 $userfields[] = $db->qn('c.name');
                 break;
             case 'country':
                 $userfields[] = $db->qn('cn.name', 'country');
                 break;
             case 'state':
                 $userfields[] = $db->qn('st.name', 'state');
                 break;
             case 'city':
                 $userfields[] = $db->qn('loc.ezcity', 'city');
                 break;
             case 'fname':
             case 'file_title':
             case 'file_description':
             case 'file_ordering':
             case 'picture_url':
             case 'picture_url_thumb':
                 $userfields[] = $db->qn('e.id');
                 break;
             case 'custom':
                 break;
             default:
                 $userfields[] = $db->qn($field->field_name);
                 break;
         }
     }
     // Build the query
     $userfields = array_unique($userfields);
     $query = $db->getQuery(true);
     $query->select(implode(",\n", $userfields));
     $query->from($db->qn('#__ezrealty', 'e'));
     $query->leftJoin($db->qn('#__ezrealty_catg', 'c') . ' ON ' . $db->qn('e.cid') . ' = ' . $db->qn('c.id'));
     $query->leftJoin($db->qn('#__ezrealty_country', 'cn') . ' ON ' . $db->qn('e.cnid') . ' = ' . $db->qn('cn.id'));
     $query->leftJoin($db->qn('#__ezrealty_state', 'st') . ' ON ' . $db->qn('e.stid') . ' = ' . $db->qn('st.id'));
     $query->leftJoin($db->qn('#__ezrealty_locality', 'loc') . ' ON ' . $db->qn('e.locid') . ' = ' . $db->qn('loc.id'));
     $selectors = array();
     // Filter by published state
     $publish_state = $template->get('publish_state', 'general');
     if ($publish_state != '' && ($publish_state == 1 || $publish_state == 0)) {
         $selectors[] = $db->qn('e.published') . ' = ' . $publish_state;
     }
     // Filter by transaction type
     $transaction_type = $template->get('transaction_type', 'property');
     if ($transaction_type[0] != '') {
         $selectors[] = $db->qn('e.type') . ' IN (' . implode(',', $transaction_type) . ')';
     }
     // Filter by property type
     $property_type = $template->get('property_type', 'property');
     if ($property_type[0] != '') {
         $selectors[] = $db->qn('e.cid') . ' IN (' . implode(',', $property_type) . ')';
     }
     // Filter by street
     $street = $template->get('street', 'property');
     if ($street[0] != '') {
         $selectors[] = $db->qn('e.address2') . " IN ('" . implode("','", $street) . "')";
     }
     // Filter by locality
//.........这里部分代码省略.........
开发者ID:alesconti,项目名称:FF_2015,代码行数:101,代码来源:propertyexport.php

示例12: getStart


//.........这里部分代码省略.........
         if (!empty($filter)) {
             $query->group($filter);
         }
     }
     // Order by set field
     $orderby = $this->getFilterBy('sort', $ignore);
     if (!empty($orderby)) {
         $query->order($orderby);
     }
     // Add a limit if user wants us to
     $limits = $this->getExportLimit();
     // Execute the query
     $csvidb->setQuery($query, $limits['offset'], $limits['limit']);
     $csvilog->addDebug(JText::_('COM_CSVI_EXPORT_QUERY'), true);
     // There are no records, write SQL query to log
     if (!is_null($csvidb->getErrorMsg())) {
         $this->addExportContent(JText::sprintf('COM_CSVI_ERROR_RETRIEVING_DATA', $csvidb->getErrorMsg()));
         $this->writeOutput();
         $csvilog->AddStats('incorrect', $csvidb->getErrorMsg());
     } else {
         $logcount = $csvidb->getNumRows();
         $jinput->set('logcount', $logcount);
         if ($logcount > 0) {
             $linenumber = 1;
             while ($record = $csvidb->getRow()) {
                 $csvilog->setLinenumber($linenumber++);
                 if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') {
                     $this->addExportContent($exportclass->NodeStart());
                 }
                 foreach ($export_fields as $column_id => $field) {
                     $fieldname = $field->field_name;
                     // Add the replacement
                     if (isset($record->{$fieldname})) {
                         $fieldvalue = CsviHelper::replaceValue($field->replace, $record->{$fieldname});
                     } else {
                         $fieldvalue = '';
                     }
                     switch ($fieldname) {
                         case 'category_path':
                             // Get all the category IDs
                             $query = $db->getQuery(true);
                             $query->select('virtuemart_category_id');
                             $query->from('#__virtuemart_calc_categories');
                             $query->where('virtuemart_calc_id = ' . $record->virtuemart_calc_id);
                             $db->setQuery($query);
                             $catids = $db->loadColumn();
                             if (!empty($catids)) {
                                 $categories = array();
                                 foreach ($catids as $catid) {
                                     $categories[] = $helper->createCategoryPathById($catid);
                                 }
                                 $fieldvalue = implode('|', $categories);
                             }
                             $fieldvalue = CsviHelper::replaceValue($field->replace, $fieldvalue);
                             $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header, true);
                             break;
                         case 'shopper_group_name':
                             $query = $db->getQuery(true);
                             $query->select('virtuemart_shoppergroup_id');
                             $query->from('#__virtuemart_calc_shoppergroups');
                             $query->where('virtuemart_calc_id = ' . $record->virtuemart_calc_id);
                             $db->setQuery($query);
                             $groupids = $db->loadResultArray();
                             if (!empty($groupids)) {
                                 $query = $db->getQuery(true);
                                 $query->select('shopper_group_name');
开发者ID:spiridonov-oa,项目名称:SheinCandles,代码行数:67,代码来源:calcexport.php

示例13: getStart


//.........这里部分代码省略.........
         if (!empty($filter)) {
             $query->group($filter);
         }
     }
     // Order by set field
     $orderby = $this->getFilterBy('sort', $ignore);
     if (!empty($orderby)) {
         $query->order($orderby);
     }
     // Add a limit if user wants us to
     $limits = $this->getExportLimit();
     // Execute the query
     $csvidb->setQuery($query, $limits['offset'], $limits['limit']);
     $csvilog->addDebug(JText::_('COM_CSVI_EXPORT_QUERY'), true);
     // There are no records, write SQL query to log
     if (!is_null($csvidb->getErrorMsg())) {
         $this->addExportContent(JText::sprintf('COM_CSVI_ERROR_RETRIEVING_DATA', $csvidb->getErrorMsg()));
         $this->writeOutput();
         $csvilog->AddStats('incorrect', $csvidb->getErrorMsg());
     } else {
         $logcount = $csvidb->getNumRows();
         $jinput->set('logcount', $logcount);
         if ($logcount > 0) {
             $linenumber = 1;
             while ($record = $csvidb->getRow()) {
                 $csvilog->setLinenumber($linenumber++);
                 if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') {
                     $this->addExportContent($exportclass->NodeStart());
                 }
                 foreach ($export_fields as $column_id => $field) {
                     $fieldname = $field->field_name;
                     // Add the replacement
                     if (isset($record->{$fieldname})) {
                         $fieldvalue = CsviHelper::replaceValue($field->replace, $record->{$fieldname});
                     } else {
                         $fieldvalue = '';
                     }
                     switch ($fieldname) {
                         case 'product_sku':
                             $query = $db->getQuery(true);
                             $query->select('product_sku');
                             $query->from('#__virtuemart_products');
                             $query->where('virtuemart_product_id = ' . $record->virtuemart_product_id);
                             $db->setQuery($query);
                             $fieldvalue = $db->loadResult();
                             if (strlen(trim($fieldvalue)) == 0) {
                                 $fieldvalue = $field->default_value;
                             }
                             $record->output[$column_id] = $fieldvalue;
                             break;
                         case 'product_name':
                             $query = $db->getQuery(true);
                             $query->select($fieldname);
                             $query->from('#__virtuemart_products_' . $template->get('language', 'general'));
                             $query->where('virtuemart_product_id = ' . $record->virtuemart_product_id);
                             $db->setQuery($query);
                             $fieldvalue = CsviHelper::replaceValue($field->replace, $db->loadResult());
                             // Check if we have any content otherwise use the default value
                             if (strlen(trim($fieldvalue)) == 0) {
                                 $fieldvalue = $field->default_value;
                             }
                             $record->output[$column_id] = $fieldvalue;
                             break;
                         case 'product_price':
                             $product_price = number_format($record->product_price, $template->get('export_price_format_decimal', 'general', 2, 'int'), $template->get('export_price_format_decsep', 'general'), $template->get('export_price_format_thousep', 'general'));
                             if (strlen(trim($product_price)) == 0) {
开发者ID:alesconti,项目名称:FF_2015,代码行数:67,代码来源:priceexport.php

示例14: getStart


//.........这里部分代码省略.........
					ON #__vm_product_product_type_xref.product_type_id = #__vm_product_type.product_type_id
					LEFT JOIN #__virtuemart_products
					ON #__vm_product_product_type_xref.product_id = #__virtuemart_products.virtuemart_product_id ';
                // Add the product type X tables
                $q .= "\nLEFT JOIN #__" . $vmid . " ON #__" . $vmid . ".product_id = #__virtuemart_products.virtuemart_product_id " . "\n";
                // Check if there are any selectors
                $selectors = array();
                // Add product type ID checks
                if (is_int($filterid)) {
                    $selectors[] = '#__vm_product_type.product_type_id = ' . $filterid;
                }
                // Filter by product type name
                if ($producttypeid) {
                    $selectors[] = '#__vm_product_type.product_type_id IN (' . implode(',', $producttypeid) . ')';
                }
                // Check if we need to attach any selectors to the query
                if (count($selectors) > 0) {
                    $q .= ' WHERE ' . implode(' AND ', $selectors) . "\n";
                }
                // Special field treatment
                $special = array();
                $special['product_sku'] = $db->qn('#__virtuemart_products') . '.' . $db->qn('product_sku');
                $special['product_id'] = $db->qn('#__virtuemart_products') . '.' . $db->qn('virtuemart_product_id');
                $special['product_type_name'] = $db->qn('#__vm_product_type') . '.' . $db->qn('product_type_name');
                $special['product_type_id'] = $db->qn('#__vm_product_type') . '.' . $db->qn('product_type_id');
                // Check if we need to group the orders together
                $groupby = $template->get('groupby', 'general', false, 'bool');
                if ($groupby) {
                    $filter = $this->getFilterBy('groupby', $ignore, $special);
                    if (!empty($filter)) {
                        $q .= " GROUP BY " . $filter;
                    }
                }
                // Order by set field
                $orderby = $this->getFilterBy('sort', $ignore, $special);
                if (!empty($orderby)) {
                    $q .= " ORDER BY " . $orderby;
                }
                $queries[] = $q . ')';
            }
            // Create the full query
            $q = implode("\nUNION\n", $queries);
            // Add export limits
            $limits = $this->getExportLimit();
            // Execute the query
            $csvidb->setQuery($q, $limits['offset'], $limits['limit']);
            $csvilog->addDebug(JText::_('COM_CSVI_EXPORT_QUERY'), true);
            // There are no records, write SQL query to log
            if (!is_null($csvidb->getErrorMsg())) {
                $this->addExportContent(JText::sprintf('COM_CSVI_ERROR_RETRIEVING_DATA', $csvidb->getErrorMsg()));
                $this->writeOutput();
                $csvilog->AddStats('incorrect', $csvidb->getErrorMsg());
            } else {
                $logcount = $csvidb->getNumRows();
                $jinput->set('logcount', $logcount);
                if ($logcount > 0) {
                    while ($record = $csvidb->getRow()) {
                        if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') {
                            $this->addExportContent($exportclass->NodeStart());
                        }
                        foreach ($export_fields as $column_id => $field) {
                            if ($field->process) {
                                $fieldname = $field->field_name;
                                // Add the replacement
                                if (isset($record->{$fieldname})) {
                                    $fieldvalue = CsviHelper::replaceValue($field->replace, $record->{$fieldname});
                                } else {
                                    $fieldvalue = '';
                                }
                                switch ($fieldname) {
                                    default:
                                        // Check if we have any content otherwise use the default value
                                        if (strlen(trim($fieldvalue)) == 0) {
                                            $fieldvalue = $field->default_value;
                                        }
                                        $record->output[$column_id] = $fieldvalue;
                                        break;
                                }
                            }
                        }
                        // Output the data
                        $this->addExportFields($record);
                        if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') {
                            $this->addExportContent($exportclass->NodeEnd());
                        }
                        // Output the contents
                        $this->writeOutput();
                    }
                } else {
                    $this->addExportContent(JText::_('COM_CSVI_NO_DATA_FOUND'));
                    // Output the contents
                    $this->writeOutput();
                }
            }
        } else {
            $this->addExportContent(JText::_('COM_CSVI_NO_DATA_FOUND'));
            $this->writeOutput();
            $csvilog->AddStats('incorrect', $db->getErrorMsg());
        }
    }
开发者ID:alesconti,项目名称:FF_2015,代码行数:101,代码来源:producttypenamesexport.php

示例15:

					<td id="newfield_defaultvalue"><input type="text"
						name="_default_value" id="_default_value" value="" size="55" />
					</td>
					<!-- Process field -->
					<td id="newfield_processfield"><?php 
    echo CsviHelper::getYesNo('_process_field', '1', '', '_process_field_default');
    ?>
					</td>
					<!-- Combine field -->
					<td id="newfield_combinefield"><?php 
    echo CsviHelper::getYesNo('_combine_field', '0', '', '_combine_field_default');
    ?>
					</td>
					<!-- Sort field -->
					<td id="newfield_sortfield"><?php 
    echo CsviHelper::getYesNo('_sort_field', '0', '', '_sort_field_default');
    ?>
					</td>
					<!-- Replacement field -->
					<td id="newfield_replacementfield"><?php 
    echo JHtml::_('select.genericlist', $this->replacements, '_replace_field[]', 'multiple="true"', 'value', 'text', '', '_replace_field_default');
    ?>
					</td>
				</tr>
			</tbody>
		</table>
		<br />
		<div id="toolbar" class="toolbar-list">
			<ul>
				<li id="toolbar-quickadd" class="button"><?php 
    echo JHtml::_('link', '#', '<span class="icon-32-csvi_add_32 quickadd-button" id="quickadd-button">&nbsp;</span>' . JText::_('COM_CSVI_QUICKADD'));
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:31,代码来源:default_fields.php


注:本文中的CsviHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。