本文整理汇总了PHP中G::replaceDataGridField方法的典型用法代码示例。如果您正苦于以下问题:PHP G::replaceDataGridField方法的具体用法?PHP G::replaceDataGridField怎么用?PHP G::replaceDataGridField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::replaceDataGridField方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array())
{
if ($sUID != '' && is_array($aFields) && $sPath != '') {
$sContent = G::replaceDataGridField($sContent, $aFields);
G::verifyPath($sPath, true);
//Start - Create .doc
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
$size = array();
$size["Letter"] = "216mm 279mm";
$size["Legal"] = "216mm 357mm";
$size["Executive"] = "184mm 267mm";
$size["B5"] = "182mm 257mm";
$size["Folio"] = "216mm 330mm";
$size["A0Oversize"] = "882mm 1247mm";
$size["A0"] = "841mm 1189mm";
$size["A1"] = "594mm 841mm";
$size["A2"] = "420mm 594mm";
$size["A3"] = "297mm 420mm";
$size["A4"] = "210mm 297mm";
$size["A5"] = "148mm 210mm";
$size["A6"] = "105mm 148mm";
$size["A7"] = "74mm 105mm";
$size["A8"] = "52mm 74mm";
$size["A9"] = "37mm 52mm";
$size["A10"] = "26mm 37mm";
$size["Screenshot640"] = "640mm 480mm";
$size["Screenshot800"] = "800mm 600mm";
$size["Screenshot1024"] = "1024mm 768mm";
$sizeLandscape["Letter"] = "279mm 216mm";
$sizeLandscape["Legal"] = "357mm 216mm";
$sizeLandscape["Executive"] = "267mm 184mm";
$sizeLandscape["B5"] = "257mm 182mm";
$sizeLandscape["Folio"] = "330mm 216mm";
$sizeLandscape["A0Oversize"] = "1247mm 882mm";
$sizeLandscape["A0"] = "1189mm 841mm";
$sizeLandscape["A1"] = "841mm 594mm";
$sizeLandscape["A2"] = "594mm 420mm";
$sizeLandscape["A3"] = "420mm 297mm";
$sizeLandscape["A4"] = "297mm 210mm";
$sizeLandscape["A5"] = "210mm 148mm";
$sizeLandscape["A6"] = "148mm 105mm";
$sizeLandscape["A7"] = "105mm 74mm";
$sizeLandscape["A8"] = "74mm 52mm";
$sizeLandscape["A9"] = "52mm 37mm";
$sizeLandscape["A10"] = "37mm 26mm";
$sizeLandscape["Screenshot640"] = "480mm 640mm";
$sizeLandscape["Screenshot800"] = "600mm 800mm";
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
if (!isset($aProperties['media'])) {
$aProperties['media'] = 'Letter';
}
if ($sLandscape) {
$media = $sizeLandscape[$aProperties['media']];
} else {
$media = $size[$aProperties['media']];
}
$marginLeft = '15';
if (isset($aProperties['margins']['left'])) {
$marginLeft = $aProperties['margins']['left'];
}
$marginRight = '15';
if (isset($aProperties['margins']['right'])) {
$marginRight = $aProperties['margins']['right'];
}
$marginTop = '15';
if (isset($aProperties['margins']['top'])) {
$marginTop = $aProperties['margins']['top'];
}
$marginBottom = '15';
if (isset($aProperties['margins']['bottom'])) {
$marginBottom = $aProperties['margins']['bottom'];
}
fwrite($oFile, '<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<!--[if !mso]>
<style>
v\\:* {behavior:url(#default#VML);}
o\\:* {behavior:url(#default#VML);}
w\\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:DoNotHyphenateCaps/>
<w:PunctuationKerning/>
<w:DrawingGridHorizontalSpacing>9.35 pt</w:DrawingGridHorizontalSpacing>
<w:DrawingGridVerticalSpacing>9.35 pt</w:DrawingGridVerticalSpacing>
</w:WordDocument>
</xml><![endif]-->
<style>
//.........这里部分代码省略.........
示例2: sendMessage
//.........这里部分代码省略.........
$fileTemplate = $pathEmail . $sTemplate;
G::mk_dir( $pathEmail, 0777, true );
if (! file_exists( $fileTemplate )) {
$data['FILE_TEMPLATE'] = $fileTemplate;
$result = new wsResponse( 28, G::LoadTranslation( 'ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data ) );
return $result;
}
if ($appFields == null) {
$Fields = $oldFields['APP_DATA'];
} else {
$Fields = array_merge( $oldFields['APP_DATA'], $appFields );
}
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $Fields, false);
$sFrom = G::buildFrom($aSetup, $sFrom);
$showMessage = ($showMessage) ? 1 : 0 ;
$messageArray = array(
"msg_uid" => "",
"app_uid" => $caseId,
"del_index" => $delIndex,
"app_msg_type" => "TRIGGER",
"app_msg_subject" => $sSubject,
"app_msg_from" => $sFrom,
"app_msg_to" => $sTo,
"app_msg_body" => $sBody,
"app_msg_cc" => $sCc,
"app_msg_bcc" => $sBcc,
示例3: sendNotifications
//.........这里部分代码省略.........
if (isset($conf["TAS_DEF_MESSAGE_TYPE"]) &&
isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) &&
$conf["TAS_DEF_MESSAGE_TYPE"] == "template" &&
$conf["TAS_DEF_MESSAGE_TEMPLATE"] != ""
) {
if ($conf["TAS_DEF_MESSAGE_TEMPLATE"] == "alert_message.html") {
$swtplDefault = 1;
}
$fileTemplate = $pathEmail . $conf["TAS_DEF_MESSAGE_TEMPLATE"];
if (!file_exists($fileTemplate)) {
throw (new Exception("Template file \"$fileTemplate\" does not exist."));
}
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $aFields, false);
} else {
$sBody = nl2br(G::replaceDataGridField($aTaskInfo["TAS_DEF_MESSAGE"], $aFields, false));
}
G::LoadClass("tasks");
G::LoadClass("groups");
G::LoadClass("spool");
$task = new Tasks();
$group = new Groups();
$oUser = new Users();
foreach ($aTasks as $aTask) {
$sTo = null;
$sCc = null;
示例4: sendNotifications
public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom = "")
{
try {
$applicationData = $this->loadCase($sApplicationUID);
$aFields["APP_NUMBER"] = $applicationData["APP_NUMBER"];
$oConfiguration = new Configuration();
$sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria('workflow');
$oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails');
$oCriteria->add(ConfigurationPeer::OBJ_UID, '');
$oCriteria->add(ConfigurationPeer::PRO_UID, '');
$oCriteria->add(ConfigurationPeer::USR_UID, '');
$oCriteria->add(ConfigurationPeer::APP_UID, '');
if (ConfigurationPeer::doCount($oCriteria) == 0) {
$oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => ''));
$aConfiguration = array();
} else {
$aConfiguration = $oConfiguration->load('Emails', '', '', '', '');
if ($aConfiguration['CFG_VALUE'] != '') {
$aConfiguration = unserialize($aConfiguration["CFG_VALUE"]);
$passwd = $aConfiguration["MESS_PASSWORD"];
$passwdDec = G::decrypt($passwd, "EMAILENCRYPT");
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$aConfiguration["MESS_PASSWORD"] = $passwd;
} else {
$aConfiguration = array();
}
}
if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
return false;
}
//Send derivation notification - Start
$oTask = new Task();
$aTaskInfo = $oTask->load($sCurrentTask);
if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') {
return false;
}
if ($sFrom == '') {
$sFrom = '"ProcessMaker"';
}
$hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $sFrom, $match);
if (!$hasEmailFrom || strpos($sFrom, $aConfiguration['MESS_ACCOUNT']) === false) {
if ($aConfiguration['MESS_ENGINE'] != 'MAIL' && $aConfiguration['MESS_ACCOUNT'] != '') {
$sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>';
} else {
if ($aConfiguration['MESS_ENGINE'] == 'MAIL') {
$sFrom .= ' <info@' . gethostbyaddr('127.0.0.1') . '>';
} else {
if ($aConfiguration['MESS_SERVER'] != '') {
if ($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER'])) {
$sFrom .= ' <info@' . $sAux . '>';
} else {
$sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>';
}
} else {
$sFrom .= ' <info@processmaker.com>';
}
}
}
}
if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') {
$sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $aFields);
} else {
$sSubject = G::LoadTranslation('ID_MESSAGE_SUBJECT_DERIVATION');
}
//erik: new behaviour for messages
G::loadClass('configuration');
$oConf = new Configurations();
$oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', '');
$conf = $oConf->aConfig;
$pathEmail = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . $aTaskInfo["PRO_UID"] . PATH_SEP;
$swtplDefault = 0;
$sBody = null;
if (isset($conf["TAS_DEF_MESSAGE_TYPE"]) && isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) && $conf["TAS_DEF_MESSAGE_TYPE"] == "template" && $conf["TAS_DEF_MESSAGE_TEMPLATE"] != "") {
if ($conf["TAS_DEF_MESSAGE_TEMPLATE"] == "alert_message.html") {
$swtplDefault = 1;
}
$fileTemplate = $pathEmail . $conf["TAS_DEF_MESSAGE_TEMPLATE"];
if (!file_exists($fileTemplate)) {
throw new Exception("Template file \"{$fileTemplate}\" does not exist.");
}
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $aFields);
} else {
$sBody = nl2br(G::replaceDataGridField($aTaskInfo["TAS_DEF_MESSAGE"], $aFields));
}
G::LoadClass("tasks");
G::LoadClass("groups");
G::LoadClass("spool");
$task = new Tasks();
$group = new Groups();
$oUser = new Users();
foreach ($aTasks as $aTask) {
//.........这里部分代码省略.........
示例5: sendMessage
/**
* send message
*
* @param string $caseId
* @param string $sFrom
* @param string $sTo
* @param string $sCc
* @param string $sBcc
* @param string $sSubject
* @param string $sTemplate
* @param $appFields = null
* @param $aAttachment = null
* @param boolean $showMessage = true
* @param int $delIndex = 0
* @return $result will return an object
*/
public function sendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null, $showMessage = true, $delIndex = 0)
{
try {
G::LoadClass("system");
$aSetup = System::getEmailConfiguration();
$passwd = $aSetup['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd, 'EMAILENCRYPT');
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$aSetup['MESS_PASSWORD'] = $passwd;
if ($aSetup['MESS_RAUTH'] == false || is_string($aSetup['MESS_RAUTH']) && $aSetup['MESS_RAUTH'] == 'false') {
$aSetup['MESS_RAUTH'] = 0;
} else {
$aSetup['MESS_RAUTH'] = 1;
}
$oSpool = new spoolRun();
$oSpool->setConfig(array('MESS_ENGINE' => $aSetup['MESS_ENGINE'], 'MESS_SERVER' => $aSetup['MESS_SERVER'], 'MESS_PORT' => $aSetup['MESS_PORT'], 'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'], 'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'], 'SMTPSecure' => $aSetup['SMTPSecure'], 'SMTPAuth' => $aSetup['MESS_RAUTH']));
$oCase = new Cases();
$oldFields = $oCase->loadCase($caseId);
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
$fileTemplate = $pathEmail . $sTemplate;
G::mk_dir($pathEmail, 0777, true);
if (!file_exists($fileTemplate)) {
$data['FILE_TEMPLATE'] = $fileTemplate;
$result = new wsResponse(28, G::LoadTranslation('ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data));
return $result;
}
if ($appFields == null) {
$Fields = $oldFields['APP_DATA'];
} else {
$Fields = array_merge($oldFields['APP_DATA'], $appFields);
}
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $Fields);
$hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $sFrom, $match);
if (!$hasEmailFrom || strpos($sFrom, $aSetup['MESS_ACCOUNT']) === false) {
$sFrom = '"' . stripslashes($sFrom) . '" <' . $aSetup['MESS_ACCOUNT'] . ">";
}
$showMessage = $showMessage ? 1 : 0;
$messageArray = array("msg_uid" => "", "app_uid" => $caseId, "del_index" => $delIndex, "app_msg_type" => "TRIGGER", "app_msg_subject" => $sSubject, "app_msg_from" => $sFrom, "app_msg_to" => $sTo, "app_msg_body" => $sBody, "app_msg_cc" => $sCc, "app_msg_bcc" => $sBcc, "app_msg_attach" => $aAttachment, "app_msg_template" => "", "app_msg_status" => "pending", "app_msg_show_message" => $showMessage, "contentTypeIsHtml" => preg_match("/^.+\\.html?\$/i", $fileTemplate) ? true : false);
$oSpool->create($messageArray);
$oSpool->sendMail();
if ($oSpool->status == 'sent') {
$result = new wsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $sTo);
} else {
$result = new wsResponse(29, $oSpool->status . ' ' . $oSpool->error . print_r($aSetup, 1));
}
return $result;
} catch (Exception $e) {
return new wsResponse(100, $e->getMessage());
}
}
示例6: sendNotifications
public function sendNotifications($taskUid, $arrayTask, $arrayData, $applicationUid, $delIndex, $from = '')
{
try {
$arrayApplicationData = $this->loadCase($applicationUid);
$arrayData['APP_NUMBER'] = $arrayApplicationData['APP_NUMBER'];
if (!class_exists('System')) {
G::LoadClass('system');
}
$aConfiguration = System::getEmailConfiguration();
$msgError = "";
if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
$msgError = "The default configuration wasn't defined";
$aConfiguration['MESS_ENGINE'] = '';
}
//Send derivation notification - Start
$oTask = new Task();
$aTaskInfo = $oTask->load($taskUid);
if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') {
return false;
}
$from = G::buildFrom($aConfiguration, $from);
if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') {
$sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $arrayData);
} else {
$sSubject = G::LoadTranslation('ID_MESSAGE_SUBJECT_DERIVATION');
}
//erik: new behaviour for messages
G::loadClass('configuration');
$oConf = new Configurations();
$oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', '');
$conf = $oConf->aConfig;
$pathEmail = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . $aTaskInfo["PRO_UID"] . PATH_SEP;
$swtplDefault = 0;
$sBody = null;
if (isset($conf["TAS_DEF_MESSAGE_TYPE"]) && isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) && $conf["TAS_DEF_MESSAGE_TYPE"] == "template" && $conf["TAS_DEF_MESSAGE_TEMPLATE"] != "") {
if ($conf["TAS_DEF_MESSAGE_TEMPLATE"] == "alert_message.html") {
$swtplDefault = 1;
}
$fileTemplate = $pathEmail . $conf["TAS_DEF_MESSAGE_TEMPLATE"];
if (!file_exists($fileTemplate)) {
$tempale = PATH_CORE . "templates" . PATH_SEP . "mails" . PATH_SEP . "alert_message.html";
$copied = @copy($tempale, $fileTemplate);
if ($copied) {
$dataTemplate = array("prf_filename" => $conf["TAS_DEF_MESSAGE_TEMPLATE"], "prf_path" => $fileTemplate, "pro_uid" => $aTaskInfo["PRO_UID"], "usr_uid" => "00000000000000000000000000000001", "prf_uid" => G::generateUniqueID(), "prf_type" => "file", "prf_create_date" => date("Y-m-d H:i:s"));
$filesManager = new ProcessMaker\BusinessModel\FilesManager();
$filesManager->addProcessFilesManagerInDb($dataTemplate);
} else {
throw new Exception("Template file \"{$fileTemplate}\" does not exist.");
}
}
$sBody = file_get_contents($fileTemplate);
} else {
$sBody = nl2br($aTaskInfo['TAS_DEF_MESSAGE']);
}
G::LoadClass("tasks");
G::LoadClass("groups");
G::LoadClass("spool");
$task = new Tasks();
$group = new Groups();
$oUser = new Users();
foreach ($arrayTask as $aTask) {
$sTo = null;
$sCc = null;
if (isset($aTask['DEL_INDEX'])) {
$arrayData2 = $arrayData;
$appDelegation = AppDelegationPeer::retrieveByPK($applicationUid, $aTask['DEL_INDEX']);
if (!is_null($appDelegation)) {
$arrayData2['TAS_TITLE'] = Content::load('TAS_TITLE', '', $appDelegation->getTasUid(), SYS_LANG);
$arrayData2['DEL_TASK_DUE_DATE'] = $appDelegation->getDelTaskDueDate();
}
} else {
$arrayData2 = $arrayData;
}
if (isset($aTask['USR_UID']) && !empty($aTask['USR_UID'])) {
$user = new \ProcessMaker\BusinessModel\User();
$arrayUserData = $user->getUser($aTask['USR_UID'], true);
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2, trim($arrayUserData['USR_TIME_ZONE']) != '' ? trim($arrayUserData['USR_TIME_ZONE']) : \ProcessMaker\Util\System::getTimeZone());
} else {
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2);
}
$sBody2 = G::replaceDataGridField($sBody, $arrayData2, false);
switch ($aTask["TAS_ASSIGN_TYPE"]) {
case "SELF_SERVICE":
if ($swtplDefault == 1) {
G::verifyPath($pathEmail, true);
//Create if it does not exist
$fileTemplate = $pathEmail . G::LoadTranslation('ID_UNASSIGNED_MESSAGE');
if (!file_exists($fileTemplate) && file_exists(PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'))) {
@copy(PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'), $fileTemplate);
}
$sBody2 = G::replaceDataField(file_get_contents($fileTemplate), $arrayData2);
}
if (isset($aTask["TAS_UID"]) && !empty($aTask["TAS_UID"])) {
$arrayTaskUser = array();
$arrayAux1 = $task->getGroupsOfTask($aTask["TAS_UID"], 1);
foreach ($arrayAux1 as $arrayGroup) {
$arrayAux2 = $group->getUsersOfGroup($arrayGroup["GRP_UID"]);
foreach ($arrayAux2 as $arrayUser) {
$arrayTaskUser[] = $arrayUser["USR_UID"];
}
//.........这里部分代码省略.........