You are here

public function TMGMTJobItemUIController::applyOperation in Translation Management Tool 7

Applies an operation to the given entity.

Note: the export operation is directly carried out by the operationForm() method.

Parameters

string $op: The operation (revert, delete or import).

$entity: The entity to manipulate.

Return value

string The status message of what has been applied.

Overrides EntityDefaultUIController::applyOperation

File

ui/includes/tmgmt_ui.controller.job_item.inc, line 87
Contains the job item UI controller.

Class

TMGMTJobItemUIController
Entity UI controller for the Job Entity.

Code

public function applyOperation($op, $entity) {
  switch ($op) {
    case 'delete':
      $entity
        ->delete();
      return t('The translation job item %label has been deleted.', array(
        '%label' => $entity
          ->label(),
      ));
    case 'accept':
      $entity
        ->accepted('The translation job item has been accepted by !user.', array(
        '!user' => theme('username', array(
          'account' => $GLOBALS['user'],
        )),
      ));
      return t('The translation job item %label has been accepted.', array(
        '%label' => $entity
          ->label(),
      ));
  }
  return FALSE;
}