/**
  * Invoke regeneration of all graphs
  */
 public function actionGrefresh()
 {
     Graphs::model()->clearAll();
     $this->redirect('Default:');
 }
Exemple #2
0
 private function wordVerify()
 {
     if (!$this->isRequiredIDValid('wordVerifyID', $_GET) && !isset($_GET['wordVerifyString'])) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid word verification ID.');
     }
     if (isset($_GET['wordVerifyID'])) {
         $wordVerifyID = $_GET['wordVerifyID'];
         $graphs = new Graphs();
         $text = $graphs->getVerificationImageText($wordVerifyID);
     } else {
         $text = $_GET['wordVerifyString'];
     }
     $graph = new WordVerify($text);
     $graph->draw();
     die;
 }
 public function SubmittedPatientAdd(AppForm $form)
 {
     Storage::getInstance()->createPatient($form->values);
     Graphs::model()->clearAll();
     $this->flashMessage('Novy pacient bol úspešne pridaný', 'info');
     $this->redirect('default');
     // redirect to listing
 }
Exemple #4
0
 /**
  * Returns the HTML/JavaScript for a field when the WebForm is NOT in Verify mode.
  *
  * @param string ID of the field
  * @param string Additional options to the <input> element
  * @return string HTML of the field
  */
 public function getFieldInput($field, $options = '')
 {
     $onblur = $onmouseover = $onmouseout = $onkeyup = $onclick = '';
     if (count($field['html']) > 0) {
         if (isset($field['html']['onblur'])) {
             $onblur = $field['html']['onblur'] . ' ';
         }
         if (isset($field['html']['onmouseover'])) {
             $onmouseover = $field['html']['onmouseover'] . ' ';
         }
         if (isset($field['html']['onmouseout'])) {
             $onmouseout = $field['html']['onmouseout'] . ' ';
         }
         if (isset($field['html']['onkeyup'])) {
             $onkeyup = $field['html']['onkeyup'] . ' ';
         }
         if (isset($field['html']['onclick'])) {
             $onclick = $field['html']['onclick'] . ' ';
         }
     }
     if ($this->_verifyForm) {
         switch ($field['type']) {
             case WFT_CC_EXPIRATION:
                 break;
             default:
                 $onblur .= sprintf(' webFormEditField(\'%s\', false, %s); ', $field['id'], $field['required'] ? 'true' : 'false');
                 break;
         }
     }
     $onmouseover .= 'webFormShowErrorBox(this); ';
     $onmouseout .= 'webFormHideErrorBox(); ';
     $onkeyup .= 'webFormHideErrorBox(); ';
     if (strlen($field['helpBody']) > 0) {
         $onmouseover .= sprintf("webFormShowHelpBox(this, '%s', '%s', '%s'); ", $field['caption'], $field['helpBody'], $field['helpRules']);
         $onmouseout .= 'webFormHideHelpBox(this); ';
         $onkeyup .= 'webFormHideHelpBox(this); ';
     }
     // Validate the field when leaving focus
     $onblur .= sprintf("webFormValidateField('%s', %s); ", $field['id'], $field['required'] ? 'true' : 'false');
     $extendedJavaScript = '';
     if (strlen($onblur) > 0) {
         $extendedJavaScript .= sprintf(' onblur="%s"', $onblur);
     }
     if (strlen($onmouseover) > 0) {
         $extendedJavaScript .= sprintf(' onmouseover="%s"', $onmouseover);
     }
     if (strlen($onmouseout) > 0) {
         $extendedJavaScript .= sprintf(' onmouseout="%s"', $onmouseout);
     }
     if (strlen($onkeyup) > 0) {
         $extendedJavaScript .= sprintf(' onkeyup="%s"', $onkeyup);
     }
     if (strlen($onclick) > 0) {
         $extendedJavaScript .= sprintf(' onclick="%s"', $onclick);
     }
     switch ($field['type']) {
         case WFT_TEXT:
         case WFT_DATE:
         case WFT_PHONE:
         case WFT_EMAIL:
         case WFT_CC_NUMBER:
         case WFT_PASSWORD:
         case WFT_CC_CVV2:
         case WFT_CURRENCY:
             if ($field['type'] == WFT_PASSWORD) {
                 $type = 'password';
             } else {
                 $type = 'text';
             }
             $input = sprintf("<input class=\"webFormElementText\" type=\"%s\" name=\"%s\" id=\"%s\" value=\"%s\" tabindex=\"%d\" " . "size=\"%d\" maxlength=\"%d\"%s", $type, $field['id'], $field['id'], strlen($field['validatedData']) > 0 ? $field['validatedData'] : $field['defaultValue'], $field['tabIndex'], $field['size'], $field['length'][1], strlen($options) > 0 ? ' ' . $options : '');
             $input .= sprintf(' %s', $extendedJavaScript);
             $input .= " />\n";
             break;
         case WFT_TEXTAREA:
             $input = sprintf("<textarea class=\"webFormElementTextBox\" name=\"%s\" id=\"%s\" tabindex=\"%d\" " . "rows=\"3\" cols=\"%d\" maxlength=\"%d\"%s %s>%s</textarea>", $field['id'], $field['id'], $field['tabIndex'], $field['size'], $field['length'][1], strlen($options) > 0 ? ' ' . $options : '', $extendedJavaScript, strlen($field['validatedData']) > 0 ? $field['validatedData'] : $field['defaultValue']);
             break;
         case WFT_CC_TYPE:
         case WFT_SELECT:
         case WFT_BOOLEAN:
             $input = sprintf("<select class=\"webFormElementSelect\" name=\"%s\" id=\"%s\" tabindex=\"%d\"%s%s>\n" . "<option value=\"%s\">- Select Option -</option>\n", $field['id'], $field['id'], $field['tabIndex'], strlen($options) > 0 ? ' ' . $options : '', $extendedJavaScript, $field['required'] ? 'nosel' : '');
             $selected = '';
             foreach ($field['defaultValue'] as $option) {
                 if (!strcmp($field['validatedData'], $option['id'])) {
                     $selected = $option['id'];
                 }
             }
             if ($selected == '') {
                 foreach ($field['defaultValue'] as $option) {
                     if ($option['selected']) {
                         $selected = $option['id'];
                     }
                 }
             }
             foreach ($field['defaultValue'] as $option) {
                 $input .= sprintf("<option value=\"%s\"%s>%s</option>\n", $option['id'], !strcmp($selected, $option['id']) ? ' selected' : '', $option['caption']);
             }
             $input .= "</select>\n";
             break;
         case WFT_CC_EXPIRATION:
             $curYear = intval(date('Y'));
             if (strlen($field['validatedData']) > 0) {
                 $mp = explode('/', $field['validatedData']);
                 $selMonth = $mp[0];
                 $selYear = $mp[1];
             } else {
                 $selMonth = 0;
                 $selYear = 0;
             }
             $monthScript = sprintf("<script>document.getElementById('%sMonth').value = '%d';</script>", $field['id'], $selMonth);
             $input = sprintf("<select class=\"webFormElementSelect\" name=\"%sMonth\" id=\"%sMonth\" tabindex=\"%d\" %s %s>\n" . "<option value=\"%s\">- Select Month -</option>\n" . "<option value=\"1\">1 - January</option>\n" . "<option value=\"2\">2 - February</option>\n" . "<option value=\"3\">3 - March</option>\n" . "<option value=\"4\">4 - April</option>\n" . "<option value=\"5\">5 - May</option>\n" . "<option value=\"6\">6 - June</option>\n" . "<option value=\"7\">7 - July</option>\n" . "<option value=\"8\">8 - August</option>\n" . "<option value=\"9\">9 - September</option>\n" . "<option value=\"10\">10 - October</option>\n" . "<option value=\"11\">11 - November</option>\n" . "<option value=\"12\">12 - December</option>\n" . "</select> %s" . "<select class=\"webFormElementSelect\" name=\"%sYear\" id=\"%sYear\" tabindex=\"%d\" %s %s>\n" . "<option value=\"%s\">- Select Year -</option>\n", $field['id'], $field['id'], $field['tabIndex'], $extendedJavaScript, strlen($options) > 0 ? ' ' . $options : '', $field['required'] ? 'nosel' : '', $monthScript, $field['id'], $field['id'], $field['tabIndex'] + 1, $extendedJavaScript, strlen($options) > 0 ? ' ' . $options : '', $field['required'] ? 'nosel' : '');
             for ($year = $curYear; $year < $curYear + 15; $year++) {
                 $input .= sprintf("<option value=\"%d\"%s>%d</option>\n", $year, $year == $selYear ? ' selected' : '', $year);
             }
             $input .= "</select>\n";
             break;
         case WFT_ANTI_SPAM_IMAGE:
             $graphs = new Graphs();
             $verificationImage = $graphs->verificationImage();
             // If there's a relative path, convert the image URL
             if ($this->_relPath != '') {
                 $verificationImage = str_replace('<img src="', sprintf('<img src="%s', $this->_relPath), $verificationImage);
             }
             $input = sprintf("<div style=\"padding: 0px 0px 0px 0px; text-align: left;\">\n" . "Please type the characters in the image below (case-insensitive)\n" . "<p>\n%s\n<p>\n<input type=\"text\" name=\"%s\" id=\"%s\" size=\"8\" " . "maxlength=\"10\" tabindex=\"%d\" %s %s>\n" . "<div id=\"%sCaption\" class=\"webFormCaption\"></div>\n" . "</div>\n", $verificationImage, $field['id'], $field['id'], $field['tabIndex'], strlen($options) > 0 ? ' ' . $options : '', $extendedJavaScript, $field['id']);
             break;
     }
     return $input;
 }