updateSurveyPage - Updates a survey page

@param int $surveyId - The survey to get the page from
@param int $pageId - The page to update
@param array $data - See API docs for available fields

@return @see Client::sendRequest
322394
public function updateSurveyPage($surveyId, $pageId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PATCH', sprintf('surveys/%d/pages/%d', $surveyId, $pageId), [], $data)
		);
	}
207934
protected function updatePage($page_id)
    {
        if (!$this->isError() && !$this->page->update($page_id, $this->getSubmitted())) {
            $this->errorAndExit($this->text('Unexpected result'));
        }
    }
1201340
public function update(PageRequest $request, Page $page)
    {
        $page->update($request->all());
        return new PageResource($page);
    }
508188
public function update($id, $data)
    {
        $this->mangleCidrNotation($id);

        $response = Request::put("{$this->uri}/$id")
            ->authenticateWith($this->username, $this->password)
            ->body(json_encode($data))
            ->sendsType('application/json')
            ->send();

        return $this->processResponse($response);
    }
86575
public function execute($trackId = null, $surveyId = null)
    {
        $batch = $this->getBatch();
        $select = $this->db->select();

        $select->from('gems__surveys', array('gsu_export_code', 'gsu_survey_name', 'gsu_survey_description', 'gsu_surveyor_id'))
                ->where('gsu_id_survey = ?', $surveyId);
        // \MUtil_Echo::track($select->__toString(), $roundId);

        $data = $this->db->fetchRow($select);
        // \MUtil_Echo::track($data);

        if ($data && isset($data['gsu_export_code']) && $data['gsu_export_code']) {
            $count = $batch->addToCounter('surveys_exported');

            if ($count == 1) {
                $this->exportTypeHeader('surveys');
                $this->exportFieldHeaders($data);
            }
            $this->exportFieldData($data);
            $this->exportFlush();

            $batch->setMessage('survey_export', sprintf(
                    $this->plural('%d survey code exported', '%d survey codes exported', $count),
                    $count
                    ));
        }
    }
735998
public function update($id, $data)
    {
        $response = $this->restClient->put($this->endpoint . '/' . $id, $data);

        return $response['body'];
    }
630908
public function getSurveyResponse($surveyId, $responseId, $detailed = false, array $filters = [])
	{
		if ($detailed) {
			return $this->sendRequest(
				$this->createRequest('GET', sprintf('surveys/%s/responses/%s/details', $surveyId, $responseId), [ 
					'query' => $filters 
				])
			);
		} else {
			return $this->sendRequest(
				$this->createRequest('GET', sprintf('surveys/%s/responses/%s', $surveyId, $responseId), [ 
					'query' => $filters 
				])
			);
		}
	}
1297056
private function _updateSurvey(array $values, $userId)
    {
        if ($this->tracker->filterChangesOnly($this->_gemsSurvey, $values)) {

            if (\Gems_Tracker::$verbose) {
                $echo = '';
                foreach ($values as $key => $val) {
                    $old = isset($this->_gemsSurvey[$key]) ? $this->_gemsSurvey[$key] : null;
                    $echo .= $key . ': ' . $old . ' => ' . $val . "\n";
                }
                \MUtil_Echo::r($echo, 'Updated values for ' . $this->_surveyId);
            }

            if (! isset($values['gsu_changed'])) {
                $values['gsu_changed'] = new \MUtil_Db_Expr_CurrentTimestamp();
            }
            if (! isset($values['gsu_changed_by'])) {
                $values['gsu_changed_by'] = $userId;
            }

            if ($this->exists) {
                // Update values in this object
                $this->_gemsSurvey = $values + $this->_gemsSurvey;

                // return 1;
                return $this->db->update('gems__surveys', $values, array('gsu_id_survey = ?' => $this->_surveyId));

            } else {
                if (! isset($values['gsu_created'])) {
                    $values['gsu_created'] = new \MUtil_Db_Expr_CurrentTimestamp();
                }
                if (! isset($values['gsu_created_by'])) {
                    $values['gsu_created_by'] = $userId;
                }

                // Update values in this object
                $this->_gemsSurvey = $values + $this->_gemsSurvey;

                // Remove the Gems survey id
                unset($this->_gemsSurvey['gsu_id_survey']);

                $this->_surveyId = $this->db->insert('gems__surveys', $this->_gemsSurvey);
                $this->_gemsSurvey['gsu_id_survey'] = $this->_surveyId;
                $this->exists = true;

                return 1;
            }

        } else {
            return 0;
        }
    }
