Index: /pro-violet-viettel/www/deploy/api/platform/modules/space/actions/actions.class.php
===================================================================
--- /pro-violet-viettel/www/deploy/api/platform/modules/space/actions/actions.class.php	(revision 854)
+++ /pro-violet-viettel/www/deploy/api/platform/modules/space/actions/actions.class.php	(revision 855)
@@ -140,5 +140,5 @@
     }
 
-    private function ChangeParentDir($item, $destination) {
+    private function changeParentDir($item, $destination) {
         if ($item->type == 'directory') {
             $tblfile = TblspacefilePeer::retrieveByPk($item->id);
@@ -154,53 +154,4 @@
         return $item;
     }
-
-    private function CreatePreview($fileurl, $userId, $fileid) {
-    	$url = "https://docs.google.com/gview?url=" .urlencode($fileurl) . "";
-    	file_put_contents("1.html", $url);
-    	$content="";
-    	$ch = curl_init();
-    	curl_setopt($ch, CURLOPT_URL, $url);
-    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
-    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-    	$content = curl_exec($ch);
-    	file_put_contents("1.html", $content);
-    	preg_match("'img\?id\\\u003d(.*?)%3D'si", $content, $matches);
-    	$count=0;
-    	if (isset($matches[1]))
-    	{
-    		$id = $matches[1];
-    		$count=0;
-    		for ($i = 0; $i <= 20; $i++) {
-    			$imgurl = "https://docs.google.com/viewerng/img?id=" . $id . "&w=600&page=" . $i;
-    			$ch = curl_init();
-    			curl_setopt($ch, CURLOPT_URL, $imgurl);
-    			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
-    			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-    			$image = curl_exec($ch);
-    			$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-    			if ($code == 200)
-    			{
-    
-    				$count++;
-    				if (!file_exists('previews/'. $userId."/")) {
-    					mkdir('previews/'. $userId."/", 0777, true);
-    				}
-    
-    				if (!file_exists('previews/'. $userId."/".$fileid."/")) {
-    
-    					mkdir('previews/'. $userId."/".$fileid."/", 0777, true);
-    
-    				}
-    				file_put_contents("previews/" . $userId . "/" . $fileid . "/" . $i . ".png", $image);
-    
-    			} else {
-    				break;
-    			}
-    		}
-    
-    	}
-    	return $count;
-    }    
-    
     public function executePreview(){
         $fileId = $this->getRequestParameter('fileId');
@@ -219,5 +170,5 @@
             $fileName = $tblres->getFullFilename(); 
             $fileUrl = str_replace("/srv/www/violet/web", "http://sbgapi.violet.vn", $fileName);
-            $count=$this->CreatePreview($fileUrl, $userId, $fileId);
+            $count=$this->createPreview($fileUrl, $userId, $fileId);
         }
         $data['fileid']=$fileId;
@@ -395,5 +346,5 @@
                     }
                 } else if ($act == 'move') {
-                    $this->ChangeParentDir($treeObj, $destination);
+                    $this->changeParentDir($treeObj, $destination);
                     if ($treeObj->type == 'directory')
                         $aryNewTree['DIRECTORIES'][] = $treeObj;
@@ -427,5 +378,4 @@
         $fileError = $this->getRequest()->hasFileError($file);
         $fileErrorNum = $this->getRequest()->getFileError($file);
-
         if ($fileErrorNum || $fileError)
             return false;
@@ -449,8 +399,10 @@
         $ext = pathinfo($fileUrl, PATHINFO_EXTENSION);
         $ext = strtolower($ext);
+        
         if (in_array($ext, array("ppt","xls","doc","pdf","docx","pptx","xlsx"))) 
         { 
-            $this->CreatePreview($fileUrl, $userId, $tblfile->getFileId());
-        }
+            $this->createPreview($fileUrl, $userId, $tblfile->getFileId());
+        }
+        
         if ($response == 1) {
             $aryError = array('err' => "", 'errCode' => 0);
@@ -465,8 +417,60 @@
             );
             $aryData = array('DIRECTORIES' => array(), 'FILES' => $aryFiles, 'ERROR' => $aryError);
-            echo json_encode($aryData); 
+            
+            $jsonData = json_encode($aryData);
+            echo $jsonData;
         }
 
         return sfView::NONE;
+    }
+
+    private function createPreview($fileurl, $userId, $fileid) {
+
+       
+        $url = "https://docs.google.com/gview?url=" .urlencode($fileurl) . "";
+        file_put_contents("1.html", $url);
+        $content="";
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        $content = curl_exec($ch);
+       file_put_contents("1.html", $content);
+        preg_match("'img\?id\\\u003d(.*?)%3D'si", $content, $matches);
+        $count=0;
+        if (isset($matches[1]))
+        {
+        $id = $matches[1];
+        $count=0;
+        for ($i = 0; $i <= 20; $i++) {
+            $imgurl = "https://docs.google.com/viewerng/img?id=" . $id . "&w=600&page=" . $i;
+            $ch = curl_init();
+            curl_setopt($ch, CURLOPT_URL, $imgurl);
+            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+            $image = curl_exec($ch); 
+            $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+            if ($code == 200) 
+            {
+                
+                $count++;
+                if (!file_exists('previews/'. $userId."/")) {
+                    mkdir('previews/'. $userId."/", 0777, true); 
+                }
+                
+                if (!file_exists('previews/'. $userId."/".$fileid."/")) {
+                    
+                    mkdir('previews/'. $userId."/".$fileid."/", 0777, true); 
+                    
+                }
+                file_put_contents("previews/" . $userId . "/" . $fileid . "/" . $i . ".png", $image);
+
+            } else {
+                break;
+            }
+        }
+        
+        }
+        return $count;
     }
 
@@ -539,5 +543,10 @@
         return sfView::NONE;
     }
-
+    public function executeGetFiles()
+    {
+       $tblfile = TblspacefilePeer::retrieveByPk(64);
+       print_r($tblfile);
+      return sfView::NONE;
+    }
 }
 
