Esempio n. 1
0
 function __construct($template)
 {
     $this->_mailer = new Zend_Mail('koi8-r');
     $this->_view = new Zend_View();
     $this->_template = $template;
     $this->_view->setScriptPath(APPLICATION_PATH . '/views/scripts/email');
     $config = Bootstrap::get('config');
     $this->_mailer->addCc($config["mail"]["kadavr"]);
     $this->_mailer->addCc($config["mail"]["cc"]);
 }
Esempio n. 2
0
 public function preDispatch()
 {
     $acl = Zend_Registry::get('acl');
     if (!$acl->isAllowed(Zend_Registry::get('role'), 'admin', $this->getRequest()->action)) {
         if (!Zend_Auth::getInstance()->hasIdentity()) {
             $this->_forward('noauth', 'error');
         } else {
             $this->_forward('noacl', 'error');
         }
     }
     $this->config = Bootstrap::get('config');
 }
Esempio n. 3
0
 public function init()
 {
     parent::init();
     $this->setName("teamconfirm");
     $this->removeElement("email");
     $this->removeElement("kadres");
     $this->removeElement("klist");
     $this->removeElement("zlist");
     $this->removeElement("sezon2008");
     $this->getElement("oldid")->setDecorators(array('ViewHelper', 'TableRow'));
     $max = Bootstrap::get('model')->getMaxPlayers();
     $decorators = array('ViewHelper', array("HtmlTag", array("tag" => "td")));
     $this->addElement('hidden', 'tid', array('required' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('text', 'contact', array('filters' => array('StringTrim'), 'validators' => array(array('EmailAddress', true)), 'required' => true, 'label' => 'E-mail для контакта'));
     for ($i = 0; $i < $max; $i++) {
         $this->addElement('text', "pid{$i}", array('filters' => array('StringTrim'), 'validators' => array(array('Digits')), 'required' => false, 'class' => 'short', 'decorators' => $decorators));
         $this->addElement('hidden', "oldpid{$i}", array('required' => false, 'decorators' => array('ViewHelper')));
     }
     $this->addElement('submit', 'save', array('required' => false, 'label' => 'Записать', 'decorators' => array('ViewHelper')));
     $this->addElement('submit', 'confirm', array('required' => false, 'label' => 'Утвердить регистрацию!', 'decorators' => array('ViewHelper')));
     $this->addElement('submit', 'delete', array('required' => false, 'label' => 'Удалить!', 'decorators' => array('ViewHelper')));
 }
Esempio n. 4
0
 /**
  * Get registreted model instance
  *
  * @return Reg2_Model_Data
  */
 public static function getModel()
 {
     return Bootstrap::get('model');
 }
Esempio n. 5
0
 public function init()
 {
     $config = Bootstrap::get('config');
     $this->setName("register");
     $this->setAction("");
     $this->setMethod("POST");
     $this->addElementPrefixPath('Reg2_Validate', APPLICATION_PATH . '/../library/Validate/', 'validate');
     $this->addElementPrefixPath('Reg2_Decorator', APPLICATION_PATH . '/../library/Decorators/', 'decorator');
     $this->addPrefixPath('Reg2_Form_Element', APPLICATION_PATH . '/../library/Elements/', 'element');
     $this->setElementDecorators(array('ViewHelper', 'TableRow'));
     if (APPLICATION_ENV == 'production') {
         //    	    $this->addElement('hash', '_confhash', array(
         //            	'required'   => true,
         //            	'ignore'   => true,
         //            ));
     }
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'validators' => array(array('StringLength', true, array(1, 50)), array('UniqueTeamName', true, $this->_tid)), 'required' => true, 'label' => 'Название команды'));
     $this->addElement('text', 'email', array('filters' => array('StringTrim'), 'validators' => array(array('EmailAddress', true)), 'required' => true, 'label' => 'E-mail регистрирующего'));
     $this->addElement('text', 'remail', array('filters' => array('StringTrim'), 'validators' => array(array('EmailAddress', true)), 'required' => false, 'label' => 'Резервный контактный e-mail'));
     $this->addElement('RadioPlus', 'sezon2008', array('multioptions' => array('y' => "Команда играла в сезоне {$config['ichb']['old']['year']} года", 'n' => 'Нет, команда не играла в прошлом сезоне'), 'value' => 'n', 'required' => true, 'label' => "Сезон {$config['ichb']['old']['year']}", 'links' => array('y' => 'oldid')));
     $this->addElement('text', 'oldid', array('filters' => array('StringTrim'), 'validators' => array(array('Digits'), array('ValidRegno', $this->_tid)), 'trim' => true, 'required' => false, 'label' => 'Регистрационный номер команды:', 'decorators' => array(array('Label', array("class" => "required")), 'ViewHelper', array("HtmlTag", array("tag" => "br")))));
     $this->addElement('text', 'url', array('filters' => array('StringTrim'), 'required' => false, 'label' => 'URL командной страницы'));
     $this->addElement('RadioPlus', 'kadres', array('multioptions' => array('kap' => 'Капитан команды', 'reg' => 'Регистрирующий', 'list' => 'Командный лист:', 'other' => 'Другой адрес:'), 'value' => 'kap', 'required' => true, 'label' => 'Контактный адрес', 'links' => array('list' => 'tlist', 'other' => 'dradr')));
     $this->addElement('text', 'tlist', array('filters' => array('StringTrim'), 'validators' => array(array('EmailAddress', true)), 'trim' => true, 'required' => false, 'decorators' => array('ViewHelper')));
     $this->addElement('text', 'dradr', array('filters' => array('StringTrim'), 'validators' => array(array('EmailAddress', true)), 'trim' => true, 'required' => false, 'decorators' => array('ViewHelper')));
     $this->addElement('RadioPlus', 'klist', array('multioptions' => array('y' => 'Капитан подписан на лист', 'n' => 'Капитан не подписан на лист'), 'value' => 'y', 'required' => true, 'label' => 'Лист Совета Капитанов', 'links' => array('n' => array('tsubs', 'tsubs_kod'))));
     $this->addElement('text', 'tsubs', array('filters' => array('StringTrim'), 'validators' => array(array('EmailAddress', true)), 'label' => 'просьба подписать адрес', 'trim' => true, 'required' => false, 'decorators' => array('Label', 'ViewHelper', array("HtmlTag", array("tag" => "br")))));
     $this->addElement('Select', 'tsubs_kod', array('multioptions' => array('koi8' => 'КОИ8', 'translite' => 'translite'), 'value' => 'koi8', 'required' => false, 'label' => 'в', 'decorators' => array('Label', 'ViewHelper')));
     $this->addElement('RadioPlus', 'zlist', array('multioptions' => array('y' => 'Да, команда имеет доступ к материалам листов', 'n' => 'Нет,'), 'value' => 'y', 'required' => true, 'label' => 'Листы Клуба', 'links' => array('n' => array('zsubs', 'zsubs_kod', 'zsubs_list'))));
     $this->addElement('text', 'zsubs', array('filters' => array('StringTrim'), 'validators' => array(array('EmailAddress', true)), 'label' => 'просьба подписать адрес', 'trim' => true, 'required' => false, 'decorators' => array('Label', 'ViewHelper', array("HtmlTag", array("tag" => "br")))));
     $this->addElement('Select', 'zsubs_kod', array('multioptions' => array('koi8' => 'КОИ8', 'translite' => 'translite'), 'value' => 'koi8', 'required' => false, 'label' => 'в', 'decorators' => array('Label', 'ViewHelper')));
     $this->addElement('Select', 'zsubs_list', array('multioptions' => array('ZNATOK' => 'ZNATOK', 'Z-INFO' => 'Z-INFO'), 'value' => 'znatok', 'required' => false, 'label' => 'на лист', 'decorators' => array('Label', 'ViewHelper')));
     $this->addElement('Textarea', 'comment', array('required' => false, 'label' => 'Комментарии', 'cols' => '100'));
     /// Players
     $decorators = array('ViewHelper', array("HtmlTag", array("tag" => "td")));
     $max = Bootstrap::get('model')->getMaxPlayers();
     for ($i = 0; $i < $max; $i++) {
         $who = $i ? "игрока {$i}" : "капитана";
         $this->addElement('checkbox', "pold{$i}", array("decorators" => $decorators));
         $this->addElement('text', "pname{$i}", array('filters' => array('StringTrim'), 'required' => true, 'allowEmpty' => $i != 0, 'autoInsertNotEmptyValidator' => $i == 0, 'class' => "player-req", 'validators' => array(new Reg2_Validate_OldName($i), new Reg2_Validate_UniquePlayerReg($i, $this->_tid)), "decorators" => $decorators, "label" => "Имя {$who}"));
         $val = new Reg2_Validate_PlayerFieldsRequired($i);
         $this->addElement('text', "pfamil{$i}", array('filters' => array('StringTrim'), 'required' => true, 'allowEmpty' => $i != 0, 'autoInsertNotEmptyValidator' => $i == 0, 'class' => "player-req", 'validators' => array($val), "decorators" => $decorators, "label" => "Фамилия {$who}"));
         $this->addElement('text', "pcity{$i}", array('filters' => array('StringTrim'), 'required' => true, 'allowEmpty' => $i != 0, 'autoInsertNotEmptyValidator' => $i == 0, 'class' => "player-req", 'validators' => array($val), "decorators" => $decorators, "label" => "Город {$who}"));
         $this->addElement('text', "pcountry{$i}", array('filters' => array('StringTrim'), 'required' => false, 'class' => 'player', 'validators' => array(new Reg2_Validate_PlayerFieldsRequired($i, true)), "decorators" => $decorators, "label" => "Страна {$who}"));
         // optional - пол, дата рождения, адрес email
         $this->addElement('select', "psex{$i}", array('filters' => array('StringTrim'), 'required' => false, 'multiOptions' => array("" => "", "m" => "М", "f" => "Ж"), 'class' => "short", "decorators" => $decorators, "label" => "Пол {$who}"));
         //        	$this->addElement('DateTextBox', "pbirth$i", array(
         //            	'filters'    => array('StringTrim'),
         //            	'required'   => false,
         //        		'invalidMessage' => 'Неверная дата',
         //        		'formatLength'   => 'short',
         //        		'class'		=> "player",
         //        		'decorators' => array('DijitElement'),
         //        		"value"	=> "1970-01-01",
         //        		"datePattern" => 'yyyy-MM-dd',
         //        	));
         $this->addElement('Date', "pborn{$i}", array('validators' => array(array('Date', true)), "decorators" => array('Date', array("HtmlTag", array("tag" => "td"))), 'label' => "Дата рождения {$who}"));
         $this->addElement('text', "pemail{$i}", array('filters' => array('StringTrim'), 'required' => $i == 0, 'allowEmpty' => $i != 0, 'autoInsertNotEmptyValidator' => $i == 0, 'validators' => array(array('EmailAddress', true), new Reg2_Validate_UniqueKapEmail($i, $this->_tid)), 'class' => "player", "decorators" => $decorators, "label" => "E-mail {$who}"));
     }
     //$form_factory = Zend_Controller_Action_HelperBroker::getExistingHelper('getForm');
     //$players = $form_factory->getForm('PlayerData');
     //$this->addSubForm($players, 'players');
     //        $this->setSubFormDecorators(array(
     //        	array('ViewScript', array("viewScript" => "playerheader.phtml")),
     //   			 'FormElements',
     //    	 	array('HtmlTag', array('tag' => 'p', 'id' => 'players'))
     //		));
     $this->addElement('submit', 'register', array('required' => false, 'ignore' => true, 'label' => 'Зарегистрировать!', 'decorators' => array('ViewHelper')));
 }
Esempio n. 6
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'];
     }
 }
Esempio n. 7
0
 public function teameditAction()
 {
     if (!($id = (int) $this->_getParam('id', false))) {
         return $this->_helper->redirector('index');
     }
     $this->_checkKap($id);
     $this->view->form = $form = $this->_helper->getForm('teamedit', array("tid" => $id, "admin" => $this->_isAdmin));
     $model = Bootstrap::get('model');
     $this->view->maxplayers = $model->getMaxPlayers();
     $this->view->tid = $id;
     $request = $this->getRequest();
     $this->view->isadmin = $this->_isAdmin;
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             $values = $form->getValues();
             if ($form->save->isChecked()) {
                 $result = $model->saveTeamData($values, $this->_isAdmin);
                 $form->reset();
                 $form->populate($model->getTeamData($id));
                 $this->view->error = $result;
             } elseif ($this->_isAdmin && $form->delete->isChecked()) {
                 $model->deleteTeam($id);
                 return $this->_helper->redirector('index', 'admin');
             }
         }
     } else {
         $form->populate($model->getTeamData($id));
     }
     if ($this->_isAdmin) {
         $this->view->data_errors = $model->checkTeamData($form->getValues());
     }
 }