Get all the surveys that belongs to the api key's owner.

 @return [Array<QuestionproRails::Survey>] Surveys.
486992
def list_surveys
      url = ApiRequest.base_path("questionpro.survey.getAllSurveys")
      result = self.class.get(url, body: self.options)
      
      self.full_response = result
      self.status = result['status']
      
      surveys = []
      result_surveys = result['response']['surveys']
      result_surveys.each do |survey|
        surveys.push(Survey.new(survey))
      end     

      return surveys
    end
683390
public function toSurveyAction()
    {
        if (! $this->_initToken()) {
            // Default option
            $this->_forward('index');
            return;
        }

        $language = $this->locale->getLanguage();

        try {
            $url  = $this->token->getUrl(
                    $language,
                    $this->currentUser->getUserId() ? $this->currentUser->getUserId() : $this->token->getRespondentId()
                    );

            /************************
             * Optional user logout *
             ************************/
            if ($this->currentUser->isLogoutOnSurvey()) {
                $this->currentUser->unsetAsCurrentUser();
            }

            // Redirect at once
            header('Location: ' . $url);
            exit();

        } catch (\Gems_Tracker_Source_SurveyNotFoundException $e) {
            $this->addMessage(sprintf(
                    $this->_('The survey for token %s is no longer active.'),
                    strtoupper($this->tokenId)
                    ));

            // Default option
            $this->_forward('index');
        }
    }
936198
def unique_question_codes
      codes = @survey.versions.map(&:question_codes).flatten.uniq
      codes.map do |code|
        session_fields.include?(code) ? "answer_#{code}" : code
      end
    end
1364831
public function inSource()
    {
        if ($this->exists) {
            $survey = $this->getSurvey();

            return $survey->inSource($this);
        } else {
            return false;
        }
    }
97018
def todolists
      active_response = Logan::Client.get "/projects/#{@id}/todolists.json"
      lists_array = active_response.parsed_response.map do |h|
        Logan::TodoList.new h.merge({ :project_id => @id })
      end
    end
877599
def SurveyOptions(self):
        
        list_of_measures = []
        if self.et.find("SurveyOptions") is None:
            return list_of_measures
        return self._get_measures(self.et.find("SurveyOptions"))
1193489
def get_surveys(self):
        
        payload = { 
            'Request': 'getSurveys',
            'Format': 'JSON'
            }
        r = self._session.get(QUALTRICS_URL, params=payload)
        output = r.json()
        return output['Result']['Surveys']
571970
public function getAll(): array
    {
        return $this->getApi()->request($this->getApi()
                                             ->sprintf('/repos/:owner/:repo/git/refs', $this->getGitData()->getOwner(),
                                                 $this->getGitData()->getRepo()));
    }
819849
def owners(self):
        ''''''
        return [o.strip() for o in self.owner.split(self.OWNER_ID_SEPARATOR)]
507808
public function checkRegistryRequestsAnswers()
    {
        if ($this->db && (! $this->_gemsSurvey)) {
            $result = $this->db->fetchRow("SELECT * FROM gems__surveys WHERE gsu_id_survey = ?", $this->_surveyId);
            if ($result) {
                $this->_gemsSurvey = $result;
                $this->exists = true;
            } else {
                //Row not present, try with empty array? or should we throw an error?
                $this->_gemsSurvey = array(
                    'gsu_code'             => null,
                    'gsu_valid_for_length' => 6,
                    'gsu_valid_for_unit'   => 'M',
                    );
                $this->exists = false;
            }
        }

        return (boolean) $this->_gemsSurvey;
    }
