Esempio n. 1
0
 /**
  * @return string
  */
 protected function getDefaultError()
 {
     if (\Input::get('act') != '') {
         $defaultError = sprintf('User "%s" has not enough permission to run action "%s" for DataContainer "%s"', \BackendUser::getInstance()->username, \Input::get('act'), $this->definition->getName());
         if (\Input::get('id') != '') {
             $defaultError .= ' on item with ID "' . \Input::get('id') . '"';
         }
     } else {
         $defaultError = sprintf('User "%s" has not enough permission to access module "%s"', \BackendUser::getInstance()->username, \Input::get('do'));
     }
     return $defaultError;
 }
Esempio n. 2
0
 /**
  * Translate a key
  *
  * If key starts with a trailing slash, it tries to find it in the global language array. Otherwise it will
  * have a look into the data container language vars
  *
  * @param $key
  * @return string
  */
 public function translate($key)
 {
     $chunks = explode('/', $key);
     if (substr($key, 0, 1) == '/') {
         $value = $GLOBALS['TL_LANG'];
         array_shift($chunks);
     } else {
         $value = $GLOBALS['TL_LANG'][$this->definition->getName()];
     }
     foreach ($chunks as $chunk) {
         if (!isset($value[$chunk])) {
             return '';
         }
         $value = $value[$chunk];
     }
     return $value;
 }