Пример #1
0
 /**
  * @return bool
  */
 public function beforeSave()
 {
     $this->modx->getRequest();
     $ip = $this->modx->request->getClientIp();
     $value = $this->getProperty('value');
     $value = $value > 0 ? 1 : -1;
     $this->object->set('id', $this->comment->get('id'));
     $this->object->set('owner', $this->comment->get('createdby'));
     $this->object->set('class', 'TicketComment');
     $this->object->set('value', $value);
     $this->object->set('ip', $ip['ip']);
     $this->object->set('createdon', date('Y-m-d H:i:s'));
     $this->object->set('createdby', $this->modx->user->get('id'));
     return true;
 }
Пример #2
0
 /**
  * @return bool
  */
 public function beforeSave()
 {
     $this->modx->getRequest();
     $ip = $this->modx->request->getClientIp();
     $value = $this->getProperty('value');
     if ($value > 0) {
         $value = 1;
     } elseif ($value < 0) {
         $value = -1;
     } else {
         $value = 0;
     }
     $this->object->set('id', $this->ticket->id);
     $this->object->set('owner', $this->ticket->createdby);
     $this->object->set('class', 'Ticket');
     $this->object->set('value', $value);
     $this->object->set('ip', $ip['ip']);
     $this->object->set('createdon', date('Y-m-d H:i:s'));
     $this->object->set('createdby', $this->modx->user->id);
     return true;
 }