Get all tracks for a respondent

Specify the optional $order to sort other than on start date

@param int $respondentId
@param int $organizationId
@param mixed $order The column(s) and direction to order by
@return \Gems_Tracker_RespondentTrack[]
179879
public function getRespondentTracks($respondentId, $organizationId, $order = array('gr2t_start_date'))
    {
        $select = $this->db->select()
                ->from('gems__respondent2track')
                ->joinInner('gems__tracks', 'gr2t_id_track = gtr_id_track')
                ->joinInner('gems__reception_codes', 'gr2t_reception_code = grc_id_reception_code')
                ->where('gr2t_id_user = ? AND gr2t_id_organization = ?');
        if (!is_null($order)) {
            $select->order($order);
        }
        $rows   = $this->db->fetchAll($select, array($respondentId, $organizationId));
        $tracks = array();

        foreach ($rows as $row) {
            $tracks[$row['gr2t_id_respondent_track']] = $this->getRespondentTrack($row);
        }

        return $tracks;
    }
1097661
public function getRelation($respondentId, $relationId)
    {
        $filter = array(
            'grr_id_respondent' => $respondentId,        // Just a safeguard to make sure we get only relations for this patient
            'grr_id'            => $relationId
        );

        $data = $this->loadFirst($filter);

        if (!$data) {
            $data = array();
        }

        $relationObject = $this->loader->getInstance('Model_RespondentRelationInstance', $this, $data);

        return $relationObject;
    }
1287373
protected function buildOrderJoin(string $order): array
    {
        list($column, $direction) = $this->formatOrderDirection($order);

        $lookupBuilder = $this->getLookupBuilder();

        $column = $lookupBuilder->fetchColumnName($column);
        $newOrder = $lookupBuilder->buildJoin($this, $column);
        if (false === $newOrder) {
            return [$column, $direction];
        }

        list($alias, $column) = $newOrder;

        return [
            $alias.'.'.$column,
            $direction,
        ];
    }
1139537
public function invoice($orderId, $invoiceKey)
    {
        $transformer = new InvoiceTransformer(self::STATUS_PAID, $invoiceKey);
        $body        = $transformer->output();

        /** @var \SkyHub\Api\Handler\Response\HandlerInterface $responseHandler */
        $responseHandler = $this->service()->post($this->baseUrlPath("$orderId/invoice"), $body);
        return $responseHandler;
    }
149366
protected function visitSirelNodeOrder(Node\Order $order)
    {
        return $this->visit($order->getExpression()) . " "
            . ($order->isAscending() ? "ASC" : "DESC");
    }
823167
public function listOrganizationRepositories($organization, $type = null)
	{
		$data = array();
		if(!is_null($type))
			$data['type'] = $type;
		
		return $this->client->request("/orgs/$organization/repos", 'GET', $data, 200, 'GitHubSimpleRepo', true);
	}
1135123
public function findOrganizationBanner($organizationId, $bannerId)
    {
        list($response) = $this->findOrganizationBannerWithHttpInfo($organizationId, $bannerId);
        return $response;
    }
708713
public function indexOrder($order_id)
    {
        $this->setOrder($order_id);
        $this->submitIndexOrder();
        $this->setTitleIndexOrder();
        $this->setBreadcrumbIndexOrder();

        $this->setData('order', $this->data_order);

        $this->setDataPanelLogsIndexOrder();
        $this->setDataPanelSummaryIndexOrder();
        $this->setDataPanelCommentIndexOrder();
        $this->setDataPanelCustomerIndexOrder();
        $this->setDataPanelComponentsIndexOrder();
        $this->setDataPanelPaymentAddressIndexOrder();
        $this->setDataPanelShippingAddressIndexOrder();

        $this->outputIndexOrder();
    }
778690
public function findOrganizationMenu($organizationId, $menuId)
    {
        list($response) = $this->findOrganizationMenuWithHttpInfo($organizationId, $menuId);
        return $response;
    }
557694
protected function getOrder($orderId)
    {
        if (null == $order = OrderQuery::create()->findPk($orderId)) {
            $this->getLog()->addError(
                $this->getTranslator()->trans("Unknown order ID:  %id", array('%id' => $orderId))
            );
        }

        return $order;
    }
1142611
public function listOrganizationMenuItems($organizationId, $menuId)
    {
        list($response) = $this->listOrganizationMenuItemsWithHttpInfo($organizationId, $menuId);
        return $response;
    }
206300
private function getCostCollection(OrderInterface $order) : Collection
    {
        if ($order->hasShippingMethod()) {
            $costs = $this->getCurrentShippingMethodCostsCollection($order);
            if ($costs->count() > 0) {
                return $costs;
            }
        }
        
        return $this->getShippingCostCollection($order);
    }
449371
public function reorderProfileUpdates($id, $order, $offset = null, $utc = false)
    {
        $payload = $this->buildReorderProfileUpdatesPayload((array) $order, $offset, $utc);

        return $this->send($this->getHttp()->post($this->url.'profiles/'.$id.'/updates/reorder.json', null, $payload));
    }
230772
public function dispatchAction(Order $order)
    {
        $em = $this->getDoctrine()->getEntityManager();

        $order->dispatchBySeller($this->get('exchange_manager')->getExchange());

        $em->persist($order);
        $em->flush();

        $this->get('notifier')->notify(new OrderDispatchedBySellerEvent($order), $this->getUser());

        return $this->redirect($this->generateUrl('Order_show', array(
            'id' => $order->getNumberForPath()
        )));
    }
304600
public function updateTrackCode(Model $order, UpdateTrackCodeRequest $request)
    {
        $order->update(['track_code' => $request->track_code]);

        //Mail::to($userEmail)->send(new UpdateOrderStatusMail($orderStatusTitle));

        return redirect()->route('admin.order.index');
    }
878221
public function findOneByOrderIdNotFinished($orderId)
    {
        $qb = $this->createQueryBuilder('p');
        $qb->select('p')
            ->where('p.orderId = :orderId')
            ->andWhere('p.finished is NULL')
            ->setParameter('orderId', strtoupper($orderId))
            ;

        return $qb->getQuery()->getOneOrNullResult();
    }
822037
protected function _exportRespondent($respondentId)
    {
        $respondentModel = $this->loader->getModels()->getRespondentModel(false);

        //Insert orgId when set
        if (is_array($respondentId) && isset($respondentId['gr2o_id_organization'])) {
            $filter['gr2o_id_organization'] = $respondentId['gr2o_id_organization'];
            $respondentId = $respondentId['gr2o_patient_nr'];
        } else {
            // Or accept to find in current organization
            // $filter['gr2o_id_organization'] = $this->currentUser->getCurrentOrganizationId();
            // Or use any allowed organization?
            $filter['gr2o_id_organization'] = array_keys($this->currentUser->getAllowedOrganizations());
        }
        $filter['gr2o_patient_nr'] = $respondentId;

        $respondentModel->setFilter($filter);
        $respondentData = $respondentModel->loadFirst();

        $this->html->snippet($this->_respondentSnippet,
            'model', $respondentModel,
            'data', $respondentData,
            'respondentId', $respondentId);

        $tracker = $this->loader->getTracker();
        $tracks = $tracker->getRespondentTracks($respondentData['gr2o_id_user'], $respondentData['gr2o_id_organization']);

        foreach ($tracks as $trackId => $track) {
            $this->_exportTrack($track);
        }
    }