getSurveyPages - Gets all pages for a given survey

@param int $surveyId - The survey to get the pages from
@param array $filters - Available filters: page, per_page

@return @see Client::sendRequest
330852
public function getSurveyPages($surveyId, array $filters = [])
	{
		return $this->sendRequest(
			$this->createRequest('GET', sprintf('surveys/%d/pages', $surveyId), [ 
				'query' => $filters 
			])
		);
	}
1922
public function checkSurvey($sourceSurveyId, $surveyId, $userId)
    {
        $changed     = 0;
        $created     = false;
        $deleted     = false;
        $deletedFile = false;
        $survey      = $this->tracker->getSurvey($surveyId);

        // Get OpenRosa data
        if ($sourceSurveyId) {
            // Surveys in OpenRose
            $db = $this->getSourceDatabase();

            $select = $db->select();
            $select->from('gems__openrosaforms')
                    ->where('gof_id = ?', $sourceSurveyId);

            $openRosaSurvey = $db->fetchRow($select);
        } else {
            $openRosaSurvey = false;
        }

        if ($openRosaSurvey) {
            // Exists
            $values['gsu_survey_name']     = sprintf(
                    '%s [%s]',
                    $openRosaSurvey['gof_form_title'],
                    $openRosaSurvey['gof_form_version']
                    );
            $values['gsu_status']          = 'OK';
            $values['gsu_surveyor_active'] = $openRosaSurvey['gof_form_active'];

            if (!$surveyId) {
                // New
                $values['gsu_active']      = 0;
                $values['gsu_id_source']   = $this->getId();
                $values['gsu_surveyor_id'] = $sourceSurveyId;
                $created = true;
            }

            if (!$this->sourceFileExists($openRosaSurvey['gof_form_xml'])) {
                // No longer exists
                $values['gsu_surveyor_active'] = 0;
                $values['gsu_status']          = 'Survey form XML was removed from directory.';
                $deletedFile = true;
            }


        } else {
            // No longer exists
            $values['gsu_surveyor_active'] = 0;
            $values['gsu_status']          = 'Survey was removed from source.';

            $deleted = true;
        }

        $changed = $survey->saveSurvey($values, $userId);

        if (! $changed) {
            return;
        }

        if ($deleted) {
            $message = $this->_('The \'%s\' survey is no longer active. The survey was removed from OpenRosa!');

        } elseif ($deletedFile) {
            $message = $this->_('The \'%s\' survey is no longer active. The survey XML file was removed from its directory!');

        } elseif ($created) {
            $message = $this->_('Imported the \'%s\' survey.');

        } else {
            $message = $this->_('Updated the \'%s\' survey.');
        }

        return sprintf($message, $survey->getName());;
    }
416339
public function getQuestionList($language, $surveyId, $sourceSurveyId = null)
    {
        $survey = $this->getSurvey($surveyId, $sourceSurveyId);
        $model  = $survey->getModel();
        $result = [];

        foreach($model->getItemsOrdered() as $name) {
            if ($label = $model->get($name, 'label')) {
                $result[$name] = $label;
            }
        }

        if ($model->getMeta('nested', false)) {
            foreach ($model->getMeta('nestedNames') as $name) {
                // We have a nested model, add the nested questions
                $nestedModel = $model->get($name, 'model');
                foreach($nestedModel->getItemsOrdered() as $name) {
                    if ($label = $nestedModel->get($name, 'label')) {
                        $result[$name] = $label;
                    }
                }
            }
        }

        return $result;
    }
750884
public function actionGetAllUrls(array $criteria = [], $siteId = null): Response
    {
        return $this->asJson(RouteMap::$plugin->routes->getAllUrls($criteria, $siteId));
    }
730602
public function deleteSurveyResponse($surveyId, $responseId)
	{
		return $this->sendRequest(
			$this->createRequest('DELETE', sprintf('surveys/%s/responses/%s', $surveyId, $responseId))
		);
	}
866428
public function listSurveys($optParams = array())
  {
    $params = array();
    $params = array_merge($params, $optParams);
    return $this->call('list', array($params), "Google_Service_Surveys_SurveysListResponse");
  }
949930
public function getCollectorMessages($collectorId, array $filters = [])
	{
		return $this->sendRequest(
			$this->createRequest('GET', sprintf('collectors/%s/messages', $collectorId), [
				'query' => $filters
			])
		);
	}
