Get Search Data

@return bool|mixed
@throws \Exception
486280
public function getSearchData()
    {
        try {
            $q = $this->_request->getParam('q');
            if ($q != '') {
                return [
                    'term' => $q,
                ];
            }
        } catch (\Exception $e) {
            throw $e;
        }
        return false;
    }
261368
public function getRecommSearch()
    {
        if ($this->_sSearch === null) {
            $this->_sSearch = false;
            if ($sSearch = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('searchrecomm', false)) {
                $this->_sSearch = $sSearch;
            }
        }

        return $this->_sSearch;
    }
150610
public function getCatalog()
    {
        if ($this->idcat < 0) return false;
        try {
            return Catalog::getById($this->idcat);
        } catch (\Exception $e) {
            return false;
        }
    }
427237
protected function _get()
	{
		$id_path = $this->identifier_to_path( $this->identifier );
		$file = static::$path.$id_path.'.cache';
		if ( ! is_file($file) or ($size = filesize($file)) == 0)
		{
			return false;
		}

		$handle = fopen($file, 'r');
		if ( ! $handle)
		{
			return false;
		}

		// wait for a lock
		while( ! flock($handle, LOCK_SH));

		// read the session data
		$payload = fread($handle, $size);

		//release the lock
		flock($handle, LOCK_UN);

		// close the file
		fclose($handle);

		try
		{
			$this->unprep_contents($payload);
		}
		catch (\UnexpectedValueException $e)
		{
			return false;
		}

		return true;
	}
1083561
public function getMatchData()
    {
        if (!$this->lastMatchResult) {
            $this->throwException(
                'Failed to get match data: No match result found. Use match first'
            );
        }

        $data = [];
        foreach ($this->lastMatchResult as $key => $value) {
            if (is_string($key)) {
                $data[$key] = $value;
            }
        }

        return $data;
    }
