setActivityByChatAndOnlineUser() 공개 정적인 메소드

public static setActivityByChatAndOnlineUser ( $chat, erLhcoreClassModelChatOnlineUser $onlineUser ) : integer
$onlineUser erLhcoreClassModelChatOnlineUser
리턴 integer
 public function __get($var)
 {
     switch ($var) {
         case 'time_created_front':
             $this->time_created_front = date('Ymd') == date('Ymd', $this->time) ? date(erLhcoreClassModule::$dateHourFormat, $this->time) : date(erLhcoreClassModule::$dateDateHourFormat, $this->time);
             return $this->time_created_front;
             break;
         case 'user_closed_ts_front':
             $this->user_closed_ts_front = date('Ymd') == date('Ymd', $this->user_closed_ts) ? date(erLhcoreClassModule::$dateHourFormat, $this->user_closed_ts) : date(erLhcoreClassModule::$dateDateHourFormat, $this->user_closed_ts);
             return $this->user_closed_ts_front;
             break;
         case 'is_operator_typing':
             $this->is_operator_typing = $this->operator_typing > time() - 60;
             // typing is considered if status did not changed for 30 seconds
             return $this->is_operator_typing;
             break;
         case 'is_user_typing':
             $this->is_user_typing = $this->user_typing > time() - 10;
             // typing is considered if status did not changed for 30 seconds
             return $this->is_user_typing;
             break;
         case 'wait_time_seconds':
             $this->wait_time_seconds = time() - $this->time;
             return $this->wait_time_seconds;
         case 'wait_time_front':
             $this->wait_time_front = erLhcoreClassChat::formatSeconds($this->wait_time);
             return $this->wait_time_front;
             break;
         case 'wait_time_pending':
             $this->wait_time_pending = erLhcoreClassChat::formatSeconds(time() - $this->time);
             return $this->wait_time_pending;
             break;
         case 'chat_duration_front':
             $this->chat_duration_front = erLhcoreClassChat::formatSeconds($this->chat_duration);
             return $this->chat_duration_front;
             break;
         case 'user_name':
             return $this->user_name = (string) $this->user;
             break;
         case 'plain_user_name':
             $this->plain_user_name = false;
             if ($this->user !== false) {
                 $this->plain_user_name = (string) $this->user->name_support;
             }
             return $this->plain_user_name;
             break;
         case 'user':
             $this->user = false;
             if ($this->user_id > 0) {
                 try {
                     $this->user = erLhcoreClassModelUser::fetch($this->user_id, true);
                 } catch (Exception $e) {
                     $this->user = false;
                 }
             }
             return $this->user;
             break;
         case 'operator_typing_user':
             $this->operator_typing_user = false;
             if ($this->operator_typing_id > 0) {
                 try {
                     $this->operator_typing_user = erLhcoreClassModelUser::fetch($this->operator_typing_id);
                 } catch (Exception $e) {
                     $this->operator_typing_user = false;
                 }
             }
             return $this->operator_typing_user;
             break;
         case 'online_user':
             $this->online_user = false;
             if ($this->online_user_id > 0) {
                 try {
                     $this->online_user = erLhcoreClassModelChatOnlineUser::fetch($this->online_user_id);
                 } catch (Exception $e) {
                     $this->online_user = false;
                 }
             }
             return $this->online_user;
             break;
         case 'department':
             $this->department = false;
             if ($this->dep_id > 0) {
                 try {
                     $this->department = erLhcoreClassModelDepartament::fetch($this->dep_id, true);
                 } catch (Exception $e) {
                 }
             }
             return $this->department;
             break;
         case 'product':
             $this->product = false;
             if ($this->product_id > 0) {
                 try {
                     $this->product = erLhAbstractModelProduct::fetch($this->product_id, true);
                 } catch (Exception $e) {
                 }
             }
             return $this->product;
             break;
         case 'product_name':
             $this->product_name = (string) $this->product;
             return $this->product_name;
             break;
         case 'department_name':
             return $this->department_name = (string) $this->department;
             break;
         case 'number_in_queue':
             $this->number_in_queue = 1;
             if ($this->status == self::STATUS_PENDING_CHAT) {
                 $this->number_in_queue = erLhcoreClassChat::getCount(array('filterlt' => array('id' => $this->id), 'filter' => array('dep_id' => $this->dep_id, 'status' => self::STATUS_PENDING_CHAT))) + 1;
             }
             return $this->number_in_queue;
             break;
         case 'screenshot':
             $this->screenshot = false;
             if ($this->screenshot_id > 0) {
                 try {
                     $this->screenshot = erLhcoreClassModelChatFile::fetch($this->screenshot_id);
                 } catch (Exception $e) {
                 }
             }
             return $this->screenshot;
             break;
         case 'unread_time':
             $diff = time() - $this->last_user_msg_time;
             $hours = floor($diff / 3600);
             $minits = floor(($diff - $hours * 3600) / 60);
             $seconds = $diff - $hours * 3600 - $minits * 60;
             $this->unread_time = array('hours' => $hours, 'minits' => $minits, 'seconds' => $seconds);
             return $this->unread_time;
             break;
         case 'user_tz_identifier_time':
             $date = new DateTime(null, new DateTimeZone($this->user_tz_identifier));
             $this->user_tz_identifier_time = $date->format(erLhcoreClassModule::$dateHourFormat);
             return $this->user_tz_identifier_time;
             break;
         case 'additional_data_array':
             $jsonData = json_decode($this->additional_data);
             if ($jsonData !== null) {
                 $this->additional_data_array = $jsonData;
             } else {
                 $this->additional_data_array = $this->additional_data;
             }
             return $this->additional_data_array;
             break;
         case 'chat_variables_array':
             if (!empty($this->chat_variables)) {
                 $jsonData = json_decode($this->chat_variables, true);
                 if ($jsonData !== null) {
                     $this->chat_variables_array = $jsonData;
                 } else {
                     $this->chat_variables_array = $this->chat_variables;
                 }
             } else {
                 $this->chat_variables_array = $this->chat_variables;
             }
             return $this->chat_variables_array;
             break;
         case 'user_status_front':
             if ($this->online_user !== false) {
                 $this->user_status_front = erLhcoreClassChat::setActivityByChatAndOnlineUser($this, $this->online_user);
             } else {
                 $this->user_status_front = $this->user_status == self::USER_STATUS_JOINED_CHAT ? 0 : 1;
             }
             return $this->user_status_front;
             break;
         default:
             break;
     }
 }