article -> id); echo $url;?>"> */ function display($template = NULL) { $this -> complete = false; $this -> error=false; $this->itemId = JRequest :: getUInt('Itemid', 0); $this -> publicationId = JRequest :: getString('activePublicationId'); $user = JFactory :: getUser(); $this -> sourceType = JRequest :: getString('sourceType') ; if (JFactory :: getUser()->guest) { $redirectUrl='index.php?option=com_openaire&view=claiminline&tmpl=modal&sourceType='.$this -> sourceType.'&activePublicationId=' . $this -> publicationId.'&Itemid=' . $this->itemId; JFactory :: getApplication()->redirect(JRoute :: _(JUri :: base() . 'index.php?option=com_users&view=login&tmpl=modal&activePublicationId=' . $this -> publicationId . 'Itemid=' . $this->itemId . '&return=' . base64_encode(JRoute :: _( $redirectUrl)), FALSE)); return TRUE; } $claimModel = $this->getModel(self :: CLAIM_MODEL); $searchModel = $this->getModel(self :: SEARCH_MODEL); $locale = JFactory :: getLanguage()->getTag(); $projectId = JRequest :: getString('projectId'); $this->funder = JRequest :: getString('funder'); $this -> fields_layout = JRequest :: getString('fields_layout', 'horizontal'); $statistics = $searchModel->getProjectStatistics($locale,true); $this->funders = ($statistics == NULL) ? NULL : $statistics['funder']->data; $this->contexts = $claimModel->getContexts(); //echo('Contexts:
' . htmlspecialchars(print_r($claimModel -> getContexts(), TRUE)) . ""); /*if (($this->funder == NULL) && ($this->funders != NULL)) { $funders = array_values($this->funders); $this->funder = array_shift($funders)->id; }*/ switch (JRequest :: getString('action')) { case self :: SUBMIT: if ($this->sourceType === 'dataset') { $publication = $searchModel->getDataset($this->publicationId, $locale); } else { $publication = $searchModel->getPublication($this->publicationId, $locale); } if ($publication == null) { $this->error = true; $this->complete = true; parent :: display($template); } $projectIds = JRequest :: getString('projects', NULL); $conceptIds = JFactory :: getApplication()->input->get('concepts', FALSE,'array'); if ($projectIds !== FALSE){ $projectIds = explode(",", $projectIds); $claimModel->emptySelectedProjects(OpenAireModelClaim::CLAIMINLINE. $this -> publicationId); foreach ($projectIds as $projectId) { $project = $searchModel->getProject($projectId, $locale); if ($project != NULL) { $project->id = $projectId; $claimModel->addSelectedProject($project, OpenAireModelClaim::CLAIMINLINE. $this -> publicationId); } } } if ($conceptIds !== FALSE) { //var_dump($conceptIds); //exit; $claimModel->emptySelectedConcepts(OpenAireModelClaim::CLAIMINLINE. $this -> publicationId); foreach ($conceptIds as $i => $conceptId) { $concept = $claimModel->getConcept($conceptId); if ($concept != NULL) { $concept -> id = $conceptId; $claimModel->addSelectedConcept($concept, OpenAireModelClaim::CLAIMINLINE. $this -> publicationId); } } } $this -> error= $claimModel->claimSelectedPublications($user, OpenAireModelClaim::CLAIMINLINE, $publication, $this -> publicationId,$this -> sourceType); $this -> complete = true; parent :: display($template); return true; /* case self :: SUBMIT: return true;*/ default: $claimModel->emptySelectedProjects(OpenAireModelClaim::CLAIMINLINE. $this -> publicationId); $claimModel->emptySelectedConcepts(OpenAireModelClaim::CLAIMINLINE. $this -> publicationId); } $this->selectedProjects = $claimModel->getSelectedProjects(OpenAireModelClaim::CLAIMINLINE . $this -> publicationId); $this->selectedConcepts = $claimModel->getSelectedConcepts(OpenAireModelClaim::CLAIMINLINE . $this -> publicationId); // JLog :: add("Retrieved contexts " . print_r($claimModel->getContexts(), TRUE), JLog :: DEBUG, self :: LOG); JLog :: add("Retrieved contexts ", JLog :: DEBUG, self :: LOG); if (count($errors = $this->get('Errors')) > 0) { JLog :: add('Error viewing claiminline: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); return FALSE; } parent :: display($template); } }