complete = false; $this->itemId = JRequest :: getUInt('Itemid', 0); $this -> publicationId = JRequest :: getString('activePublicationId'); $user = JFactory :: getUser(); if (JFactory :: getUser()->guest) { 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 :: _('index.php?option=com_openaire&view=claiminline&tmpl=modal&Itemid=' . $this->itemId, FALSE)), 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); $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: $publication = $searchModel->getPublication($this -> publicationId, $locale); $projectIds = JRequest :: getVar('projects', FALSE); $conceptIds = JRequest :: getVar('concepts', FALSE); if ($projectIds !== FALSE){ $projectIds = explode(",", $projectIds); $claimModel->emptySelectedProjects(); 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(); foreach ($conceptIds as $i => $conceptId) { $concept = $claimModel->getConcept($conceptId); if ($concept != NULL) { $concept -> id = $conceptId; $claimModel->addSelectedConcept($concept, OpenAireModelClaim::CLAIMINLINE. $this -> publicationId); } } } $claimModel->claimSelectedPublications($user, OpenAireModelClaim::CLAIMINLINE, $publication, $this -> publicationId); $this -> complete = true; parent :: display($template); return true; } $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); if (count($errors = $this->get('Errors')) > 0) { JLog :: add('Error viewing claiminline: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); return FALSE; } parent :: display($template); } }