Пример #1
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $response = $this->getResponse();
     $hash = $request->idx;
     $pendingMapper = new Syj_Model_PendingMapper();
     $pending = $pendingMapper->fetchByHash($hash);
     if (!isset($pending)) {
         throw new Syj_Exception_NotFound('Not Found', 404);
     }
     $formData = $request->getPost();
     switch ($pending->action) {
         case 'validate_creation':
             if (array_key_exists('pending_validate', $formData)) {
                 if (!$pending->run()) {
                     throw new Syj_Exception();
                 }
                 $title = $this->view->translate("account validated");
                 $this->_helper->ViewRenderer->setViewScriptPathSpec(':controller/creation_validate.:suffix');
             } else {
                 if (array_key_exists('pending_cancel', $formData)) {
                     if (!$pending->cancel()) {
                         throw new Syj_Exception();
                     }
                     $title = $this->view->translate("account deleted");
                     $this->_helper->ViewRenderer->setViewScriptPathSpec(':controller/creation_cancel.:suffix');
                 } else {
                     $this->view->form = new Syj_Form_Pending_ValidateCreation($pending, array('name' => 'pendingform'));
                     $title = $this->view->translate('account creation validation');
                 }
             }
             break;
         case 'reset_password':
             if (array_key_exists('pending_validate', $formData)) {
                 if (!$pending->run()) {
                     throw new Syj_Exception();
                 }
                 $this->view->newpwd = $pending->newpwd;
                 $title = $this->view->translate("password changed");
                 $this->_helper->ViewRenderer->setViewScriptPathSpec(':controller/password_validate.:suffix');
                 $this->_helper->SyjUserManager->logout();
             } else {
                 if (array_key_exists('pending_cancel', $formData)) {
                     if (!$pending->cancel()) {
                         throw new Syj_Exception();
                     }
                     $title = $this->view->translate("request canceled");
                     $this->_helper->ViewRenderer->setViewScriptPathSpec(':controller/password_cancel.:suffix');
                 } else {
                     $this->view->form = new Syj_Form_Pending_ResetPassword($pending, array('name' => 'pendingform'));
                     $title = $this->view->translate('password reset validation');
                 }
             }
             break;
         default:
             throw new Syj_Exception_Request();
             break;
     }
     $this->view->headTitle($title);
 }
Пример #2
0
 public function notifyPendings()
 {
     $pendingMapper = new Syj_Model_PendingMapper();
     $pendings = $pendingMapper->fetchForUser($this);
     foreach ($pendings as $pending) {
         $pending->notify();
     }
 }
Пример #3
0
<?php

/*  This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
    and is published under the AGPL license. */
$mapper = new Syj_Model_PendingMapper();
foreach ($mapper->fetchAll() as $pending) {
    $pending->notify();
}
Пример #4
0
 public function cancel()
 {
     if ($this->_cancel() === false) {
         return false;
     }
     $mapper = new Syj_Model_PendingMapper();
     $mapper->delete($this);
     return true;
 }