public function SaveProfile(Button $button)
 {
     $form = $button->getForm();
     $values = $form->getValues();
     try {
         if ($this->mode == 'superadmin') {
             if (isset($values['password_new'])) {
                 if ($values['password'] == $this->profile_data['password']) {
                     if ($values['password_new'] == $values['password_new_confirm']) {
                         $values['password'] = $values['password_new'];
                     } else {
                         throw new AuthenticationException('New password does not match.');
                     }
                 } else {
                     throw new AuthenticationException('Old password does not match with provided password.');
                 }
             } else {
                 unset($values['password']);
             }
             unset($values['password_new']);
             unset($values['password_new_confirm']);
             $this->config_data['admin'] = array_merge($this->config_data['admin'], $values);
             $config = new Config();
             $config->import($this->config_data);
             $config->save(APP_DIR . '/config/admin.ini', 'admin');
             $this->flash('Super admin profile updated');
         }
     } catch (Exception $e) {
         $this->flash($e->getMessage(), 'error');
     }
     $this->end();
 }
Beispiel #2
0
 public function getForm()
 {
     if ($this->form == null) {
         return parent::getForm();
     } else {
         return $this->form;
     }
 }
 public function formNewMenuItemSubmitted(Button $button)
 {
     $form = $button->getForm();
     $values = $form->getValues();
     //fd($values);exit;
     $parent_data = explode(';', $values['parent_data']);
     if ($values['link_type'] == 'internal') {
         $values['url'] = $values['internal_url'];
     } else {
         if (substr($values['external_url'], 0, 6) == 'http://') {
             $values['url'] = $values['external_url'];
         } else {
             $values['url'] = 'http://' . $values['external_url'];
         }
     }
     unset($values['internal_url']);
     unset($values['external_url']);
     $parent_id = $parent_data[0];
     $parent_level = $parent_data[1];
     unset($values['parent_data']);
     unset($values['btnClose']);
     $values['parent'] = $parent_id;
     $values['level'] = $parent_level + 1;
     $values['menu_id'] = $this->menu->id;
     try {
         $this->model('menuItems')->create($values);
         $this->invalidateControl('menuDragDrop');
         $this->invalidateControl('frmNewItem');
         $this->validateControl('formNewMenuItem');
         $this->flash('Item ' . $values['title'] . ' created');
         //if(!$this->isAjax()) $this->redirect('this');
     } catch (DibiDriverException $e) {
         $this->flash($e->getMessage());
     }
     //$this->redirect('this');
 }
Beispiel #4
0
 public function FormSent(Button $btn)
 {
     $values = $btn->getForm()->getValues();
     $this->parent->flashMessage('Message Sent', 'success');
     $this->parent->redirect('this');
 }
Beispiel #5
0
 public function formEditSubmitted(Button $button)
 {
     $session = Environment::getSession('params')->remove();
     $form = $button->getForm();
     if ($form->isValid()) {
         $values = $form->getValues();
         unset($values['btnClose']);
         try {
             $this->model('pages')->update($values);
             $this->flash('Page updated');
             if (!$this->isAjax()) {
                 $this->redirect('Pages:');
             } else {
                 $this->invalidateControl('form');
                 $this->invalidateControl('grid');
             }
         } catch (DibiDriverException $e) {
             $this->flash($e->getMessage());
         }
     }
 }
Beispiel #6
0
 public function formModuleInstallerSubmitted(Button $button)
 {
     $form = $button->getForm();
     $values = $form->getValues();
     unset($values['btnClose']);
     $file = $values['file'];
     if ($file->isOK()) {
         $file->move(MODULES_DIR . '/' . $file->getName());
     }
 }
Beispiel #7
0
 public function FormAddTermSubmitted(Button $button)
 {
     $values = $button->getForm()->getValues();
     $start_datetime = $values['start_date'] . ' ' . $values['start_date_time'];
     unset($values['start_date']);
     unset($values['start_date_time']);
     $values['start_datetime'] = $start_datetime;
     $application_deadline = $values['deadline_date'] . ' ' . $values['deadline_date_time'];
     unset($values['deadline_date']);
     unset($values['deadline_date_time']);
     $values['application_deadline'] = $application_deadline;
     $teacher_id = $this->getUser()->getId();
     $values['teacher_id'] = (int) $teacher_id;
     $values['min_seminar_points'] = (int) $values['min_seminar_points'];
     try {
         $session = Environment::getSession('exam_terms_edit_form_' . $values['id']);
         if (isset($session['form_data'])) {
             ExamManager::update($values);
             $this->flashMessage('Term updated', 'success');
         } else {
             ExamManager::add($values);
             unset($session['form_data']);
             $this->flashMessage('Term added', 'success');
         }
         $this->template->show_popup = false;
         $this->invalidateControl('popup');
         $this->invalidateControl('flash');
         /*if(!$this->isAjax())*/
         $this->redirect('this');
     } catch (DibiException $e) {
         $this->flashMessage($e->getMessage(), 'error');
         $this->invalidateControl('popup_flash');
     }
 }
Beispiel #8
0
 public function getSearchResults(Button $button)
 {
     $form = $button->getForm();
     $values = $form->getValues();
     $form->parent->flash('Search not implemented');
     $form->parent->end();
 }