function _skinr_ui_mass_update_batch_process in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr_ui/skinr_ui.admin.inc \_skinr_ui_mass_update_batch_process()
Batch operation for skin configuration mass updates.
1 string reference to '_skinr_ui_mass_update_batch_process'
- skinr_ui_mass_update in ./
skinr_ui.admin.inc - Mass update skin configurations, updating all skin configurations in the $skins array with the field values in $updates.
File
- ./
skinr_ui.admin.inc, line 298 - Admin page callbacks for the Skinr UI module.
Code
function _skinr_ui_mass_update_batch_process($skins, $updates, &$context) {
if (!isset($context['sandbox']['progress'])) {
$context['sandbox']['progress'] = 0;
$context['sandbox']['max'] = count($skins);
$context['sandbox']['skins'] = $skins;
}
// Process skins in groups of 5.
$count = min(5, count($context['sandbox']['skins']));
for ($i = 1; $i <= $count; $i++) {
// For each sid, load the skin configuration, reset the values, and save it.
$sid = array_shift($context['sandbox']['skins']);
$skin = _skinr_ui_mass_update_helper($sid, $updates);
// Store result for post-processing in the finished callback.
$context['results'][] = $skin->skin;
// Update our progress information.
$context['sandbox']['progress']++;
}
// Inform the batch engine that we are not finished,
// and provide an estimation of the completion level we reached.
if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
}
}