/**
  * @param array $element
  * @param bool  $showUser
  * @param null  $serviceName
  * @return array
  */
 public static function getOnlineLastSession(array $element, $showUser = false, $serviceName = null)
 {
     //sort by CREATED_TIMESTAMP to get last link
     $filter = array('IBLOCK_ID' => $element['IBLOCK_ID'], 'SECTION_ID' => $element['SECTION_ID'], 'ELEMENT_ID' => $element['ELEMENT_ID']);
     if (!is_null($serviceName)) {
         $filter['SERVICE'] = $serviceName;
     }
     $select = array();
     if ($showUser) {
         $select = array('USER');
     }
     $onlineSession = CWebDavLogOnlineEdit::getList(array('CREATED_TIMESTAMP' => 'DESC'), $filter, $select);
     if ($onlineSession) {
         $onlineSession = $onlineSession->fetch();
     }
     return is_array($onlineSession) ? $onlineSession : array();
 }
 /**
  * @return bool
  */
 protected function isLastSession()
 {
     if ($this->isExclusiveEdit()) {
         return true;
     }
     //todo query count
     //check: this is last session?
     $webdav = $this->getWebdav();
     $onlineEditor = CWebDavLogOnlineEdit::getList(array(), array('IBLOCK_ID' => $webdav->arParams['element_array']['IBLOCK_ID'], 'SECTION_ID' => $webdav->arParams['element_array']['IBLOCK_SECTION_ID'], 'ELEMENT_ID' => $webdav->arParams['element_array']['ID'], 'SERVICE' => $this->getServiceName(), 'SERVICE_FILE_ID' => $this->getFileId()));
     if ($onlineEditor) {
         return !(bool) $onlineEditor->fetch();
     }
     return true;
 }