579270
public function getCollectionPages($collectionId)
    {
        $pageMapper = ($this->container->dataMapper)('PageMapper');

        // Page Collection
        $data = $pageMapper->findCollectionPagesById($collectionId);

        return $data;
    }
1109527
public function analyzeSurveyQuestions($benchmarkBundleId, array $questionids, array $filters = [])
	{
		return $this->sendRequest(
			$this->createRequest('GET', sprintf('benchmark_bundles/%d/analyze', $benchmarkBundleId). [
				'query' => array_merge($filters, [
					'question_ids' => implode(',', $questionIds)
				])
			])
		);
	}
235981
public function echoPdfBySurveyId($surveyId)
    {
        $pdf = $this->getSurveyPdf($surveyId);

        $this->echoPdf($pdf, $surveyId . '.pdf');
    }
156417
public function getPageSuggestions($pageID, $limit = 0, $approved = true) {

		// Make sure the current user has appropriate permission.

		$pageID = (int)$pageID;
		if(($page = ExtensibleSearchPage::get_by_id(ExtensibleSearchPage::class, $pageID)) && $page->canView()) {

			// Retrieve the search suggestions.

			$suggestions = ExtensibleSearchSuggestion::get()->filter(array(
				'Approved' => (int)$approved,
				'ExtensibleSearchPageID' => $pageID
			))->sort('Frequency', 'DESC');
			if($limit) {
				$suggestions = $suggestions->limit($limit);
			}

			// Make sure the search suggestions are unique.

			return $suggestions->column('Term');
		}
		return array();
	}
254998
public function getSurveysFor($organizationId)
    {
        if ($organizationId !== null) {
            $where = "AND EXISTS (SELECT 1 FROM gems__rounds
                INNER JOIN gems__tracks ON gro_id_track = gtr_id_track
                WHERE gro_id_survey = gsu_id_survey AND
                gtr_organizations LIKE '%|" . (int) $organizationId . "|%')";
        } else {
            $where = "";
        }

        $sql = "SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE gsu_active = 1 " .
            $where . " ORDER BY gsu_survey_name ASC";

        return $this->_getSelectPairsCached(__FUNCTION__. '_' . $organizationId, $sql, array(), 'surveys');
    }
1319831
public function execute($sourceId = null, $sourceSurveyId = null, $surveyId = null, $userId = null)
    {
        $batch    = $this->getBatch();
        $source   = $this->loader->getTracker()->getSource($sourceId);

        if (null === $userId) {
            $userId = $this->loader->getCurrentUser()->getUserId();
       }

        $messages = $source->checkSurvey($sourceSurveyId, $surveyId, $userId);

        $batch->addToCounter('checkedSurveys');
        $batch->addToCounter('changedSurveys', $messages ? 1 : 0);
        $batch->setMessage('changedSurveys', sprintf(
                $this->_('%d of %d surveys changed.'),
                $batch->getCounter('changedSurveys'),
                $batch->getCounter('checkedSurveys')));

        if ($messages) {
            foreach ((array) $messages as $message) {
                $batch->addMessage($message);
            }
        }
    }
166995
function getUsers(array $filters = array(), array $fields = array())
    {
        $params = array(1, $this->username, $this->password, $filters);
        if (!empty($fields)) {
            $params[] = $fields;
        }

        return $this->sendRequest('wp.getUsers', $params);
    }
571008
public function replaceSurvey($surveyId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PUT', sprintf('surveys/%d', $surveyId), [], $data)
		);
	}
132542
public function getSubCategoriesPager($categoryId, $page = 1, $limit = 25, $criteria = [])
    {
        $queryBuilder = $this->getObjectManager()->createQueryBuilder()
            ->select('c')
            ->from($this->class, 'c')
            ->where('c.parent = :categoryId')
            ->setParameter('categoryId', $categoryId);

        $pager = new Pager($limit);
        $pager->setQuery(new ProxyQuery($queryBuilder));
        $pager->setPage($page);
        $pager->init();

        return $pager;
    }
1360498
public function getRawTokenAnswerRowsCount(array $filter, $surveyId, $sourceSurveyId = null) {
        $select = $this->getRawTokenAnswerRowsSelect($filter, $surveyId, $sourceSurveyId);

        $p = new \Zend_Paginator_Adapter_DbSelect($select);
        $count = $p->getCountSelect()->query()->fetchColumn();

        return $count;
    }