public function showAction()
 {
     $selectedYear = $this->getRequest()->getParam('selectedYear', null);
     if (is_null($selectedYear) || !in_array($selectedYear, $this->_statisticsModel->getYears())) {
         return $this->_redirectToAndExit('index');
     }
     $this->view->languageSelectorDisabled = true;
     $date = new Opus_Date();
     $date->setYear($selectedYear)->setMonth(12)->setDay(31);
     $this->view->dateThreshold = $this->getHelper('Dates')->getDateString($date);
     $this->view->selectedYear = $selectedYear;
     $this->view->sumDocsUntil = $this->_statisticsModel->getNumDocsUntil($selectedYear);
     $monthStat = $this->_statisticsModel->getMonthStatistics($selectedYear);
     $this->view->totalNumber = array_sum($monthStat);
     $this->view->title = $this->view->translate('Statistic_Controller') . ' ' . $selectedYear;
     $this->view->monthStat = $monthStat;
     $this->view->typeStat = $this->_statisticsModel->getTypeStatistics($selectedYear);
     $this->view->instStat = $this->_statisticsModel->getInstituteStatistics($selectedYear);
     $this->_breadcrumbs->setLabelFor('admin_statistic_show', $selectedYear);
 }
Esempio n. 2
0
 public function testGetFileObjectForUnpublishedFileForDocumentsAdmin()
 {
     $this->loginUser('security8', 'security8pwd');
     $file = $this->createTestFile('test.pdf');
     $doc = $this->createTestDocument();
     $doc->setServerState('unpublished');
     $doc->addFile($file);
     $date = new Opus_Date();
     $date->setYear('2100')->setMonth('00')->setDay('01');
     $doc->setEmbargoDate($date);
     $docId = $doc->store();
     $model = new Frontdoor_Model_File($docId, "test.pdf");
     $realm = new MockRealm(true, true);
     $opusFile = $model->getFileObject($realm);
     $this->assertEquals("test.pdf", $opusFile->getPathName());
 }
Esempio n. 3
0
 /**
  * Dateien dürfen vom Admin heruntergeladen werden, auch wenn das Embargo-Datum nicht vergangen ist.
  * Regressiontest for OPUSVIER-3313.
  */
 public function testAccessForEmbargoedDocumentForAdmin()
 {
     $this->loginUser('admin', 'adminadmin');
     $file = $this->createTestFile('test.pdf');
     $doc = $this->createTestDocument();
     $doc->setServerState('published');
     $doc->addFile($file);
     $date = new Opus_Date();
     $date->setYear('2100')->setMonth('00')->setDay('01');
     $doc->setEmbargoDate($date);
     $docId = $doc->store();
     $model = new Frontdoor_Model_File($docId, "test.pdf");
     $realm = new MockRealm(true, true);
     $file = $model->getFileObject($realm);
     $this->assertEquals('test.pdf', $file->getPathName());
 }
 * @copyright   Copyright (c) 2008-2011, OPUS 4 development team
 * @license     http://www.gnu.org/licenses/gpl.html General Public License
 * @version     $Id$
 */
/**
 * script to create 10000 documents, e.g., for performance testing
 */
for ($i = 1; $i < 10000; $i++) {
    $d = new Opus_Document();
    $d->setServerState('published');
    $d->setType('preprint');
    $d->setLanguage('deu');
    $title = $d->addTitleMain();
    $title->setLanguage('deu');
    $title->setValue('title-' . rand());
    $date = new Opus_Date();
    $date->setNow();
    $date->setYear(1990 + $i % 23);
    $d->setPublishedDate($date);
    $p = new Opus_Person();
    $p->setFirstName("foo-" . $i % 7);
    $p->setLastName("bar-" . $i % 5);
    $p = $d->addPersonAuthor($p);
    $c = new Opus_Collection(15990 + $i % 103);
    $d->addCollection($c);
    $s = $d->addSubject()->setType('ddc');
    $s->setValue($i % 97);
    $docId = $d->store();
    echo "docId: {$docId}\n";
}
exit;
 /**
  * Test für OPUSVIER-3275.
  */
 public function testEmbargoDateHasNotPassed()
 {
     $this->useEnglish();
     $file = $this->createTestFile('foo.pdf');
     $doc = $this->createTestDocument();
     $doc->setServerState('published');
     $doc->addFile($file);
     $date = new Opus_Date();
     $date->setYear('2100')->setMonth('00')->setDay('01');
     $doc->setEmbargoDate($date);
     $docId = $doc->store();
     $this->dispatch('frontdoor/index/index/docId/' . $docId);
     $this->assertNotQueryContentContains('//*', '/files/' . $docId . '/foo.pdf');
     $this->assertQueryContentContains('//*', 'This document is embargoed until:');
 }