本文整理汇总了PHP中G::getPathFromUID方法的典型用法代码示例。如果您正苦于以下问题:PHP G::getPathFromUID方法的具体用法?PHP G::getPathFromUID怎么用?PHP G::getPathFromUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::getPathFromUID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: casesShowOuputDocumentExist
function casesShowOuputDocumentExist($url)
{
$urlArray = explode("?", $url);
$urlParametroString = $urlArray[1];
parse_str($urlParametroString, $_GET);
require_once "classes/model/AppDocumentPeer.php";
$oAppDocument = new AppDocument();
$oAppDocument->Fields = $oAppDocument->load($_GET['a'], isset($_GET['v']) ? $_GET['v'] : null);
$sAppDocUid = $oAppDocument->getAppDocUid();
$info = pathinfo($oAppDocument->getAppDocFilename());
if (!isset($_GET['ext'])) {
$ext = $info['extension'];
} else {
if ($_GET['ext'] != '') {
$ext = $_GET['ext'];
} else {
$ext = $info['extension'];
}
}
$ver = isset($_GET['v']) && $_GET['v'] != '' ? '_' . $_GET['v'] : '';
if (!$ver) {
//This code is in the case the outputdocument won't be versioned
$ver = '_1';
}
$realPath = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $sAppDocUid . $ver . '.' . $ext;
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $info['basename'] . $ver . '.' . $ext;
$realPath2 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $info['basename'] . '.' . $ext;
$sw_file_exists = false;
if (file_exists($realPath)) {
$sw_file_exists = true;
} elseif (file_exists($realPath1)) {
$sw_file_exists = true;
$realPath = $realPath1;
} elseif (file_exists($realPath2)) {
$sw_file_exists = true;
$realPath = $realPath2;
}
$swFileExist = 0;
if ($sw_file_exists) {
$swFileExist = 1;
}
return $swFileExist;
}
示例2: AppDocument
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
try {
//save info
G::LoadClass('case');
G::LoadClass('tasks');
$oAppDocument = new AppDocument();
$aFields = array('APP_UID' => $_GET['APP_UID'], 'DEL_INDEX' => 100000, 'USR_UID' => $_SESSION['USER_LOGGED'], 'DOC_UID' => $_GET['UID'], 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], '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' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '');
$oAppDocument->create($aFields);
$sAppDocUid = $oAppDocument->getAppDocUid();
$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($_GET['APP_UID']) . PATH_SEP;
$sFileName = $sAppDocUid . '.' . $ext;
$sOriginalName = $_FILES['form']['name']['APP_DOC_FILENAME'];
G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
$oData['APP_UID'] = $_GET['APP_UID'];
$documentData = new uploadDocumentData($_GET['APP_UID'], $_SESSION['USER_LOGGED'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid);
$oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
unlink($sPathName . $sFileName);
}
//end plugin
//update AppData with the current file uploaded
$oCase = new Cases();
$aAppDataFields = $oCase->loadCase($_GET['APP_UID']);
示例3: InputDocument
$oInputDocument = new InputDocument();
$aID = $oInputDocument->load($indocUid);
//Get the Custom Folder ID (create if necessary)
$oFolder = new AppFolder();
$documentFileStructure = $oFolder->getFolderStructure();
$aFields = array("APP_UID" => $_SESSION["APPLICATION"], "DEL_INDEX" => $_SESSION["INDEX"], "USR_UID" => $_SESSION["USER_LOGGED"], "DOC_UID" => $indocUid, "APP_DOC_TYPE" => "INPUT", "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), "APP_DOC_COMMENT" => "", "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $arrayFileName[$i], "FOLDER_UID" => $oFolder->createFromPath($aID["INP_DOC_DESTINATION_PATH"]), "APP_DOC_TAGS" => $oFolder->parseTags($aID["INP_DOC_TAGS"]), "APP_DOC_FIELDNAME" => $fieldName);
} else {
$aFields = array("APP_UID" => $_SESSION["APPLICATION"], "DEL_INDEX" => $_SESSION["INDEX"], "USR_UID" => $_SESSION["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" => $arrayFileName[$i], "APP_DOC_FIELDNAME" => $fieldName);
}
$oAppDocument = new AppDocument();
$oAppDocument->create($aFields);
$iDocVersion = $oAppDocument->getDocVersion();
$sAppDocUid = $oAppDocument->getAppDocUid();
$aInfo = pathinfo($oAppDocument->getAppDocFilename());
$sExtension = isset($aInfo["extension"]) ? $aInfo["extension"] : "";
$pathUID = G::getPathFromUID($_SESSION["APPLICATION"]);
$sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP;
// . $documentFileStructure;
$sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension;
G::uploadFile($arrayFileTmpName[$i], $sPathName, $sFileName);
//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);
$documentData = new uploadDocumentData($_SESSION["APPLICATION"], $_SESSION["USER_LOGGED"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion);
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
if (!isset($aFields["APP_DOC_UID"])) {
$aFields["APP_DOC_UID"] = $sAppDocUid;
}
示例4: unset
$Fields['APP_DATA'] = $oCase->ExecuteTriggers($_SESSION['TASK'], 'OUTPUT_DOCUMENT', $_GET['UID'], 'AFTER', $Fields['APP_DATA']);
$Fields['DEL_INDEX'] = $_SESSION['INDEX'];
$Fields['TAS_UID'] = $_SESSION['TASK'];
//Execute after triggers - End
//Save data - Start
unset($Fields['APP_STATUS']);
unset($Fields['APP_PROC_STATUS']);
unset($Fields['APP_PROC_CODE']);
unset($Fields['APP_PIN']);
$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 . G::getPathFromUID($_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');
}
示例5: switch
*
* @author David Callizaya <davidsantos@colosa.com>
*/
switch ($RBAC->userCanAccess('PM_SUPERVISOR')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
require_once "classes/model/AppDocumentPeer.php";
$oAppDocument = new AppDocument();
$oAppDocument->Fields = $oAppDocument->load($_GET['a']);
$sAppDocUid = $oAppDocument->getAppDocUid();
$info = pathinfo($oAppDocument->getAppDocFilename());
if (!isset($_GET['ext'])) {
$ext = $info['extension'];
} else {
if ($_GET['ext'] != '') {
$ext = $_GET['ext'];
} else {
$ext = $info['extension'];
}
}
$realPath = PATH_DOCUMENT . G::getPathFromUID($_SESSION['APPLICATION']) . '/outdocs/' . $info['basename'] . '.' . $ext;
G::streamFile($realPath, true);
示例6: addCasesOutputDocument
/**
* Get data of Cases OutputDocument
*
* @param string $applicationUid
* @param string $outputDocumentUid
* @param string $userUid
*
* return object Return an object with data of an OutputDocument
*/
public function addCasesOutputDocument($applicationUid, $outputDocumentUid, $userUid)
{
try {
$sApplication = $applicationUid;
$index = \AppDelegation::getCurrentIndex($applicationUid);
$sUserLogged = $userUid;
$outputID = $outputDocumentUid;
$g = new \G();
$g->sessionVarSave();
\G::LoadClass( 'case' );
$oCase = new \Cases();
$oCase->thisIsTheCurrentUser( $sApplication, $index, $sUserLogged, '', 'casesListExtJs' );
//require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new \OutputDocument();
$aOD = $oOutputDocument->load( $outputID );
$Fields = $oCase->loadCase( $sApplication );
$sFilename = preg_replace( '[^A-Za-z0-9_]', '_', \G::replaceDataField( $aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA'] ) );
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppFolder.php");
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppDocument.php");
//Get the Custom Folder ID (create if necessary)
$oFolder = new \AppFolder();
$folderId = $oFolder->createFromPath( $aOD['OUT_DOC_DESTINATION_PATH'], $sApplication );
//Tags
$fileTags = $oFolder->parseTags( $aOD['OUT_DOC_TAGS'], $sApplication );
//Get last Document Version and apply versioning if is enabled
$oAppDocument = new \AppDocument();
$lastDocVersion = $oAppDocument->getLastDocVersion( $outputID, $sApplication );
$oCriteria = new \Criteria( 'workflow' );
$oCriteria->add( \AppDocumentPeer::APP_UID, $sApplication );
$oCriteria->add( \AppDocumentPeer::DOC_UID, $outputID );
$oCriteria->add( \AppDocumentPeer::DOC_VERSION, $lastDocVersion );
$oCriteria->add( \AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT' );
$oDataset = \AppDocumentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
if (($aOD['OUT_DOC_VERSIONING']) && ($lastDocVersion != 0)) {
//Create new Version of current output
$lastDocVersion ++;
if ($aRow = $oDataset->getRow()) {
$aFields = array ('APP_DOC_UID' => $aRow['APP_DOC_UID'],'APP_UID' => $sApplication,'DEL_INDEX' => $index,'DOC_UID' => $outputID,'DOC_VERSION' => $lastDocVersion + 1,'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->create( $aFields );
$sDocUID = $aRow['APP_DOC_UID'];
}
} 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'];
}
$this->generate( $outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties , $applicationUid);
//.........这里部分代码省略.........
示例7: addCasesOutputDocument
/**
* Get data of Cases OutputDocument
*
* @param string $applicationUid
* @param string $outputDocumentUid
* @param string $userUid
*
* return object Return an object with data of an OutputDocument
*/
public function addCasesOutputDocument($applicationUid, $outputDocumentUid, $userUid)
{
try {
$sApplication = $applicationUid;
$index = \AppDelegation::getCurrentIndex($applicationUid);
$sUserLogged = $userUid;
$outputID = $outputDocumentUid;
$g = new \G();
$g->sessionVarSave();
\G::LoadClass('case');
$oCase = new \Cases();
$oCase->thisIsTheCurrentUser($sApplication, $index, $sUserLogged, '', 'casesListExtJs');
//require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new \OutputDocument();
$aOD = $oOutputDocument->load($outputID);
$Fields = $oCase->loadCase($sApplication);
$sFilename = preg_replace('[^A-Za-z0-9_]', '_', \G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
require_once PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppFolder.php";
require_once PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppDocument.php";
//Get the Custom Folder ID (create if necessary)
$oFolder = new \AppFolder();
$folderId = $oFolder->createFromPath($aOD['OUT_DOC_DESTINATION_PATH'], $sApplication);
//Tags
$fileTags = $oFolder->parseTags($aOD['OUT_DOC_TAGS'], $sApplication);
//Get last Document Version and apply versioning if is enabled
$oAppDocument = new \AppDocument();
$lastDocVersion = $oAppDocument->getLastDocVersion($outputID, $sApplication);
$oCriteria = new \Criteria('workflow');
$oCriteria->add(\AppDocumentPeer::APP_UID, $sApplication);
$oCriteria->add(\AppDocumentPeer::DOC_UID, $outputID);
$oCriteria->add(\AppDocumentPeer::DOC_VERSION, $lastDocVersion);
$oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT');
$oDataset = \AppDocumentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
if ($aOD['OUT_DOC_VERSIONING'] && $lastDocVersion != 0) {
//Create new Version of current output
$lastDocVersion++;
if ($aRow = $oDataset->getRow()) {
$aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], 'APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion + 1, '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->create($aFields);
$sDocUID = $aRow['APP_DOC_UID'];
}
} 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'];
}
$this->generate($outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (bool) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties, $applicationUid);
/*----------------------------------********---------------------------------*/
$licensedFeatures =& \PMLicensedFeatures::getSingleton();
//.........这里部分代码省略.........
示例8: pathinfo
$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)) {
$sw_file_exists = true;
} elseif (file_exists($realPath1)) {
$sw_file_exists = true;
$realPath = $realPath1;
}
if (!$sw_file_exists) {
$error_message = "'" . $oAppDocument->Fields['APP_DOC_FILENAME'] . "' " . G::LoadTranslation('ID_ERROR_STREAMING_FILE');
if (isset($_POST['request']) && $_POST['request'] == true) {
$res['success'] = 'failure';
$res['message'] = $error_message;
print G::json_encode($res);
} else {
G::SendMessageText($error_message, "ERROR");
示例9: PMFGenerateOutputDocument
/**
*
* @method
*
* Generates an Output Document
*
* @name PMFGenerateOutputDocument
* @label PMF Generate Output Document
*
* @param string(32) | $outputID | Output ID | Output Document ID
* @return none | $none | None | None
*
*/
function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = null, $sUserLogged = null)
{
$g = new G();
$g->sessionVarSave();
if ($sApplication) {
$_SESSION["APPLICATION"] = $sApplication;
} else {
$sApplication = $_SESSION["APPLICATION"];
}
if ($index) {
$_SESSION["INDEX"] = $index;
} else {
$index = $_SESSION["INDEX"];
}
if ($sUserLogged) {
$_SESSION["USER_LOGGED"] = $sUserLogged;
} else {
$sUserLogged = $_SESSION["USER_LOGGED"];
}
G::LoadClass('case');
$oCase = new Cases();
$oCase->thisIsTheCurrentUser($sApplication, $index, $sUserLogged, '', 'casesListExtJs');
//require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new OutputDocument();
$aOD = $oOutputDocument->load($outputID);
$Fields = $oCase->loadCase($sApplication);
//The $_GET['UID'] variable is used when a process executes.
//$_GET['UID']=($aOD['OUT_DOC_VERSIONING'])?$_GET['UID']:$aOD['OUT_DOC_UID'];
//$sUID = ($aOD['OUT_DOC_VERSIONING'])?$_GET['UID']:$aOD['OUT_DOC_UID'];
$sFilename = preg_replace('[^A-Za-z0-9_]', '_', G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
require_once 'classes/model/AppFolder.php';
require_once 'classes/model/AppDocument.php';
//Get the Custom Folder ID (create if necessary)
$oFolder = new AppFolder();
//$aOD['OUT_DOC_DESTINATION_PATH'] = ($aOD['OUT_DOC_DESTINATION_PATH']=='')?PATH_DOCUMENT
// . $_SESSION['APPLICATION'] . PATH_SEP . 'outdocs'. PATH_SEP:$aOD['OUT_DOC_DESTINATION_PATH'];
$folderId = $oFolder->createFromPath($aOD['OUT_DOC_DESTINATION_PATH'], $sApplication);
//Tags
$fileTags = $oFolder->parseTags($aOD['OUT_DOC_TAGS'], $sApplication);
//Get last Document Version and apply versioning if is enabled
$oAppDocument = new AppDocument();
$lastDocVersion = $oAppDocument->getLastDocVersion($outputID, $sApplication);
$oCriteria = new Criteria('workflow');
$oCriteria->add(AppDocumentPeer::APP_UID, $sApplication);
//$oCriteria->add(AppDocumentPeer::DEL_INDEX, $index);
$oCriteria->add(AppDocumentPeer::DOC_UID, $outputID);
$oCriteria->add(AppDocumentPeer::DOC_VERSION, $lastDocVersion);
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT');
$oDataset = AppDocumentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
if ($aOD['OUT_DOC_VERSIONING'] && $lastDocVersion != 0) {
//Create new Version of current output
$lastDocVersion++;
if ($aRow = $oDataset->getRow()) {
$aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], 'APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion + 1, '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->create($aFields);
$sDocUID = $aRow['APP_DOC_UID'];
}
} 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';
}
//.........这里部分代码省略.........
示例10: pathinfo
$oAppDocument->Fields = $oAppDocument->load($_GET['a'], $docVersion);
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = isset($info['extension']) ? $info['extension'] : '';
//BUG fix: must handle files without any extension
if (isset($_GET['b'])) {
if ($_GET['b'] == '0') {
$bDownload = false;
} else {
$bDownload = true;
}
} else {
$bDownload = true;
}
$app_uid = G::getPathFromUID($oAppDocument->Fields['APP_UID']);
$file = G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
$realPath = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
$realPath1 = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '.' . $ext;
$sw_file_exists = false;
if (file_exists($realPath)) {
$sw_file_exists = true;
} elseif (file_exists($realPath1)) {
$sw_file_exists = true;
$realPath = $realPath1;
}
if (!$sw_file_exists) {
$error_message = G::LoadTranslation('ID_ERROR_STREAMING_FILE');
if (isset($_POST['request']) && $_POST['request'] == true) {
$res['success'] = 'failure';
$res['message'] = $error_message;
示例11: 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;
}
示例12: uploadExternalDocument
//.........这里部分代码省略.........
'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++) {
if ($errors[$i]==null) {
continue;
}
$err_msg .= $items[$i]." : ".$errors[$i]."\n";
}
$response['error']=$err_msg;
$response['message']=$err_msg;
$response['success']=false;
} elseif ($emptyInstances==$uploadedInstances) {
$response['error']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
$response['message']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
$response['success']=false;
} else {
$response['error']= G::LoadTranslation('ID_UPLOAD_COMPLETE');
$response['message']="Upload complete";
$response['success']=true;
}
}
}
}
print_r(G::json_encode($response));
/*
G::LoadClass ('case');
$oCase = new Cases ();
$G_PUBLISH = new Publisher ();
$Fields ['DOC_UID'] = "-1";
$Fields ['appId'] = "00000000000000000000000000000000";
$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields,
'appFolderSaveDocument?UID=-1&appId=' . $Fields ['appId'] . "&folderId=" . $_POST ['folderID']);
G::RenderPage ('publish', 'raw');
*/
}
示例13: isset
$aFields["APP_DOC_TITLE"] = isset($_POST["TITLE"]) ? $_POST["TITLE"] : "";
//$aFields["FOLDER_UID"] = $folderId,
//$aFields["APP_DOC_TAGS"] = $fileTags
$aFields["APP_DOC_FIELDNAME"] = $_POST["APP_DOC_FIELDNAME"];
} else {
//New record
$aFields = array("APP_UID" => $_POST["APPLICATION"], "DEL_INDEX" => $_POST["INDEX"], "USR_UID" => $_POST["USR_UID"], "DOC_UID" => $_POST["DOC_UID"], "APP_DOC_TYPE" => $_POST["APP_DOC_TYPE"], "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), "APP_DOC_COMMENT" => isset($_POST["COMMENT"]) ? $_POST["COMMENT"] : "", "APP_DOC_TITLE" => isset($_POST["TITLE"]) ? $_POST["TITLE"] : "", "APP_DOC_FILENAME" => isset($_FILES["ATTACH_FILE"]["name"]) ? $_FILES["ATTACH_FILE"]["name"] : "", "FOLDER_UID" => $folderId, "APP_DOC_TAGS" => $fileTags, "APP_DOC_FIELDNAME" => isset($_POST["APP_DOC_FIELDNAME"]) ? $_POST["APP_DOC_FIELDNAME"] : (isset($_FILES["ATTACH_FILE"]["name"]) ? $_FILES["ATTACH_FILE"]["name"] : ""));
}
$oAppDocument->create($aFields);
$sAppUid = $oAppDocument->getAppUid();
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = isset($info["extension"]) ? $info["extension"] : "";
//Save the file
echo $sPathName = PATH_DOCUMENT . G::getPathFromUID($sAppUid) . PATH_SEP;
echo $sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $ext;
print G::uploadFile($_FILES["ATTACH_FILE"]["tmp_name"], $sPathName, $sFileName);
print "* The file " . $_FILES["ATTACH_FILE"]["name"] . " was uploaded successfully in case " . $sAppUid . " as input document..\n";
//Get current Application Fields
$application = new Application();
$appFields = $application->Load($_POST["APPLICATION"]);
$appFields = unserialize($appFields["APP_DATA"]);
$_SESSION["APPLICATION"] = $appFields["APPLICATION"];
$_SESSION["PROCESS"] = $appFields["PROCESS"];
$_SESSION["TASK"] = $appFields["TASK"];
$_SESSION["INDEX"] = $appFields["INDEX"];
$_SESSION["USER_LOGGED"] = $appFields["USER_LOGGED"];
//$_POST["USR_UID"]
//$_SESSION["USR_USERNAME"] = $appFields["USR_USERNAME"];
//$_SESSION["STEP_POSITION"] = 0;
示例14: array
$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' => $_POST['form']['APP_DOC_TYPE'], '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' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_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;
$sFileName = $sAppDocUid . "_" . $iDocVersion . '.' . $ext;
G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName);
//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, $aFields['APP_DOC_FILENAME'], $sAppDocUid);
$oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
unlink($sPathName . $sFileName);
}
//end plugin
}
}
G::header('location: appFolderList');
die;
示例15: addInputDocument
//.........这里部分代码省略.........
"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);
}
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$file = $filter->xssFilterHard($file, 'path');