Ejemplo n.º 1
0
 public function isValid($value)
 {
     $this->_setValue($value);
     $team = Reg2_Model_Data::getModel()->findTeamByName($value);
     if ($team && $team->tid != $this->_tid) {
         $this->_error(self::NAME_EXIST);
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 public function isValid($value, $context = null)
 {
     if (is_array($context) && !empty($context["pold" . $this->_id]) && $context["pold" . $this->_id] == 1 && !empty($context["pname" . $this->_id]) && !empty($context["pfamil" . $this->_id])) {
         $p = Reg2_Model_Data::getModel()->findPlayerByName($context["pname" . $this->_id], $context["pfamil" . $this->_id]);
         if (!$p) {
             $this->_setValue($context["pname" . $this->_id] . " " . $context["pfamil" . $this->_id]);
             $this->_error(self::NAME_NOT_OLD);
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 3
0
 public function isValid($value, $context = null)
 {
     if (is_array($context) && !empty($context["pname" . $this->_id]) && !empty($context["pfamil" . $this->_id])) {
         $regs = Reg2_Model_Data::getModel()->findRegByName($context["pname" . $this->_id], $context["pfamil" . $this->_id]);
         foreach ($regs as $reg) {
             if ($context["poldid" . $this->_id] == $reg["uid"]) {
                 continue;
             }
             if ($context["pid" . $this->_id] == $reg["uid"]) {
                 continue;
             }
             if ($this->_tid == $reg["tid"]) {
                 continue;
             }
             $this->team = $reg["tname"];
             $this->_setValue($context["pname" . $this->_id] . " " . $context["pfamil" . $this->_id]);
             $this->_error(self::PLAYER_ALREADY);
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 4
0
 public function isValid($value, $context = null)
 {
     $this->_setValue($value);
     if (!$value) {
         return true;
     }
     // find new teams by regno
     $team = Reg2_Model_Data::getModel()->findTeamByRegno($value, true);
     if ($team && $team->tid != $this->_tid) {
         $this->_error(self::REGNO_REGISTERED);
         return false;
     }
     if (is_array($context) && isset($context["sezon2008"]) && $context["sezon2008"] == 'y') {
         // find old team by regno
         $team = Reg2_Model_Data::getModel()->findTeamByRegno((int) $value, false);
         if (!$team) {
             $this->_error(self::REGNO_MISSING);
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 5
0
 public function isValid($value, $context = null)
 {
     $this->_setValue($value);
     if ($this->_id > 0) {
         return true;
     }
     Zend_Registry::get('log')->info("Unique kap: {$value} {$this->_tid}.");
     if ($value) {
         $user = Reg2_Model_Data::getModel()->findUserByEmail($value);
         if ($user && $user->tid != $this->_tid && $user->tid != 0) {
             $team = Reg2_Model_Data::getModel()->findTeam($user->tid);
             $this->team = $team->imia;
             if (!empty($context["pold0"]) || !empty($context['pid0']) && ($context['name'] == $team->imia || $context['oldid'] == $team->regno)) {
                 return true;
             }
             Zend_Registry::get('log')->info("Unique kap fail: {$value} {$this->_tid} team: {$user->tid} ");
             $this->_error(self::MAIL_ALREADY);
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 6
0
 public function regnoAction()
 {
     $model = Reg2_Model_Data::getModel();
     $teams = $model->getTeams();
     $teamdata = array();
     $tnames = array();
     $i = 0;
     foreach ($teams as $team) {
         $teamdata["regno{$i}"] = $team->regno;
         $teamdata["tid{$i}"] = $team->tid;
         $tnames[$i] = $team->imia;
         $i++;
     }
     $this->view->teamcount = $i;
     $this->view->form = $form = $this->_helper->getForm('regno', array("teams" => $tnames));
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             $values = $form->getValues();
             $result = $model->saveTeamRegno($values);
             $this->view->error = $result;
         }
     } else {
         $form->populate($teamdata);
     }
 }
Ejemplo n.º 7
0
 public function regnoAction()
 {
     $this->view->teams = Reg2_Model_Data::getModel()->getTeamsRegno();
 }