13222
protected function getData($check = false)
    {
        $data = $this->getParameters();

        if ($this->hasRequestParameter('type')) {
            $type = $this->getRequestParameter('type');
            unset($data['type']);

            if ($type !== 'custom_input') {
                foreach ($data as $key => $value) {
                    $data[$type . '_' . $key] = $value;
                    unset($data[$key]);
                }
            }
        }

        $data = $this->mapData($data);

        if ($this->hasRequestParameter('school_name')) {
            $data[Storage::DIAGNOSTIC_SCHOOL_NAME] = \tao_helpers_Display::sanitizeXssHtml(trim($this->getRequestParameter('school_name')));
        }
        if ($this->hasRequestParameter('school_number')) {
            $data[Storage::DIAGNOSTIC_SCHOOL_NUMBER] = \tao_helpers_Display::sanitizeXssHtml(trim($this->getRequestParameter('school_number')));
        }

        if ($check) {
            if (!$this->hasRequestParameter('os')) {
                throw new \common_exception_MissingParameter('os');
            }
            if (!$this->hasRequestParameter('osVersion')) {
                throw new \common_exception_MissingParameter('osVersion');
            }
            if (!$this->hasRequestParameter('browser')) {
                throw new \common_exception_MissingParameter('browser');
            }
            if (!$this->hasRequestParameter('browserVersion')) {
                throw new \common_exception_MissingParameter('browserVersion');
            }
            $data['osVersion'] = preg_replace('/[^\w\.]/', '', $data['osVersion']);
            $data['browserVersion'] = preg_replace('/[^\w\.]/', '', $data['browserVersion']);
        }

        if (isset($_COOKIE['login'])) {
            $data['login'] = $_COOKIE['login'];
        } else {
            $data['login'] = 'Anonymous';
        }

        $user = \common_session_SessionManager::getSession()->getUser();
        if ($user && $user->getIdentifier()) {
            $data['user_id'] = $user->getIdentifier();
        }

        $data['version'] = $this->getServiceLocator()->get(\common_ext_ExtensionsManager::SERVICE_ID)->getExtensionById('taoClientDiagnostic')->getVersion();

        $data['ip'] = (!empty($_SERVER['HTTP_X_REAL_IP'])) ? $_SERVER['HTTP_X_REAL_IP'] : ((!empty($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : 'unknown');
        return $data;
    }
768914
public function getDatas()
    {
        if ($this->datas === null) {
            $this->datas = $this->readDatas();
        }
        
        return $this->datas;
    }
591055
public function getSearch()
    {
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:cdn:manager:object:browse')) {
            throw new ApiException(
                'You do not have permission to access this resource',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput    = Factory::service('Input');
        $oModel    = Factory::model('Object', 'nails/module-cdn');
        $sKeywords = $oInput->get('keywords');
        $iPage     = (int) $oInput->get('page') ?: 1;
        $oResult   = $oModel->search(
            $sKeywords,
            $iPage,
            static::MAX_OBJECTS_PER_REQUEST
        );

        $oResponse = Factory::factory('ApiResponse', 'nails/module-api');
        $oResponse->setData(array_map(
            function ($oObj) {
                $oObj->is_img = isset($oObj->img);
                $oObj->url    = (object) [
                    'src'     => cdnServe($oObj->id),
                    'preview' => isset($oObj->img) ? cdnCrop($oObj->id, 400, 400) : null,
                ];
                return $oObj;
            },
            $oResult->data
        ));
        return $oResponse;
    }
675830
public function getData()
    {
        $systemInformation                  = [];
        $systemInformation['newup_version'] = Application::VERSION;

        return $this->dataArray + $systemInformation + $this->collectData();
    }
506019
public function getData()
    {
        $productItemData = [
            'id'          => (int) $this->document->getId(),
            'name'        => $this->getDocumentSource('name'),
            'price'       => $this->getProductPrice(),
            'image'       => $this->getProductImage(),
            'score'       => $this->getDocumentScore(),
            'is_in_stock' => $this->isInStockProduct(),
        ];

        return $productItemData;
    }
1003730
public function getDataAction()
    {
        $request           = $this->getRequest();
        $dataCount         = 0;
        $dataFilteredCount = 0;
        $tableData         = array();
        $draw              = 0;
        if($request->isPost()) {

            $post           = get_object_vars($request->getPost());
            $columns        = array_keys($this->tool()->getColumns());
            $draw           = (int) $post['draw'];
            $selColOrder    = $columns[(int) $post['order'][0]['column']];
            $orderDirection = isset($post['order']['0']['dir']) ? strtoupper($post['order']['0']['dir']) : 'ASC';
            $searchValue    = isset($post['search']['value']) ? $post['search']['value'] : null;
            $searchableCols = $this->tool()->getSearchableColumns();
            $start          = (int) $post['start'];
            $length         = (int) $post['length'];

            $data              = $this->themeTable()->getData($searchValue, $searchableCols, $selColOrder, $orderDirection, $start, $length)->toArray();
            $dataCount         = $this->themeTable()->getTotalData();
            $dataFilteredCount = $this->themeTable()->getTotalFiltered();
            $tableData         = $data;

            for($ctr = 0; $ctr < count($tableData); $ctr++) {
                // apply text limits
                foreach($tableData[$ctr] as $vKey => $vValue) {
                    $tableData[$ctr][$vKey] = $this->tool()->limitedText($vValue, 80);
                }

                $tableData[$ctr]['DT_RowId'] = $tableData[$ctr]['pros_theme_id'];
            }
        }

        $response = [
            'draw'            => $draw,
            'data'            => $tableData,
            'recordsFiltered' => $dataFilteredCount,
            'recordsTotal'    => $dataCount
        ];

        return new JsonModel($response);
    }
1331516
private function getData() {
    $this->rawData = [];

    $class = !empty($this->parameters['class']) ? $this->parameters['class'] : '';
    $category = !empty($this->parameters['category']) ? $this->parameters['category'] : '';

    // One of the 3 search parameters should be provided:
    // 1. Location.
    // 2. Class name.
    // 3. Category.
    if (
      !isset($this->parameters['location']) &&
      $class == 'any' &&
      $category == 'any') {
      return;
    }

    $options = [
      'query' => [
        'schedule' => TRUE,
        'desc' => 'true',
      ],
    ];

    // Location is optional.
    if (!empty($this->parameters['location'])) {
      $options['query']['location'] = array_filter([$this->parameters['location']]);
    }

    // Category is optional.
    if ($category !== 'any') {
      $options['query']['category'] = $category;
    }

    // Class is optional.
    if ($class !== 'any') {
      $options['query']['class'] = self::$idStrip . $class;
    }

    // Filter by date.
    $interval = 'P1D';
    if ($this->parameters['filter_length'] == 'week') {
      $interval = 'P1W';
    }
    $date = DrupalDateTime::createFromTimestamp($this->parameters['filter_timestamp'], $this->timezone);

    $options['query']['start'] = $date->getTimestamp();
    $options['query']['end'] = $date->add(new \DateInterval($interval))->modify('-1 day')->getTimestamp();

    $data = $this->request($options);

    // Classes IDs has some garbage withing the IDs.
    $class_name_options = $this->getOptions($this->request(['query' => ['classes' => TRUE]]), 'id', 'title');
    $dirty_keys = array_keys($class_name_options);
    $refined_keys = array_map(function ($item) {
      return str_replace(GroupexRequestTrait::$idStrip, '', $item);
    }, $dirty_keys);
    $refined_options = array_combine(array_values($class_name_options), $refined_keys);

    $raw_data = [];

    if (!empty($data) && is_array($data)) {
      foreach ($data as $item) {
        $raw_data[$item->id] = $item;
        if (isset($refined_options[$item->title])) {
          $raw_data[$item->id]->class_id = $refined_options[$item->title];
        }
      }
    }
    $this->rawData = $raw_data;
  }
147793
public function fetchResult()
    {
        if ($this->checkValid()) {
            try {
                return $this->getAdapter()->fetchAssoc($this->resultSQL);
            } catch (Exception $e) {
                $e->log();
            }
        }

        return false;
    }
297565
public function getResult()
    {
        $result = parent::getResult();
        if (is_array($result) && isset($result['error'])) {
            throw new Exception($result['error']);
        }
        return $result;
    }
1014656
public function get_data() {
        if ($this->item !== null) {
            return true;
        }
        if ($this->item = $this->item_form->get_data()) {
            return true;
        }
        return false;
    }
1217088
public function get_data() {

		$data           = [
			$this->slug => [],
		];
		$this->instance = 0;
		$has_data       = true;
		while ( true === $has_data ) {
			$this_data = $this->get_child_data();
			$this_data = array_filter( $this_data );
			if ( ! empty( $this_data ) ) {
				$data[ $this->slug ][] = $this_data;
			} else {
				$has_data = false;
			}
			$this->instance ++;
		}

		return $data;
	}
14578
public function search()
    {
        $dataProvider = new ActiveDataProvider([
            'query' => static::find()->where(['user_id' => User::loggedId()]),
            'pagination' => [
                'defaultPageSize' => 10,
                'forcePageParam' => false
            ],
        ]);
        $dataProvider->sort->defaultOrder = ['post_seen' => SORT_ASC, 'id' => SORT_DESC];
        $dataProvider->pagination->pageSize = Yii::$app->session->get('per-page', 20);
        return $dataProvider;
    }