Ejemplo n.º 1
0
 public function AjaxFilesCopy()
 {
     $oAccount = $this->getDefaultAccountFromParam();
     if (!$this->oApiCapability->IsFilesSupported($oAccount)) {
         throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::FilesNotAllowed);
     }
     $sFromType = $this->getParamValue('FromType');
     $sToType = $this->getParamValue('ToType');
     $sFromPath = $this->getParamValue('FromPath');
     $sToPath = $this->getParamValue('ToPath');
     $aItems = @json_decode($this->getParamValue('Files'), true);
     $oResult = null;
     foreach ($aItems as $aItem) {
         $sNewName = $this->oApiFilestorage->GetNonExistingFileName($oAccount, $sToType, $sToPath, $aItem['Name']);
         $oResult = $this->oApiFilestorage->Copy($oAccount, $sFromType, $sToType, $sFromPath, $sToPath, $aItem['Name'], $sNewName);
     }
     return $this->DefaultResponse($oAccount, __FUNCTION__, $oResult);
 }