deleteSurveyPageQuestion - Delete a survey page question

@param int $surveyId - The survey to get the page from
@param int $pageId - The page the question is on
@param int $questionId - The question to delete

@return @see Client::sendRequest
347605
public function deleteSurveyPageQuestion($surveyId, $pageId, $questionId)
	{
		return $this->sendRequest(
			$this->createRequest('DELETE', sprintf('surveys/%d/pages/%d/questions/%d', $surveyId, $pageId, $questionId))
		);	
	}
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;
    }
581393
public function removeAction($pageId)
    {
        $page = $this->getPage($pageId);
        if ($page->getSlug() == '')
        {
            throw new AccessDeniedException();
        }
        $request = $this->getRequest();
        if ($request->request->get('confirm') === 'yes')
        {
            if ($this->container->getParameter('fulgurio_light_cms.allow_recursive_page_delete') == FALSE
                    && $page->hasChildren())
            {
                $this->get('session')->getFlashBag()->add(
                        'error',
                        $this->get('translator')->trans('fulgurio.lightcms.pages.recursive_remove_not_allowed', array(), 'admin')
                );
                return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $pageId)));
            }
            $em = $this->getDoctrine()->getManager();

            $em->remove($page);
            $em->flush();
            $this->get('session')->getFlashBag()->add(
                    'success',
                    $this->get('translator')->trans('fulgurio.lightcms.pages.delete_success_message', array(), 'admin')
            );
            if ($page->getParentId())
            {
                return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $page->getParentId())));
            }
            return $this->redirect($this->generateUrl('AdminPages'));
        }
        else if ($request->request->get('confirm') === 'no')
        {
            return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $pageId)));
        }
        $templateName = $request->isXmlHttpRequest() ? 'FulgurioLightCMSBundle::adminConfirmAjax.html.twig' : 'FulgurioLightCMSBundle::adminConfirm.html.twig';
        return $this->render($templateName, array(
            'action' => $this->generateUrl('AdminPagesRemove', array('pageId' => $pageId)),
            'confirmationMessage' => $this->get('translator')->trans('fulgurio.lightcms.pages.delete_confirm_message', array('%title%' => $page->getTitle()), 'admin'),
        ));
    }
478324
public function create($appId, $scanId, $issueId, ReviewBuilder $input, array $queryParams = [])
    {
        $response = $this->api
            ->applications()
            ->scans()
            ->issues()
            ->reviews()
            ->create($appId, $scanId, $issueId, $input->toArray(), $queryParams);

        return new ReviewResponse($response);
    }
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);
            }
        }
    }
1262668
public function deleteGoal($id, $counterId)
    {
        $resource = 'counter/' . $counterId . '/goal/' . $id;
        $response = $this->sendDeleteRequest($resource);
        return $response;
    }
