$dataMap = $user->attribute('contentobject')->attribute('data_map'); if (isset($dataMap[$identifier])) { $value = $dataMap[$identifier]->attribute('content'); } } return $value; } private function userName() { $value = false; $user = eZUser::currentUser(); if (get_class($user) == 'eZUser' and $user->isLoggedIn() === true) { $contentObject = $user->attribute('contentobject'); if (get_class($contentObject) == 'eZContentObject') { $value = $contentObject->attribute('name'); } } return $value; } private function userEmail() { $value = false; $user = eZUser::currentUser(); if (get_class($user) == 'eZUser' and $user->isLoggedIn() === true) { $value = $user->attribute('email'); } return $value; } } eZSurveyQuestion::registerQuestionType(ezpI18n::tr('survey', 'Text Entry'), 'TextEntry');
$tpl_email = eZTemplate::factory(); $tpl_email->setVariable('intro', $this->Text2); $tpl_email->setVariable('survey', $survey); $tpl_email->setVariable('survey_questions', $surveyQuestions); $tpl_email->setVariable('survey_node', $node); $templateResult = $tpl_email->fetch('design:survey/feedbackfield_mail.tpl'); if (trim($this->Text3) != '') { $subject = $this->Text3; } else { $subject = $tpl_email->variable('subject'); } $mail = new eZMail(); $ini = eZINI::instance(); $emailSender = $ini->variable('MailSettings', 'EmailSender'); if (!$emailSender) { $emailSender = $ini->variable('MailSettings', 'AdminEmail'); } $mail->setSenderText($emailSender); $mail->setReceiver($mailTo); $mail->setSubject($subject); $mail->setBody($templateResult); if ($this->Num == 1) { $adminReceiver = $ini->variable('MailSettings', 'AdminEmail'); $mail->addBcc($adminReceiver); } $mailResult = eZMailTransport::send($mail); } } } eZSurveyQuestion::registerQuestionType(ezpI18n::tr('survey', 'Feedback field'), 'FeedbackField');
$http = eZHTTPTool::instance(); $prefix = eZSurveyType::PREFIX_ATTRIBUTE; $postSurveyAnswer = $prefix . '_ezsurvey_answer_' . $this->ID . '_' . $contentObjectAttributeID; $postSurveyExtraInfoAnswer = $prefix . '_ezsurvey_answer_' . $this->ID . '_extra_info_' . $contentObjectAttributeID; if ($http->hasPostVariable($postSurveyAnswer) and $http->hasPostVariable($postSurveyExtraInfoAnswer)) { $answer = $http->postvariable($postSurveyAnswer); if (is_array($answer) and in_array($this->ExtraInfo['extra_info']['value'], $answer)) { $surveyAnswer[$this->ExtraInfo['extra_info']['value']] = $http->postVariable($postSurveyExtraInfoAnswer); return $surveyAnswer; } if ($this->ExtraInfo['extra_info']['value'] == $answer) { $surveyAnswer[$answer] = $http->postVariable($postSurveyExtraInfoAnswer); return $surveyAnswer; } else { eZDebug::writeWarning('Answer: ' . $answer . ' and internal key: ' . $this->ExtraInfo['extra_info']['value'] . ' is not equal', 'eZSurveyMultipleChoice::extraInfoAnswer'); } } return $surveyAnswer; } function isSingleQuestion() { $type = $this->attribute('num'); return $type != 3 && $type != 4 ? true : false; } var $Options; var $OptionID = 0; var $ExtraInfo; var $ExtraInfoID = 0; } eZSurveyQuestion::registerQuestionType(ezpI18n::tr('survey', 'Single/Multiple Choice'), 'MultipleChoice');
if ($checked != $option['checked']) { $option['checked'] = $checked; $this->setHasDirtyData(true); } } // Need to store the attribute id for sorting in the callback function tabOrderCompare. $option['contentobjectattribute_id'] = $attributeID; } usort($this->Options, array($this, 'tabOrderCompare')); $this->reorderOptions(); $this->encodeXMLOptions(); } function questionNumberIterate(&$iterator) { if (count($this->Options) > 1) { $this->QuestionNumber = $iterator++; } } function answer() { if (count($this->Options) > 1) { return parent::answer(); } $arrayKeys = array_keys($this->Options); return $this->Options[$arrayKeys[0]]['value']; } var $Options; var $OptionID = 0; } eZSurveyQuestion::registerQuestionType(ezpI18n::tr('survey', 'Form Receiver'), 'Receiver', true);
$filePath = ''; $fileSize = 0; $fileLabel = ''; if (array_key_exists('info', $result)) { $fileName = $result['info']['basename']; $fileLabel = $result['label']; //normal or unique name $filePath = $this->uploadPath . $fileName; $surveyAnswer = $filePath; } if (array_key_exists('size', $result)) { $fileSize = $result['size']; } //Set file specific params $this->setAttribute('text2', $fileLabel); $this->setAttribute('num2', $fileSize); //set to value or zero $this->setAnswer($surveyAnswer); return $surveyAnswer; } //option 3) check for answer post $postSurveyAnswer = $prefix . '_ezsurvey_answer_' . $this->ID . '_' . $this->contentObjectAttributeID(); if ($http->hasPostVariable($postSurveyAnswer) && strlen($http->postVariable($postSurveyAnswer))) { $surveyAnswer = $http->postVariable($postSurveyAnswer); return $surveyAnswer; } return $this->Default; } } eZSurveyQuestion::registerQuestionType(ezpI18n::tr('survey', 'File'), 'File');
/*! This is a related object and should not require an answer. \return false */ function canAnswer() { return false; } /*! Iterate the number of the question. Since the related object do not have any input fields, The iterator should not be runned. */ function questionNumberIterate(&$iterator) { } function &cloneQuestion($surveyID, $resetOriginalID = false) { $num = $resetOriginalID === false ? $this->Num : 0; $row = array('id' => null, 'survey_id' => $surveyID, 'original_id' => $this->OriginalID, 'tab_order' => $this->TabOrder, 'type' => $this->Type, 'mandatory' => $this->Mandatory, 'default_value' => $this->Default, 'text' => $this->Text, 'text2' => $this->Text2, 'text3' => $this->Text3, 'num' => $num, 'num2' => $this->Num2); $classname = implode('', array('eZSurvey', $this->Type)); $cloned = new $classname($row); $cloned->store(); if ($resetOriginalID === true) { $cloned->setAttribute('original_id', $cloned->attribute('id')); $cloned->store(); } return $cloned; } } eZSurveyQuestion::registerQuestionType(ezpI18n::tr('survey', 'Related object'), 'RelatedObject');
// // The "eZ Publish professional licence" is available at // http://ez.no/products/licences/professional/. For pricing of this licence // please contact us via e-mail to licence@ez.no. Further contact // information is available at http://ez.no/home/contact/. // // The "GNU General Public License" (GPL) is available at // http://www.gnu.org/copyleft/gpl.html. // // Contact licence@ez.no if any conditions of this licencing isn't clear to // you. // /*! \file ezsurveyparagraph.php */ class eZSurveyParagraph extends eZSurveyQuestion { function eZSurveyParagraph($row = false) { $row['type'] = 'Paragraph'; $this->eZSurveyQuestion($row); } function canAnswer() { return false; } function questionNumberIterate(&$iterator) { } } eZSurveyQuestion::registerQuestionType(ezpI18n::tr('survey', 'Paragraph'), 'Paragraph');
$this->setAttribute('text', $domString); } if ($http->hasPostVariable('SurveyQuestion_' . $this->ID . '_Text2') && $http->postVariable('SurveyQuestion_' . $this->ID . '_Text2') != $this->Text2) { $this->setAttribute('text2', $http->postVariable('SurveyQuestion_' . $this->ID . '_Text2')); } if ($http->hasPostVariable('SurveyQuestion_' . $this->ID . '_Text3') && $http->postVariable('SurveyQuestion_' . $this->ID . '_Text3') != $this->Text3) { $this->setAttribute('text3', $http->postVariable('SurveyQuestion_' . $this->ID . '_Text3')); } if ($http->hasPostVariable('SurveyQuestion_' . $this->ID . '_Num') && $http->postVariable('SurveyQuestion_' . $this->ID . '_Num') != $this->Num) { $this->setAttribute('num', $http->postVariable('SurveyQuestion_' . $this->ID . '_Num')); } if ($http->hasPostVariable('SurveyQuestion_' . $this->ID . '_Num2') && $http->postVariable('SurveyQuestion_' . $this->ID . '_Num2') != $this->Num2) { $this->setAttribute('num2', $http->postVariable('SurveyQuestion_' . $this->ID . '_Num2')); } if ($http->hasPostVariable('SurveyQuestion_' . $this->ID . '_Mandatory_Hidden')) { if ($http->hasPostVariable('SurveyQuestion_' . $this->ID . '_Mandatory')) { $newMandatory = 1; } else { $newMandatory = 0; } if ($newMandatory != $this->Mandatory) { $this->setAttribute('mandatory', $newMandatory); } } if ($http->hasPostVariable('SurveyQuestion_' . $this->ID . '_Default') && $http->postVariable('SurveyQuestion_' . $this->ID . '_Default') != $this->Default) { $this->setAttribute('default_value', $http->postVariable('SurveyQuestion_' . $this->ID . '_Default')); } } } eZSurveyQuestion::registerQuestionType('Formatted Paragraph', 'FormattedParagraph');
// Contact licence@ez.no if any conditions of this licencing isn't clear to // you. // /*! \file ezsurveysectionheader.php */ class eZSurveySectionHeader extends eZSurveyQuestion { /*! Constructor of the survey. */ function eZSurveySectionHeader($row = false) { $row['type'] = 'SectionHeader'; $this->eZSurveyQuestion($row); } /*! This is a section and should not require an answer. */ function canAnswer() { return false; } /*! Iterate the number of the question. */ function questionNumberIterate(&$iterator) { } } eZSurveyQuestion::registerQuestionType(ezpI18n::tr('survey', 'Section Header'), 'SectionHeader');