/** * @param ModuleWidget_EntityWidget $oWidget */ public function _eventWidgetsEdit($oWidget) { if ($this->GetPost()) { $aConfig = array(); $sPrefix = 'widget.' . $oWidget->GetId() . '.config.'; if ($xVal = $this->GetPost('widget_group')) { $aConfig[$sPrefix . 'wgroup'] = $xVal; } $aConfig[$sPrefix . 'active'] = (bool) $this->GetPost('widget_active'); $xVal = strtolower($this->GetPost('widget_priority')); $aConfig[$sPrefix . 'priority'] = $xVal == 'top' ? 'top' : intval($xVal); if ($this->GetPost('widget_display') == 'period') { if ($sFrom = $this->GetPost('widget_period_from')) { $aConfig[$sPrefix . 'display.date_from'] = date('Y-m-d', strtotime($sFrom)); } if ($sUpto = $this->GetPost('widget_period_upto')) { $aConfig[$sPrefix . 'display.date_upto'] = date('Y-m-d', strtotime($sUpto)); } } $xVal = strtolower($this->GetPost('widget_visitors')); $aConfig[$sPrefix . 'visitors'] = in_array($xVal, array('users', 'admins')) ? $xVal : null; Config::WriteCustomConfig($aConfig); R::Location('admin/site-widgets'); } $this->_setTitle(E::ModuleLang()->Get('action.admin.widget_edit_title')); $this->SetTemplateAction('site/widgets_add'); E::ModuleViewer()->Assign('oWidget', $oWidget); }