1158084
public static function get_surveys_by_courses($courseids = array()) {
        global $CFG, $USER, $DB;

        $returnedsurveys = array();
        $warnings = array();

        $params = self::validate_parameters(self::get_surveys_by_courses_parameters(), array('courseids' => $courseids));

        $mycourses = array();
        if (empty($params['courseids'])) {
            $mycourses = enrol_get_my_courses();
            $params['courseids'] = array_keys($mycourses);
        }

        // Ensure there are courseids to loop through.
        if (!empty($params['courseids'])) {

            list($courses, $warnings) = external_util::validate_courses($params['courseids'], $mycourses);

            // Get the surveys in this course, this function checks users visibility permissions.
            // We can avoid then additional validate_context calls.
            $surveys = get_all_instances_in_courses("survey", $courses);
            foreach ($surveys as $survey) {
                $context = context_module::instance($survey->coursemodule);
                // Entry to return.
                $surveydetails = array();
                // First, we return information that any user can see in the web interface.
                $surveydetails['id'] = $survey->id;
                $surveydetails['coursemodule']      = $survey->coursemodule;
                $surveydetails['course']            = $survey->course;
                $surveydetails['name']              = external_format_string($survey->name, $context->id);

                if (has_capability('mod/survey:participate', $context)) {
                    $trimmedintro = trim($survey->intro);
                    if (empty($trimmedintro)) {
                        $tempo = $DB->get_field("survey", "intro", array("id" => $survey->template));
                        $survey->intro = get_string($tempo, "survey");
                    }

                    // Format intro.
                    list($surveydetails['intro'], $surveydetails['introformat']) =
                        external_format_text($survey->intro, $survey->introformat, $context->id, 'mod_survey', 'intro', null);
                    $surveydetails['introfiles'] = external_util::get_area_files($context->id, 'mod_survey', 'intro', false,
                                                                                    false);

                    $surveydetails['template']  = $survey->template;
                    $surveydetails['days']      = $survey->days;
                    $surveydetails['questions'] = $survey->questions;
                    $surveydetails['surveydone'] = survey_already_done($survey->id, $USER->id) ? 1 : 0;

                }

                if (has_capability('moodle/course:manageactivities', $context)) {
                    $surveydetails['timecreated']   = $survey->timecreated;
                    $surveydetails['timemodified']  = $survey->timemodified;
                    $surveydetails['section']       = $survey->section;
                    $surveydetails['visible']       = $survey->visible;
                    $surveydetails['groupmode']     = $survey->groupmode;
                    $surveydetails['groupingid']    = $survey->groupingid;
                }
                $returnedsurveys[] = $surveydetails;
            }
        }
        $result = array();
        $result['surveys'] = $returnedsurveys;
        $result['warnings'] = $warnings;
        return $result;
    }
1019261
protected function loadSurvey()
    {
        if (! $this->surveyList) {
            $this->addMessageInvalid($this->_('Survey insertion impossible: no insertable survey exists!'));
        }
        if (count($this->surveyList) === 1) {
            $model = $this->getModel();
            $model->set('gto_id_survey', 'elementClass', 'Exhibitor');

            reset($this->surveyList);
            $this->formData['gto_id_survey'] = key($this->surveyList);
        }

        if (isset($this->formData['gto_id_survey'])) {
            $this->survey = $this->tracker->getSurvey($this->formData['gto_id_survey']);

            $groupId = $this->survey->getGroupId();
            $groups  = $this->util->getDbLookup()->getGroups();
            if (isset($groups[$groupId])) {
                $this->formData['ggp_name'] = $groups[$groupId];
            }

            $this->formData['gto_valid_until'] = $this->survey->getInsertDateUntil($this->formData['gto_valid_from']);
        }
    }
1187698
public Stream<LsQuestionGroup> getGroups(int surveyId) throws LimesurveyRCException {
        JsonElement result = callRC(new LsApiBody("list_groups", getParamsWithKey(surveyId)));
        List<LsQuestionGroup> questionGroups = gson.fromJson(result, new TypeToken<List<LsQuestionGroup>>() {
        }.getType());

        return questionGroups.stream().sorted(Comparator.comparing(LsQuestionGroup::getOrder));
    }
15171
public static function get_all() {
        $states = array();
        $us = new ReflectionClass('question_state');
        foreach ($us->getStaticProperties() as $name => $notused) {
            $states[] = self::$$name;
        }
        return $states;
    }
1317955
def get_objects(method, key)
      self.class.get("/#{method}", query: { token: @token }).tap do |response|
        raise "error retrieving #{key} from #{method}: #{response.fetch('error', 'unknown error')}" unless response['ok']
      end.fetch(key)
    end
41963
def get_all_parents(self):
        
        ownership = Ownership.objects.filter(child=self)
        parents = Company.objects.filter(parent__in=ownership)
        for parent in parents:
            parents = parents | parent.get_all_parents()
        return parents
1234794
def list(self):
        
        
        uri = URITemplate(self.baseuri + '/{owner}').expand(
            owner=self.username)
        return self.session.get(uri)