945562
public function deleteById($appId, $scanId, $libraryId, array $queryParams = [])
    {
        if (is_null($appId) || is_null($scanId) || is_null($libraryId)) {
            throw new LibException('appId, scanId, or libraryId is null');
        }

        $response = $this->client->delete($this->uri($appId, $scanId, $libraryId), [
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }
368071
public function checkSurvey($sourceSurveyId, $surveyId, $userId)
    {
        $messages = array();
        $survey   = $this->tracker->getSurvey($surveyId);

        if (null === $sourceSurveyId) {
            // Was removed
            $values['gsu_active'] = 0;
            $values['gsu_surveyor_active'] = 0;
            $values['gsu_status'] = 'Survey was removed from source.';

            if ($survey->saveSurvey($values, $userId)) {
                $messages[] = sprintf($this->_('The \'%s\' survey is no longer active. The survey was removed from LimeSurvey!'), $survey->getName());
            }
        } else {
            $lsDb = $this->getSourceDatabase();

            // SELECT sid, surveyls_title AS short_title, surveyls_description AS description, active, datestamp, ' . $this->_anonymizedField . '
            $select = $lsDb->select();
            // 'alloweditaftercompletion' ?
            $select->from($this->_getSurveysTableName(), array('active', 'datestamp', 'tokenanswerspersistence', $this->_anonymizedField))
                    ->joinInner(
                            $this->_getSurveyLanguagesTableName(),
                            'sid = surveyls_survey_id AND language = surveyls_language',
                            array('surveyls_title', 'surveyls_description'))
                    ->where('sid = ?', $sourceSurveyId);
            $lsSurvey = $lsDb->fetchRow($select);

            $surveyor_title = substr(\MUtil_Html::removeMarkup(html_entity_decode($lsSurvey['surveyls_title'])), 0, 100);
            $surveyor_description = substr(\MUtil_Html::removeMarkup(html_entity_decode($lsSurvey['surveyls_description'])), 0, 100);
            $surveyor_status = '';

            // ANONIMIZATION
            switch ($lsSurvey[$this->_anonymizedField]) {
                case 'Y':
                    $surveyor_status .= 'Uses anonymous answers. ';
                    break;
                case 'N':
                    break;
                default:
                    // This is for the case that $this->_anonymizedField is empty, we show an update statement.
                    // The answers already in the table can only be linked to the response based on the completion time
                    // this requires a manual action as token table only hold minuts while survey table holds seconds
                    // and we might have responses with the same timestamp.
                    $lsDb->query("UPDATE " . $this->_getSurveysTableName() . " SET `" . $this->_anonymizedField . "` = 'N' WHERE sid = ?;", $sourceSurveyId);
                    $messages[] = sprintf($this->_("Corrected anonymization for survey '%s'"), $surveyor_title);

                    $lsDb->query("ALTER TABLE " . $this->_getSurveyTableName($sourceSurveyId) . " ADD `token` varchar(36) default NULL;");
            }

            // DATESTAMP
            if ($lsSurvey['datestamp'] == 'N') {
                $surveyor_status .= 'Not date stamped. ';
            }

            // DATESTAMP
            if ($lsSurvey['tokenanswerspersistence'] == 'N') {
                $surveyor_status .= 'Token-based persistence is disabled. ';
            }

            // IS ACTIVE
            if ($lsSurvey['active'] == 'Y') {
                try {
                    $tokenTable = $lsDb->fetchAssoc('SHOW COLUMNS FROM ' . $this->_getTokenTableName($sourceSurveyId));
                } catch (\Zend_Exception $e) {
                    $tokenTable = false;
                }

                if ($tokenTable) {
                    $missingFields   = $this->_checkTokenTable($tokenTable);

                    if ($missingFields) {
                        $sql    = "ALTER TABLE " . $this->_getTokenTableName($sourceSurveyId) . " " . implode(', ', $missingFields);
                        $fields = implode($this->_(', '), array_keys($missingFields));
                        // \MUtil_Echo::track($missingFields, $sql);
                        try {
                            $lsDb->query($sql);
                            $messages[] = sprintf($this->_("Added to token table '%s' the field(s): %s"), $surveyor_title, $fields);
                        } catch (\Zend_Exception $e) {
                            $surveyor_status .= 'Token attributes could not be created. ';
                            $surveyor_status .= $e->getMessage() . ' ';

                            $messages[] = sprintf($this->_("Attribute fields not created for token table for '%s'"), $surveyor_title);
                            $messages[] = sprintf($this->_('Required fields: %s', $fields));
                            $messages[] = $e->getMessage();

                            // Maximum reporting for this case
                            \MUtil_Echo::r($missingFields, 'Missing fields for ' . $surveyor_title);
                            \MUtil_Echo::r($e);
                        }
                    }

                    if ($this->fixTokenAttributeDescriptions($sourceSurveyId)) {
                        $messages[] = sprintf($this->_("Updated token attribute descriptions for '%s'"), $surveyor_title);
                    }
                } else {
                    $surveyor_status .= 'No token table created. ';
                }


            } else {
                $surveyor_status .= 'Not active. ';
            }
            $surveyor_active = (0 === strlen($surveyor_status));

            // Update Gems
            $values = array();

            if ($survey->exists) {   // Update
                if ($survey->isActiveInSource() != $surveyor_active) {
                    $values['gsu_surveyor_active'] = $surveyor_active ? 1 : 0;

                    $messages[] = sprintf($this->_('The status of the \'%s\' survey has changed.'), $survey->getName());
                }

                // Reset to inactive if the surveyor survey has become inactive.
                if ($survey->isActive() && $surveyor_status) {
                    $values['gsu_active'] = 0;
                    $messages[] = sprintf($this->_('Survey \'%s\' IS NO LONGER ACTIVE!!!'), $survey->getName());
                }

                if (substr($surveyor_status,  0,  127) != (string) $survey->getStatus()) {
                    if ($surveyor_status) {
                        $values['gsu_status'] = substr($surveyor_status,  0,  127);
                        $messages[] = sprintf($this->_('The status of the \'%s\' survey has changed to \'%s\'.'), $survey->getName(), $values['gsu_status']);
                    } elseif ($survey->getStatus() != 'OK') {
                        $values['gsu_status'] = 'OK';
                        $messages[] = sprintf($this->_('The status warning for the \'%s\' survey was removed.'), $survey->getName());
                    }
                }

                if ($survey->getName() != $surveyor_title) {
                    $values['gsu_survey_name'] = $surveyor_title;
                    $messages[] = sprintf($this->_('The name of the \'%s\' survey has changed to \'%s\'.'), $survey->getName(), $surveyor_title);
                }

                if ($survey->getDescription() != $surveyor_description) {
                    $values['gsu_survey_description'] = $surveyor_description;
                    $messages[] = sprintf($this->_('The description of the \'%s\' survey has changed to \'%s\'.'), $survey->getName(), $surveyor_description);
                }

            } else { // New record
                $values['gsu_survey_name']        = $surveyor_title;
                $values['gsu_survey_description'] = $surveyor_description;
                $values['gsu_surveyor_active']    = $surveyor_active ? 1 : 0;
                $values['gsu_active']             = 0;
                $values['gsu_status']             = $surveyor_status ? $surveyor_status : 'OK';
                $values['gsu_surveyor_id']        = $sourceSurveyId;
                $values['gsu_id_source']          = $this->getId();

                $messages[] = sprintf($this->_('Imported the \'%s\' survey.'), $surveyor_title);
            }
            $survey->saveSurvey($values, $userId);

            // Check return url description
            $this->_checkReturnURI($sourceSurveyId, $survey, $messages);
        }

        return $messages;
    }
615608
protected function delete_files_in_hints($questionid, $contextid) {
        global $DB;
        $fs = get_file_storage();

        $hintids = $DB->get_records_menu('question_hints',
                array('questionid' => $questionid), 'id', 'id,1');
        foreach ($hintids as $hintid => $notused) {
            $fs->delete_area_files($contextid, 'question', 'hint', $hintid);
        }
    }
48496
public function createSurveyPage($surveyId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('POST', sprintf('surveys/%d/pages', $surveyId), [], $data)
		);
	}
730602
public function deleteSurveyResponse($surveyId, $responseId)
	{
		return $this->sendRequest(
			$this->createRequest('DELETE', sprintf('surveys/%s/responses/%s', $surveyId, $responseId))
		);
	}
901384
public function getAll($appId, $scanId, $issueId, array $queryParams = [])
    {
        $response = $this->api
            ->applications()
            ->scans()
            ->issues()
            ->reviews()
            ->getAll($appId, $scanId, $issueId, $queryParams);

        return new ReviewsResponse($response);
    }
1163992
def removePage(self, pageId):
        
        try:
            self._pages[pageId].deleteLater()
            del self._pages[pageId]
        except KeyError:
            pass
157802
public function getClosureByPageId($pageId)
    {
        return $queryBuilder = function (EntityRepository $er) use ($pageId) {
            $qb = $er->createQueryBuilder('p');
            $qb2 = $er->createQueryBuilder('p2');
            $qb->andWhere(
                $qb->expr()->in(
                    'p.locale',
                    $qb2->select('p2.locale')
                        ->where('p2.id = :id')->getDql()
                )
            );

            $qb->setParameter('id', $pageId);

            return $qb;
        };
    }
19866
public function getCollectorsForSurvey($surveyId, array $filters = [])
	{
		return $this->sendRequest(
			$this->createRequest('GET', sprintf('surveys/%s/collectors', $surveyId), [ 
				'query' => $filters 
			])
		);
	}
217633
protected function use_question($questionid) {
        if (isset($this->recentlyusedquestions[$questionid])) {
            $this->recentlyusedquestions[$questionid] += 1;
        } else {
            $this->recentlyusedquestions[$questionid] = 1;
        }

        foreach ($this->availablequestionscache as $categorykey => $questionsforcategory) {
            foreach ($questionsforcategory as $numuses => $questionids) {
                if (!isset($questionids[$questionid])) {
                    continue;
                }
                unset($this->availablequestionscache[$categorykey][$numuses][$questionid]);
                if (empty($this->availablequestionscache[$categorykey][$numuses])) {
                    unset($this->availablequestionscache[$categorykey][$numuses]);
                }
            }
        }
    }
776779
public function getSurveyName($surveyId) {
        $tracker = $this->loader->getTracker();
        $survey  = $tracker->getSurvey($surveyId);

        return $survey->getName();
    }