Exemplo n.º 1
0
 /**
  * Gets the description of this profile
  * @param zibo\library\i18n\translation\Translator $translator
  * @return string
  */
 public function getDescription(Translator $translator)
 {
     if ($this->description) {
         return $translator->translate($this->description);
     }
     return '';
 }
 /**
  * Gets the fail message of the check
  * @param zibo\library\i18n\translation\Translator $translator
  * @return string
  */
 public function getMessage(Translator $translator)
 {
     if ($this->isMet()) {
         return '';
     }
     return $translator->translate($this->message);
 }
 /**
  * Gets the options for the view type
  * @param zibo\library\i18n\translation\Translator $translator
  * @return array
  */
 protected function getViewOptions(Translator $translator)
 {
     $views = ContentViewFactory::getInstance()->getDetailViews();
     foreach ($views as $name => $class) {
         $views[$name] = $translator->translate(self::TRANSLATION_VIEW . $name);
     }
     return $views;
 }
Exemplo n.º 4
0
 /**
  * Decorates the data in the cell
  * @param zibo\library\html\table\Cell $cell Cell to decorate
  * @param zibo\library\html\table\Row $row Row containing the cell
  * @param int $rowNumber Number of the current row
  * @param array $remainingValues Array with the values of the remaining rows of the table
  * @return null
  */
 public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues)
 {
     $data = $cell->getValue();
     $class = $data->getStatusClass();
     if ($data->isError) {
         $status = $this->translator->translate(self::TRANSLATION_ERROR);
     } elseif ($data->isInProgress) {
         $status = $this->translator->translate(self::TRANSLATION_PROGRESS);
     } else {
         $status = $this->translator->translate(self::TRANSLATION_WAITING);
     }
     $value = '<div class="' . $class . '"></div> ' . $status;
     $cell->setValue($value);
     $cell->appendToClass('status');
 }
 /**
  * Decorates the cell
  * @param zibo\library\html\table\Cell $cell Cell of the value to decorate
  * @param zibo\library\html\table\Row $row Row containing the cell
  * @param int $rowNumber Number of the current row
  * @param array $remainingValues Array containing the values of the remaining rows of the table
  * @return null
  */
 public function decorate(Cell $cell, Row $row, $rowNumber, array $remainingValues)
 {
     $field = $cell->getValue();
     if (!$field instanceof ModelField) {
         return;
     }
     $label = $field->getLabel();
     if (!$label) {
         $cell->setValue('');
         return;
     }
     $value = $this->translator->translate($label);
     $value .= '<div class="info">' . $label . '</div>';
     $cell->setValue($value);
 }
 /**
  * Gets the include unlocalized options
  * @param zibo\library\i18n\translation\Translator $translator
  * @return array
  */
 protected function getIncludeUnlocalizedOptions(Translator $translator)
 {
     return array('' => $translator->translate(self::TRANSLATION_NO), ModelQuery::INCLUDE_UNLOCALIZED_FETCH => $translator->translate(self::TRANSLATION_YES));
 }
Exemplo n.º 7
0
 /**
  * Gets the title of this report
  * @param zibo\library\i18n\translation\Translator $translator
  * @return string
  */
 public function getTitle(Translator $translator)
 {
     return $translator->translate(self::TRANSLATION_TITLE, array('total' => count($this->nodes)));
 }
Exemplo n.º 8
0
 /**
  * @dataProvider providerTranslate
  */
 public function testTranslate($expected, $key, $vars = null, $default = null)
 {
     $translator = new Translator($this->englishLocale, $this->io);
     $result = $translator->translate($key, $vars, $default);
     $this->assertEquals($expected, $result);
 }
 /**
  * Get the label of this action
  * @param zibo\library\i18n\translation\Translator $translator
  * @param joppa\model\Node $node
  * @return string
  */
 public function getLabel(Translator $translator)
 {
     return $translator->translate($this->labelTranslationKey);
 }
Exemplo n.º 10
0
 /**
  * Get the label of this node type
  * @param zibo\library\i18n\translation\Translator $translator
  * @return string
  */
 public function getLabel(Translator $translator)
 {
     return $translator->translate(Module::TRANSLATION_NODE_TYPE_PREFIX . $this->name);
 }
Exemplo n.º 11
0
 /**
  * Get a suffix for the permission inherit label based on the inherited settings
  * @param joppa\model\NodeSettings $nodeSettings
  * @param zibo\library\i18n\translation\Translator $translator
  * @return string if a permission setting is found the suffix will be " ($securityLevel)"
  */
 private function getPermissionInheritSuffix(NodeSettings $nodeSettings, Translator $translator)
 {
     $permission = $nodeSettings->get(NodeSettingModel::SETTING_PERMISSIONS, NodeSettingModel::AUTHENTICATION_STATUS_EVERYBODY, true, true);
     if ($permission == null) {
         return '';
     }
     $suffix = ' (';
     if ($permission == NodeSettingModel::AUTHENTICATION_STATUS_ANONYMOUS) {
         $suffix .= $translator->translate(self::TRANSLATION_ANONYMOUS);
     } elseif ($permission == NodeSettingModel::AUTHENTICATION_STATUS_AUTHENTICATED) {
         $suffix .= $translator->translate(self::TRANSLATION_AUTHENTICATED);
     } elseif ($permission == NodeSettingModel::AUTHENTICATION_STATUS_EVERYBODY) {
         $suffix .= $translator->translate(self::TRANSLATION_EVERYBODY);
     } else {
         $suffix .= $permission;
     }
     $suffix .= ')';
     return $suffix;
 }
 /**
  * Gets the options for the parameters type
  * @param zibo\library\i18n\translation\Translator $translator
  * @return array
  */
 private function getParametersTypeOptions($translator)
 {
     return array('none' => $translator->translate(self::TRANSLATION_PARAMETERS_TYPE_NONE), ContentProperties::PARAMETERS_TYPE_NUMERIC => $translator->translate(self::TRANSLATION_PARAMETERS_TYPE_NUMERIC), ContentProperties::PARAMETERS_TYPE_NAMED => $translator->translate(self::TRANSLATION_PARAMETERS_TYPE_NAMED));
 }
Exemplo n.º 13
0
 /**
  * Get the label of this node type
  * @param zibo\library\i18n\translation\Translator $translator
  * @return string
  */
 public function getLabel(Translator $translator)
 {
     return $translator->translate(Module::TRANSLATION_NODE_TYPE_PREFIX . self::NODE_TYPE);
 }
 /**
  * Gets the options for the parameters type
  * @param zibo\library\i18n\translation\Translator $translator
  * @return array
  */
 private function getParameterIdOptions($translator)
 {
     return array(ModelTable::PRIMARY_KEY => $translator->translate(self::TRANSLATION_PRIMARY_KEY), 'slug' => $translator->translate(self::TRANSLATION_SLUG));
 }