You are here

public function MostPopularService::updateStatus in Drupal Most Popular 7

Same name and namespace in other branches
  1. 6 classes/services.php \MostPopularService::updateStatus()

Updates the status of this service.

Parameters

integer $status: The new status. Depending on whether the service is enabled, this value may be ignored.

boolean $save: If this is true, the service will be saved if the status has changed. If false, you must save the service yourself.

1 call to MostPopularService::updateStatus()
MostPopularService::update in classes/services.php
Updates this service with the given values

File

classes/services.php, line 76
Defines a wrapper for the mostpopular_services table.

Class

MostPopularService
@file Defines a wrapper for the mostpopular_services table.

Code

public function updateStatus($status, $save = TRUE) {
  $old = $this->status;
  if (!$this->enabled) {
    $this->status = MostPopularService::STATUS_DISABLED;
  }
  elseif ($status == MostPopularService::STATUS_DISABLED) {
    $this->status = MostPopularService::STATUS_CONFIGURED;
  }
  else {
    $this->status = $status;
  }
  if ($save && $this->status != $old) {
    $this
      ->save();
  }
}