Example #1
0
 public function newpwdAction()
 {
     if (!($id = (int) $this->_getParam('id', false))) {
         return $this->_helper->redirector('kap');
     }
     $model = Reg2_Model_Data::getModel();
     $kap = $model->findPlayer($id);
     $user = $model->findUserByEmail($kap->email);
     if (!$user) {
         throw new Exception("Не найдено капитанской записи для игрока номер {$id}");
     }
     $team = $model->findTeam($user->tid);
     if (!$team || $team->kap != $id) {
         throw new Exception("Не найдено капитанской записи для игрока номер {$id}");
     }
     $mail = new Reg2_Mail('cappwd');
     $mail->getMailer()->addTo($kap->email)->setSubject("ICHB-{$this->config['ichb']['year']} - Captain's Access");
     $mail->getView()->team = $team;
     $mail->getView()->pwd = $model->createUserPassword($kap->email, $team->tid);
     $mail->getView()->kadavr = $this->config['mail']['kadavr'];
     $mail->send();
     $this->view->user = $kap;
 }
Example #2
0
 public function registerAction()
 {
     $request = $this->getRequest();
     if (!$request->isPost()) {
         return $this->_helper->redirector('index');
     }
     $form = $this->_helper->getForm('register');
     if (!$form->isValid($request->getPost())) {
         return $this->_forward('index');
     }
     $values = $form->getValues();
     // success
     switch ($values["kadres"]) {
         case "kap":
             $contact = $values["pemail0"];
             break;
         case "reg":
             $contact = $values["email"];
             break;
         case "list":
             $contact = $values["tlist"];
             break;
         case "other":
             $contact = $values["dradr"];
             break;
         default:
             $contact = '';
     }
     $values["contact"] = $contact;
     $result = Bootstrap::get('model')->addTeamData($values);
     if ($result !== true) {
         $this->view->error = $result;
         return;
         // redisplay form with error
     }
     $teamname = $this->_helper->translit($values["name"]);
     $mail = new Reg2_Mail('newreg');
     $view = $mail->getView();
     $view->maxplayers = Bootstrap::get('model')->getMaxPlayers();
     $view->data = $values;
     $mail->getMailer()->addTo($this->config['mail']['register'])->setSubject("ICHB-{$this->config['ichb']['year']} - New Registration: {$teamname}");
     $mail->send();
     if ($values["klist"] == 'n' || $values["zlist"] == 'n') {
         $mail = new Reg2_Mail('subscribe');
         $view = $mail->getView();
         $mail->getMailer()->addTo($this->config['mail']['pochta'])->setSubject("ICHB-{$this->config['ichb']['year']} - Subscribe");
         $view->name = $values["name"];
         if ($values["klist"] == 'n') {
             $view->list = "Совета Капитанов";
             $view->kod = $values["tsubs_kod"];
             $view->addr = $values["tsubs"];
             $mail->getMailer()->setReplyTo($values["tsubs"], $values["name"]);
             $mail->send();
         }
         $mail = new Reg2_Mail('subscribe');
         $view = $mail->getView();
         $mail->getMailer()->addTo($this->config['mail']['pochta'])->setSubject("ICHB-{$this->config['ichb']['year']} - Subscribe");
         $view->name = $values["name"];
         if ($values["zlist"] == 'n') {
             $view->list = $values["zsubs_list"];
             $view->kod = $values["zsubs_kod"];
             $view->addr = $values["zsubs"];
             $mail->getMailer()->setReplyTo($values["zsubs"], $values["name"]);
             $mail->send();
         }
         $this->view->list_desc = 1;
         $this->view->pochta = $this->config['mail']['pochta'];
     }
 }