You are here

class TMGMTLocalTranslatorUIController in Translation Management Tool 7

Local translator plugin UI controller.

Hierarchy

Expanded class hierarchy of TMGMTLocalTranslatorUIController

1 string reference to 'TMGMTLocalTranslatorUIController'
tmgmt_local_tmgmt_translator_plugin_info in translators/tmgmt_local/tmgmt_local.module
Implements hook_tmgmt_translator_plugin_info().

File

translators/tmgmt_local/includes/tmgmt_local.plugin.ui.inc, line 11
Provides the user translator UI plugin controller.

View source
class TMGMTLocalTranslatorUIController extends TMGMTDefaultTranslatorUIController {

  /**
   * {@inheritdoc}
   */
  public function checkoutSettingsForm($form, &$form_state, TMGMTJob $job) {
    if ($translators = tmgmt_local_translators($job->source_language, array(
      $job->target_language,
    ))) {
      $form['translator'] = array(
        '#title' => t('Select translator for this job'),
        '#type' => 'select',
        '#options' => array(
          '' => t('Select user'),
        ) + $translators,
        '#default_value' => $job
          ->getSetting('translator'),
      );
    }
    else {
      $form['message'] = array(
        '#markup' => t('There are no translators available.'),
      );
    }
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function checkoutInfo(TMGMTJob $job) {
    $label = $job
      ->getTranslator()
      ->label();
    $form['#title'] = t('@translator translation job information', array(
      '@translator' => $label,
    ));
    $form['#type'] = 'fieldset';
    $tuid = $job
      ->getSetting('translator');
    if ($tuid && ($translator = user_load($tuid))) {
      $form['job_status'] = array(
        '#type' => 'item',
        '#title' => t('Job status'),
        '#markup' => t('Translation job is assigned to %name.', array(
          '%name' => entity_label('user', $translator),
        )),
      );
    }
    else {
      $form['job_status'] = array(
        '#type' => 'item',
        '#title' => t('Job status'),
        '#markup' => t('Translation job is not assigned to any translator.'),
      );
    }
    if ($job
      ->getSetting('job_comment')) {
      $form['job_comment'] = array(
        '#type' => 'item',
        '#title' => t('Job comment'),
        '#markup' => filter_xss($job
          ->getSetting('job_comment')),
      );
    }
    return $form;
  }
  public function pluginSettingsForm($form, &$form_state, TMGMTTranslator $translator, $busy = FALSE) {
    $form['allow_all'] = array(
      '#title' => t('Allow translations for enabled languages even if no translator has the necessary capabilities'),
      '#type' => 'checkbox',
      '#default_value' => $translator
        ->getSetting('allow_all'),
    );
    return $form;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TMGMTDefaultTranslatorUIController::checkoutInfoWrapper public function Provides a simple wrapper for the checkout info fieldset.
TMGMTDefaultTranslatorUIController::reviewDataItemElement public function Form callback for the data item element form. Overrides TMGMTTranslatorUIControllerInterface::reviewDataItemElement 1
TMGMTDefaultTranslatorUIController::reviewForm public function Form callback for the job item review form. Overrides TMGMTTranslatorUIControllerInterface::reviewForm
TMGMTDefaultTranslatorUIController::reviewFormSubmit public function Submit callback for the job item review form. Overrides TMGMTTranslatorUIControllerInterface::reviewFormSubmit
TMGMTDefaultTranslatorUIController::reviewFormValidate public function Validation callback for the job item review form. Overrides TMGMTTranslatorUIControllerInterface::reviewFormValidate
TMGMTLocalTranslatorUIController::checkoutInfo public function Retrieves information about a translation job. Overrides TMGMTDefaultTranslatorUIController::checkoutInfo
TMGMTLocalTranslatorUIController::checkoutSettingsForm public function Form callback for the checkout settings form. Overrides TMGMTDefaultTranslatorUIController::checkoutSettingsForm
TMGMTLocalTranslatorUIController::pluginSettingsForm public function Form callback for the plugin settings form. Overrides TMGMTDefaultTranslatorUIController::pluginSettingsForm
TMGMTPluginBase::$pluginInfo protected property
TMGMTPluginBase::$pluginType protected property
TMGMTPluginBase::pluginInfo public function Returns the info of the type of the plugin. Overrides TMGMTPluginBaseInterface::pluginInfo
TMGMTPluginBase::pluginType public function Returns the type of the plugin. Overrides TMGMTPluginBaseInterface::pluginType
TMGMTPluginBase::__construct public function Constructor. Overrides TMGMTPluginBaseInterface::__construct