Example #1
0
 /**
  * Retrieve property from the model object
  *
  * @param mixed $name Field/property name
  *
  * @return mixed
  */
 protected function getModelObjectValue($name)
 {
     $result = parent::getModelObjectValue($name);
     switch ($name) {
         case 'date':
             $result = $this->formatTime($result);
             break;
         case 'method_name':
             $result = $this->getModelObject()->getPaymentMethod() ? $this->getModelObject()->getPaymentMethod()->getName() : $result;
             break;
         case 'type':
             $list = \XLite\Model\Payment\BackendTransaction::getTypes();
             $result = $list[$result];
             break;
         case 'status':
             $list = \XLite\Model\Payment\Transaction::getStatuses();
             $result = $list[$result];
             break;
         case 'value':
             $result = static::formatPrice($result, $this->getModelObject()->getCurrency());
             break;
         case 'note':
             if (!$result) {
                 $result = static::t('n/a');
             }
             break;
         default:
     }
     return $result;
 }
Example #2
0
 /**
  * Retrieve property from the model object
  *
  * @param mixed $name Field/property name
  *
  * @return mixed
  */
 protected function getModelObjectValue($name)
 {
     // If field name starts with 'parameter_', this field
     // is represented by a bound \XLite\Model\DataSource\Parameter object
     if (strpos($name, 'parameter_') === 0) {
         $paramName = substr($name, 10);
         return $this->getModelObject()->getParameterValue($paramName);
     } else {
         // Otherwise it's a field of a current model object
         return parent::getModelObjectValue($name);
     }
 }
Example #3
0
 /**
  * Retrieve property from the model object
  *
  * @param mixed $name Field/property name
  *
  * @return mixed
  */
 protected function getModelObjectValue($name)
 {
     if ('access_level' == $name) {
         $field = $this->getFormField('access', 'access_level');
         if ($field && $field instanceof \XLite\View\FormField\Label) {
             $value = $this->getAccessLevelAsText();
         }
     }
     return isset($value) ? $value : parent::getModelObjectValue($name);
 }
Example #4
0
 /**
  * Retrieve property from the model object
  *
  * @param mixed $name Field/property name
  *
  * @return mixed
  */
 protected function getModelObjectValue($name)
 {
     $value = parent::getModelObjectValue($name);
     if ('format' == $name) {
         $value = \XLite\View\FormField\Select\FloatFormat::getFormat($this->getModelObjectValue('thousandDelimiter'), $this->getModelObjectValue('decimalDelimiter'));
     } elseif ('trailing_zeroes' == $name) {
         $value = '' !== \XLite\Core\Config::getInstance()->General->trailing_zeroes;
     }
     return $value;
 }
Example #5
0
 /**
  * Retrieve property from the model object
  *
  * @param mixed $name Field/property name
  *
  * @return mixed
  */
 protected function getModelObjectValue($name)
 {
     return 'permissions' == $name && $this->getModelObject()->isPermanentRole() ? 'Root access' : parent::getModelObjectValue($name);
 }
Example #6
0
 /**
  * Retrieve property from the model object
  *
  * @param string $name Field/property name
  *
  * @return mixed
  */
 protected function getModelObjectValue($name)
 {
     $name = preg_replace('/^([^_]*_)(.*)$/', '\\2', $name);
     return parent::getModelObjectValue($name);
 }
Example #7
0
 /**
  * Retrieve property from the model object
  *
  * @param mixed $name Field/property name
  *
  * @return mixed
  */
 protected function getModelObjectValue($name)
 {
     switch ($name) {
         case 'template':
             $result = \XLite\View\FormField\Select\Template::SKIN_STANDARD;
             $currentModule = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getCurrentSkinModule();
             if ($currentModule) {
                 $currentColor = \XLite\Core\Layout::getInstance()->getLayoutColorName();
                 $result = $currentModule->getModuleId() . ($currentColor ? '_' . $currentColor : '');
             }
             break;
         default:
             $result = parent::getModelObjectValue($name);
     }
     return $result;
 }
Example #8
0
 /**
  * Change model object value
  *
  * @param string $name Object value name
  *
  * @return mixed
  */
 protected function getModelObjectValue($name)
 {
     if ('contentTab' == $name) {
         $name = 'content';
     }
     return parent::getModelObjectValue($name);
 }
Example #9
0
 /**
  * Retrieve property from the model object
  *
  * @param mixed $name Field/property name
  *
  * @return mixed
  */
 protected function getModelObjectValue($name)
 {
     switch ($name) {
         case 'body':
             $value = '';
             $localPath = '';
             if (\XLite\Core\Request::getInstance()->template) {
                 $localPath = \XLite\Core\Request::getInstance()->template;
             } elseif ($this->getModelObject()->getId()) {
                 $localPath = $this->getModelObjectValue('template');
             }
             if ($localPath) {
                 $model = $this->getModelObject();
                 $fullPath = $this->getFullPathByLocalPath($localPath, $model->getId() ? 'theme_tweaker/default' : null);
                 $value = \Includes\Utils\FileManager::read($fullPath);
             }
             break;
         default:
             $value = parent::getModelObjectValue($name);
             break;
     }
     return $value;
 }