function mostpopular_service_config_form_submit in Drupal Most Popular 6
Same name and namespace in other branches
- 7 mostpopular.services.inc \mostpopular_service_config_form_submit()
1 string reference to 'mostpopular_service_config_form_submit'
File
- ./
mostpopular.admin.inc, line 640 - Defines all the administration forms for the Most Popular module.
Code
function mostpopular_service_config_form_submit($form, &$form_state) {
$sid = $form_state['values']['sid'];
unset($form_state['values']['sid']);
$throttles = $form_state['values']['throttle_fieldset'];
unset($form_state['values']['throttle_fieldset']);
$back = $form_state['values']['back'];
unset($form_state['values']['back']);
$clear = $form_state['values']['clear'];
unset($form_state['values']['clear']);
switch ($form_state['values']['op']) {
case $form_state['values']['reset']:
MostPopularLastRun::resetThrottles($sid);
drupal_set_message(t('The throttles have been reset to their default values.'));
break;
case $back:
$form_state['redirect'] = 'admin/settings/mostpopular/services';
break;
case $clear:
MostPopularLastRun::resetLastRun($sid);
drupal_set_message(t('The most popular caches have been cleared for this service. You should refresh the stats.'));
// Fall through
case $form_state['values']['submit']:
foreach ($throttles as $iid => $field) {
$last = MostPopularLastRun::fetch($sid, $iid);
$last->throttle = $field['throttle'];
$last
->save();
}
// Reset the service
$service = MostPopularService::fetch($sid);
$service
->updateStatus(MostPopularService::STATUS_CONFIGURED);
drupal_set_message(t('This service has been configured.'));
break;
}
}