本文整理汇总了PHP中QQN::FormQuestion方法的典型用法代码示例。如果您正苦于以下问题:PHP QQN::FormQuestion方法的具体用法?PHP QQN::FormQuestion怎么用?PHP QQN::FormQuestion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQN
的用法示例。
在下文中一共展示了QQN::FormQuestion方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CountByFormQuestionTypeId
/**
* Count FormQuestions
* by FormQuestionTypeId Index(es)
* @param integer $intFormQuestionTypeId
* @return int
*/
public static function CountByFormQuestionTypeId($intFormQuestionTypeId, $objOptionalClauses = null)
{
// Call FormQuestion::QueryCount to perform the CountByFormQuestionTypeId query
return FormQuestion::QueryCount(QQ::Equal(QQN::FormQuestion()->FormQuestionTypeId, $intFormQuestionTypeId), $objOptionalClauses);
}
示例2: MoveDown
public function MoveDown()
{
$blnFound = false;
foreach (FormQuestion::LoadArrayBySignupFormId($this->intSignupFormId, QQ::OrderBy(QQN::FormQuestion()->OrderNumber)) as $objFormQuestion) {
if ($blnFound) {
break;
}
if ($objFormQuestion->Id == $this->Id) {
$blnFound = true;
}
}
$this->OrderNumber++;
$this->Save();
if ($objFormQuestion) {
$objFormQuestion->OrderNumber--;
$objFormQuestion->Save();
}
self::RefreshOrderNumber($this->intSignupFormId);
}
示例3: dtgFormQuestions_Bind
protected function dtgFormQuestions_Bind()
{
$this->dtgFormQuestions->DataSource = $this->objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber));
}
示例4: header
}
$objSignupForm = SignupForm::Load(QApplication::PathInfo(0));
if (!$objSignupForm) {
QApplication::Redirect('/events/');
}
if (!$objSignupForm->IsLoginCanView(QApplication::$Login)) {
QApplication::Redirect('/events/');
}
// Disable strict no-cache for IE due to IE issues with downloading no-cache items
if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) {
header("Pragma:");
header("Expires:");
}
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename=' . $objSignupForm->CsvFilename);
$objFormQuestionArray = $objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber));
// Get Column Titles
print "First Name,Last Name";
foreach ($objFormQuestionArray as $objFormQuestion) {
if ($objFormQuestion->FormQuestionTypeId == FormQuestionType::Address) {
print ", Street";
print ", City";
print ", State And Zip Code";
} else {
print "," . EscapeCsv($objFormQuestion->ShortDescription);
}
}
if ($objSignupForm->CountFormProducts() > 0) {
foreach ($objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber)) as $objFormProduct) {
if ($objFormProduct->ViewFlag) {
print ",";
示例5: CreateFormItemControls
/**
* 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;
}
}
//.........这里部分代码省略.........
示例6: GenerateFormInMinistry
//.........这里部分代码省略.........
$intProductCount = rand(0, 3);
for ($i = 0; $i < $intProductCount; $i++) {
$objFormProduct = new FormProduct();
$objFormProduct->SignupForm = $objSignupForm;
$objFormProduct->FormProductTypeId = FormProductType::Optional;
$objFormProduct->FormPaymentTypeId = FormPaymentType::PayInFull;
$objFormProduct->Name = self::GenerateTitle(2, 5);
$objFormProduct->Description = self::GenerateContent(1, 3, 10);
$objFormProduct->MinimumQuantity = 1;
$objFormProduct->MaximumQuantity = rand(1, 3);
$objFormProduct->Cost = rand(1, 10) * 5;
$objFormProduct->OrderNumber = $intOrderNumber;
$intOrderNumber++;
$objFormProduct->ViewFlag = true;
$objFormProduct->Save();
}
// 4: Otpional Donation
if (rand(0, 1)) {
$objFormProduct = new FormProduct();
$objFormProduct->SignupForm = $objSignupForm;
$objFormProduct->FormProductTypeId = FormProductType::Optional;
$objFormProduct->FormPaymentTypeId = FormPaymentType::Donation;
$objFormProduct->Name = 'Donation';
$objFormProduct->Description = self::GenerateContent(1, 3, 10);
$objFormProduct->MinimumQuantity = 1;
$objFormProduct->MaximumQuantity = 1;
$objFormProduct->OrderNumber = $intOrderNumber;
$intOrderNumber++;
$objFormProduct->ViewFlag = true;
$objFormProduct->Save();
}
// Add Form Questions
$intOrderNumber = 1;
foreach (FormQuestionType::$NameArray as $intFormQuestionTypeId => $strName) {
if (rand(0, 1)) {
$objFormQuestion = null;
} else {
$objFormQuestion = new FormQuestion();
$objFormQuestion->SignupForm = $objSignupForm;
$objFormQuestion->OrderNumber = $intOrderNumber;
$objFormQuestion->FormQuestionTypeId = $intFormQuestionTypeId;
$objFormQuestion->RequiredFlag = rand(0, 1);
$objFormQuestion->ViewFlag = rand(0, 1);
switch ($intFormQuestionTypeId) {
case FormQuestionType::SpouseName:
$objFormQuestion->ShortDescription = 'Spouse\'s Name';
$objFormQuestion->Question = 'What is your spouse\'s name?';
break;
case FormQuestionType::Address:
$objFormQuestion->ShortDescription = 'Home Address';
$objFormQuestion->Question = 'What is your address?';
break;
case FormQuestionType::Age:
$objFormQuestion->ShortDescription = 'Age';
$objFormQuestion->Question = 'How old are you?';
break;
case FormQuestionType::DateofBirth:
$objFormQuestion->ShortDescription = 'Date of Birth';
$objFormQuestion->Question = 'When were you born';
break;
case FormQuestionType::Gender:
$objFormQuestion->ShortDescription = 'Gender';
$objFormQuestion->Question = 'What is your gender?';
break;
case FormQuestionType::Phone:
$objFormQuestion->ShortDescription = 'Phone';
示例7: dtgSignupEntries_SetupColumns
public function dtgSignupEntries_SetupColumns()
{
$this->dtgSignupEntries->RemoveAllColumns();
$this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->Person->LastName, 'Name=Name', 'Html=<?= $_FORM->RenderName($_ITEM); ?>', 'HtmlEntities=false');
// $this->dtgSignupEntries->MetaAddTypeColumn('SignupEntryStatusTypeId', 'SignupEntryStatusType', 'Name=Status');
foreach ($this->objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber)) as $objFormQuestion) {
if ($objFormQuestion->ViewFlag) {
$this->dtgSignupEntries->AddColumn(new QDataGridColumn($objFormQuestion->ShortDescription, '<?= $_FORM->RenderAnswer($_ITEM, ' . $objFormQuestion->Id . ',' . $objFormQuestion->FormQuestionTypeId . '); ?>', 'HtmlEntities=false'));
}
}
foreach ($this->objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber)) as $objFormProduct) {
if ($objFormProduct->ViewFlag) {
/* $this->dtgSignupEntries->AddColumn(new QDataGridColumn($objFormProduct->Name. ' Quantity', '<?= $_FORM->RenderProductQuantity($_ITEM, ' . $objFormProduct->Id . '); ?>', 'HtmlEntities=false'));*/
$this->dtgSignupEntries->AddColumn(new QDataGridColumn($objFormProduct->Name, '<?= $_FORM->RenderProductAmount($_ITEM, ' . $objFormProduct->Id . '); ?>', 'HtmlEntities=false'));
}
}
if ($this->objSignupForm->CountFormProducts()) {
$this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->AmountPaid, 'Name=Paid', 'Html=<?= $_FORM->RenderAmount($_ITEM->AmountPaid); ?>');
$this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->AmountBalance, 'Name=Balance', 'Html=<?= $_FORM->RenderAmount($_ITEM->AmountBalance); ?>');
$this->dtgSignupEntries->AddColumn(new QDataGridColumn('Payment Type', '<?= $_FORM->RenderPaymentType($_ITEM); ?>', 'HtmlEntities=false'));
}
$this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->DateSubmitted, 'Name=Submitted', 'Html=<?= $_ITEM->DateSubmitted ? $_ITEM->DateSubmitted->ToString("MMM D YYYY") : null; ?>');
}
示例8: ResolveContentItem
/**
* Used internally by the Meta-based Add Column tools.
*
* Given a QQNode or a Text String, this will return a FormQuestion-based QQNode.
* It will also verify that it is a proper FormQuestion-based QQNode, and will throw an exception otherwise.
*
* @param mixed $mixContent
* @return QQNode
*/
protected function ResolveContentItem($mixContent)
{
if ($mixContent instanceof QQNode) {
if (!$mixContent->_ParentNode) {
throw new QCallerException('Content QQNode cannot be a Top Level Node');
}
if ($mixContent->_RootTableName == 'form_question') {
if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
}
$objCurrentNode = $mixContent;
while ($objCurrentNode = $objCurrentNode->_ParentNode) {
if (!$objCurrentNode instanceof QQNode) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
}
if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
}
}
return $mixContent;
} else {
throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "form_question".');
}
} else {
if (is_string($mixContent)) {
switch ($mixContent) {
case 'Id':
return QQN::FormQuestion()->Id;
case 'SignupFormId':
return QQN::FormQuestion()->SignupFormId;
case 'SignupForm':
return QQN::FormQuestion()->SignupForm;
case 'OrderNumber':
return QQN::FormQuestion()->OrderNumber;
case 'FormQuestionTypeId':
return QQN::FormQuestion()->FormQuestionTypeId;
case 'ShortDescription':
return QQN::FormQuestion()->ShortDescription;
case 'Question':
return QQN::FormQuestion()->Question;
case 'RequiredFlag':
return QQN::FormQuestion()->RequiredFlag;
case 'InternalFlag':
return QQN::FormQuestion()->InternalFlag;
case 'Options':
return QQN::FormQuestion()->Options;
case 'AllowOtherFlag':
return QQN::FormQuestion()->AllowOtherFlag;
case 'ViewFlag':
return QQN::FormQuestion()->ViewFlag;
default:
throw new QCallerException('Simple Property not found in FormQuestionDataGrid content: ' . $mixContent);
}
} else {
if ($mixContent instanceof QQAssociationNode) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
} else {
throw new QCallerException('Invalid Content type');
}
}
}
}