/** * {@inheritDoc} */ protected function fetchData() { parent::fetchData(); $query = ' SELECT pub_auth.publication_id AS publicationId, COUNT(cit.id) AS citationCount FROM publications_authors pub_auth LEFT JOIN citations cit ON (pub_auth.publication_id = cit.publication_id) WHERE pub_auth.author_id = :authorId GROUP BY publicationId ORDER BY citationCount DESC '; $statement = $this->db->prepare($query); $statement->bindValue(':authorId', $this->parameters['authorId']['value'], PDO::PARAM_INT); $statement->execute(); $data = array(); $data['publications'] = $statement->fetchAll(PDO::FETCH_ASSOC); $data = IndexHelper::convertWrongDataTypes($this->dataFormat['publications']['int'], $data, 2, 0); $this->setData($data); }
/** * Returns an array which contains a list from the database * with all colleagues of the author up to a specific * citation timestamp. * * @param array $data The array which should be filled with the * colleagues of the author. * * @return array An array which contains the colleagues. */ private function fetchColleaguesData(array $data) { $colleaguesStatement = $this->getColleaguesStatement(); if (!array_key_exists('colleagues', $data['author'])) { $data['author']['colleagues'] = array(); } foreach (array_keys($data['author']['colleagues']) as $citationTimestamp) { $colleaguesStatement->bindValue(':authorId', $this->parameters['authorId']['value'], PDO::PARAM_INT); $colleaguesStatement->bindValue(':citationTimestamp', $citationTimestamp, PDO::PARAM_INT); $colleaguesStatement->execute(); $data['author']['colleagues'][$citationTimestamp] = $colleaguesStatement->fetchAll(PDO::FETCH_ASSOC); } $data = IndexHelper::convertWrongDataTypes($this->dataFormat['author']['colleagues']['int']['int'], $data, 4, 0, array(0 => array('author'), 1 => array('colleagues'))); return $data; }