Changeset View
Changeset View
Standalone View
Standalone View
core/units/helpers/brackets_helper.php
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | |||||
*/ | */ | ||||
var $_language = null; | var $_language = null; | ||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
parent::__construct(); | parent::__construct(); | ||||
$this->_language = $this->Application->recallObject('lang.current'); | $this->_language = $this->Application->recallObject('lang.current'); | ||||
/* @var $lang kDBItem */ | /** @var kDBItem $lang */ | ||||
$this->_decimalSeparator = $this->_language->GetDBField('DecimalPoint'); | $this->_decimalSeparator = $this->_language->GetDBField('DecimalPoint'); | ||||
$this->_thousandsSeparator = $this->_language->GetDBField('ThousandSep'); | $this->_thousandsSeparator = $this->_language->GetDBField('ThousandSep'); | ||||
} | } | ||||
function InitHelper($min_field, $max_field, $default_values, $default_start_value = null) | function InitHelper($min_field, $max_field, $default_values, $default_start_value = null) | ||||
{ | { | ||||
$this->min_field = $min_field; | $this->min_field = $min_field; | ||||
▲ Show 20 Lines • Show All 173 Lines • ▼ Show 20 Line(s) | |||||
/** | /** | ||||
* Saves brackets to database | * Saves brackets to database | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
*/ | */ | ||||
function OnPreSaveBrackets($event) | function OnPreSaveBrackets($event) | ||||
{ | { | ||||
$items_info = $this->getBrackets($event); | $items_info = $this->getBrackets($event); | ||||
if ($items_info) { | if ($items_info) { | ||||
Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace: Expected 1 spaces after "if" opening bracket; 0 found | |||||
Expected 1 spaces before "if" closing bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace: Expected 1 spaces before "if" closing bracket; 0 found | |||||
No blank line found before "if" control structure Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.NoLineBeforeOpen: No blank line found before "if" control structure | |||||
/** @var kDBItem $object */ | |||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBItem */ | |||||
$linked_info = $object->getLinkedInfo(); | $linked_info = $object->getLinkedInfo(); | ||||
$stored_ids = $this->Conn->GetCol('SELECT '.$object->IDField.' FROM '.$object->TableName.' WHERE '.$linked_info['ForeignKey'].' = '.$linked_info['ParentId']); | $stored_ids = $this->Conn->GetCol('SELECT '.$object->IDField.' FROM '.$object->TableName.' WHERE '.$linked_info['ForeignKey'].' = '.$linked_info['ParentId']); | ||||
uasort($items_info, Array(&$this, 'compareBrackets') ); | uasort($items_info, Array(&$this, 'compareBrackets') ); | ||||
foreach ($items_info as $item_id => $values) { | foreach ($items_info as $item_id => $values) { | ||||
Show All 40 Lines | |||||
/** | /** | ||||
* Sorts brackets and returns sorted array | * Sorts brackets and returns sorted array | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
* @return Array | * @return Array | ||||
*/ | */ | ||||
function arrangeBrackets($event) | function arrangeBrackets($event) | ||||
{ | { | ||||
/** @var kDBItem $object */ | |||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBItem */ | |||||
$temp = $this->getBrackets($event); | $temp = $this->getBrackets($event); | ||||
foreach ($temp as $id => $record) { | foreach ($temp as $id => $record) { | ||||
if ( $record[$this->max_field] == '∞' ) { | if ( $record[$this->max_field] == '∞' ) { | ||||
$temp[$id][$this->max_field] = -1; | $temp[$id][$this->max_field] = -1; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | |||||
/** | /** | ||||
* Replace infinity mark with -1 before saving to db | * Replace infinity mark with -1 before saving to db | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
*/ | */ | ||||
function replaceInfinity($event) | function replaceInfinity($event) | ||||
{ | { | ||||
/** @var kDBItem $object */ | |||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBItem */ | |||||
if ( $object->GetDBField($this->max_field) == '∞' ) { | if ( $object->GetDBField($this->max_field) == '∞' ) { | ||||
$object->SetDBField($this->max_field, -1); | $object->SetDBField($this->max_field, -1); | ||||
} | } | ||||
} | } | ||||
} | } |
Expected 1 spaces after "if" opening bracket; 0 found