You are here

class UltimateCronGeneralSettings in Ultimate Cron 7.2

General settings plugin class.

Hierarchy

Expanded class hierarchy of UltimateCronGeneralSettings

1 string reference to 'UltimateCronGeneralSettings'
general.inc in plugins/ultimate_cron/settings/general.inc

File

plugins/ultimate_cron/settings/general.class.php, line 10
General settings for Ultimate Cron.

View source
class UltimateCronGeneralSettings extends UltimateCronSettings {

  /**
   * Handle kill signal.
   */
  public function signal($item, $signal) {
    switch ($signal) {
      case 'kill':
        $item
          ->sendSignal('kill', TRUE);
        return;
    }
  }

  /**
   * Use ajax for run, since we're launching in the background.
   */
  public function build_operations_alter($job, &$allowed_operations) {
    if (empty($allowed_operations['run'])) {
      if (in_array('killable', $job->hook['tags']) && !$job
        ->peekSignal('kill')) {
        $allowed_operations['kill'] = array(
          'title' => t('Kill'),
          'href' => 'admin/config/system/cron/jobs/list/' . $job->name . '/signal/' . $this->type . '/' . $this->name . '/kill',
          'attributes' => array(
            'class' => array(
              'use-ajax',
            ),
          ),
          'query' => array(
            'token' => drupal_get_token('signal'),
          ),
        );
      }
    }
  }

  /**
   * Implements hook_cron_post_schedule().
   */
  public function cron_post_schedule($job, &$result) {
    if (self::getGlobalOption('bypass_schedule')) {
      $result = $result || empty($job->disabled) && !$job
        ->isLocked();
    }
  }

  /**
   * Default settings.
   */
  public function defaultSettings() {
    return array(
      'nodejs' => module_exists('nodejs'),
    );
  }

  /**
   * Settings form.
   */
  public function settingsForm(&$form, &$form_state, $job = NULL) {
    $elements =& $form['settings'][$this->type][$this->name];
    $values =& $form_state['values']['settings'][$this->type][$this->name];
    if (!$job) {
      $elements['nodejs'] = array(
        '#type' => 'checkbox',
        '#title' => t('nodejs'),
        '#default_value' => $values['nodejs'],
        '#description' => t('Enable nodejs integration (Live reload on jobs page. Requires the nodejs module to be installed and configured).'),
        '#fallback' => TRUE,
      );
    }
    else {
      $elements['no_settings'] = array(
        '#markup' => '<p>' . t('This plugin has no settings.') . '</p>',
      );
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UltimateCronGeneralSettings::build_operations_alter public function Use ajax for run, since we're launching in the background. Overrides UltimateCronPlugin::build_operations_alter
UltimateCronGeneralSettings::cron_post_schedule public function Implements hook_cron_post_schedule(). Overrides UltimateCronPlugin::cron_post_schedule
UltimateCronGeneralSettings::defaultSettings public function Default settings. Overrides UltimateCronPlugin::defaultSettings
UltimateCronGeneralSettings::settingsForm public function Settings form. Overrides UltimateCronPlugin::settingsForm
UltimateCronGeneralSettings::signal public function Handle kill signal. Overrides UltimateCronPlugin::signal
UltimateCronPlugin::$description public property
UltimateCronPlugin::$globalOptions public static property
UltimateCronPlugin::$instances public static property
UltimateCronPlugin::$name public property
UltimateCronPlugin::$plugin public property
UltimateCronPlugin::$settings public property
UltimateCronPlugin::$title public property
UltimateCronPlugin::$weight public property 1
UltimateCronPlugin::cleanForm public function Clean form of empty fallback values.
UltimateCronPlugin::cronapi public function A hook_cronapi() for plugins. 1
UltimateCronPlugin::cron_alter public function A hook_cron_alter() for plugins. 3
UltimateCronPlugin::cron_post_invoke public function A hook_cron_post_invoke() for plugins.
UltimateCronPlugin::cron_post_launch public function A hook_cron_post_launch() for plugins.
UltimateCronPlugin::cron_post_run public function A hook_cron_post_run() for plugins.
UltimateCronPlugin::cron_pre_invoke public function A hook_cron_pre_invoke() for plugins.
UltimateCronPlugin::cron_pre_launch public function A hook_cron_pre_launch() for plugins.
UltimateCronPlugin::cron_pre_run public function A hook_cron_pre_run() for plugins.
UltimateCronPlugin::cron_pre_schedule public function A hook_cron_pre_schedule() for plugins. 2
UltimateCronPlugin::drupal_array_remove_nested_value public function Modified version drupal_array_get_nested_value().
UltimateCronPlugin::factory public static function Singleton factoryLogEntry.
UltimateCronPlugin::fallbackalize public function Process fallback form parameters.
UltimateCronPlugin::formatLabel public function Format label for the plugin. 1
UltimateCronPlugin::formatLabelVerbose public function Format verbose label for the plugin. 1
UltimateCronPlugin::getDefaultSettings public function Get default settings. 1
UltimateCronPlugin::getGlobalOption public static function Get global plugin option.
UltimateCronPlugin::getGlobalOptions public static function Get all global plugin options.
UltimateCronPlugin::hook_cron_alter final public static function Invoke hook_cron_alter() on plugins.
UltimateCronPlugin::hook_cron_post_invoke final public static function Invoke hook_cron_post_invoke() on plugins.
UltimateCronPlugin::hook_cron_post_launch final public static function Invoke hook_cron_post_launch() on plugins.
UltimateCronPlugin::hook_cron_post_run final public static function Invoke hook_cron_post_run() on plugins.
UltimateCronPlugin::hook_cron_post_schedule final public static function Invoke hook_cron_post_schedule() on plugins.
UltimateCronPlugin::hook_cron_pre_invoke final public static function Invoke hook_cron_pre_invoke() on plugins.
UltimateCronPlugin::hook_cron_pre_launch final public static function Invoke hook_cron_pre_launch() on plugins.
UltimateCronPlugin::hook_cron_pre_run final public static function Invoke hook_cron_pre_run() on plugins.
UltimateCronPlugin::hook_cron_pre_schedule final public static function Invoke hook_cron_pre_schedule() on plugins.
UltimateCronPlugin::isValid public function Default plugin valid for all jobs. 2
UltimateCronPlugin::setGlobalOption public static function Set global plugin option.
UltimateCronPlugin::setSettings public function Save settings to db.
UltimateCronPlugin::settingsFormSubmit public function Settings form submit handler. 3
UltimateCronPlugin::settingsFormValidate public function Settings form validate handler. 1
UltimateCronPlugin::settingsLabel public function Get label for a specific setting. 3
UltimateCronPlugin::unsetGlobalOption public static function Remove a global plugin option.
UltimateCronPlugin::unsetGlobalOptions public static function Remove all global plugin options.
UltimateCronPlugin::__construct public function Constructor. 1
UltimateCronPluginMultiple::$multiple public static property Overrides UltimateCronPlugin::$multiple
UltimateCronPluginMultiple::defaultSettingsForm public static function Default settings form. Overrides UltimateCronPlugin::defaultSettingsForm
UltimateCronPluginMultiple::jobSettingsForm public static function Job settings form. Overrides UltimateCronPlugin::jobSettingsForm
UltimateCronPluginMultiple::jobSettingsFormSubmit public static function Job settings form submit handler. Overrides UltimateCronPlugin::jobSettingsFormSubmit
UltimateCronPluginMultiple::jobSettingsFormValidate public static function Job settings form validate handler. Overrides UltimateCronPlugin::jobSettingsFormValidate