function result() { $surveyID = $this->attribute('survey_id'); $survey = eZSurvey::fetch($surveyID); $contentObjectID = $survey->attribute('contentobject_id'); $contentClassAttributeID = $survey->attribute('contentclassattribute_id'); $languageCode = $survey->attribute('language_code'); $result = eZSurveyEntry::fetchResult($this, $contentObjectID, $contentClassAttributeID, $languageCode, false, 5); return $result['result']; }
private function addSenderEmailsFromQuestions(&$emailList) { if (($survey = $this->survey($this->SurveyID)) === false) { $survey = eZSurvey::fetch($this->SurveyID); } if ($survey instanceof eZSurvey) { $questionList = $survey->fetchQuestionList(); foreach ($questionList as $question) { $id = $question->attribute('original_id'); $key = $this->questionKeyValue($question); switch ($question->attribute('type')) { case 'EmailEntry': $value = $question->attribute('text'); $emailList[$key] = "{$value} ({$id})"; break; } } } }
function eZSurveyRelatedObject($row = false) { $row['type'] = 'RelatedObject'; $this->eZSurveyQuestion($row); $surveyID = $this->attribute('survey_id'); $survey = eZSurvey::fetch($surveyID); $contentObjectID = $survey->attribute('contentobject_id'); $postRelatedObject = 'SelectedNodeIDArray'; $http = eZHTTPTool::instance(); if ($http->hasPostVariable($postRelatedObject)) { // need to do an extra check if this is the datatype that should receive the information. $value = $http->postVariable($postRelatedObject); } $http = eZHTTPTool::instance(); $module = $GLOBALS['module']; // $http->removeSessionVariable( 'LastAccessesURI' ); // $http->removeSessionVariable( 'RedirectURIAfterPublish' ); // $http->removeSessionVariable( 'RedirectIfDiscarded' ); if ($module->exitStatus() !== eZModule::STATUS_REDIRECT) { if ($http->hasSessionVariable('LastAccessesURI_Backup_' . $contentObjectID . '_' . $this->ID) and $http->sessionVariable('LastAccessesURI_Backup_' . $contentObjectID . '_' . $this->ID) !== null) { $value = $http->sessionVariable('LastAccessesURI_Backup_' . $contentObjectID . '_' . $this->ID); $http->setSessionVariable('LastAccessesURI', $value['content']); $http->removeSessionVariable('LastAccessesURI_Backup_' . $contentObjectID . '_' . $this->ID); if (is_numeric($this->Num) and $this->Num > 0) { $contentObjectExists = eZContentObject::exists($this->Num); if ($contentObjectExists !== true) { $this->Num = 0; $this->store(); } } } if ($http->hasSessionVariable('RedirectURIAfterPublish_Backup_' . $contentObjectID . '_' . $this->ID) and $http->sessionVariable('RedirectURIAfterPublish_Backup_' . $contentObjectID . '_' . $this->ID) !== null) { $value = $http->sessionVariable('RedirectURIAfterPublish_Backup_' . $contentObjectID . '_' . $this->ID); $http->setSessionVariable('RedirectURIAfterPublish', $value['content']); $http->removeSessionVariable('RedirectURIAfterPublish_Backup_' . $contentObjectID . '_' . $this->ID); } if ($http->hasSessionVariable('RedirectIfDiscarded_Backup_' . $contentObjectID . '_' . $this->ID) and $http->sessionVariable('RedirectIfDiscarded_Backup_' . $contentObjectID . '_' . $this->ID) !== null) { $value = $http->sessionVariable('RedirectIfDiscarded_Backup_' . $contentObjectID . '_' . $this->ID); $http->setSessionVariable('RedirectIfDiscarded', $value['content']); $http->removeSessionVariable('RedirectIfDiscarded_Backup_' . $contentObjectID . '_' . $this->ID); } } }
private function fetchFeedbackSurvey() { if (($survey = $this->survey($this->SurveyID)) === false) { $survey = eZSurvey::fetch($this->SurveyID); } return $survey; }
// THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE. // // 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 preview.php */ $http = eZHTTPTool::instance(); $Module = $Params['Module']; $surveyID = $Params['SurveyID']; $survey = eZSurvey::fetch($surveyID); if (!$survey) { return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } $res = eZTemplateDesignResource::instance(); $res->setKeys(array(array('survey', $surveyID))); $tpl = eZTemplate::factory(); $tpl->setVariable('preview', true); $tpl->setVariable('survey', $survey); $Result = array(); $Result['content'] = $tpl->fetch('design:survey/view.tpl'); $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('survey', 'Survey Preview')));
function fetchSurveyByID($surveyID, $functionName = 'fetchSurveyByID') { $survey = false; if (is_numeric($surveyID) and $surveyID > 0) { $survey = eZSurvey::fetch($surveyID); if (!is_object($survey)) { eZDebug::writeWarning("Survey is not valid: " . var_export($survey, true), 'eZSurveyType::' . $functionName); } } else { eZDebug::writeWarning("Survey id is not numeric or above 0: " . var_export($surveyID, true), 'eZSurveyType::' . $functionName); } return $survey; }
static function fetchByObjectInfo($contentObjectID, $contentClassAttributeID, $languageCode) { $db = eZDB::instance(); $contentObjectID = $db->escapeString($contentObjectID); $contentObjectAttributeID = $db->escapeString($contentClassAttributeID); $languageCode = $db->escapeString($languageCode); $query = "SELECT ezsurvey.id as id FROM\n ezsurvey, ezcontentobject, ezcontentobject_attribute WHERE\n ezsurvey.id=ezcontentobject_attribute.data_int AND\n ezcontentobject_attribute.data_type_string='ezsurvey' AND\n ezcontentobject_attribute.version=ezsurvey.contentobjectattribute_version AND\n ezcontentobject.id=ezcontentobject_attribute.contentobject_id AND\n ezcontentobject.current_version=ezcontentobject_attribute.version AND\n ezsurvey.contentobject_id='" . $contentObjectID . "' AND\n ezsurvey.contentclassattribute_id='" . $contentClassAttributeID . "' AND\n ezsurvey.language_code='" . $languageCode . "'"; $rows = $db->arrayQuery($query); $survey = false; if (count($rows) > 0) { $survey = eZSurvey::fetch($rows[0]['id']); } return $survey; }
function storeResult($params) { $this->setAttribute('tstamp', time()); $this->store(); $object = new eZSurveyMetaData(array('result_id' => $this->ID)); if ($this->MetaData !== null) { foreach (array_keys($this->MetaData) as $key) { $object->setAttribute('attr_name', $key); $object->setAttribute('attr_value', $this->MetaData[$key]); $object->store(); $object->setAttribute('id', null); } } else { // to have stored result_id in ezsuveymetadata table too $object->setAttribute('attr_name', ''); $object->setAttribute('attr_value', ''); $object->store(); } $survey = eZSurvey::fetch($this->attribute('survey_id')); $survey->storeResult($this->ID, $params); }
protected function surveyContentObject($surveyID) { if (!isset(self::$contentObject[$surveyID])) { $survey = eZSurvey::fetch($this->SurveyID); $survey = $this->survey(); if ($survey instanceof eZSurvey and $object = eZContentObject::fetch($survey->attribute('contentobject_id')) and $object instanceof eZContentObject) { self::$contentObject[$surveyID] = $object; } else { return false; } } return self::$contentObject[$surveyID]; }
// 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 result_list.php */ $http = eZHTTPTool::instance(); $Module = $Params['Module']; $resultID = $Params['ResultID']; $surveyResult = eZSurveyResult::fetch($resultID); if (!$surveyResult) { return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } $survey = eZSurvey::fetch($surveyResult->attribute('survey_id')); if (!$survey) { return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } $validation = array(); $contentObjectID = $survey->attribute('contentobject_id'); $contentObjectAttributeID = $survey->attribute('contentobjectattribute_id'); $contentClassAttributeID = $survey->attribute('contentclassattribute_id'); $languageCode = $survey->attribute('language_code'); $params = array('prefix_attribute' => eZSurveyType::PREFIX_ATTRIBUTE, 'contentobjectattribute_id' => $contentObjectAttributeID); $survey->processViewActions($validation, $params); if ($http->hasPostVariable('SurveyStoreButton') && $validation['error'] == false) { $result = eZSurveyResult::instance($surveyResult->attribute('survey_id'), $surveyResult->attribute('user_id')); $result->storeResult($params); $Module->redirectTo('/survey/result_list/' . $contentObjectID . '/' . $contentClassAttributeID . '/' . $languageCode); } else {