Esempio n. 1
0
 /**
  * Overloaded to allow setting the status value - so we can intercept with the appropriate
  *  status method (confirm() unconfirm() ban())
  *
  * @ignore
  * {@inheritdoc}
  */
 public function __set($name, $value)
 {
     if ($name == 'status') {
         if ($value == -1) {
             return $this->ban();
         }
         if ($value == 0) {
             return $this->unconfirm();
         }
         if ($value == 1) {
             return $this->confirm();
         }
     }
     //Don't allow changing wins during active-groups, only during brackets
     if ($name == 'wins') {
         if (BBHelper::tournament_in_group_rounds($this->tournament())) {
             return;
         }
     }
     //Special handling for setting race value - he could be changing it by ID or by Name
     if ($name == 'race') {
         //Don't bother if we've already saved a value in new_data
         if (!isset($this->new_data['race'])) {
             //Treat it as an attempt to define by race id integer
             if (is_numeric($value)) {
                 //The value is not new, don't save
                 if ($value == $this->race_id) {
                     return;
                 }
             } else {
                 if ($value == $this->race) {
                     return;
                 }
             }
         }
     }
     parent::__set($name, $value);
 }