Esempio n. 1
0
File: edit.php Progetto: alcf/chms
 public function btnSave_Click()
 {
     // Check for unique token
     $strToken = QApplication::Tokenize($this->txtToken->Text);
     if (strlen($strToken)) {
         if (is_numeric($strToken)) {
             $this->txtToken->Warning = 'URL must have more than just numbers';
         }
         if (($objTest = SignupForm::LoadByToken($strToken)) && $objTest->Id != $this->mctSignupForm->SignupForm->Id) {
             $this->txtToken->Warning = 'URL is already taken';
         }
         if ($this->txtToken->Warning) {
             $this->txtToken->Blink();
             $this->txtToken->Focus();
             return;
         }
         $this->txtToken->Text = $strToken;
     } else {
         $this->txtToken->Text = null;
     }
     $this->mctSignupForm->SaveSignupForm();
     // Add Child
     switch ($this->mctSignupForm->SignupForm->SignupFormTypeId) {
         case SignupFormType::Event:
             if (!$this->mctSignupChild->EventSignupForm->SignupForm) {
                 $this->mctSignupChild->EventSignupForm->SignupForm = $this->mctSignupForm->SignupForm;
             }
             $this->mctSignupChild->SaveEventSignupForm();
             break;
         case SignupFormType::Course:
             if (!$this->mctSignupChild->ClassMeeting->SignupForm) {
                 $this->mctSignupChild->ClassMeeting->SignupForm = $this->mctSignupForm->SignupForm;
             }
             $this->mctSignupChild->SaveClassMeeting();
             break;
         default:
             throw new Exception('Invalid SignupFormTypeId: ' . $objSignupForm->SignupFormTypeId);
     }
     // Redirect to View Page
     QApplication::Redirect('/events/form.php/' . $this->mctSignupForm->SignupForm->Id);
 }