Changeset View
Changeset View
Standalone View
Standalone View
core/units/email_templates/email_template_tp.php
Show All 18 Lines | |||||
/** | /** | ||||
* Removes "Enabled" column, when not in debug mode | * Removes "Enabled" column, when not in debug mode | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
*/ | */ | ||||
function ModifyUnitConfig($params) | function ModifyUnitConfig($params) | ||||
{ | { | ||||
if ( !$this->Application->isDebugMode() ) { | if ( !$this->Application->isDebugMode() ) { | ||||
/** @var Array $grids */ | |||||
$grids = $this->Application->getUnitOption($this->Prefix, 'Grids', Array ()); | $grids = $this->Application->getUnitOption($this->Prefix, 'Grids', Array ()); | ||||
Lint: CodingStandard.Array.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
PHP keywords must be lowercase; expected "array" but found "Array" Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
/* @var $grids Array */ | |||||
foreach ($grids as $grid_name => $grid_data) { | foreach ($grids as $grid_name => $grid_data) { | ||||
if ( array_key_exists('Enabled', $grid_data['Fields']) ) { | if ( array_key_exists('Enabled', $grid_data['Fields']) ) { | ||||
unset($grids[$grid_name]['Fields']['Enabled']); | unset($grids[$grid_name]['Fields']['Enabled']); | ||||
} | } | ||||
} | } | ||||
$this->Application->setUnitOption($this->Prefix, 'Grids', $grids); | $this->Application->setUnitOption($this->Prefix, 'Grids', $grids); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Checks, that field can be edited | * Checks, that field can be edited | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
function IsEditable($params) | function IsEditable($params) | ||||
{ | { | ||||
if ($this->Application->isDebugMode()) { | if ($this->Application->isDebugMode()) { | ||||
return true; | return true; | ||||
} | } | ||||
/** @var kDBItem $object */ | |||||
$object = $this->getObject($params); | $object = $this->getObject($params); | ||||
/* @var $object kDBItem */ | |||||
return $object->GetDBField($params['check_field']); | return $object->GetDBField($params['check_field']); | ||||
} | } | ||||
/** | /** | ||||
* To recipient read-only | * To recipient read-only | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return string | * @return string | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function ToRecipientReadOnly($params) | protected function ToRecipientReadOnly($params) | ||||
{ | { | ||||
return !$this->IsEditable(Array ('check_field' => 'AllowChangingRecipient')); | return !$this->IsEditable(Array ('check_field' => 'AllowChangingRecipient')); | ||||
} | } | ||||
/** | /** | ||||
* Removes "To" options from possible options in "RecipientType" field | * Removes "To" options from possible options in "RecipientType" field | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
*/ | */ | ||||
function RemoveToRecipientType($params) | function RemoveToRecipientType($params) | ||||
{ | { | ||||
/** @var kDBItem $object */ | |||||
$object = $this->getObject($params); | $object = $this->getObject($params); | ||||
/* @var $object kDBItem */ | |||||
$field_options = $object->GetFieldOptions('RecipientType'); | $field_options = $object->GetFieldOptions('RecipientType'); | ||||
unset($field_options['options'][ EmailTemplate::RECIPIENT_TYPE_TO ]); | unset($field_options['options'][ EmailTemplate::RECIPIENT_TYPE_TO ]); | ||||
$object->SetFieldOptions('RecipientType', $field_options); | $object->SetFieldOptions('RecipientType', $field_options); | ||||
} | } | ||||
/** | /** | ||||
* Restores "To" option in possible option list in "RecipientType" field | * Restores "To" option in possible option list in "RecipientType" field | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
*/ | */ | ||||
function RestoreRecipientType($params) | function RestoreRecipientType($params) | ||||
{ | { | ||||
/** @var kDBItem $object */ | |||||
$object = $this->getObject($params); | $object = $this->getObject($params); | ||||
/* @var $object kDBItem */ | |||||
$field_options = $object->GetFieldOptions('RecipientType'); | $field_options = $object->GetFieldOptions('RecipientType'); | ||||
$virtual_fields = $this->Application->getUnitOption($this->Prefix, 'VirtualFields'); | $virtual_fields = $this->Application->getUnitOption($this->Prefix, 'VirtualFields'); | ||||
$field_options['options'] = $virtual_fields['RecipientType']['options']; | $field_options['options'] = $virtual_fields['RecipientType']['options']; | ||||
$object->SetFieldOptions('RecipientType', $field_options); | $object->SetFieldOptions('RecipientType', $field_options); | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |
There must be no space between the Array keyword and the opening parenthesis