public function fundTask()
 {
     // get the id of the citation
     $id = Request::getInt('id', '');
     $row = new Citation($this->database);
     $row->load($id);
     // toggle the affiliation
     if ($row->fundedby == 1) {
         $row->fundedby = 0;
     } elseif ($row->fundedby == 0) {
         $row->fundedby = 1;
     }
     if (!$row->save($row)) {
         $this->setError($row->getError());
         $this->displayTask();
         return;
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('CITATION_FUNDED'));
 }
Exemple #2
0
 /**
  * Download a batch of entries
  *
  * @return  void
  */
 public function downloadbatchTask()
 {
     // get the submit buttons value
     $download = Request::getVar('download', '');
     $no_html = Request::getVar('no_html', 0);
     // get the citations we want to export
     $citationsString = Request::getVar('idlist', '');
     $citations = explode('-', $citationsString);
     // return to browse mode if we really dont wanna download
     if (strtolower($download) != 'endnote' && strtolower($download) != 'bibtex') {
         if (!$no_html) {
             return $this->displayTask();
         } else {
             return json_encode(array('status' => '1'));
         }
     }
     // var to hold output
     $doc = '';
     // for each citation we want to downlaod
     foreach ($citations as $c) {
         $cc = new Citation($this->database);
         $cc->load($c);
         //get the badges
         $ct = new Tags($cc->id);
         $cc->badges = $ct->render('string', array('label' => 'badge'));
         $cd = new Download();
         $cd->setFormat(strtolower($download));
         $doc .= $cd->formatReference($cc) . "\r\n\r\n";
         $mine = $cd->getMimeType();
     }
     $ext = strtolower($download) == 'bibtex' ? '.bib' : '.enw';
     // filename
     $filename = 'citations_export_' . strtolower($download) . '_' . Date::of('now')->format('Y_m_d') . $ext;
     // output file
     header('Content-Type: application/octet-stream');
     header('Content-Disposition: Attachment; filename=' . $filename);
     header('Pragma: no-cache');
     echo $doc;
     exit;
 }
Exemple #3
0
 /**
  * Show the results of the import
  *
  * @return  void
  */
 public function savedTask()
 {
     // Get the session object
     $session = App::get('session');
     // Get the citations
     $citations_saved = $session->get('citations_saved');
     $citations_not_saved = $session->get('citations_not_saved');
     $citations_error = $session->get('citations_error');
     // Check to make sure we have citations
     if (!$citations_saved && !$citations_not_saved) {
         App::redirect(Route::url('index.php?option=com_citations&task=import'), Lang::txt('COM_CITATIONS_IMPORT_MISSING_FILE_CONTINUE'), 'error');
         return;
     }
     // Set the page title
     $this->_buildTitle();
     // Set the pathway
     $this->_buildPathway();
     // Filters for gettiung just previously uploaded
     $filters = array('start' => 0, 'search' => '');
     // Instantiate a new view
     $this->view->title = Lang::txt(strtoupper($this->_option)) . ': ' . Lang::txt(strtoupper($this->_option) . '_' . strtoupper($this->_task));
     $this->view->config = $this->config;
     $this->view->database = $this->database;
     $this->view->filters = $filters;
     $this->view->citations = array();
     foreach ($citations_saved as $cs) {
         $cc = new Citation($this->database);
         $cc->load($cs);
         $this->view->citations[] = $cc;
     }
     $this->view->openurl['link'] = '';
     $this->view->openurl['text'] = '';
     $this->view->openurl['icon'] = '';
     //take care fo type
     $ct = new Type($this->database);
     $this->view->types = $ct->getType();
     //get any messages
     $this->view->messages = Notify::messages('citations');
     //display view
     $this->view->display();
 }