本文整理汇总了PHP中AppDocument::getDocVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP AppDocument::getDocVersion方法的具体用法?PHP AppDocument::getDocVersion怎么用?PHP AppDocument::getDocVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppDocument
的用法示例。
在下文中一共展示了AppDocument::getDocVersion方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AppDocument
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
require_once "classes/model/AppDocumentPeer.php";
$oAppDocument = new AppDocument();
if (!isset($_GET['v'])) {
//Load last version of the document
$docVersion = $oAppDocument->getLastAppDocVersion($_GET['a']);
} else {
$docVersion = $_GET['v'];
}
$oAppDocument->Fields = $oAppDocument->load($_GET['a'], $docVersion);
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = $info['extension'];
if (isset($_GET['b'])) {
if ($_GET['b'] == '0') {
$bDownload = false;
} else {
$bDownload = true;
}
} else {
$bDownload = true;
}
$realPath = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/' . $sAppDocUid . '_' . $iDocVersion . '.' . $ext;
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/' . $sAppDocUid . '.' . $ext;
$sw_file_exists = false;
if (file_exists($realPath)) {
示例2: switch
$Fields['DEL_INDEX'] = $_SESSION['INDEX'];
$Fields['TAS_UID'] = $_SESSION['TASK'];
//Execute after triggers - End
//Save data - Start
$oCase->updateCase($_SESSION['APPLICATION'], $Fields);
//Save data - End
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
$sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
$oData['APP_UID'] = $_SESSION['APPLICATION'];
$oData['ATTACHMENT_FOLDER'] = true;
switch ($aOD['OUT_DOC_GENERATE']) {
case "BOTH":
$documentData = new uploadDocumentData($_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $pathOutput . $sFilename . '.pdf', $sFilenameOriginal . '.pdf', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "PDF";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
//Only delete if the file was saved correctly
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
//$oAppDocument = new AppDocument();
//$oAppDocument->update($aFields);
unlink($pathOutput . $sFilename . '.pdf');
}
$documentData = new uploadDocumentData($_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $pathOutput . $sFilename . '.doc', $sFilenameOriginal . '.doc', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "DOC";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
示例3: addCasesOutputDocument
//.........这里部分代码省略.........
//create
if ($lastDocVersion == 0) {
$lastDocVersion ++;
}
$aFields = array ('APP_UID' => $sApplication,'DEL_INDEX' => $index,'DOC_UID' => $outputID,'DOC_VERSION' => $lastDocVersion,'USR_UID' => $sUserLogged,'APP_DOC_TYPE' => 'OUTPUT','APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_FILENAME' => $sFilename,'FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags
);
$oAppDocument = new \AppDocument();
$aFields['APP_DOC_UID'] = $sDocUID = $oAppDocument->create( $aFields );
}
}
$sFilename = $aFields['APP_DOC_UID'] . "_" . $lastDocVersion;
$pathOutput = PATH_DOCUMENT . \G::getPathFromUID($sApplication) . PATH_SEP . 'outdocs' . PATH_SEP; //G::pr($sFilename);die;
\G::mk_dir( $pathOutput );
$aProperties = array ();
if (! isset( $aOD['OUT_DOC_MEDIA'] )) {
$aOD['OUT_DOC_MEDIA'] = 'Letter';
}
if (! isset( $aOD['OUT_DOC_LEFT_MARGIN'] )) {
$aOD['OUT_DOC_LEFT_MARGIN'] = '15';
}
if (! isset( $aOD['OUT_DOC_RIGHT_MARGIN'] )) {
$aOD['OUT_DOC_RIGHT_MARGIN'] = '15';
}
if (! isset( $aOD['OUT_DOC_TOP_MARGIN'] )) {
$aOD['OUT_DOC_TOP_MARGIN'] = '15';
}
if (! isset( $aOD['OUT_DOC_BOTTOM_MARGIN'] )) {
$aOD['OUT_DOC_BOTTOM_MARGIN'] = '15';
}
$aProperties['media'] = $aOD['OUT_DOC_MEDIA'];
$aProperties['margins'] = array ('left' => $aOD['OUT_DOC_LEFT_MARGIN'],'right' => $aOD['OUT_DOC_RIGHT_MARGIN'],'top' => $aOD['OUT_DOC_TOP_MARGIN'],'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN']
);
if (isset($aOD['OUT_DOC_REPORT_GENERATOR'])) {
$aProperties['report_generator'] = $aOD['OUT_DOC_REPORT_GENERATOR'];
}
$this->generate( $outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties , $applicationUid);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
//G::LoadClass('plugin');
$oPluginRegistry = & \PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
$oAppDocument1 = new \AppDocument();
$oAppDocument1->update( $aFields );
$sPathName = PATH_DOCUMENT . \G::getPathFromUID($sApplication) . PATH_SEP;
$oData['APP_UID'] = $sApplication;
$oData['ATTACHMENT_FOLDER'] = true;
switch ($aOD['OUT_DOC_GENERATE']) {
case "BOTH":
$documentData = new \uploadDocumentData( $sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion() );
$documentData->sFileType = "PDF";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink( $pathOutput . $sFilename . '.pdf' );
}
$documentData = new \uploadDocumentData( $sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion() );
$documentData->sFileType = "DOC";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink( $pathOutput . $sFilename . '.doc' );
}
break;
case "PDF":
$documentData = new \uploadDocumentData( $sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion() );
$documentData->sFileType = "PDF";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink( $pathOutput . $sFilename . '.pdf' );
}
break;
case "DOC":
$documentData = new \uploadDocumentData( $sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion() );
$documentData->sFileType = "DOC";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink( $pathOutput . $sFilename . '.doc' );
}
break;
}
}
$g->sessionVarRestore();
$oAppDocument = \AppDocumentPeer::retrieveByPK( $aFields['APP_DOC_UID'], $lastDocVersion);
if ($oAppDocument->getAppDocStatus() == 'DELETED') {
$oAppDocument->setAppDocStatus('ACTIVE');
$oAppDocument->save();
}
$response = $this->getCasesOutputDocument($applicationUid, $userUid, $aFields['APP_DOC_UID']);
return $response;
} catch (\Exception $e) {
throw $e;
}
}
示例4: addInputDocument
//.........这里部分代码省略.........
"DOC_UID" => $inputDocumentUid,
"APP_DOC_TYPE" => $appDocType,
"APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"),
"APP_DOC_COMMENT" => $appDocComment,
"APP_DOC_TITLE" => "",
"APP_DOC_FILENAME" => $appDocFileName,
"FOLDER_UID" => $folderId,
"APP_DOC_TAGS" => $tags
);
$appDocument->create($arrayField);
break;
}
//Save the file
$appDocUid = $appDocument->getAppDocUid();
$docVersion = $appDocument->getDocVersion();
$arrayInfo = pathinfo($appDocument->getAppDocFilename());
$extension = (isset($arrayInfo["extension"])) ? $arrayInfo["extension"] : null;
$strPathName = PATH_DOCUMENT . G::getPathFromUID($applicationUid) . PATH_SEP;
$strFileName = $appDocUid . "_" . $docVersion . "." . $extension;
switch ($option) {
case "xmlform":
G::uploadFile($fileTmpName, $strPathName, $strFileName);
break;
case "file":
$umaskOld = umask(0);
if (!is_dir($strPathName)) {
G::verifyPath($strPathName, true);
}
示例5: array
} else {
$fields = array (
'APP_UID' => $_REQUEST['APP_UID'],
'DEL_INDEX' => $_REQUEST ['DEL_INDEX'],
'USR_UID' => $casesFields['APP_DATA']['USER_LOGGED'],
'DOC_UID' => - 1,
'APP_DOC_TYPE' => 'ATTACHED',
'APP_DOC_CREATE_DATE' => date ( 'Y-m-d H:i:s' ),
'APP_DOC_COMMENT' => '',
'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $_FILES ['form'] ['name'] [$fieldName]
);
}
$appDocument->create($fields);
$docVersion = $appDocument->getDocVersion();
$appDocUid = $appDocument->getAppDocUid ();
$info = pathinfo ( $appDocument->getAppDocFilename () );
$extension = (isset ( $info ['extension'] ) ? $info ['extension'] : '');
$pathName = PATH_DOCUMENT . $_REQUEST['APP_UID'] . PATH_SEP;
$fileName = $appDocUid . '_'.$docVersion.'.' . $extension;
G::uploadFile ( $_FILES ['form'] ['tmp_name'] [$fieldName], $pathName, $fileName );
}
}
}
$assign = $result['message'];
$aMessage['MESSAGE'] = '<strong>The information was submitted. Thank you.</strong>';
} else {
throw new Exception('An error occurred while the application was being processed.<br /><br />
示例6: PMFGenerateOutputDocument
//.........这里部分代码省略.........
}
} else {
////No versioning so Update a current Output or Create new if no exist
if ($aRow = $oDataset->getRow()) {
//Update
$aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], 'APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
$oAppDocument = new AppDocument();
$oAppDocument->update($aFields);
$sDocUID = $aRow['APP_DOC_UID'];
} else {
//we are creating the appdocument row
//create
if ($lastDocVersion == 0) {
$lastDocVersion++;
}
$aFields = array('APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
$oAppDocument = new AppDocument();
$aFields['APP_DOC_UID'] = $sDocUID = $oAppDocument->create($aFields);
}
}
$sFilename = $aFields['APP_DOC_UID'] . "_" . $lastDocVersion;
$pathOutput = PATH_DOCUMENT . G::getPathFromUID($sApplication) . PATH_SEP . 'outdocs' . PATH_SEP;
//G::pr($sFilename);die;
G::mk_dir($pathOutput);
$aProperties = array();
if (!isset($aOD['OUT_DOC_MEDIA'])) {
$aOD['OUT_DOC_MEDIA'] = 'Letter';
}
if (!isset($aOD['OUT_DOC_LEFT_MARGIN'])) {
$aOD['OUT_DOC_LEFT_MARGIN'] = '15';
}
if (!isset($aOD['OUT_DOC_RIGHT_MARGIN'])) {
$aOD['OUT_DOC_RIGHT_MARGIN'] = '15';
}
if (!isset($aOD['OUT_DOC_TOP_MARGIN'])) {
$aOD['OUT_DOC_TOP_MARGIN'] = '15';
}
if (!isset($aOD['OUT_DOC_BOTTOM_MARGIN'])) {
$aOD['OUT_DOC_BOTTOM_MARGIN'] = '15';
}
$aProperties['media'] = $aOD['OUT_DOC_MEDIA'];
$aProperties['margins'] = array('left' => $aOD['OUT_DOC_LEFT_MARGIN'], 'right' => $aOD['OUT_DOC_RIGHT_MARGIN'], 'top' => $aOD['OUT_DOC_TOP_MARGIN'], 'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN']);
if (isset($aOD['OUT_DOC_REPORT_GENERATOR'])) {
$aProperties['report_generator'] = $aOD['OUT_DOC_REPORT_GENERATOR'];
}
$oOutputDocument->generate($outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (bool) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
//G::LoadClass('plugin');
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
$oAppDocument1 = new AppDocument();
$oAppDocument1->update($aFields);
$sPathName = PATH_DOCUMENT . G::getPathFromUID($sApplication) . PATH_SEP;
$oData['APP_UID'] = $sApplication;
$oData['ATTACHMENT_FOLDER'] = true;
switch ($aOD['OUT_DOC_GENERATE']) {
case "BOTH":
$documentData = new uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "PDF";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink($pathOutput . $sFilename . '.pdf');
}
$documentData = new uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "DOC";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink($pathOutput . $sFilename . '.doc');
}
break;
case "PDF":
$documentData = new uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "PDF";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink($pathOutput . $sFilename . '.pdf');
}
break;
case "DOC":
$documentData = new uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "DOC";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink($pathOutput . $sFilename . '.doc');
}
break;
}
}
$g->sessionVarRestore();
}
示例7: documentUploadFiles
/**
* second step for upload file
* upload file in foler app_uid
*
* @param $userUid
* @param $Fields
* @param $type
* @throws \Exception
*/
public function documentUploadFiles($userUid, $app_uid, $app_doc_uid, $request_data)
{
$response = array("status" => "fail");
if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
$arrayField = array ();
$arrayFileName = array ();
$arrayFileTmpName = array ();
$arrayFileError = array ();
$i = 0;
foreach ($_FILES["form"]["name"] as $fieldIndex => $fieldValue) {
if (is_array( $fieldValue )) {
foreach ($fieldValue as $index => $value) {
if (is_array( $value )) {
foreach ($value as $grdFieldIndex => $grdFieldValue) {
$arrayField[$i]["grdName"] = $fieldIndex;
$arrayField[$i]["grdFieldName"] = $grdFieldIndex;
$arrayField[$i]["index"] = $index;
$arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex][$index][$grdFieldIndex];
$arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex][$index][$grdFieldIndex];
$arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex][$index][$grdFieldIndex];
$i = $i + 1;
}
}
}
} else {
$arrayField[$i] = $fieldIndex;
$arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex];
$arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex];
$arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex];
$i = $i + 1;
}
}
if (count( $arrayField ) > 0) {
for ($i = 0; $i <= count( $arrayField ) - 1; $i ++) {
if ($arrayFileError[$i] == 0) {
$indocUid = null;
$fieldName = null;
$fileSizeByField = 0;
$oAppDocument = new \AppDocument();
$aAux = $oAppDocument->load($app_doc_uid);
$iDocVersion = $oAppDocument->getDocVersion();
$sAppDocUid = $oAppDocument->getAppDocUid();
$aInfo = pathinfo( $oAppDocument->getAppDocFilename() );
$sExtension = ((isset( $aInfo["extension"] )) ? $aInfo["extension"] : "");
$pathUID = G::getPathFromUID($app_uid);
$sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP;
$sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension;
G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName );
$response = array("status" => "ok");
}
}
}
}
return $response;
}
示例8: uploadExternalDocument
//.........这里部分代码省略.........
'USR_UID' => $_SESSION['USER_LOGGED'],
'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
$_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags
);
$oAppDocument->create($aFields);
break;
default:
//New
$aFields = array(
'APP_UID' => $appId,
'DEL_INDEX' => isset($_SESSION['INDEX'])?$_SESSION['INDEX']:1,
'USR_UID' => $_SESSION['USER_LOGGED'],
'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
$_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags
);
$oAppDocument->create($aFields);
break;
}
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = (isset($info['extension']) ? $info['extension'] : '');
//save the file
//if (!empty($_FILES['form'])) {
//if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
$sPathName = PATH_DOCUMENT . G::getPathFromUID($appId) . PATH_SEP;
$file = G::getPathFromFileUID($appId, $sAppDocUid);
$sPathName .= $file[0];
$sFileName = $file[1] . "_" . $iDocVersion . '.' . $ext;
G::uploadFile($fileObj['tempName'], $sPathName, $sFileName); //upload
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger (PM_UPLOAD_DOCUMENT) && class_exists ('uploadDocumentData')) {
$oData['APP_UID'] = $appId;
$documentData = new uploadDocumentData (
$appId,
$_SESSION['USER_LOGGED'],
$sPathName . $sFileName,
$fileObj['fileName'],
$sAppDocUid
);
//$oPluginRegistry->executeTriggers (PM_UPLOAD_DOCUMENT , $documentData);
//unlink ($sPathName . $sFileName);
}
//end plugin
if ($sw_error) {
// there were errors
$err_msg="";
for ($i=0; $i<$uploadedInstances; $i++) {
示例9: addCasesOutputDocument
//.........这里部分代码省略.........
$dataUser = $user->load($userUid);
$pmDrive->setDriveUser($dataUser['USR_EMAIL']);
$appData = $app->Load($applicationUid);
if ($appData['APP_DRIVE_FOLDER_UID'] == null) {
$process = new \Process();
$process->setProUid($appData['PRO_UID']);
$result = $pmDrive->createFolder($process->getProTitle() . ' - ' . G::LoadTranslation("ID_CASE") . ' #' . $appData['APP_NUMBER'], $pmDrive->getFolderIdPMDrive($userUid));
$appData['APP_DRIVE_FOLDER_UID'] = $result->id;
$app->update($appData);
}
$fileIdDriveDoc = '';
$fileIdDrivePdf = '';
$sFilenameOriginal = preg_replace('[^A-Za-z0-9_]', '_', \G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
switch ($aOD['OUT_DOC_GENERATE']) {
case "BOTH":
$result = $pmDrive->uploadFile('application/pdf', $pathOutput . $sFilename . '.pdf', $sFilenameOriginal . '.pdf', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_PDF', $result->webContentLink);
$fileIdDrivePdf = $result->id;
$result = $pmDrive->uploadFile('application/doc', $pathOutput . $sFilename . '.doc', $sFilenameOriginal . '.doc', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_DOC', $result->webContentLink);
$fileIdDriveDoc = $result->id;
break;
case "PDF":
$result = $pmDrive->uploadFile('application/pdf', $pathOutput . $sFilename . '.pdf', $sFilenameOriginal . '.pdf', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_PDF', $result->webContentLink);
$fileIdDrivePdf = $result->id;
break;
case "DOC":
$result = $pmDrive->uploadFile('application/doc', $pathOutput . $sFilename . '.doc', $sFilenameOriginal . '.doc', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_DOC', $result->webContentLink);
$fileIdDriveDoc = $result->id;
break;
}
$aFields['DOC_VERSION'] = $oAppDocument->getDocVersion();
// $docVersion;
$aFields['APP_DOC_UID'] = $oAppDocument->getAppDocUid();
//$appDocUid;
$appDocUid = $aFields['APP_DOC_UID'];
$oAppDocument->update($aFields);
//$option = 'pmDrive';
//add permissions
$criteria = new \Criteria('workflow');
$criteria->addSelectColumn(\ApplicationPeer::PRO_UID);
$criteria->addSelectColumn(\TaskUserPeer::TAS_UID);
$criteria->addSelectColumn(\TaskUserPeer::USR_UID);
$criteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
$criteria->add(\ApplicationPeer::APP_UID, $applicationUid);
$criteria->addJoin(\ApplicationPeer::PRO_UID, \TaskPeer::PRO_UID, \Criteria::LEFT_JOIN);
$criteria->addJoin(\TaskPeer::TAS_UID, \TaskUserPeer::TAS_UID, \Criteria::LEFT_JOIN);
$dataset = \ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$userPermission = array();
$case = new \Cases();
while ($dataset->next()) {
$row = $dataset->getRow();
if ($row['TU_RELATION'] == 1) {
//users
$dataUser = $user->load($row['USR_UID']);
if (array_search($dataUser['USR_EMAIL'], $userPermission) === false) {
$objectPermissions = $case->getAllObjects($row['PRO_UID'], $applicationUid, $row['TAS_UID'], $row['USR_UID']);
if (array_search($appDocUid, $objectPermissions['OUTPUT_DOCUMENTS']) !== false) {
$userPermission[] = $dataUser['USR_EMAIL'];
}
}
} else {
//Groups