661736
public function createSurveyFromExisting($surveyId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('POST', 'surveys', [], array_merge($data, [ 'from_survey_id' => $surveyId ]))
		);
	}
778793
public function deleteSurveyPage($surveyId, $pageId)
	{
		return $this->sendRequest(
			$this->createRequest('DELETE', sprintf('surveys/%d/pages/%d', $surveyId, $pageId))
		);
	}
571008
public function replaceSurvey($surveyId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PUT', sprintf('surveys/%d', $surveyId), [], $data)
		);
	}
599869
public static function view_survey($surveyid) {
        global $DB, $USER;

        $params = self::validate_parameters(self::view_survey_parameters(),
                                            array(
                                                'surveyid' => $surveyid
                                            ));
        $warnings = array();

        // Request and permission validation.
        $survey = $DB->get_record('survey', array('id' => $params['surveyid']), '*', MUST_EXIST);
        list($course, $cm) = get_course_and_cm_from_instance($survey, 'survey');

        $context = context_module::instance($cm->id);
        self::validate_context($context);
        require_capability('mod/survey:participate', $context);

        $viewed = survey_already_done($survey->id, $USER->id) ? 'graph' : 'form';

        // Trigger course_module_viewed event and completion.
        survey_view($survey, $course, $cm, $context, $viewed);

        $result = array();
        $result['status'] = true;
        $result['warnings'] = $warnings;
        return $result;
    }
63367
public function update($id, $data)
    {
        $response = $this->handler->handle('PUT', $data);

        return $this->make($response, false);
    }
64301
public function update($id, $data)
    {
        $routeMatch = $this->getEvent()->getRouteMatch();
        $mode = $routeMatch->getParam('mode', false);
        $type = $routeMatch->getParam('type', false);
        $endpoint = $routeMatch->getParam('endpoint', false);
        $annee = $routeMatch->getParam('annee', 0);
        
        $processStateHandler = $this->getProcessStateHandler();
        $process = $processStateHandler->getProcess($mode, $type, $endpoint, $annee);
        
        if (is_null($process)) {
            $process = $processStateHandler->getDefaultProcess($mode, $type, $endpoint, $annee);
            $processStateHandler->saveProcess($process);
        }
        if (array_key_exists('force-execution-stop', $data)) {
            $process->setInterrupted(true);
        } else {
            $active = array_key_exists('active', $data) && $data['active'] === 'true';
            $process->setActive($active);
            $shedule = $data['shedule'] === 'true' && $data['active'] === 'true';
            $process->setShedule($shedule);
            $process->setCron($shedule ? $data['cron'] : null);
        }
        
        $processStateHandler->saveProcess($process);
        $response = $this->getResponse();
        $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
        $serializer = $this->getSerializer();
        $processJson = $serializer->serialize($process, 'json');
        $response->setContent($processJson);
        return $response;
    }
917518
protected function setPage($page_id)
    {
        $this->data_page = array();

        if (is_numeric($page_id)) {

            $conditions = array(
                'language' => 'und',
                'page_id' => $page_id
            );

            $this->data_page = $this->page->get($conditions);

            if (empty($this->data_page)) {
                $this->outputHttpStatus(404);
            }

            $this->preparePage($this->data_page);
        }
    }
194127
public function update($id, array $data)
    {
        $project = $this->client->put(sprintf('projects/%d.json', $id), [
            'json' => $data,
        ]);

        return new Project($this->response($project));
    }
344867
public function create($data, $checkoutPageId = null)
    {
        if (isset($checkoutPageId)) {
            return $this->client()->put($data, 'checkout-pages/{checkoutPageId}', ['checkoutPageId' => $checkoutPageId]);
        }

        return $this->client()->post($data, 'checkout-pages');
    }