protected function GetControlHtml()
 {
     $strOutput = $this->lblMessage->Render(false) . '<br /><table style="border: 1px solid #DDDDDD" cellpadding="4" cellspacing="0" width="100%">';
     foreach (NarroProject::$AvailablePreferences as $strName => $arrPref) {
         if ($arrPref['project_type'] && $arrPref['project_type'] != $this->objProject->ProjectType) {
             continue;
         }
         $this->lblMessage->Text = t('Here you can set your project preferences.');
         switch ($arrPref['type']) {
             case 'number':
                 $txtNumber = new QIntegerTextBox($this);
                 $txtNumber->Name = $strName;
                 $txtNumber->Minimum = 5;
                 $txtNumber->Maximum = 100;
                 $txtNumber->MaxLength = 3;
                 $txtNumber->Width = 50;
                 if ($arrPref['global']) {
                     $txtNumber->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId);
                 }
                 $txtNumber->Text = $this->objProject->GetPreferenceValueByName($strName);
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtNumber->RenderWithError(false), $arrPref['description'] ? t($arrPref['description']) : '');
                 $this->arrControls[$strName] = $txtNumber;
                 break;
             case 'text':
                 $txtTextPref = new QTextBox($this);
                 $txtTextPref->Name = $strName;
                 if ($arrPref['global']) {
                     $txtTextPref->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId);
                 }
                 $txtTextPref->Text = $this->objProject->GetPreferenceValueByName($strName);
                 $txtTextPref->Columns = strlen($txtTextPref->Text);
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtTextPref->RenderWithError(false), $arrPref['description'] ? t($arrPref['description']) : '');
                 $this->arrControls[$strName] = $txtTextPref;
                 break;
             case 'option':
                 $lstOption = new QListBox($this);
                 $lstOption->Name = $strName;
                 if ($arrPref['global']) {
                     $lstOption->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId);
                 }
                 foreach ($arrPref['values'] as $strValue) {
                     $lstOption->AddItem(t($strValue), $strValue, $strValue == $this->objProject->GetPreferenceValueByName($strName));
                 }
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $lstOption->RenderWithError(false), $arrPref['description'] ? t($arrPref['description']) : '');
                 $this->arrControls[$strName] = $lstOption;
                 break;
         }
     }
     $strOutput .= '</table><br />';
     $this->strText = $strOutput;
     return parent::GetControlHtml();
 }
Exemplo n.º 2
0
 public function Validate()
 {
     if (parent::Validate()) {
         if (trim($this->strText) != "") {
             $this->strText = trim($this->strText);
             $strOriginal = $this->strText;
             $strFinal = '';
             while (strlen($strOriginal)) {
                 if (is_numeric(QString::FirstCharacter($strOriginal))) {
                     $strFinal .= QString::FirstCharacter($strOriginal);
                 }
                 if (strtolower(QString::FirstCharacter($strOriginal)) == 'x') {
                     $strFinal .= 'x';
                 }
                 $strOriginal = substr($strOriginal, 1);
             }
             if (strlen($strFinal) == 10 && strpos($strFinal, 'x') === false) {
                 $this->strText = substr($strFinal, 0, 3) . '-' . substr($strFinal, 3, 3) . '-' . substr($strFinal, 6);
                 $this->strValidationError = null;
                 return true;
             }
             if (strlen($strFinal) > 11 && strpos($strFinal, 'x') == 10 && strpos($strFinal, 'x', 11) === false && strlen($strFinal) <= 17) {
                 $this->strText = substr($strFinal, 0, 3) . '-' . substr($strFinal, 3, 3) . '-' . substr($strFinal, 6, 4) . ' ' . substr($strFinal, 10);
                 $this->strValidationError = null;
                 return true;
             }
             $this->strValidationError = 'For example "213-555-1212" or "213-555-1212 x123"';
             return false;
         }
     } else {
         return false;
     }
     $this->strValidationError = null;
     return true;
 }
Exemplo n.º 3
0
 public function GetEndScript()
 {
     $strToReturn = parent::GetEndScript();
     if ($this->blnVisible) {
         $strToReturn .= sprintf('qc.regSTB("%s"); ', $this->strControlId);
     }
     return $strToReturn;
 }
Exemplo n.º 4
0
 public function RenderRole(HouseholdParticipation $objParticipation)
 {
     $strControlId = 'txtRole' . $objParticipation->Id;
     if (!($txtRole = $this->GetControl($strControlId))) {
         $txtRole = new QTextBox($this->dtgMembers, $strControlId);
         $txtRole->Text = $objParticipation->RoleOverride;
     }
     $strControlId = 'lblRole' . $objParticipation->Id;
     if (!($lblRole = $this->GetControl($strControlId))) {
         $lblRole = new QLabel($this->dtgMembers, $strControlId);
         $lblRole->Text = 'Head';
     }
     if ($this->objHousehold->HeadPersonId == $objParticipation->PersonId) {
         $txtRole->Text = null;
         $txtRole->Visible = false;
         $lblRole->Visible = true;
     } else {
         $txtRole->Visible = true;
         $lblRole->Visible = false;
     }
     return $lblRole->Render(false) . $txtRole->Render(false);
 }
Exemplo n.º 5
0
 public function Validate()
 {
     if (parent::Validate()) {
         if (trim($this->strText) != "") {
             $objResult = $this->ValidateUrl($this->strText);
             if ($objResult["Result"] != EW_OK) {
                 $this->strValidationError = "Invalid URL";
                 return false;
             }
         }
     } else {
         return false;
     }
     $this->strValidationError = "";
     return true;
 }
Exemplo n.º 6
0
 public function Validate()
 {
     if (parent::Validate()) {
         if (strlen(trim($this->strText))) {
             // RegExp taken from php.net
             $this->strText = trim($this->strText);
             $strEmailAddressArray = QEmailServer::GetEmailAddresses($this->strText);
             if (count($strEmailAddressArray) != 1 || strtolower($strEmailAddressArray[0]) != strtolower($this->strText)) {
                 $this->strValidationError = "Invalid e-mail address";
                 return false;
             }
         }
     } else {
         return false;
     }
     $this->strValidationError = "";
     return true;
 }
Exemplo n.º 7
0
 public function dtgRole_RoleNameColumn_Render(NarroRole $objNarroRole)
 {
     $strControlId = 'lblRoleName' . $objNarroRole->RoleId;
     $lblRoleName = $this->Form->GetControl($strControlId);
     if (!$lblRoleName) {
         $lblRoleName = new QLabel($this->dtgRole, $strControlId);
         $lblRoleName->DisplayStyle = QDisplayStyle::Inline;
         $lblRoleName->Text = t($objNarroRole->RoleName);
     }
     $strControlId = 'txtEditRole' . $objNarroRole->RoleId;
     $txtEditRole = $this->Form->GetControl($strControlId);
     if (!$txtEditRole) {
         $txtEditRole = new QTextBox($this->dtgRole, $strControlId);
         $txtEditRole->DisplayStyle = QDisplayStyle::None;
         $txtEditRole->Text = $objNarroRole->RoleName;
     }
     return $lblRoleName->Render(false) . $txtEditRole->Render(false);
 }
Exemplo n.º 8
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case 'CodeCssClass':
             try {
                 return $this->strCodeCssClass = QType::Cast($mixValue, QType::String);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 return $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 return $objExc;
             }
     }
 }
