function _skinr_context_ui_mass_update_batch_process in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr_context/skinr_context_ui.admin.inc \_skinr_context_ui_mass_update_batch_process()
Batch operation for skin configuration mass updates.
1 string reference to '_skinr_context_ui_mass_update_batch_process'
- skinr_context_ui_mass_update in skinr_context/
skinr_context_ui.admin.inc - Mass update skin configuration groups, updating all skin configuration grouos in the $groups array with the field values in $updates.
File
- skinr_context/
skinr_context_ui.admin.inc, line 158 - Admin page callbacks for the Skinr Context UI module.
Code
function _skinr_context_ui_mass_update_batch_process($groups, $updates, &$context) {
if (!isset($context['sandbox']['progress'])) {
$context['sandbox']['progress'] = 0;
$context['sandbox']['max'] = count($groups);
$context['sandbox']['groups'] = $groups;
}
// Process groups in batches of 5.
$count = min(5, count($context['sandbox']['groups']));
for ($i = 1; $i <= $count; $i++) {
// For each sid, load the skin configuration, reset the values, and save it.
$gid = array_shift($context['sandbox']['groups']);
$group = _skinr_context_ui_mass_update_helper($gid, $updates);
// Store result for post-processing in the finished callback.
$context['results'][] = $group->title;
// 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'];
}
}