Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r7391 -r7855 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 7391) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 7855) @@ -308,6 +308,7 @@ $current_path = $this->Conn->GetOne('SELECT ParentPath FROM '.TABLE_PREFIX.'Category WHERE CategoryId='.$parent_cat_id); $subcats = $this->Conn->GetCol('SELECT CategoryId FROM '.TABLE_PREFIX.'Category WHERE ParentPath LIKE "'.$current_path.'%" '); $object->addFilter('category_filter', TABLE_PREFIX.'CategoryItems.CategoryId IN ('.implode(', ', $subcats).')'); + $object->addFilter('primary_filter', 'PrimaryCat = 1'); } else { $object->addFilter('category_filter', TABLE_PREFIX.'CategoryItems.CategoryId = '.$parent_cat_id ); @@ -1365,6 +1366,39 @@ } /** + * Performs each export step & displays progress percent + * + * @param kEvent $event + */ + function OnExportProgress(&$event) + { + $export_object =& $this->Application->recallObject('CatItemExportHelper'); + /* @var $export_object kCatDBItemExportHelper */ + + $event = new kEvent($event->getPrefixSpecial().':OnDummy'); + + $action_method = 'perform'.ucfirst($event->Special); + $field_values = $export_object->$action_method($event); + + // finish code is done from JS now + if ($field_values['start_from'] == $field_values['total_records']) { + if ($event->Special == 'import') { + $this->Application->StoreVar('PermCache_UpdateRequired', 1); + $this->Application->Redirect('in-portal/categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1, 'no_amp' => 1)); + } + elseif ($event->Special == 'export') { + $template = $this->Application->getUnitOption($event->Prefix, 'ModuleFolder').'/'.$event->Special.'_finish'; + $this->Application->Redirect($template, Array('pass' => 'all')); + } + } + + $export_options = $export_object->loadOptions($event); + echo $export_options['start_from'] * 100 / $export_options['total_records']; + + $event->status = erSTOP; + } + + /** * Returns specific to each item type columns only * * @param kEvent $event