Exemplo n.º 9
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         // MISC
         case "UniqueList":
             try {
                 $this->strUniqueList = QType::Cast($mixValue, QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
Exemplo n.º 10
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case "SizingClass":
             // Bootstrap::InputGroupLarge, Bootstrap::InputGroupMedium or Bootstrap::InputGroupSmall
             try {
                 $this->SetSizingClass($mixValue);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "LeftText":
             try {
                 $this->SetLeftText($mixValue);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "RightText":
             try {
                 $this->SetRightText($mixValue);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
Exemplo n.º 11
0
 public function __set($strName, $mixValue)
 {
     $this->blnModified = true;
     switch ($strName) {
         // MISC
         case 'LabelForInvalid':
             try {
                 $this->strLabelForInvalid = QType::Cast($mixValue, QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
Exemplo n.º 12
0
 public function RenderFund(RecurringDonationItems $objItem = null)
 {
     if (!$objItem) {
         return '<strong>TOTAL SUBMISSION</strong>';
     }
     $lstFunds = $this->GetControl('lstFunds' . $this->dtgDonationItems->CurrentRowIndex);
     $txtFund = $this->GetControl('txtFund' . $this->dtgDonationItems->CurrentRowIndex);
     if (!$lstFunds) {
         $lstFunds = new QListBox($this->dtgDonationItems, 'lstFunds' . $this->dtgDonationItems->CurrentRowIndex);
         $lstFunds->ActionParameter = $this->dtgDonationItems->CurrentRowIndex;
         $lstFunds->AddAction(new QChangeEvent(), new QAjaxAction('lstFunds_Change'));
         $txtFund = new QTextBox($this->dtgDonationItems, 'txtFund' . $this->dtgDonationItems->CurrentRowIndex);
         $txtFund->Visible = false;
         if (!$objItem->StewardshipFundId) {
             $lstFunds->AddItem('- Select One -', null);
         }
         foreach (StewardshipFund::LoadArrayByExternalFlag(true, QQ::OrderBy(QQN::StewardshipFund()->ExternalName)) as $objFund) {
             $lstFunds->AddItem($objFund->ExternalName, $objFund->Id, $objFund->Id == $objItem->StewardshipFundId);
         }
         $lstFunds->AddItem('- Other... -', false);
     }
     return $lstFunds->RenderWithError(false) . ' ' . $txtFund->RenderWithError(false);
 }
Exemplo n.º 13
0
 protected function Form_Create()
 {
     $this->Draggable = new QPanel($this);
     $this->Draggable->Text = 'Drag me';
     $this->Draggable->CssClass = 'draggable';
     $this->Draggable->Moveable = true;
     //$this->Draggable->AddAction(new QDraggable_StopEvent(), new QJavascriptAction("alert('Dragged to ' + ui.position.top + ',' + ui.position.left)"));
     $this->Draggable->AddAction(new QDraggable_StopEvent(), new QAjaxAction("drag_stop"));
     // Dropable
     $this->Droppable = new QPanel($this);
     $this->Droppable->Text = "Drop here";
     //$this->Droppable->AddAction(new QDroppable_DropEvent(), new QJavascriptAction("alert('Dropped ' + ui.draggable.attr('id'))"));
     $this->Droppable->AddAction(new QDroppable_DropEvent(), new QAjaxAction("droppable_drop"));
     $this->Droppable->CssClass = 'droppable';
     $this->Droppable->Droppable = true;
     // Resizable
     $this->Resizable = new QPanel($this);
     $this->Resizable->CssClass = 'resizable';
     $this->Resizable->Resizable = true;
     $this->Resizable->AddAction(new QResizable_StopEvent(), new QAjaxAction('resizable_stop'));
     // Selectable
     $this->Selectable = new QSelectable($this);
     $this->Selectable->AutoRenderChildren = true;
     $this->Selectable->CssClass = 'selectable';
     for ($i = 1; $i <= 5; ++$i) {
         $pnl = new QPanel($this->Selectable);
         $pnl->Text = 'Item ' . $i;
         $pnl->CssClass = 'selitem';
     }
     $this->Selectable->Filter = 'div.selitem';
     $this->Selectable->SelectedItems = array($pnl->ControlId);
     // pre-select last item
     $this->Selectable->AddAction(new QSelectable_StopEvent(), new QAjaxAction('selectable_stop'));
     // Sortable
     $this->Sortable = new QSortable($this);
     $this->Sortable->AutoRenderChildren = true;
     $this->Sortable->CssClass = 'sortable';
     for ($i = 1; $i <= 5; ++$i) {
         $pnl = new QPanel($this->Sortable);
         $pnl->Text = 'Item ' . $i;
         $pnl->CssClass = 'sortitem';
     }
     $this->Sortable->Items = 'div.sortitem';
     $this->Sortable->AddAction(new QSortable_StopEvent(), new QAjaxAction('sortable_stop'));
     // Accordion
     $this->Accordion = new QAccordion($this);
     $lbl = new QLinkButton($this->Accordion);
     $lbl->Text = 'Header 1';
     $pnl = new QPanel($this->Accordion);
     $pnl->Text = 'Section 1';
     $lbl = new QLinkButton($this->Accordion);
     $lbl->Text = 'Header 2';
     $pnl = new QPanel($this->Accordion);
     $pnl->Text = 'Section 2';
     $lbl = new QLinkButton($this->Accordion);
     $lbl->Text = 'Header 3';
     $pnl = new QPanel($this->Accordion);
     $pnl->Text = 'Section 3';
     $this->Accordion->AddAction(new QChangeEvent(), new QAjaxAction('accordion_change'));
     // Autocomplete
     // Both autocomplete controls below will use the mode
     // "match only on the beginning of the word"
     QAutocomplete::UseFilter(QAutocomplete::FILTER_STARTS_WITH);
     // Client-side only autocomplete
     $this->Autocomplete1 = new QAutocomplete($this);
     $this->Autocomplete1->Source = self::$LANGUAGES;
     $this->Autocomplete1->Name = "Standard Autocomplete";
     $this->Autocomplete2 = new QAutocomplete($this);
     $this->Autocomplete2->Source = self::$LANGUAGES;
     $this->Autocomplete2->AutoFocus = true;
     $this->Autocomplete2->MustMatch = true;
     $this->Autocomplete2->Name = "AutoFocus and MustMatch";
     // Ajax Autocomplete
     // Note: To show the little spinner while the ajax search is happening, you
     // need to define the .ui-autocomplete-loading class in a style sheet. See
     // header.inc.php for an example.
     $this->AjaxAutocomplete = new QAutocomplete($this);
     $this->AjaxAutocomplete->SetDataBinder("update_autocompleteList");
     $this->AjaxAutocomplete->AddAction(new QAutocomplete_ChangeEvent(), new QAjaxAction('ajaxautocomplete_change'));
     $this->AjaxAutocomplete->DisplayHtml = true;
     $this->AjaxAutocomplete->Name = 'With Html Display';
     $this->AjaxAutocomplete2 = new QAutocomplete($this);
     $this->AjaxAutocomplete2->MultipleValueDelimiter = ',';
     $this->AjaxAutocomplete2->SetDataBinder("update_autocompleteList");
     $this->AjaxAutocomplete2->Name = 'Multiple selection';
     // Button
     $this->Button = new QJqButton($this);
     $this->Button->Label = "Click me";
     // Label overrides Text
     $this->Button->AddAction(new QClickEvent(), new QServerAction("button_click"));
     $this->CheckBox = new QJqCheckBox($this);
     $this->CheckBox->Text = "CheckBox";
     $this->RadioButton = new QJqRadioButton($this);
     $this->RadioButton->Text = "RadioButton";
     $this->IconButton = new QJqButton($this);
     $this->IconButton->Text = "Sample";
     $this->IconButton->ShowText = false;
     $this->IconButton->Icons = array("primary" => JqIcon::Lightbulb);
     // Lists
     $this->CheckList1 = new QCheckBoxList($this);
     $this->CheckList1->Name = "CheckBoxList with buttonset";
     foreach (self::$LANGUAGES as $strLang) {
         $this->CheckList1->AddItem($strLang);
     }
     $this->CheckList1->ButtonMode = QCheckBoxList::ButtonModeSet;
     $this->CheckList2 = new QCheckBoxList($this);
     $this->CheckList2->Name = "CheckBoxList with button style";
     foreach (self::$LANGUAGES as $strLang) {
         $this->CheckList2->AddItem($strLang);
     }
     $this->CheckList2->ButtonMode = QCheckBoxList::ButtonModeJq;
     $this->CheckList2->RepeatColumns = 4;
     $this->RadioList1 = new QRadioButtonList($this);
     $this->RadioList1->Name = "RadioButtonList with buttonset";
     foreach (self::$LANGUAGES as $strLang) {
         $this->RadioList1->AddItem($strLang);
     }
     $this->RadioList1->ButtonMode = QCheckBoxList::ButtonModeSet;
     $this->RadioList2 = new QRadioButtonList($this);
     $this->RadioList2->Name = "RadioButtonList with button style";
     foreach (self::$LANGUAGES as $strLang) {
         $this->RadioList2->AddItem($strLang);
     }
     $this->RadioList2->ButtonMode = QCheckBoxList::ButtonModeJq;
     $this->RadioList2->RepeatColumns = 4;
     // Datepicker
     $this->Datepicker = new QDatepicker($this);
     // DatepickerBox
     $this->DatepickerBox = new QDatepickerBox($this);
     // Dialog
     $this->Dialog = new QDialog($this);
     $this->Dialog->Text = 'a non modal dialog';
     $this->Dialog->AddButton('Cancel', 'cancel');
     $this->Dialog->AddButton('OK', 'ok');
     $this->Dialog->AddAction(new QDialog_ButtonEvent(), new QAjaxAction('dialog_press'));
     $this->Dialog->AutoOpen = false;
     $this->btnShowDialog = new QJqButton($this);
     $this->btnShowDialog->Text = 'Show Dialog';
     $this->btnShowDialog->AddAction(new QClickEvent(), new QShowDialog($this->Dialog));
     $this->txtDlgTitle = new QTextBox($this);
     $this->txtDlgTitle->Name = "Set Title To:";
     $this->txtDlgTitle->AddAction(new QKeyPressEvent(10), new QAjaxAction('dlgTitle_Change'));
     $this->txtDlgTitle->AddAction(new QBackspaceKeyEvent(10), new QAjaxAction('dlgTitle_Change'));
     $this->txtDlgText = new QTextBox($this);
     $this->txtDlgText->Name = "Set Text To:";
     $this->txtDlgText->AddAction(new QKeyPressEvent(10), new QAjaxAction('dlgText_Change'));
     $this->txtDlgText->AddAction(new QBackspaceKeyEvent(10), new QAjaxAction('dlgText_Change'));
     // Progressbar
     $this->Progressbar = new QProgressbar($this);
     $this->Progressbar->Value = 37;
     // Slider
     $this->Slider = new QSlider($this);
     $this->Slider->AddAction(new QSlider_SlideEvent(), new QJavascriptAction('jQuery("#' . $this->Progressbar->ControlId . '").progressbar ("value", ui.value)'));
     $this->Slider->AddAction(new QSlider_ChangeEvent(), new QAjaxAction('slider_change'));
     $this->Slider2 = new QSlider($this);
     $this->Slider2->Range = true;
     $this->Slider2->Values = array(10, 50);
     $this->Slider2->AddAction(new QSlider_ChangeEvent(), new QAjaxAction('slider2_change'));
     // Tabs
     $this->Tabs = new QTabs($this);
     $tab1 = new QPanel($this->Tabs);
     $tab1->Text = 'First tab is active by default';
     $tab2 = new QPanel($this->Tabs);
     $tab2->Text = 'Tab 2';
     $tab3 = new QPanel($this->Tabs);
     $tab3->Text = 'Tab 3';
     $this->Tabs->Headers = array('One', 'Two', 'Three');
 }
Exemplo n.º 14
0
 /**
  * PHP __set magic method implementation
  * @param string $strName Property Name
  * @param string $mixValue Property value
  *
  * @throws Exception|QCallerException
  * @throws Exception|QInvalidCastException
  */
 public function __set($strName, $mixValue)
 {
     $this->blnModified = true;
     switch ($strName) {
         // MISC
         case "Maximum":
             try {
                 $this->mixMaximum = QType::Cast($mixValue, $this->strDataType);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "Minimum":
             try {
                 $this->mixMinimum = QType::Cast($mixValue, $this->strDataType);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "Step":
             try {
                 $this->mixStep = QType::Cast($mixValue, $this->strDataType);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'LabelForInvalid':
             try {
                 $this->strLabelForInvalid = QType::Cast($mixValue, QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'LabelForGreater':
             try {
                 $this->strLabelForGreater = QType::Cast($mixValue, QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'LabelForLess':
             try {
                 $this->strLabelForLess = QType::Cast($mixValue, QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'LabelForNotStepAligned':
             try {
                 $this->strLabelForNotStepAligned = QType::Cast($mixValue, QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
Exemplo n.º 15
0
 protected function lstField_Setup(IssueField $objIssueField)
 {
     $lstField = new QListBox($this);
     $lstField->Name = $objIssueField->Name;
     $lstField->ActionParameter = $objIssueField->Id;
     if (!($lstField->Required = $objIssueField->RequiredFlag)) {
         $lstField->AddItem('- Select One -');
     }
     $objSelectedIssueFieldOption = $this->mctIssue->Issue->GetFieldOptionForIssueField($objIssueField);
     foreach ($objIssueField->GetOptionArray() as $objIssueFieldOption) {
         $lstField->AddItem($objIssueFieldOption->Name, $objIssueFieldOption->Id, $objSelectedIssueFieldOption && $objSelectedIssueFieldOption->Id == $objIssueFieldOption->Id);
     }
     if ($objIssueField->MutableFlag) {
         $lstField->AddItem('- Other... -', -1);
         $txtMutableField = new QTextBox($this, 'txtMutableField' . $objIssueField->Id);
         $txtMutableField->Visible = false;
         $txtMutableField->SetCustomStyle('margin-top', '2px');
         $this->txtMutableFields[$objIssueField->Id] = $txtMutableField;
         $lstField->AddAction(new QChangeEvent(), new QAjaxAction('lstField_Change'));
     }
     if ($objIssueField->RequiredFlag) {
         $this->lstRequiredFields[] = $lstField;
     } else {
         $this->lstOptionalFields[] = $lstField;
     }
 }
Exemplo n.º 16
0
 public function __set($strName, $mixValue)
 {
     $this->blnModified = true;
     switch ($strName) {
         // MISC
         case 'Maximum':
             try {
                 if ($mixValue == QDateTime::Now) {
                     $this->dttMaximum = QDateTime::Now;
                 } else {
                     $this->dttMaximum = QType::Cast($mixValue, QType::DateTime);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Minimum':
             try {
                 if ($mixValue == QDateTime::Now) {
                     $this->dttMinimum = QDateTime::Now;
                 } else {
                     $this->dttMinimum = QType::Cast($mixValue, QType::DateTime);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DateTimeFormat':
             try {
                 $this->strDateTimeFormat = QType::Cast($mixValue, QType::String);
                 // trigger an update to reformat the text with the new format
                 $this->DateTime = $this->dttDateTime;
                 return $this->strDateTimeFormat;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DateTime':
             try {
                 $this->dttDateTime = QType::Cast($mixValue, QType::DateTime);
                 if (!$this->dttDateTime || !$this->strDateTimeFormat) {
                     parent::__set('Text', '');
                 } else {
                     parent::__set('Text', $this->dttDateTime->qFormat($this->strDateTimeFormat));
                 }
                 return $this->dttDateTime;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Text':
             $this->dttDateTime = QDateTimeTextBox::ParseForDateTimeValue($this->strText);
             return parent::__set('Text', $mixValue);
         case 'LabelForInvalid':
             try {
                 return $this->strLabelForInvalid = QType::Cast($mixValue, QType::String);
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
Exemplo n.º 17
0
 public function __set($strName, $mixValue)
 {
     $this->blnModified = true;
     switch ($strName) {
         // MISC
         case 'Maximum':
             try {
                 if ($mixValue == QDateTime::Now) {
                     $this->dttMaximum = QDateTime::Now;
                 } else {
                     $this->dttMaximum = QType::Cast($mixValue, QType::DateTime);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Minimum':
             try {
                 if ($mixValue == QDateTime::Now) {
                     $this->dttMinimum = QDateTime::Now;
                 } else {
                     $this->dttMinimum = QType::Cast($mixValue, QType::DateTime);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'LabelForInvalid':
             try {
                 return $this->strLabelForInvalid = QType::Cast($mixValue, QType::String);
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case 'AltField':
             $this->mixAltField = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'altField', $mixValue);
             }
             break;
         case 'AltFormat':
             try {
                 $this->strAltFormat = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'altFormat', $this->strAltFormat);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'AppendText':
             try {
                 $this->strAppendText = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'appendText', $this->strAppendText);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'AutoSize':
             try {
                 $this->blnAutoSize = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'autoSize', $this->blnAutoSize);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'OnBeforeShow':
             try {
                 $this->mixOnBeforeShow = new QJsClosure($mixValue, array("input", "inst"));
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'OnBeforeShowDay':
             try {
                 $this->mixOnBeforeShowDay = new QJsClosure($mixValue, array("date"));
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ButtonImage':
             try {
                 $this->strButtonImage = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'buttonImage', $this->strButtonImage);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ButtonImageOnly':
             try {
                 $this->blnButtonImageOnly = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'buttonImageOnly', $this->blnButtonImageOnly);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ButtonText':
             try {
                 $this->strButtonText = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'buttonText', $this->strButtonText);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'OnCalculateWeek':
             try {
                 $this->mixOnCalculateWeek = new QJsClosure($mixValue, array(""));
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ChangeMonth':
             try {
                 $this->blnChangeMonth = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'changeMonth', $this->blnChangeMonth);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ChangeYear':
             try {
                 $this->blnChangeYear = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'changeYear', $this->blnChangeYear);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CloseText':
             try {
                 $this->strCloseText = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'closeText', $this->strCloseText);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ConstrainInput':
             try {
                 $this->blnConstrainInput = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'constrainInput', $this->blnConstrainInput);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CurrentText':
             try {
                 $this->strCurrentText = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'currentText', $this->strCurrentText);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'JqDateFormat':
             try {
                 $this->strJqDateFormat = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'dateFormat', $this->strJqDateFormat);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DayNames':
             try {
                 $this->arrDayNames = QType::Cast($mixValue, QType::ArrayType);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'dayNames', $this->arrDayNames);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DayNamesMin':
             try {
                 $this->arrDayNamesMin = QType::Cast($mixValue, QType::ArrayType);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'dayNamesMin', $this->arrDayNamesMin);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DayNamesShort':
             try {
                 $this->arrDayNamesShort = QType::Cast($mixValue, QType::ArrayType);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'dayNamesShort', $this->arrDayNamesShort);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DefaultDate':
             $this->mixDefaultDate = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'defaultDate', $mixValue);
             }
             break;
         case 'Duration':
             $this->mixDuration = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'duration', $mixValue);
             }
             break;
         case 'FirstDay':
             try {
                 $this->intFirstDay = QType::Cast($mixValue, QType::Integer);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'firstDay', $this->intFirstDay);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'GotoCurrent':
             try {
                 $this->blnGotoCurrent = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'gotoCurrent', $this->blnGotoCurrent);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'HideIfNoPrevNext':
             try {
                 $this->blnHideIfNoPrevNext = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'hideIfNoPrevNext', $this->blnHideIfNoPrevNext);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'IsRTL':
             try {
                 $this->blnIsRTL = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'isRTL', $this->blnIsRTL);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'MaxDate':
             $this->mixMaxDate = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'maxDate', $mixValue);
             }
             break;
         case 'MinDate':
             $this->mixMinDate = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'minDate', $mixValue);
             }
             break;
         case 'MonthNames':
             try {
                 $this->arrMonthNames = QType::Cast($mixValue, QType::ArrayType);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'monthNames', $this->arrMonthNames);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'MonthNamesShort':
             try {
                 $this->arrMonthNamesShort = QType::Cast($mixValue, QType::ArrayType);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'monthNamesShort', $this->arrMonthNamesShort);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'NavigationAsDateFormat':
             try {
                 $this->blnNavigationAsDateFormat = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'navigationAsDateFormat', $this->blnNavigationAsDateFormat);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'NextText':
             try {
                 $this->strNextText = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'nextText', $this->strNextText);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'NumberOfMonths':
             $this->mixNumberOfMonths = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'numberOfMonths', $mixValue);
             }
             break;
         case 'OnChangeMonthYear':
             try {
                 $this->mixOnChangeMonthYear = new QJsClosure($mixValue, array("year", "month", "inst"));
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'OnClose':
             try {
                 $this->mixOnClose = new QJsClosure($mixValue, array("dateText", "inst"));
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'OnSelect':
             try {
                 $this->mixOnSelect = new QJsClosure($mixValue, array("dateText", "inst"));
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'PrevText':
             try {
                 $this->strPrevText = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'prevText', $this->strPrevText);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'SelectOtherMonths':
             try {
                 $this->blnSelectOtherMonths = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'selectOtherMonths', $this->blnSelectOtherMonths);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ShortYearCutoff':
             $this->mixShortYearCutoff = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'shortYearCutoff', $mixValue);
             }
             break;
         case 'ShowAnim':
             try {
                 $this->strShowAnim = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'showAnim', $this->strShowAnim);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ShowButtonPanel':
             try {
                 $this->blnShowButtonPanel = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'showButtonPanel', $this->blnShowButtonPanel);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ShowCurrentAtPos':
             try {
                 $this->intShowCurrentAtPos = QType::Cast($mixValue, QType::Integer);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'showCurrentAtPos', $this->intShowCurrentAtPos);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ShowMonthAfterYear':
             try {
                 $this->blnShowMonthAfterYear = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'showMonthAfterYear', $this->blnShowMonthAfterYear);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ShowOn':
             try {
                 $this->strShowOn = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'showOn', $this->strShowOn);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ShowOptions':
             $this->mixShowOptions = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'showOptions', $mixValue);
             }
             break;
         case 'ShowOtherMonths':
             try {
                 $this->blnShowOtherMonths = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'showOtherMonths', $this->blnShowOtherMonths);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ShowWeek':
             try {
                 $this->blnShowWeek = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'showWeek', $this->blnShowWeek);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'StepMonths':
             try {
                 $this->intStepMonths = QType::Cast($mixValue, QType::Integer);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'stepMonths', $this->intStepMonths);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'WeekHeader':
             try {
                 $this->strWeekHeader = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'weekHeader', $this->strWeekHeader);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'YearRange':
             try {
                 $this->strYearRange = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'yearRange', $this->strYearRange);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'YearSuffix':
             try {
                 $this->strYearSuffix = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'yearSuffix', $this->strYearSuffix);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
                 break;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * If this control is attachable to a codegenerated control in a ModelConnector, this function will be
  * used by the ModelConnector designer dialog to display a list of options for the control.
  * @return QModelConnectorParam[]
  **/
 public static function GetModelConnectorParams()
 {
     return array_merge(parent::GetModelConnectorParams(), array(new QModelConnectorParam(get_called_class(), 'AutoFocus', 'If set to true the first item will automatically be focused when themenu is shown.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'Delay', 'The delay in milliseconds between when a keystroke occurs and when asearch is performed. A zero-delay makes sense for local data (moreresponsive), but can produce a lot of load for remote data, whilebeing less responsive.', QType::Integer), new QModelConnectorParam(get_called_class(), 'Disabled', 'Disables the autocomplete if set to true.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'MinLength', 'The minimum number of characters a user must type before a search isperformed. Zero is useful for local data with just a few items, but ahigher value should be used when a single character search could matcha few thousand items.', QType::Integer)));
 }
 /**
  * Returns an description of the options available to modify by the designer for the code generator.
  *
  * @return QModelConnectorParam[]
  */
 public static function GetModelConnectorParams()
 {
     return array_merge(parent::GetModelConnectorParams(), array(new QModelConnectorParam(get_called_class(), 'Delimiter', 'Default: , (comma)', QType::String), new QModelConnectorParam(get_called_class(), 'Enclosure', 'Default: " (double-quote)', QType::String), new QModelConnectorParam(get_called_class(), 'Escape', 'Default: \\ (backslash)', QType::String), new QModelConnectorParam(get_called_class(), 'MinItemCount', 'Minimum number of items required.', QType::Integer), new QModelConnectorParam(get_called_class(), 'MaxItemCount', 'Maximum number of items allowed.', QType::Integer)));
 }
Exemplo n.º 21
0
 /**
  * Creates all the controls for each "question" in the form.
  * Note: For any fields that are looked up from the user's profile (e.g. address, phone, etc.) -- a drop down is available for quick access.
  * However, if they select "other", we save the data and do NOT link it to any records!
  * (e.g. if an "other" phone is used, that data is not stored anywhere else)
  */
 protected function CreateFormItemControls()
 {
     /**
      * @var Person
      */
     $objPerson = $this->objSignupEntry->Person;
     if ($objPerson != null) {
         // First, set up for the Person Name label
         $lblPersonName = new QLabel($this, 'lblPersonName');
         $lblPersonName->Name = 'Name';
         $lblPersonName->Required = true;
         $lblPersonName->Text = $objPerson->Name;
         $lblPersonName->RenderMethod = 'RenderWithName';
         $this->objFormQuestionControlArray[] = $lblPersonName;
     } else {
         // else if not logged in, prompt for First and Last Name. Always.
         $txtFirstName = new QTextBox($this);
         $txtFirstName->Name = 'First Name';
         $txtFirstName->Required = true;
         $txtFirstName->RenderMethod = 'RenderWithName';
         $this->objFormQuestionControlArray[] = $txtFirstName;
         $txtLastName = new QTextBox($this);
         $txtLastName->Name = 'Last Name';
         $txtLastName->Required = true;
         $txtLastName->RenderMethod = 'RenderWithName';
         $this->objFormQuestionControlArray[] = $txtLastName;
     }
     // Go through all the other fields
     foreach ($this->objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber)) as $objFormQuestion) {
         // Only display if this is NOT "InternalFlag"
         if ($objFormQuestion->InternalFlag) {
             continue;
         }
         $strControlId = 'fq' . $objFormQuestion->Id;
         $objFormAnswer = FormAnswer::LoadBySignupEntryIdFormQuestionId($this->objSignupEntry->Id, $objFormQuestion->Id);
         switch ($objFormQuestion->FormQuestionTypeId) {
             case FormQuestionType::SpouseName:
                 if ($objPerson != null) {
                     if (($objMarriage = $objPerson->GetMostRecentMarriage()) && $objMarriage->MarriedToPerson) {
                         $lstSpouse = new QListBox($this, $strControlId . 'id');
                         $lstSpouse->ActionParameter = $strControlId . 'nm';
                         if (!$objFormQuestion->RequiredFlag) {
                             $lstSpouse->AddItem('- Select One -', null);
                         }
                         $lstSpouse->AddItem($objMarriage->MarriedToPerson->Name, $objMarriage->MarriedToPerson->Id, true);
                         $lstSpouse->AddItem('- Other... -', false);
                         $lstSpouse->AddAction(new QChangeEvent(), new QAjaxAction('lst_ToggleOther'));
                         $lstSpouse->Name = $objFormQuestion->Question;
                         if ($objFormQuestion->RequiredFlag) {
                             $lstSpouse->Required = true;
                         }
                         $lstSpouse->RenderMethod = 'RenderWithName';
                         $this->objFormQuestionControlArray[] = $lstSpouse;
                         $txtName = new QTextBox($this, $strControlId . 'nm');
                         $txtName->RenderMethod = 'RenderWithName';
                         $this->objFormQuestionControlArray[] = $txtName;
                         $txtName->Visible = false;
                         $txtName->Required = false;
                         if ($objFormAnswer && strlen($objFormAnswer->TextValue)) {
                             if ($lstSpouse->SelectedName != $objFormAnswer->TextValue) {
                                 $lstSpouse->SelectedIndex = count($lstSpouse->GetAllItems()) - 1;
                                 $txtName->Text = $objFormAnswer->TextValue;
                                 $this->lst_ToggleOther(null, $lstSpouse->ControlId, $lstSpouse->ActionParameter);
                             }
                         }
                     } else {
                         $lstSpouse = new QListBox($this, $strControlId . 'id');
                         $lstSpouse->Visible = false;
                         if ($objFormQuestion->RequiredFlag) {
                             $lstSpouse->Required = true;
                         }
                         $lstSpouse->RenderMethod = 'RenderWithName';
                         $this->objFormQuestionControlArray[] = $lstSpouse;
                         $txtName = new QTextBox($this, $strControlId . 'nm');
                         $txtName->Name = $objFormQuestion->Question;
                         $txtName->RenderMethod = 'RenderWithName';
                         $this->objFormQuestionControlArray[] = $txtName;
                         $txtName->Visible = true;
                         $txtName->Required = $objFormQuestion->RequiredFlag;
                         if ($objFormAnswer && strlen($objFormAnswer->TextValue)) {
                             $txtName->Text = $objFormAnswer->TextValue;
                         }
                     }
                 } else {
                     $txtName = new QTextBox($this, $strControlId . 'nm');
                     $txtName->Name = $objFormQuestion->Question;
                     $txtName->RenderMethod = 'RenderWithName';
                     $this->objFormQuestionControlArray[] = $txtName;
                     $txtName->Visible = true;
                     $txtName->Required = $objFormQuestion->RequiredFlag;
                     if ($objFormAnswer && strlen($objFormAnswer->TextValue)) {
                         $txtName->Text = $objFormAnswer->TextValue;
                     }
                 }
                 break;
             case FormQuestionType::Address:
                 if ($objPerson != null) {
                     $objHouseholdArray = Household::LoadArrayBySharedHouseholds($objPerson, $this->objSignupEntry->SignupByPerson);
                     if (count($objHouseholdArray) > 1) {
                         // TODO: Implement!
                         throw new Exception('TODO: Not Implemented');
                     } else {
                         if (count($objHouseholdArray) == 1) {
                             $objAddress = $objHouseholdArray[0]->GetCurrentAddress();
                             $rblAddress = new QRadioButtonList($this, $strControlId . 'switch');
                             $rblAddress->Name = $objFormQuestion->Question;
                             $rblAddress->RenderMethod = 'RenderWithName';
                             $rblAddress->AddItem('Use Home Address Below', $objAddress->Id, true);
                             $rblAddress->AddItem('Edit Home Address', false, false);
                             $rblAddress->RepeatColumns = 2;
                             $rblAddress->AddAction(new QClickEvent(), new QAjaxAction('rblAddress_Change'));
                             $this->objFormQuestionControlArray[] = $rblAddress;
                         } else {
                             $objAddress = new Address();
                             $rblAddress = null;
                         }
                     }
                 }
                 $txtAddress1 = new QTextBox($this, $strControlId . 'address1');
                 $txtAddress1->Name = 'Address 1';
                 $txtAddress1->RenderMethod = 'RenderWithName';
                 $txtAddress1->Text = $objPerson != null ? $objAddress->Address1 : '';
                 $txtAddress2 = new QTextBox($this, $strControlId . 'address2');
                 $txtAddress2->Name = 'Address 2';
                 $txtAddress2->RenderMethod = 'RenderWithName';
                 $txtAddress2->Text = $objPerson != null ? $objAddress->Address2 : '';
                 $txtCity = new QTextBox($this, $strControlId . 'city');
                 $txtCity->Name = 'City, State and Zip';
                 $txtCity->RenderMethod = 'RenderWithName';
                 $txtCity->Text = $objPerson != null ? $objAddress->City : '';
                 $lstState = new QListBox($this, $strControlId . 'state');
                 $lstState->ActionParameter = '_' . $strControlId . 'city';
                 $lstState->Name = QApplication::Translate('State');
                 $lstState->RenderMethod = 'RenderWithError';
                 $lstState->AddItem(QApplication::Translate('- Select One -'), null);
                 foreach (UsState::LoadAll(QQ::OrderBy(QQN::UsState()->Name)) as $objUsState) {
                     if ($objPerson != null) {
                         $lstState->AddItem($objUsState->Name, $objUsState->Abbreviation, $objAddress->State == $objUsState->Abbreviation);
                     } else {
                         $lstState->AddItem($objUsState->Name, $objUsState->Abbreviation, false);
                     }
                 }
                 $txtZipCode = new QTextBox($this, $strControlId . 'zipcode');
                 $txtZipCode->ActionParameter = '_' . $strControlId . 'city';
                 $txtZipCode->Name = 'Zip Code';
                 $txtZipCode->RenderMethod = 'RenderWithError';
                 $txtZipCode->Text = $objPerson != null ? $objAddress->ZipCode : '';
                 $txtZipCode->Width = '80px';
                 if ($objFormQuestion->RequiredFlag) {
                     $txtAddress1->Required = true;
                     $txtCity->Required = true;
                     $lstState->Required = true;
                     $txtZipCode->Required = true;
                 }
                 $this->objFormQuestionControlArray[] = $txtAddress1;
                 $this->objFormQuestionControlArray[] = $txtAddress2;
                 $this->objFormQuestionControlArray[] = $txtCity;
                 $this->objFormQuestionControlArray[] = $lstState;
                 $this->objFormQuestionControlArray[] = $txtZipCode;
                 // Final configuration based on whether or not we've got a household record for this person
                 // (in which case we have defined a rblAddress)
                 if ($objPerson != null) {
                     if ($rblAddress) {
                         // Check to see if the question has been answered before
                         if ($objFormAnswer && strlen($objFormAnswer->TextValue)) {
                             // If it
                             $objAddress = Address::DeduceAddressFromFullLine($objFormAnswer->TextValue);
                             if ($objFormAnswer->AddressId == $rblAddress->SelectedValue || !$objAddress) {
                                 $txtAddress1->Enabled = false;
                                 $txtAddress2->Enabled = false;
                                 $txtCity->Enabled = false;
                                 $lstState->Enabled = false;
                                 $txtZipCode->Enabled = false;
                             } else {
                                 $txtAddress1->Text = $objAddress->Address1;
                                 $txtAddress2->Text = $objAddress->Address2;
                                 $txtCity->Text = $objAddress->City;
                                 $txtZipCode->Text = $objAddress->ZipCode;
                                 $lstState->SelectedValue = $objAddress->State;
                                 $rblAddress->SelectedIndex = 1;
                             }
                             // It has not -- let's default to having the address be presumed correct
                         } else {
                             $txtAddress1->Enabled = false;
                             $txtAddress2->Enabled = false;
                             $txtCity->Enabled = false;
                             $lstState->Enabled = false;
                             $txtZipCode->Enabled = false;
                         }
                         // No rblAddress - so let's update the address1 label to match the form question's question text
                     } else {
                         $txtAddress1->Name = $objFormQuestion->Question;
                     }
                 }
                 break;
             case FormQuestionType::Age:
                 $txtAge = new QIntegerTextBox($this, $strControlId . 'age');
                 $txtAge->Name = $objFormQuestion->Question;
                 $txtAge->Minimum = 0;
                 $txtAge->Maximum = 130;
                 $txtAge->MaxLength = 3;
                 if ($objFormAnswer && !is_null($objFormAnswer->IntegerValue)) {
                     $txtAge->Text = $objFormAnswer->IntegerValue;
                 } else {
                     if ($objPerson != null) {
                         if (!$objPerson->DobYearApproximateFlag && $objPerson->Age) {
                             $txtAge->Text = $objPerson->Age;
                         }
                     }
                 }
                 if ($objFormQuestion->RequiredFlag) {
                     $txtAge->Required = true;
                 }
                 $txtAge->RenderMethod = 'RenderWithName';
                 $this->objFormQuestionControlArray[] = $txtAge;
                 $txtAge->Width = '50px';
                 break;
             case FormQuestionType::DateofBirth:
                 $dtxDateOfBirth = new QDateTimeTextBox($this, $strControlId . 'dob');
                 $dtxDateOfBirth->LabelForInvalid = 'For example, "Mar 20 1977"';
                 $dtxDateOfBirth->Name = $objFormQuestion->Question;
                 if ($objFormAnswer && !is_null($objFormAnswer->DateValue)) {
                     $dtxDateOfBirth->Text = $objFormAnswer->DateValue->ToString('MMM D YYYY');
                 } else {
                     if ($objPerson != null) {
                         if (!$objPerson->DobYearApproximateFlag && !$objPerson->DobGuessedFlag && $objPerson->DateOfBirth) {
                             $dtxDateOfBirth->Text = $objPerson->DateOfBirth->ToString('MMM D YYYY');
                         }
                     }
                 }
                 if ($objFormQuestion->RequiredFlag) {
                     $dtxDateOfBirth->Required = true;
                 }
                 $dtxDateOfBirth->RenderMethod = 'RenderWithName';
                 $this->objFormQuestionControlArray[] = $dtxDateOfBirth;
                 $dtxDateOfBirth->Width = '150px';
                 break;
             case FormQuestionType::Gender:
                 $lstGender = new QListBox($this, $strControlId . 'gender');
                 $lstGender->Name = $objFormQuestion->Question;
                 $lstGender->AddItem('- Select One -', null);
                 if ($objFormAnswer && $objFormAnswer->TextValue) {
                     $lstGender->AddItem('Male', true, $objFormAnswer->BooleanValue);
                     $lstGender->AddItem('Female', false, !$objFormAnswer->BooleanValue);
                 } else {
                     if ($objPerson != null) {
                         $lstGender->AddItem('Male', true, $objPerson->Gender == 'M');
                         $lstGender->AddItem('Female', false, $objPerson->Gender == 'F');
                     } else {
                         $lstGender->AddItem('Male', true, true);
                         // just default to something
                         $lstGender->AddItem('Female', false, false);
                     }
                 }
                 if ($objFormQuestion->RequiredFlag) {
                     $lstGender->Required = true;
                 }
                 $lstGender->RenderMethod = 'RenderWithName';
                 $this->objFormQuestionControlArray[] = $lstGender;
                 break;
             case FormQuestionType::Phone:
                 $objPhoneArray = array();
                 if ($objPerson != null) {
                     // Add Household Numbers (if applicable)
                     foreach ($objPerson->GetHouseholdParticipationArray() as $objHouseholdParticipation) {
                         foreach ($objHouseholdParticipation->Household->GetCurrentAddress()->GetPhoneArray() as $objPhone) {
                             $objPhoneArray[] = $objPhone;
                         }
                     }
                     // Add Personal Numbers
                     foreach ($objPerson->GetPhoneArray() as $objPhone) {
                         $objPhoneArray[] = $objPhone;
                     }
                     if (count($objPhoneArray)) {
                         $lstPhone = new QListBox($this, $strControlId . 'id');
                         $lstPhone->ActionParameter = $strControlId . 'phone';
                         $lstPhone->Name = $objFormQuestion->Question;
                         $lstPhone->AddItem('- Select One -', null);
                         rsort($objPhoneArray);
                         foreach ($objPhoneArray as $objPhone) {
                             $lstPhone->AddItem($objPhone->Number, $objPhone->Id, $objFormAnswer && $objFormAnswer->PhoneId == $objPhone->Id);
                         }
                         $lstPhone->AddItem('- Other... -', false);
                         if ($objFormQuestion->RequiredFlag) {
                             $lstPhone->Required = true;
                         }
                         $lstPhone->RenderMethod = 'RenderWithName';
                         $this->objFormQuestionControlArray[] = $lstPhone;
                         $lstPhone->AddAction(new QChangeEvent(), new QAjaxAction('lst_ToggleOther'));
                     }
                 }
                 $txtPhone = new PhoneTextBox($this, $strControlId . 'phone');
                 $this->objFormQuestionControlArray[] = $txtPhone;
                 $txtPhone->RenderMethod = 'RenderWithName';
                 // We need to deduce whether or not we should show an explicit text-valued phone number from before
                 if ($objPerson != null) {
                     $blnExplicitlyTextValueOnly = $objFormAnswer && $objFormAnswer->TextValue && (!$lstPhone || !$lstPhone->SelectedValue);
                 } else {
                     $blnExplicitlyTextValueOnly = true;
                 }
                 if (count($objPhoneArray)) {
                     if ($blnExplicitlyTextValueOnly) {
                         $lstPhone->SelectedIndex = count($lstPhone->GetAllItems()) - 1;
                         $txtPhone->Visible = true;
                         $txtPhone->Required = $objFormQuestion->RequiredFlag;
                         $txtPhone->Text = $objFormAnswer->TextValue;
                     } else {
                         $txtPhone->Visible = false;
                         $txtPhone->Required = false;
                     }
                 } else {
                     $txtPhone->Visible = true;
                     $txtPhone->Required = $objFormQuestion->RequiredFlag;
                     $txtPhone->Name = $objFormQuestion->Question;
                     if ($blnExplicitlyTextValueOnly) {
                         $txtPhone->Text = $objFormAnswer ? $objFormAnswer->TextValue : '';
                     }
                 }
                 break;
             case FormQuestionType::Email:
                 $objEmailArray = array();
                 if ($objPerson != null) {
                     // Add Personal Emails
                     foreach ($objPerson->GetEmailArray() as $objEmail) {
                         $objEmailArray[] = $objEmail;
                     }
                     if (count($objEmailArray)) {
                         $lstEmail = new QListBox($this, $strControlId . 'id');
                         $lstEmail->ActionParameter = $strControlId . 'email';
                         $lstEmail->Name = $objFormQuestion->Question;
                         $lstEmail->AddItem('- Select One -', null);
                         rsort($objEmailArray);
                         foreach ($objEmailArray as $objEmail) {
                             $lstEmail->AddItem($objEmail->Address, $objEmail->Id, $objFormAnswer && $objFormAnswer->EmailId == $objEmail->Id);
                         }
                         $lstEmail->AddItem('- Other... -', false);
                         if ($objFormQuestion->RequiredFlag) {
                             $lstEmail->Required = true;
                         }
                         $lstEmail->RenderMethod = 'RenderWithName';
                         $this->objFormQuestionControlArray[] = $lstEmail;
                         $lstEmail->AddAction(new QChangeEvent(), new QAjaxAction('lst_ToggleOther'));
                     }
                 }
                 $txtEmail = new QEmailTextBox($this, $strControlId . 'email');
                 $this->strEmailCtrlId = $strControlId . 'email';
                 $this->objFormQuestionControlArray[] = $txtEmail;
                 $txtEmail->RenderMethod = 'RenderWithName';
                 // We need to deduce whether or not we should show an explicit text-valued email address from before
                 if ($objPerson != null) {
                     $blnExplicitlyTextValueOnly = $objFormAnswer && $objFormAnswer->TextValue && (!$lstEmail || !$lstEmail->SelectedValue);
                 } else {
                     $blnExplicitlyTextValueOnly = true;
                 }
                 if (count($objEmailArray)) {
                     if ($blnExplicitlyTextValueOnly) {
                         $lstEmail->SelectedIndex = count($lstEmail->GetAllItems()) - 1;
                         $txtEmail->Visible = true;
                         $txtEmail->Required = $objFormQuestion->RequiredFlag;
                         $txtEmail->Text = $objFormAnswer->TextValue;
                     } else {
                         $txtEmail->Visible = false;
                         $txtEmail->Required = false;
                     }
                 } else {
                     $txtEmail->Visible = true;
                     $txtEmail->Required = $objFormQuestion->RequiredFlag;
                     $txtEmail->Name = $objFormQuestion->Question;
                     if ($blnExplicitlyTextValueOnly) {
                         $txtEmail->Text = $objFormAnswer ? $objFormAnswer->TextValue : '';
                     }
                 }
                 break;
             case FormQuestionType::ShortText:
                 $txtAnswer = new QTextBox($this, $strControlId);
                 $txtAnswer->Name = $objFormQuestion->Question;
                 $txtAnswer->Required = $objFormQuestion->RequiredFlag;
                 $txtAnswer->RenderMethod = 'RenderWithName';
                 $this->objFormQuestionControlArray[] = $txtAnswer;
                 if ($objFormAnswer) {
                     $txtAnswer->Text = $objFormAnswer->TextValue;
                 }
                 break;
             case FormQuestionType::LongText:
                 $txtAnswer = new QTextBox($this, $strControlId);
                 $txtAnswer->Name = $objFormQuestion->Question;
                 $txtAnswer->Required = $objFormQuestion->RequiredFlag;
                 $txtAnswer->RenderMethod = 'RenderWithName';
                 $txtAnswer->TextMode = QTextMode::MultiLine;
                 $this->objFormQuestionControlArray[] = $txtAnswer;
                 if ($objFormAnswer) {
                     $txtAnswer->Text = $objFormAnswer->TextValue;
                 }
                 break;
             case FormQuestionType::Number:
                 $txtAnswer = new QIntegerTextBox($this, $strControlId);
                 $txtAnswer->Name = $objFormQuestion->Question;
                 $txtAnswer->Required = $objFormQuestion->RequiredFlag;
                 $txtAnswer->RenderMethod = 'RenderWithName';
                 $this->objFormQuestionControlArray[] = $txtAnswer;
                 $txtAnswer->Width = '50px';
                 $txtAnswer->MaxLength = 6;
                 if ($objFormAnswer) {
                     $txtAnswer->Text = $objFormAnswer->IntegerValue;
                 }
                 break;
             case FormQuestionType::YesNo:
                 $chkAnswer = new QCheckBox($this, $strControlId);
                 $chkAnswer->Name = $objFormQuestion->Question;
                 $chkAnswer->Text = trim($objFormQuestion->Options);
                 $chkAnswer->Required = $objFormQuestion->RequiredFlag;
                 $chkAnswer->RenderMethod = 'RenderWithName';
                 $this->objFormQuestionControlArray[] = $chkAnswer;
                 if ($objFormAnswer) {
                     $chkAnswer->Checked = $objFormAnswer->BooleanValue;
                 }
                 break;
             case FormQuestionType::SingleSelect:
                 $lstAnswer = new QListBox($this, $strControlId);
                 $lstAnswer->Name = $objFormQuestion->Question;
                 $lstAnswer->Required = $objFormQuestion->RequiredFlag;
                 $lstAnswer->RenderMethod = 'RenderWithName';
                 $this->objFormQuestionControlArray[] = $lstAnswer;
                 $lstAnswer->AddItem('- Select One -', null);
                 foreach (explode("\n", trim($objFormQuestion->Options)) as $strItem) {
                     if (strlen($strItem = trim($strItem))) {
                         $lstAnswer->AddItem($strItem, $strItem, $objFormAnswer && $objFormAnswer->TextValue == $strItem);
                     }
                 }
                 if ($objFormQuestion->AllowOtherFlag) {
                     $lstAnswer->ActionParameter = $strControlId . 'other';
                     $lstAnswer->AddAction(new QChangeEvent(), new QAjaxAction('lst_ToggleOther'));
                     $lstAnswer->AddItem('- Other... -', false);
                     $txtAnswer = new QTextBox($this, $strControlId . 'other');
                     $txtAnswer->RenderMethod = 'RenderWithName';
                     $txtAnswer->Required = false;
                     $txtAnswer->Visible = false;
                     $this->objFormQuestionControlArray[] = $txtAnswer;
                 }
                 if ($objFormAnswer && strlen($objFormAnswer->TextValue) && !$lstAnswer->SelectedValue) {
                     if ($objFormQuestion->AllowOtherFlag) {
                         $lstAnswer->SelectedIndex = count($lstAnswer->GetAllItems()) - 1;
                         $txtAnswer->Text = $objFormAnswer->TextValue;
                         $txtAnswer->Visible = true;
                     } else {
                         $lstAnswer->AddItem($objFormAnswer->TextValue, $objFormAnswer->TextValue, true);
                     }
                 }
                 break;
             case FormQuestionType::MultipleSelect:
                 $strAnswerArray = array();
                 if ($objFormAnswer) {
                     foreach (explode("\n", trim($objFormAnswer->TextValue)) as $strAnswer) {
                         if (strlen($strAnswer = trim($strAnswer))) {
                             $strAnswerArray[$strAnswer] = $strAnswer;
                         }
                     }
                 }
                 // GJS - Change to check boxes instead of multi select
                 $chkAnswer = new QCheckBoxList($this, $strControlId);
                 $chkAnswer->Name = $objFormQuestion->Question;
                 $chkAnswer->RenderMethod = 'RenderWithName';
                 $this->objFormQuestionControlArray[] = $chkAnswer;
                 foreach (explode("\n", trim($objFormQuestion->Options)) as $strItem) {
                     if (strlen($strItem = trim($strItem))) {
                         $chkAnswer->AddItem($strItem, $strItem, array_key_exists($strItem, $strAnswerArray));
                         $strAnswerArray[$strItem] = null;
                         unset($strAnswerArray[$strItem]);
                     }
                 }
                 foreach ($strAnswerArray as $strAnswer) {
                     $chkAnswer->AddItem($strAnswer, $strAnswer, true);
                 }
                 if ($objFormQuestion->AllowOtherFlag) {
                     $txtAnswer = new QTextBox($this, $strControlId . 'other');
                     $txtAnswer->RenderMethod = 'RenderWithName';
                     $txtAnswer->HtmlBefore = 'Add another option and hit <strong>Enter</strong>:<br/>';
                     $txtAnswer->Visible = true;
                     $txtAnswer->ActionParameter = $strControlId;
                     $txtAnswer->AddAction(new QEnterKeyEvent(), new QAjaxAction('txtMultipleSelectOther_Enter'));
                     $this->objFormQuestionControlArray[] = $txtAnswer;
                 }
                 break;
             case FormQuestionType::Instructions:
                 $lblAnswer = new QLabel($this, $strControlId);
                 $lblAnswer->HtmlEntities = false;
                 $lblAnswer->Text = nl2br(QApplication::HtmlEntities(trim($objFormQuestion->Options)), true);
                 if (strlen($strLabel = trim($objFormQuestion->Question))) {
                     $lblAnswer->Name = $strLabel;
                     $lblAnswer->RenderMethod = 'RenderWithName';
                 } else {
                     $lblAnswer->RenderMethod = 'Render';
                 }
                 $this->objFormQuestionControlArray[] = $lblAnswer;
                 break;
             default:
                 throw new Exception('Invalid FormQuestionTypeId: ' . $objFormQuestion->FormQuestionTypeId);
         }
     }
 }
Exemplo n.º 22
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case 'Culture':
             try {
                 $this->strCulture = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'culture', $this->strCulture);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Disabled':
             try {
                 $this->blnDisabled = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'disabled', $this->blnDisabled);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Icons':
             $this->mixIcons = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'icons', $mixValue);
             }
             break;
         case 'Incremental':
             $this->mixIncremental = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'incremental', $mixValue);
             }
             break;
         case 'Max':
             $this->mixMax = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'max', $mixValue);
             }
             break;
         case 'Min':
             $this->mixMin = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'min', $mixValue);
             }
             break;
         case 'NumberFormat':
             try {
                 $this->strNumberFormat = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'numberFormat', $this->strNumberFormat);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Page':
             try {
                 $this->intPage = QType::Cast($mixValue, QType::Integer);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'page', $this->intPage);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Step':
             $this->mixStep = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'step', $mixValue);
             }
             break;
         case 'Enabled':
             $this->Disabled = !$mixValue;
             // Tie in standard QCubed functionality
             parent::__set($strName, $mixValue);
             break;
         default:
             try {
                 parent::__set($strName, $mixValue);
                 break;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Exemplo n.º 23
0
 protected function GetControlHtml()
 {
     $strOutput = $this->lblMessage->Render(false) . '<br /><table style="border: 1px solid #DDDDDD" cellpadding="4" cellspacing="0" width="100%">';
     foreach (NarroUser::$AvailablePreferences as $strName => $arrPref) {
         switch ($arrPref['type']) {
             case 'number':
                 $txtNumber = new QIntegerTextBox($this);
                 $txtNumber->Name = $strName;
                 $txtNumber->Minimum = 5;
                 $txtNumber->Maximum = 100;
                 $txtNumber->MaxLength = 3;
                 $txtNumber->Width = 50;
                 $txtNumber->Text = $this->objUser->GetPreferenceValueByName($strName);
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtNumber->RenderWithError(false), t($arrPref['description']));
                 $this->arrControls[$strName] = $txtNumber;
                 break;
             case 'text':
                 $txtTextPref = new QTextBox($this);
                 $txtTextPref->Name = $strName;
                 $txtTextPref->Text = $this->objUser->GetPreferenceValueByName($strName);
                 if ($strName == 'Special characters') {
                     $strSelect = sprintf('<select onchange="document.getElementById(\'%s\').value+=this.options[this.selectedIndex].value;">', $txtTextPref->ControlId);
                     foreach (NarroDiacriticsPanel::$arrEntities as $strEntityName => $strEntityChar) {
                         $strSelect .= sprintf('<option value=" %s">%s (%s)', $strEntityName, $strEntityChar, $strEntityName);
                     }
                     $strSelect .= '</select>';
                     $arrPref['description'] = t($arrPref['description']) . $strSelect;
                     $txtTextPref->Width = 400;
                 } elseif ($strName == 'Other languages') {
                     $strSelect = sprintf('<select onchange="document.getElementById(\'%s\').value+= \' \' + this.options[this.selectedIndex].value;">', $txtTextPref->ControlId);
                     foreach (NarroLanguage::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName))) as $objLanguage) {
                         $strSelect .= sprintf('<option value="%s">%s (%s)', $objLanguage->LanguageCode, t($objLanguage->LanguageName), $objLanguage->LanguageCode);
                     }
                     $strSelect .= '</select>';
                     $arrPref['description'] = t($arrPref['description']) . $strSelect;
                     $txtTextPref->Width = 400;
                 }
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtTextPref->RenderWithError(false), $arrPref['description']);
                 $this->arrControls[$strName] = $txtTextPref;
                 break;
             case 'option':
                 $lstOption = new QListBox($this);
                 $lstOption->Name = $strName;
                 if ($strName == 'Language') {
                     $arrLanguages = NarroLanguage::LoadAllActive(QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)));
                     foreach ($arrLanguages as $objLanguage) {
                         $lstOption->AddItem(t($objLanguage->LanguageName), $objLanguage->LanguageCode, $objLanguage->LanguageCode == $this->objUser->GetPreferenceValueByName($strName));
                     }
                 } elseif ($strName == 'Application language') {
                     $arrLanguages = NarroLanguage::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)));
                     foreach ($arrLanguages as $objLanguage) {
                         $lstOption->AddItem(t($objLanguage->LanguageName), $objLanguage->LanguageCode, $objLanguage->LanguageCode == $this->objUser->GetPreferenceValueByName($strName));
                     }
                 } else {
                     foreach ($arrPref['values'] as $strValue) {
                         $lstOption->AddItem(t($strValue), $strValue, $strValue == $this->objUser->GetPreferenceValueByName($strName));
                     }
                 }
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $lstOption->RenderWithError(false), t($arrPref['description']));
                 $this->arrControls[$strName] = $lstOption;
                 break;
         }
     }
     $strOutput .= '</table><br />';
     $strOutput .= $this->btnCancel->Render(false) . ' ' . $this->btnSave->Render(false);
     if ($this->txtPreviousUrl) {
         $strOutput .= ' ' . sprintf(t('Click <a href="%s">here</a> to return to the page you were.'), $this->txtPreviousUrl);
     }
     $this->strText = $strOutput;
     return parent::GetControlHtml();
 }
Exemplo n.º 24
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case 'AppendTo':
             $this->mixAppendTo = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'appendTo', $mixValue);
             }
             break;
         case 'AutoFocus':
             try {
                 $this->blnAutoFocus = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'autoFocus', $this->blnAutoFocus);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Delay':
             try {
                 $this->intDelay = QType::Cast($mixValue, QType::Integer);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'delay', $this->intDelay);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Disabled':
             try {
                 $this->blnDisabled = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'disabled', $this->blnDisabled);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'MinLength':
             try {
                 $this->intMinLength = QType::Cast($mixValue, QType::Integer);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'minLength', $this->intMinLength);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Position':
             $this->mixPosition = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'position', $mixValue);
             }
             break;
         case 'Source':
             $this->mixSource = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'source', $mixValue);
             }
             break;
         case 'Enabled':
             $this->Disabled = !$mixValue;
             // Tie in standard QCubed functionality
             parent::__set($strName, $mixValue);
             break;
         default:
             try {
                 parent::__set($strName, $mixValue);
                 break;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * If this control is attachable to a codegenerated control in a ModelConnector, this function will be
  * used by the ModelConnector designer dialog to display a list of options for the control.
  * @return QModelConnectorParam[]
  **/
 public static function GetModelConnectorParams()
 {
     return array_merge(parent::GetModelConnectorParams(), array(new QModelConnectorParam(get_called_class(), 'AltFormat', 'The dateFormat to be used for the altField option. This allows onedate format to be shown to the user for selection purposes, while adifferent format is actually sent behind the scenes. For a full listof the possible formats see the formatDate function', QType::String), new QModelConnectorParam(get_called_class(), 'AppendText', 'The text to display after each date field, e.g., to show the requiredformat.', QType::String), new QModelConnectorParam(get_called_class(), 'AutoSize', 'Set to true to automatically resize the input field to accommodatedates in the current dateFormat.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'OnBeforeShow', 'Type:Function( Element input, Object inst )Default:nullA function thattakes an input field and current datepicker instance and returns anoptions object to update the datepicker with. It is called just beforethe datepicker is displayed.', 'QJsClosure'), new QModelConnectorParam(get_called_class(), 'OnBeforeShowDay', 'Type:Function( Date date )Default:nullA function that takes a date asa parameter and must return an array with: 	* [0]: true/false indicating whether or not this date is selectable	* [1]: a CSS class name to add to the dates cell or \\"\\" for thedefault presentation	* [2]: an optional popup tooltip for this date The function is called for each day in the datepicker before it isdisplayed.', 'QJsClosure'), new QModelConnectorParam(get_called_class(), 'ButtonImage', 'A URL of an image to use to display the datepicker when the showOnoption is set to \\"button\\" or \\"both\\". If set, the buttonText optionbecomes the alt value and is not directly displayed.', QType::String), new QModelConnectorParam(get_called_class(), 'ButtonImageOnly', 'Whether the button image should be rendered by itself instead ofinside a button element. This option is only relevant if thebuttonImage option has also been set.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'ButtonText', 'The text to display on the trigger button. Use in conjunction with theshowOn option set to \\"button\\" or \\"both\\".', QType::String), new QModelConnectorParam(get_called_class(), 'OnCalculateWeek', 'Type:Function()Default:jQuery.datepicker.iso8601WeekA function tocalculate the week of the year for a given date. The defaultimplementation uses the ISO 8601 definition: weeks start on a Monday;the first week of the year contains the first Thursday of the year.', 'QJsClosure'), new QModelConnectorParam(get_called_class(), 'ChangeMonth', 'Whether the month should be rendered as a dropdown instead of text.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'ChangeYear', 'Whether the year should be rendered as a dropdown instead of text. Usethe yearRange option to control which years are made available forselection.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'CloseText', 'The text to display for the close link. Use the showButtonPanel optionto display this button.', QType::String), new QModelConnectorParam(get_called_class(), 'ConstrainInput', 'When true, entry in the input field is constrained to those charactersallowed by the current dateFormat option.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'CurrentText', 'The text to display for the current day link. Use the showButtonPaneloption to display this button.', QType::String), new QModelConnectorParam(get_called_class(), 'JqDateFormat', 'The format for parsed and displayed dates. For a full list of thepossible formats see the formatDate function.', QType::String), new QModelConnectorParam(get_called_class(), 'DayNames', 'The list of long day names, starting from Sunday, for use as requestedvia the dateFormat option.', QType::ArrayType), new QModelConnectorParam(get_called_class(), 'DayNamesMin', 'The list of minimised day names, starting from Sunday, for use ascolumn headers within the datepicker.', QType::ArrayType), new QModelConnectorParam(get_called_class(), 'DayNamesShort', 'The list of abbreviated day names, starting from Sunday, for use asrequested via the dateFormat option.', QType::ArrayType), new QModelConnectorParam(get_called_class(), 'Duration', 'Control the speed at which the datepicker appears, it may be a time inmilliseconds or a string representing one of the three predefinedspeeds (\\"slow\\", \\"normal\\", \\"fast\\").', 'QJsClosure'), new QModelConnectorParam(get_called_class(), 'FirstDay', 'Set the first day of the week: Sunday is 0, Monday is 1, etc.', QType::Integer), new QModelConnectorParam(get_called_class(), 'GotoCurrent', 'When true, the current day link moves to the currently selected dateinstead of today.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'HideIfNoPrevNext', 'Normally the previous and next links are disabled when not applicable(see the minDate and maxDate options). You can hide them altogether bysetting this attribute to true.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'IsRTL', 'Whether the current language is drawn from right to left.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'MonthNames', 'The list of full month names, for use as requested via the dateFormatoption.', QType::ArrayType), new QModelConnectorParam(get_called_class(), 'MonthNamesShort', 'The list of abbreviated month names, as used in the month header oneach datepicker and as requested via the dateFormat option.', QType::ArrayType), new QModelConnectorParam(get_called_class(), 'NavigationAsDateFormat', 'Whether the currentText, prevText and nextText options should beparsed as dates by the formatDate function, allowing them to displaythe target month names for example.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'NextText', 'The text to display for the next month link. With the standardThemeRoller styling, this value is replaced by an icon.', QType::String), new QModelConnectorParam(get_called_class(), 'OnChangeMonthYear', 'Type:Function( Integer year, Integer month, Object inst)Default:nullCalled when the datepicker moves to a new month and/oryear. The function receives the selected year, month (1-12), and thedatepicker instance as parameters. this refers to the associated inputfield.', 'QJsClosure'), new QModelConnectorParam(get_called_class(), 'OnClose', 'Type:Function( String dateText, Object inst )Default:nullCalled whenthe datepicker is closed, whether or not a date is selected. Thefunction receives the selected date as text (\\"\\" if none) and thedatepicker instance as parameters. this refers to the associated inputfield.', 'QJsClosure'), new QModelConnectorParam(get_called_class(), 'OnSelect', 'Type:Function( String dateText, Object inst )Default:nullCalled whenthe datepicker is selected. The function receives the selected date astext and the datepicker instance as parameters. this refers to theassociated input field.', 'QJsClosure'), new QModelConnectorParam(get_called_class(), 'PrevText', 'The text to display for the previous month link. With the standardThemeRoller styling, this value is replaced by an icon.', QType::String), new QModelConnectorParam(get_called_class(), 'SelectOtherMonths', 'Whether days in other months shown before or after the current monthare selectable. This only applies if the showOtherMonths option is setto true.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'ShowAnim', 'The name of the animation used to show and hide the datepicker. Use\\"show\\" (the default), \\"slideDown\\", \\"fadeIn\\", any of the jQuery UIeffects. Set to an empty string to disable animation.', QType::String), new QModelConnectorParam(get_called_class(), 'ShowButtonPanel', 'Whether to display a button pane underneath the calendar. The buttonpane contains two buttons, a Today button that links to the currentday, and a Done button that closes the datepicker. The buttons textcan be customized using the currentText and closeText optionsrespectively.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'ShowCurrentAtPos', 'When displaying multiple months via the numberOfMonths option, theshowCurrentAtPos option defines which position to display the currentmonth in.', QType::Integer), new QModelConnectorParam(get_called_class(), 'ShowMonthAfterYear', 'Whether to show the month after the year in the header.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'ShowOn', 'When the datepicker should appear. The datepicker can appear when thefield receives focus (\\"focus\\"), when a button is clicked (\\"button\\"),or when either event occurs (\\"both\\").', QType::String), new QModelConnectorParam(get_called_class(), 'ShowOtherMonths', 'Whether to display dates in other months (non-selectable) at the startor end of the current month. To make these days selectable use theselectOtherMonths option.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'ShowWeek', 'When true, a column is added to show the week of the year. ThecalculateWeek option determines how the week of the year iscalculated. You may also want to change the firstDay option.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'StepMonths', 'Set how many months to move when clicking the previous/next links.', QType::Integer), new QModelConnectorParam(get_called_class(), 'WeekHeader', 'The text to display for the week of the year column heading. Use theshowWeek option to display this column.', QType::String), new QModelConnectorParam(get_called_class(), 'YearRange', 'The range of years displayed in the year drop-down: either relative totodays year (\\"-nn:+nn\\"), relative to the currently selected year(\\"c-nn:c+nn\\"), absolute (\\"nnnn:nnnn\\"), or combinations of theseformats (\\"nnnn:-nn\\"). Note that this option only affects what appearsin the drop-down, to restrict which dates may be selected use theminDate and/or maxDate options.', QType::String), new QModelConnectorParam(get_called_class(), 'YearSuffix', 'Additional text to display after the year in the month headers.', QType::String)));
 }
 /**
  * Constructor
  *
  * @param QControl|QForm $objParentObject
  * @param null|string    $strControlId
  */
 public function __construct($objParentObject, $strControlId = null)
 {
     parent::__construct($objParentObject, $strControlId);
     $this->strLabelForInvalid = QApplication::Translate('Invalid Web Address');
     $this->strTextMode = QTextMode::Url;
 }
 /**
  * Returns an description of the options available to modify by the designer for the code generator.
  *
  * @return array
  */
 public static function GetModelConnectorParams()
 {
     return array_merge(parent::GetModelConnectorParams(), array(new QModelConnectorParam(get_called_class(), 'Maximum', 'Meximum value allowed', QType::String), new QModelConnectorParam(get_called_class(), 'Minimum', 'Meximum value allowed', QType::String), new QModelConnectorParam(get_called_class(), 'Step', 'If value must be aligned on a step, the step amount', QType::String), new QModelConnectorParam(get_called_class(), 'LabelForLess', 'If value is too small, override the default error message', QType::String), new QModelConnectorParam(get_called_class(), 'LabelForGreater', 'If value is too big, override the default error message', QType::String), new QModelConnectorParam(get_called_class(), 'LabelForNotStepAligned', 'If value is not step aligned, override the default error message', QType::String)));
 }
 /**
  * If this control is attachable to a codegenerated control in a ModelConnector, this function will be
  * used by the ModelConnector designer dialog to display a list of options for the control.
  * @return QModelConnectorParam[]
  **/
 public static function GetModelConnectorParams()
 {
     return array_merge(parent::GetModelConnectorParams(), array(new QModelConnectorParam(get_called_class(), 'Culture', 'Sets the culture to use for parsing and formatting the value. If null,the currently set culture in Globalize is used, see Globalize docs foravailable cultures. Only relevant if the numberFormat option is set.Requires Globalize to be included.', QType::String), new QModelConnectorParam(get_called_class(), 'Disabled', 'Disables the spinner if set to true.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'NumberFormat', 'Format of numbers passed to Globalize, if available. Most common are\\"n\\" for a decimal number and \\"C\\" for a currency value. Also see theculture option.', QType::String), new QModelConnectorParam(get_called_class(), 'Page', 'The number of steps to take when paging via the pageUp/pageDownmethods.', QType::Integer)));
 }
Exemplo n.º 29
0
 /**
  * @return array|QModelConnectorParam[]
  */
 public static function GetModelConnectorParams()
 {
     return array_merge(parent::GetModelConnectorParams(), array(new QModelConnectorParam(get_called_class(), 'DefaultAreaCode', '', QType::String)));
 }