function doBulkUpdate($filter, $do, $ids = array()) { @set_time_limit(0); $change_fields = array(); $custom_fields = array(); $do_delete = false; // Make sure we have actions if (empty($do)) { return; } // Make sure we have checked items if we want a checked list if (0 == strcasecmp($filter, "checks") && empty($ids)) { return; } if (is_array($do)) { foreach ($do as $k => $v) { switch ($k) { case 'status': if (2 == $v) { $do_delete = true; } else { $change_fields[DAO_WatcherMailFilter::IS_DISABLED] = !empty($v) ? 1 : 0; } break; default: // Custom fields // if(substr($k,0,3)=="cf_") { // $custom_fields[substr($k,3)] = $v; // } break; } } } $pg = 0; if (empty($ids)) { do { list($objects, $null) = DAO_WatcherMailFilter::search(array(), $this->params, 100, $pg++, SearchFields_WatcherMailFilter::ID, true, false); $ids = array_merge($ids, array_keys($objects)); } while (!empty($objects)); } $batch_total = count($ids); for ($x = 0; $x <= $batch_total; $x += 100) { $batch_ids = array_slice($ids, $x, 100); if ($do_delete) { DAO_WatcherMailFilter::delete($batch_ids); } else { DAO_WatcherMailFilter::update($batch_ids, $change_fields); // Custom Fields //self::_doBulkSetCustomFields(ChCustomFieldSource_TimeEntry::ID, $custom_fields, $batch_ids); } unset($batch_ids); } unset($ids); }
function saveTab() { $worker = CerberusApplication::getActiveWorker(); // Delete forwards @($deletes = DevblocksPlatform::importGPC($_REQUEST['deletes'], 'array', array())); if (!empty($deletes)) { DAO_WatcherMailFilter::delete($deletes); } DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('preferences', 'notifications'))); }