public function actionAjaxGetPointScreen()
 {
     error_reporting(E_ALL);
     $answ = array('err', '');
     if (isset($_POST['pointId']) && isset($_POST['pointIp'])) {
         $pointId = $_POST['pointId'];
         $pointIp = $_POST['pointIp'];
         $monitoring = new Monitoring();
         //$url = 'http://local.planner.rtvgroup.com.ua/images/screenshot.jpg';
         $url = 'http://' . $pointIp . '/screenshot.jpg';
         $appendPath = '/spool/points/' . $pointId;
         $contentPath = YiiBase::getPathOfAlias('webroot');
         $imgPath = $contentPath . $appendPath;
         //maybe this dir doesnt exist
         $pathAppendix = explode("/", $appendPath);
         foreach ($pathAppendix as $folder) {
             $contentPath .= "/" . $folder;
             if (!file_exists($contentPath) && !is_dir($contentPath)) {
                 mkdir($contentPath);
             }
         }
         $files = scandir($imgPath);
         if ($files > 0) {
             $entrance = false;
             foreach ($files as $file) {
                 error_log($file);
                 $res = $monitoring->prapareScreenshot($file, $imgPath, $url);
                 if ($res != false) {
                     error_log("res1 " . json_encode($entrance));
                     $entrance = true;
                     $answ = array('ok', $res);
                 }
             }
             if (!$entrance) {
                 error_log("res2 " . json_encode($entrance));
                 $res = $monitoring->receiveScreenshot($imgPath, $url);
                 error_log(json_encode($res));
                 if ($res != false) {
                     $answ = array('ok', $res);
                 }
             }
         } else {
             $res = $monitoring->receiveScreenshot($imgPath, $url);
             if ($res != false) {
                 $answ = array('ok', $res);
             }
         }
     }
     echo json_encode($answ);
 }