'editgamesettings', 'setPointsPreset' => 'editgamesettings' ); public $presets; public function onLoad() { $this->presets = Core::getObject('session')->loadXML( Core::getSetting('pluginpath') . $this->id . '/presets.xml' ); } public function onOutput() { $CustomPoints = array(); if (Core::getObject('gbx')->query('GetRoundCustomPoints')) { $CustomPoints = Core::getObject('gbx')->getResponse(); } if (!is_array($CustomPoints)) { $CustomPoints = array(); } if (!Core::getObject('session')->checkPerm('editgamesettings')) { return; } echo "
"; echo ""; } public function setPoints() { if (!array_key_exists('points', $_REQUEST)) return; $str = preg_replace("/[^0-9,]/", "", $_REQUEST['points']); $array = $this->makeIntArray(explode(',', $str)); Core::getObject('actions')->add('SetRoundCustomPoints', $array, true); } public function setPointsPreset() { if (!array_key_exists('preset', $_REQUEST)) return; $str = preg_replace("/[^0-9,]/", "", $_REQUEST['preset']); $array = $this->makeIntArray(explode(',', $str)); Core::getObject('actions')->add('SetRoundCustomPoints', $array, true); } private function makeIntArray($array) { foreach ($array as $key => $value) { $array[$key] = (int)$value; } return $array; } }