예제 #1
0
 public function getActiveParticipant()
 {
     $_t = new ParticipantsTable();
     if (Zend_Auth::getInstance()->getIdentity()) {
         $_participant = $_t->findByEmail(Zend_Auth::getInstance()->getIdentity());
         if ((int) $_participant->is_active === 1) {
             define("USER_ACTIVE", 1);
         } else {
             define("USER_ACTIVE", 0);
         }
         if ($_participant->is_admin == 1) {
             define("ADMIN_ENABLED", 1);
         } else {
             define("ADMIN_ENABLED", 0);
         }
         return $_participant;
     }
     define("ADMIN_ENABLED", 0);
     return null;
 }
예제 #2
0
 public function participanteditAction()
 {
     $this->view->title = "Create New/Change";
     $_action = $this->getRequest()->getParam("act");
     $_pid = $this->getRequest()->getParam("pid");
     $_t = new ParticipantsTable();
     $_form = new ParticipantInfoUpdateForm();
     if ($_action === "del") {
         $_t->deleteById($_pid);
         $this->_redirect(APPLICATION_BASEURL_INDEX . "/admin/participant");
     } else {
         if ($_action === "edit") {
             //TODO: fill the form with actual values...
             $_participant = $_t->findById($_pid);
             $_form->loadFromModel($_participant);
         } else {
             if ($_action === "create") {
             } else {
                 if ($_action === "save") {
                     $_participant = null;
                     if ($_pid != "") {
                         $_participant = $_t->findById($_pid);
                         $_form->loadFromModel($_participant);
                     }
                     if ($_form->isValid($_POST)) {
                         if ($_pid == "") {
                             $_participant = $_t->createRow();
                             $_participant->loadFromForm($_form);
                             $_participant->insert();
                         } else {
                             $_participant->loadFromForm($_form);
                             $_participant->save();
                         }
                         //$this->_redirect(APPLICATION_BASEURL_INDEX . "/admin/participant");
                     } else {
                         $this->view->errorMsg = "Correct the errors below...";
                     }
                 }
             }
         }
     }
     $this->view->form = $_form;
 }