public function actionIndex() { $data = LicenseCMS::run()->readData(); $supportForm = new SupportForm(); $this->breadcrumbs = array(Yii::t('app', 'SYSTEM') => array('admin/index'), Yii::t('app', 'SVC')); if (isset($_POST['SupportForm'])) { $supportForm->attributes = $_POST['SupportForm']; if ($supportForm->validate()) { $supportForm->sendMail(); $this->setFlashMessage(Yii::t('app', 'SUCCESS_MSG_SAND')); $this->redirect(array('index')); } } if (!isset($data['proffers'])) { $data['proffers'] = array(); } $providerProffers = new CArrayDataProvider($data['proffers'], array('sort' => array('attributes' => array('title'), 'defaultOrder' => array('title' => false)))); $this->render('index', array('supportForm' => $supportForm, 'providerProffers' => $providerProffers)); }
/** * First-time Welcome page */ public function actionWelcome() { // User cool too? if (null === ($_user = ResourceStore::model('user')->findByPk(Session::getCurrentUserId()))) { throw new ForbiddenException(); } /** * If request contains a "force_remove=1" parameter, * remove the registration file and redirect */ if ('1' == FilterInput::get(INPUT_GET, 'force_remove', 0)) { Log::debug('Forced removal of registration marker requested.'); SystemManager::registerPlatform($_user, false, true); $this->redirect($this->_getRedirectUrl()); } $_model = new SupportForm(); // collect user input data if (isset($_POST, $_POST['SupportForm'])) { $_model->setAttributes($_POST['SupportForm']); // Validate user input and redirect to the previous page if valid if ($_model->validate()) { try { SystemManager::registerPlatform($_user, $_model->getSkipped()); $this->redirect($this->_getRedirectUrl()); return; } catch (\Exception $_ex) { $_model->addError(null, $_ex->getMessage()); } } $_model->addError('Problem', 'Registration System Unavailable'); } $this->render('welcome', array('model' => $_model)); }