/**
  * Simple test.  Return NON-NULL if valid logged in.
  */
 public function testCreatePersonValidUser()
 {
     $accountName = 'foo-' . rand();
     $accountPassword = '******' . rand();
     $this->setZendAuthIdentity($accountName);
     $account = new Opus_Account();
     $account->setLogin($accountName)->setPassword($accountPassword)->store();
     $model = new Publish_Model_LoggedUser();
     $this->assertNotNull($model->getUserId());
     $person = $model->createPerson();
     $this->assertNotNull($person);
     $this->assertEquals($account->getId(), $model->getUserId());
 }
 /**
  * Action for showing the clear form and processing POST from it.
  */
 public function clearAction()
 {
     $ids = $this->_filterReviewableIds($this->_getParam('selected'));
     if (count($ids) < 1) {
         $this->view->message = 'review_error_noselection';
         return $this->render('message');
     }
     $this->view->selected = $ids;
     $this->view->documentCount = count($ids);
     $this->view->actionUrl = $this->view->url(array('action' => 'clear'));
     $useCurrentUser = false;
     $person = null;
     $config = $this->getConfig();
     if (isset($config, $config->clearing->addCurrentUserAsReferee)) {
         $useCurrentUser = $config->clearing->addCurrentUserAsReferee;
     }
     if ($useCurrentUser) {
         $person = $this->_loggedUser->createPerson();
         if (is_null($person) or !$person->isValid()) {
             $message = "Problem clearing documents.  Information for current user is incomplete or invalid.";
             $this->getLogger()->err($message);
             throw new Application_Exception($message);
         }
     }
     if ($this->_isButtonPressed('sureno', true, false)) {
         return $this->_forward('index', null, null, array('selected' => $ids));
     }
     if ($this->_isButtonPressed('sureyes', true, false)) {
         $helper = new Review_Model_ClearDocumentsHelper();
         $userId = $this->_loggedUser->getUserId();
         if (is_null($userId) or empty($userId)) {
             $userId = 'unknown';
         }
         $helper->clear($ids, $userId, $person);
         $this->view->message = 'review_accept_success';
         return $this->render('message');
     }
     $this->view->title = 'review_accept_title';
     $this->view->instruction = 'review_accept_instruction';
     $this->render('confirm');
 }
Esempio n. 3
0
 /**
  * Render body of notification mail.
  *
  * @param string $baseUrlServer
  * @param string $baseUrlFiles
  * @return string
  */
 public function renderPublishMailBody($baseUrlServer, $baseUrlFiles)
 {
     $baseUrlServer = preg_replace('/[\\/]+$/', '', $baseUrlServer);
     $baseUrlFiles = preg_replace('/[\\/]+$/', '', $baseUrlFiles);
     $loggedUserModel = new Publish_Model_LoggedUser();
     $person = $loggedUserModel->createPerson();
     $submitterString = '';
     if (!is_null($person) and $person->isValid()) {
         $submitterString = trim($person->getFirstName() . " " . $person->getLastName());
     }
     $titleModels = $this->_document->getTitleMain();
     $titleString = '';
     if (count($titleModels) > 0) {
         $titleString = trim($titleModels[0]->getValue());
     }
     $abstractModels = $this->_document->getTitleAbstract();
     $abstractString = '';
     if (count($abstractModels) > 0) {
         $abstractString = trim($abstractModels[0]->getValue());
     }
     $template = new Matheon_Model_Template();
     $template->template = APPLICATION_PATH . '/modules/matheon/models/confirmation-mail.template';
     return $template->render(array('baseUrlServer' => $baseUrlServer, 'baseUrlFiles' => $baseUrlFiles, 'docId' => $this->getId(), 'submitterString' => $submitterString, 'titleString' => $titleString, 'abstractString' => $abstractString, 'files' => $this->_document->getFile()));
 }