本文整理汇总了PHP中G::replaceDataField方法的典型用法代码示例。如果您正苦于以下问题:PHP G::replaceDataField方法的具体用法?PHP G::replaceDataField怎么用?PHP G::replaceDataField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::replaceDataField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tdClass
/**
* tdClass
*
* @param string $values
* @param string $owner
*
* @return $value
*/
function tdClass($values, $owner)
{
$value = G::replaceDataField($this->condition, $owner->values);
$value = @eval('return (' . $value . ');');
$row = $values['row__'];
$style = $row % 2 == 0 ? $this->classNameAlt : $this->className;
return $value ? $style : '';
}
示例2: render
public function render($value, $owner = null)
{
$url = G::replaceDataField($this->file, $owner->values);
if ($this->home === "methods") {
$url = G::encryptlink(SYS_URI . $url);
}
if ($this->home === "public_html") {
$url = '/' . $url;
}
return '<img src="' . htmlentities($url, ENT_QUOTES, 'utf-8') . '" ' . ($this->style ? 'style="' . $this->style . '"' : '') . ' alt ="' . htmlentities($value, ENT_QUOTES, 'utf-8') . '"/>';
}
示例3: renderField
/**
* Function renderField
* @author David S. Callizaya S. <davidsantos@colosa.com>
* @access public
* @parameter string row
* @parameter string r
* @parameter string result
* @return string
*/
function renderField($row, $r, $result)
{
global $G_DATE_FORMAT;
//BEGIN: Special content: __sqlEdit__,__sqlDelete__
$result['sqlDelete__'] = "pagedTable.event='Delete';pagedTable_DoIt=true;if (pagedTable.onDeleteField) pagedTable_DoIt=eval(pagedTable.onDeleteField);if (pagedTable_DoIt) document.getElementById('pagedTable').outerHTML=ajax_function('{$this->ajaxServer}','delete','field='+encodeURIComponent('" . $this->fieldDataList . "'));if (pagedTable.afterDeleteField) return eval(pagedTable.afterDeleteField); else return false;";
$result['sqlEdit__'] = "pagedTable.event='Update';pagedTable.field=encodeURIComponent('" . $this->fieldDataList . "');pagedTable.updateField(pagedTable.field);return false;";
$result['pagedTableField__'] = "'" . $this->fieldDataList . "'";
$result['row__'] = $row;
//END: Special content.
//Merge $result with $xmlForm values (for default valuesSettings)
$result = array_merge($this->xmlForm->values, $result);
switch (true) {
case $this->style[$r]['data'] != '':
$value = isset($result[$this->style[$r]['data']]) ? $result[$this->style[$r]['data']] : '';
break;
default:
$value = $this->fields[$r]['Label'];
}
switch ($this->fields[$r]['Type']) {
case 'date':
/*Accept dates like 20070515 without - or / to separate its parts*/
if (strlen($value) <= 10 && strlen($value) > 4) {
$value = str_replace('/', '-', $value);
if (strpos($value, '-') === FALSE) {
$value = substr($value, 0, 4) . '-' . substr($value, 4, 2) . '-' . substr($value, 6, 2);
}
}
}
$this->tpl->newBlock("field");
$this->tpl->assign('width', $this->style[$r]['colWidth']);
$this->tpl->assign('widthPercent', $this->style[$r]['colWidth'] * 100 / $this->totalWidth . '%');
$this->tpl->assign('className', isset($this->style[$r]['colClassName']) && $this->style[$r]['colClassName'] ? $this->style[$r]['colClassName'] : $this->tdClass);
$this->tpl->assign('style', $this->tdStyle);
if (isset($this->style[$r]['align'])) {
$this->tpl->assign("align", $this->style[$r]['align']);
}
if (isset($this->style[$r]['colAlign'])) {
$this->tpl->assign("align", $this->style[$r]['colAlign']);
}
/**
* BEGIN : Reeplace of @@, @%,... in field's attributes like onclick, link,
* ...
*/
if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->onclick)) {
$this->xmlForm->fields[$this->fields[$r]['Name']]->onclick = G::replaceDataField($this->style[$r]['onclick'], $result);
}
if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->link)) {
$this->xmlForm->fields[$this->fields[$r]['Name']]->link = G::replaceDataField($this->style[$r]['link'], $result);
}
if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->value)) {
$this->xmlForm->fields[$this->fields[$r]['Name']]->value = G::replaceDataField($this->style[$r]['value'], $result);
}
/**
* BREAK : Reeplace of @@, @%,...
*/
/**
* Rendering of the field
*/
$this->xmlForm->setDefaultValues();
$this->xmlForm->setValues($result);
$this->xmlForm->fields[$this->fields[$r]['Name']]->mode = 'view';
if (array_search('rendergrid', get_class_methods(get_class($this->xmlForm->fields[$this->fields[$r]['Name']]))) !== FALSE || array_search('renderGrid', get_class_methods(get_class($this->xmlForm->fields[$this->fields[$r]['Name']]))) !== FALSE) {
$htmlField = $this->xmlForm->fields[$this->fields[$r]['Name']]->renderGrid(array($value), $this->xmlForm);
$this->tpl->assign("value", $htmlField[0]);
} else {
}
/**
* CONTINUE : Reeplace of @@, @%,...
*/
if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->onclick)) {
$this->xmlForm->fields[$this->fields[$r]['Name']]->onclick = $this->style[$r]['onclick'];
}
if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->link)) {
$this->xmlForm->fields[$this->fields[$r]['Name']]->link = $this->style[$r]['link'];
}
if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->value)) {
$this->xmlForm->fields[$this->fields[$r]['Name']]->value = $this->style[$r]['value'];
}
/**
* END : Reeplace of @@, @%,...
*/
return $this->fields[$r]['Type'];
}
示例4: registerLabel
public function registerLabel($id, $label)
{
return 1;
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$ses->Execute(G::replaceDataField('REPLACE INTO `TRANSLATION` (`TRN_CATEGORY`, `TRN_ID`, `TRN_LANG`, `TRN_VALUE`) VALUES
("LABEL", @@ID, "' . SYS_LANG . '", @@LABEL);', array('ID' => $id, 'LABEL' => $label !== null ? $label : '')));
}
示例5: DBConnection
*/
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
}
G::LoadInclude('ajax');
G::LoadClass('dynaform');
G::LoadClass('xmlDb');
$dbc = new DBConnection();
$ses = new DBSession($dbc);
//$dynaform = new dynaform( $dbc );
if ($_POST['form']['DYN_UID'] === '') {
unset($_POST['form']['DYN_UID']);
}
$Fields = $_POST['form'];
if (!isset($Fields['DYN_UID'])) {
return;
}
$file = G::decrypt($Fields['A'], URL_KEY);
$Fields['DYN_FILENAME'] = strcasecmp(substr($file, -5), '_tmp0') == 0 ? substr($file, 0, strlen($file) - 5) : $file;
$_SESSION['CURRENT_DYNAFORM'] = $Fields;
//$dynaform->Save( $Fields );
$dbc2 = new DBConnection(PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml');
$ses2 = new DBSession($dbc2);
if (!isset($Fields['ENABLETEMPLATE'])) {
$Fields['ENABLETEMPLATE'] = "0";
}
$ses2->execute(G::replaceDataField("UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
$ses2->execute(G::replaceDataField("UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
$ses2->execute(G::replaceDataField("UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
示例6: jsonr
public function jsonr(&$json)
{
foreach ($json as $key => &$value) {
$sw1 = is_array($value);
$sw2 = is_object($value);
if ($sw1 || $sw2) {
$this->jsonr($value);
}
if (!$sw1 && !$sw2) {
//read event
$fn = $this->onPropertyRead;
if (function_exists($fn)) {
$fn($json, $key, $value);
}
//set properties from trigger
$prefixs = array("@@", "@#", "@%", "@?", "@$", "@=");
if (is_string($value) && in_array(substr($value, 0, 2), $prefixs)) {
$triggerValue = substr($value, 2);
if (isset($this->fields["APP_DATA"][$triggerValue])) {
$json->{$key} = $this->fields["APP_DATA"][$triggerValue];
}
}
//set properties from 'formInstance' variable
if (isset($this->fields["APP_DATA"]["formInstance"])) {
$formInstance = $this->fields["APP_DATA"]["formInstance"];
if (!is_array($formInstance)) {
$formInstance = array($formInstance);
}
$nfi = count($formInstance);
for ($ifi = 0; $ifi < $nfi; $ifi++) {
$fi = $formInstance[$ifi];
if (is_object($fi) && isset($fi->id) && $key === "id" && $json->{$key} === $fi->id) {
foreach ($fi as $keyfi => $valuefi) {
if (isset($json->{$keyfi})) {
$json->{$keyfi} = $valuefi;
}
}
}
}
}
//query & options
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest" || $value === "checkbox" || $value === "radio" || $value === "datetime" || $value === "hidden")) {
if (!isset($json->data)) {
$json->data = array(
"value" => "",
"label" => ""
);
}
if (!isset($json->dbConnection))
$json->dbConnection = "none";
if (!isset($json->sql))
$json->sql = "";
if (!isset($json->options))
$json->options = array();
if (!isset($json->optionsSql))
$json->optionsSql = array();
else {
//convert stdClass to array
if (is_array($json->options)) {
$option = array();
foreach ($json->options as $valueOptions) {
array_push($option, array(
"value" => $valueOptions->value,
"label" => isset($valueOptions->label) ? $valueOptions->label : ""
));
}
$json->options = $option;
}
}
if ($json->dbConnection !== "" && $json->dbConnection !== "none" && $json->sql !== "") {
$cnn = Propel::getConnection($json->dbConnection);
$stmt = $cnn->createStatement();
try {
$rs = $stmt->executeQuery(G::replaceDataField($json->sql, array()), \ResultSet::FETCHMODE_NUM);
while ($rs->next()) {
$row = $rs->getRow();
$option = array(
"label" => isset($row[1]) ? $row[1] : $row[0],
"value" => $row[0]
);
array_push($json->optionsSql, $option);
}
} catch (Exception $e) {
}
}
if (isset($json->options[0])) {
$json->data = $json->options[0];
$no = count($json->options);
for ($io = 0; $io < $no; $io++) {
if ((is_array($json->options[$io]) ? $json->options[$io]["value"] : $json->options[$io]->value) === $json->defaultValue) {
$json->data = $json->options[$io];
}
}
}
}
//data
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "suggest" || $value === "dropdown" || $value === "checkbox" || $value === "radio" || $value === "datetime" || $value === "hidden")) {
$json->data = array(
"value" => isset($this->fields["APP_DATA"][$json->name]) ? $this->fields["APP_DATA"][$json->name] : (is_array($json->data) ? $json->data["value"] : $json->data->value),
//.........这里部分代码省略.........
示例7: sendNotifications
public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom = "")
{
try {
$applicationData = $this->loadCase($sApplicationUID);
$aFields["APP_NUMBER"] = $applicationData["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($sCurrentTask);
if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') {
return false;
}
$sFrom = G::buildFrom($aConfiguration, $sFrom);
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;
//.........这里部分代码省略.........
示例8: createAppEvents
function createAppEvents($PRO_UID, $APP_UID, $DEL_INDEX, $TAS_UID)
{
$aRows = array();
$aEventsRows = $this->getBy($PRO_UID, array('TAS_UID' => $TAS_UID));
if ($aEventsRows !== false) {
$aRows = array_merge($aRows, $aEventsRows);
}
$aEventsRows = $this->getBy($PRO_UID, array('EVN_TAS_UID_FROM' => $TAS_UID));
if ($aEventsRows !== false) {
$aRows = array_merge($aRows, $aEventsRows);
}
foreach ($aRows as $aData) {
// if the events has a condition
if (trim($aData['EVN_CONDITIONS']) != '') {
G::LoadClass('case');
$oCase = new Cases();
$aFields = $oCase->loadCase($APP_UID);
$Fields = $aFields['APP_DATA'];
$conditionContents = trim($aData['EVN_CONDITIONS']);
//$sContent = G::unhtmlentities($sContent);
$iAux = 0;
$iOcurrences = preg_match_all('/\\@(?:([\\>])([a-zA-Z\\_]\\w*)|([a-zA-Z\\_][\\w\\-\\>\\:]*)\\(((?:[^\\\\\\)]*(?:[\\\\][\\w\\W])?)*)\\))((?:\\s*\\[[\'"]?\\w+[\'"]?\\])+)?/', $conditionContents, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
if ($iOcurrences) {
for ($i = 0; $i < $iOcurrences; $i++) {
preg_match_all('/@>' . $aMatch[2][$i][0] . '([\\w\\W]*)' . '@<' . $aMatch[2][$i][0] . '/', $conditionContents, $aMatch2, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
$sGridName = $aMatch[2][$i][0];
$sStringToRepeat = $aMatch2[1][0][0];
if (isset($Fields[$sGridName])) {
if (is_array($Fields[$sGridName])) {
$sAux = '';
foreach ($Fields[$sGridName] as $aRow) {
$sAux .= G::replaceDataField($sStringToRepeat, $aRow);
}
}
}
$conditionContents = str_replace('@>' . $sGridName . $sStringToRepeat . '@<' . $sGridName, $sAux, $conditionContents);
}
}
$sCondition = G::replaceDataField($conditionContents, $Fields);
$evalConditionResult = false;
$sCond = 'try{ $evalConditionResult=(' . $sCondition . ')? true: false; } catch(Exception $e){$evalConditionResult=false;}';
@eval($sCond);
if (!$evalConditionResult) {
continue;
}
}
$appEventData['APP_UID'] = $APP_UID;
$appEventData['DEL_INDEX'] = $DEL_INDEX;
$appEventData['EVN_UID'] = $aData['EVN_UID'];
$appEventData['APP_EVN_ACTION_DATE'] = $this->toCalculateTime($aData);
$appEventData['APP_EVN_ATTEMPTS'] = 3;
$appEventData['APP_EVN_LAST_EXECUTION_DATE'] = null;
$appEventData['APP_EVN_STATUS'] = 'OPEN';
$oAppEvent = new AppEvent();
$oAppEvent->create($appEventData);
}
}
示例9: render
/**
* Function render
*
* @author The Answer
* @access public
* @param eter string value
* @param eter string owner
* @return string
*/
public function render($value = null, $owner = null)
{
//$optionName = $owner->values['USR_UID'];
$optionName = $value;
$onclick = $this->onclick ? ' onclick="' . G::replaceDataField($this->onclick, $owner->values) . '" ' : '';
$html = '<input class="FormCheck" id="form[' . $this->name . '][' . $optionName . ']" name="form[' . $this->name . '][' . $optionName . ']" type=\'checkbox\' value="' . $value . '"' . $onclick . '> <span class="FormCheck"></span></input>';
return $html;
}
示例10: catchMessageEvent
/**
* Catch Message-Events for the Cases
*
* @param bool $frontEnd Flag to represent progress bar
*
* @return void
*/
public function catchMessageEvent($frontEnd = false)
{
try {
\G::LoadClass("wsBase");
//Set variables
$ws = new \wsBase();
$case = new \Cases();
$common = new \ProcessMaker\Util\Common();
$common->setFrontEnd($frontEnd);
//Get data
$totalMessageEvent = 0;
$counterStartMessageEvent = 0;
$counterIntermediateCatchMessageEvent = 0;
$counter = 0;
$flagFirstTime = false;
$common->frontEndShow("START");
do {
$flagNextRecords = false;
$arrayMessageApplicationUnread = $this->getMessageApplications(array("messageApplicationStatus" => "UNREAD"), null, null, 0, 1000);
if (!$flagFirstTime) {
$totalMessageEvent = $arrayMessageApplicationUnread["total"];
$flagFirstTime = true;
}
foreach ($arrayMessageApplicationUnread["data"] as $value) {
if ($counter + 1 > $totalMessageEvent) {
$flagNextRecords = false;
break;
}
$arrayMessageApplicationData = $value;
$processUid = $arrayMessageApplicationData["PRJ_UID"];
$taskUid = $arrayMessageApplicationData["TAS_UID"];
$messageApplicationUid = $arrayMessageApplicationData["MSGAPP_UID"];
$messageApplicationCorrelation = $arrayMessageApplicationData["MSGAPP_CORRELATION"];
$messageEventDefinitionUserUid = $arrayMessageApplicationData["MSGED_USR_UID"];
$messageEventDefinitionCorrelation = $arrayMessageApplicationData["MSGED_CORRELATION"];
$arrayVariable = $this->mergeVariables($arrayMessageApplicationData["MSGED_VARIABLES"], $arrayMessageApplicationData["MSGAPP_VARIABLES"]);
$flagCatched = false;
switch ($arrayMessageApplicationData["EVN_TYPE"]) {
case "START":
if ($messageEventDefinitionCorrelation == $messageApplicationCorrelation && $messageEventDefinitionUserUid != "") {
//Start and derivate new Case
$result = $ws->newCase($processUid, $messageEventDefinitionUserUid, $taskUid, $arrayVariable);
$arrayResult = json_decode(json_encode($result), true);
if ($arrayResult["status_code"] == 0) {
$applicationUid = $arrayResult["caseId"];
$result = $ws->derivateCase($messageEventDefinitionUserUid, $applicationUid, 1);
$flagCatched = true;
//Counter
$counterStartMessageEvent++;
}
}
break;
case "INTERMEDIATE":
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\AppDelegationPeer::APP_UID);
$criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
$criteria->addSelectColumn(\AppDelegationPeer::USR_UID);
$criteria->add(\AppDelegationPeer::PRO_UID, $processUid, \Criteria::EQUAL);
$criteria->add(\AppDelegationPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
$criteria->add(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN", \Criteria::EQUAL);
$criteria->add(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL);
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$applicationUid = $row["APP_UID"];
$delIndex = $row["DEL_INDEX"];
$userUid = $row["USR_UID"];
$arrayApplicationData = $case->loadCase($applicationUid);
if (\G::replaceDataField($messageEventDefinitionCorrelation, $arrayApplicationData["APP_DATA"]) == $messageApplicationCorrelation) {
//"Unpause" and derivate Case
$arrayApplicationData["APP_DATA"] = array_merge($arrayApplicationData["APP_DATA"], $arrayVariable);
$arrayResult = $case->updateCase($applicationUid, $arrayApplicationData);
$result = $ws->derivateCase($userUid, $applicationUid, $delIndex);
$flagCatched = true;
}
}
//Counter
if ($flagCatched) {
$counterIntermediateCatchMessageEvent++;
}
break;
}
//Message-Application catch
if ($flagCatched) {
$result = $this->update($messageApplicationUid, array("MSGAPP_STATUS" => "READ"));
}
$counter++;
//Progress bar
$common->frontEndShow("BAR", "Message-Events (unread): " . $counter . "/" . $totalMessageEvent . " " . $common->progressBar($totalMessageEvent, $counter));
$flagNextRecords = true;
}
} while ($flagNextRecords);
//.........这里部分代码省略.........
示例11: getValuesDependentFields
private function getValuesDependentFields($json)
{
if (!isset($this->record["DYN_CONTENT"])) {
return array();
}
$data = array();
if (isset($json->dbConnection) && isset($json->sql)) {
$salida = array();
preg_match_all('/\\@(?:([\\@\\%\\#\\=\\!Qq])([a-zA-Z\\_]\\w*)|([a-zA-Z\\_][\\w\\-\\>\\:]*)\\(((?:[^\\\\\\)]*?)*)\\))/', $json->sql, $salida, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
$variables = isset($salida[2]) ? $salida[2] : array();
foreach ($variables as $key => $value) {
$jsonSearch = $this->jsonsf(G::json_decode($this->record["DYN_CONTENT"]), $value[0], $json->variable === "" ? "id" : "variable");
$a = $this->getValuesDependentFields($jsonSearch);
foreach ($a as $i => $v) {
$data[$i] = $v;
}
}
if ($json->dbConnection !== "" && $json->dbConnection !== "none" && $json->sql !== "") {
$cnn = Propel::getConnection($json->dbConnection);
$stmt = $cnn->createStatement();
try {
$a = G::replaceDataField($json->sql, $data);
$rs = $stmt->executeQuery($a, \ResultSet::FETCHMODE_NUM);
$rs->next();
$row = $rs->getRow();
if (isset($row[0]) && $json->type !== "suggest") {
$data[$json->variable === "" ? $json->id : $json->variable] = $row[0];
}
} catch (Exception $e) {
}
}
}
if (isset($json->options) && isset($json->options[0])) {
$data[$json->variable === "" ? $json->id : $json->variable] = $json->options[0]->value;
}
if (isset($json->placeholder) && $json->placeholder !== "") {
$data[$json->variable === "" ? $json->id : $json->variable] = "";
}
if (isset($json->defaultValue) && $json->defaultValue !== "") {
$data[$json->variable === "" ? $json->id : $json->variable] = $json->defaultValue;
}
return $data;
}
示例12: renderField
/**
* Function renderField
*
* @author David S. Callizaya S. <davidsantos@colosa.com>
* @access public
* @param eter string row
* @param eter string r
* @param eter string result
* @return string
*/
public function renderField($row, $r, $result)
{
global $G_DATE_FORMAT;
//to do: special content??
//$result['row__'] = $row; //Special content:
$styleData = $this->style[$r];
$fielDataName = $styleData['data'];
$fieldClassName = isset($styleData['colClassName']) && $styleData['colClassName'] ? $styleData['colClassName'] : $this->tdClass;
if ($fielDataName != '') {
$value = isset($result[$fielDataName]) ? $result[$fielDataName] : '';
} else {
$value = $this->fields[$r]['Label'];
}
$this->tpl->newBlock("field");
$this->tpl->assign('width', $this->style[$r]['colWidth']);
$classAttr = trim($fieldClassName) != '' ? " class=\"{$fieldClassName}\"" : '';
$this->tpl->assign('classAttr', $classAttr);
//to do: style is needed or not?
//$this->tpl->assign('style', $this->tdStyle);
$alignAttr = isset($this->style[$r]['align']) && strlen($this->style[$r]['align'] > 0) ? " align=\"" . $this->style[$r]['align'] . "\"" : '';
$this->tpl->assign("alignAttr", $alignAttr);
$fieldName = $this->fields[$r]['Name'];
$fieldClass = get_class($this->xmlForm->fields[$fieldName]);
/**
* * BEGIN : Reeplace of @@, @%,...
* in field's attributes like onclick, link,
*/
if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->link)) {
$this->xmlForm->fields[$this->fields[$r]['Name']]->link = G::replaceDataField($this->style[$r]['link'], $result);
}
if (isset($this->xmlForm->fields[$fieldName]->value)) {
$this->xmlForm->fields[$fieldName]->value = G::replaceDataField($styleData['value'], $result);
}
/**
* * END : Reeplace of @@, @%,...
*/
/**
* * Rendering of the field
*/
$this->xmlForm->fields[$fieldName]->mode = 'view';
$this->xmlForm->setDefaultValues();
$this->xmlForm->setValues($result);
//var_dump($fieldName, $fieldClass );echo '<br /><br />';
if (array_search('renderTable', get_class_methods($fieldClass)) !== false) {
$htmlField = $this->xmlForm->fields[$fieldName]->renderTable($value, $this->xmlForm, true);
if (is_object($value)) {
$value = '';
}
// checking if the value variable is a html field, a html tag content can't contain as white spaces
$testValue = preg_match("/<a ?.*>(.*)<\\/a>/i", $htmlField, $value);
$this->tpl->assign("value", $htmlField);
if ($testValue > 0 && (isset($value[1]) && strlen(trim($value[1])) == 0)) {
if (trim($value[0]) == '') {
$this->tpl->assign("value", " ");
}
// $this->tpl->assign( "value" , (preg_match('^[[:space:]]^', $value) && (substr($fieldName,0,3)!="PRO"))? str_ireplace(" "," ",$htmlField):$htmlField );
} else {
$this->tpl->assign("value", $htmlField);
}
/* $testValue = preg_match( "/<\/?\w+((\s+(\w|\w[\w-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)\/?>/i", $value, $matches ); */
// if (empty($matches)){
// $this->tpl->assign( "value" , (preg_match('^[[:space:]]^', $value) && (substr($fieldName,0,3)!="PRO"))? str_ireplace(" "," ",$htmlField):$htmlField );
// } else {
// $this->tpl->assign( "value" , $htmlField );
// }
}
return $this->fields[$r]['Type'];
}
示例13: sendNoteNotification
public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "")
{
try {
if (!class_exists('System')) {
G::LoadClass('system');
}
$aConfiguration = System::getEmailConfiguration();
if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
return false;
}
$oUser = new Users();
$aUser = $oUser->load($usrUid);
$authorName = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
G::LoadClass('case');
$oCase = new Cases();
$aFields = $oCase->loadCase($appUid);
$configNoteNotification['subject'] = G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION') . " @#APP_TITLE ";
$configNoteNotification['body'] = G::LoadTranslation('ID_CASE') . ": @#APP_TITLE<br />" . G::LoadTranslation('ID_AUTHOR') . ": {$authorName}<br /><br />{$noteContent}";
$sFrom = G::buildFrom($aConfiguration, $sFrom);
$sSubject = G::replaceDataField($configNoteNotification['subject'], $aFields);
$sBody = nl2br(G::replaceDataField($configNoteNotification['body'], $aFields));
G::LoadClass('spool');
$oUser = new Users();
$recipientsArray = explode(",", $noteRecipients);
foreach ($recipientsArray as $recipientUid) {
$aUser = $oUser->load($recipientUid);
$sTo = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
$oSpool = new spoolRun();
$oSpool->setConfig($aConfiguration);
$oSpool->create(array('msg_uid' => '', 'app_uid' => $appUid, 'del_index' => 0, 'app_msg_type' => 'DERIVATION', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $sTo, 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending'));
if ($aConfiguration['MESS_BACKGROUND'] == '' || $aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1') {
$oSpool->sendMail();
}
}
//Send derivation notification - End
} catch (Exception $oException) {
throw $oException;
}
}
示例14: evaluateVariable
public function evaluateVariable()
{
$process = new Process();
if (!$process->isBpmnProcess($_SESSION['PROCESS'])) {
return;
}
require_once PATH_CORE . 'controllers/pmTablesProxy.php';
$pmTablesProxy = new pmTablesProxy();
$variableModule = new ProcessMaker\BusinessModel\Variable();
$searchTypes = array('checkgroup', 'dropdown', 'suggest');
$processVariables = $pmTablesProxy->getDynaformVariables($_SESSION['PROCESS'], $searchTypes, false);
$variables = $this->affected_fields;
$variables = array_unique($variables);
$newFields = array();
$arrayValues = array();
$arrayLabels = array();
if (is_array($variables) && is_array($processVariables)) {
foreach ($variables as $var) {
if (strpos($var, '_label') === false) {
if (in_array($var, $processVariables)) {
if (isset($this->aFields[$var]) && is_array($this->aFields[$var][1])) {
$varLabel = $var . '_label';
$arrayValue = $this->aFields[$var];
if (is_array($arrayValue) && sizeof($arrayValue)) {
foreach ($arrayValue as $val) {
if (is_array($val)) {
$val = array_values($val);
$arrayValues[] = $val[0];
$arrayLabels[] = $val[1];
}
}
if (sizeof($arrayLabels)) {
$varInfo = $variableModule->getVariableTypeByName($_SESSION['PROCESS'], $var);
if (is_array($varInfo) && sizeof($varInfo)) {
$varType = $varInfo['VAR_FIELD_TYPE'];
switch ($varType) {
case 'array':
$arrayLabels = '["' . implode('","', $arrayLabels) . '"]';
$newFields[$var] = $arrayValues;
$newFields[$varLabel] = $arrayLabels;
break;
case 'string':
$newFields[$var] = $arrayValues[0];
$newFields[$varLabel] = $arrayLabels[0];
break;
}
$this->affected_fields[] = $varLabel;
$this->aFields = array_merge($this->aFields, $newFields);
unset($newFields);
unset($arrayValues);
unset($arrayLabels);
}
}
}
}
if (isset($this->aFields[$var]) && is_string($this->aFields[$var])) {
$varInfo = $variableModule->getVariableTypeByName($_SESSION['PROCESS'], $var);
$options = G::json_decode($varInfo["VAR_ACCEPTED_VALUES"]);
$no = count($options);
for ($io = 0; $io < $no; $io++) {
if ($options[$io]->value === $this->aFields[$var]) {
$this->aFields[$var . "_label"] = $options[$io]->label;
}
}
if ($varInfo["VAR_DBCONNECTION"] !== "" && $varInfo["VAR_DBCONNECTION"] !== "none" && $varInfo["VAR_SQL"] !== "") {
try {
$cnn = Propel::getConnection($varInfo["VAR_DBCONNECTION"]);
$stmt = $cnn->createStatement();
$sql = G::replaceDataField($varInfo["VAR_SQL"], $this->aFields);
$rs = $stmt->executeQuery($sql, \ResultSet::FETCHMODE_NUM);
while ($rs->next()) {
$row = $rs->getRow();
if ($row[0] === $this->aFields[$var]) {
$this->aFields[$var . "_label"] = isset($row[1]) ? $row[1] : $row[0];
}
}
} catch (Exception $e) {
}
}
}
}
}
}
}
}
示例15: startContinueCaseByTimerEvent
//.........这里部分代码省略.........
$flagNextRecord = false;
$criteria = clone $criteriaMain;
$criteria->setOffset($start);
$criteria->setLimit($limit);
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
if ($counter + 1 > $total) {
$flagNextRecord = false;
break;
}
$row = $rsCriteria->getRow();
$row["TMREVN_CONFIGURATION_DATA"] = unserialize($row["TMREVN_CONFIGURATION_DATA"]);
//Set variables
$arrayTimerEventData = $row;
$arrayApplicationData = $case->loadCase($row["APP_UID"]);
$applicationUid = $row["APP_UID"];
$applicationNumber = $arrayApplicationData["APP_NUMBER"];
$delIndex = $row["DEL_INDEX"];
$delDelegateDate = $row["DEL_DELEGATE_DATE"];
$bpmnEventName = $row["EVN_NAME"];
//Continue the case
$continueCaseDate = $delDelegateDate;
switch ($arrayTimerEventData["TMREVN_OPTION"]) {
case "WAIT-FOR":
if ($arrayTimerEventData["TMREVN_DAY"] . "" != "") {
$continueCaseDate = date("Y-m-d H:i:s", strtotime("{$continueCaseDate} +" . (int) $arrayTimerEventData["TMREVN_DAY"] . " days"));
}
if ($arrayTimerEventData["TMREVN_HOUR"] . "" != "") {
$continueCaseDate = date("Y-m-d H:i:s", strtotime("{$continueCaseDate} +" . (int) $arrayTimerEventData["TMREVN_HOUR"] . " hours"));
}
if ($arrayTimerEventData["TMREVN_MINUTE"] . "" != "") {
$continueCaseDate = date("Y-m-d H:i:s", strtotime("{$continueCaseDate} +" . (int) $arrayTimerEventData["TMREVN_MINUTE"] . " minutes"));
}
break;
case "WAIT-UNTIL-SPECIFIED-DATE-TIME":
$continueCaseDate = \G::replaceDataField($arrayTimerEventData["TMREVN_CONFIGURATION_DATA"], $arrayApplicationData["APP_DATA"]);
break;
}
$arrayContinueCaseDateData = $this->getYearMonthDayHourMinuteSecondByDatetime($continueCaseDate);
if (!empty($arrayContinueCaseDateData)) {
$flagCase = false;
if (strtotime($continueCaseDate) < strtotime($dateIni)) {
$flagCase = true;
//Continue the old case
} else {
$yearCase = $arrayContinueCaseDateData[0];
$monthCase = $arrayContinueCaseDateData[1];
$dayCase = $arrayContinueCaseDateData[2];
$hourCase = $arrayContinueCaseDateData[3];
$minuteCase = $arrayContinueCaseDateData[4];
if ("{$yearCase}-{$monthCase}-{$dayCase}" == "{$year}-{$month}-{$day}") {
if ((int) ($hour . $minute) <= (int) ($hourCase . $minuteCase)) {
$flagCase = $hourCase == $hour && $minuteCase == $minute;
} else {
$flagCase = true;
//Continue the old case
}
}
}
if ($flagCase) {
if ($flagRecord) {
$common->frontEndShow("TEXT", "");
}
if ($bpmnEventName != "") {
$common->frontEndShow("TEXT", "> Name Timer-Event: {$bpmnEventName}");
}
$common->frontEndShow("TEXT", "> Continue the case #{$applicationNumber}");
$common->frontEndShow("TEXT", "> Routing the case #{$applicationNumber}...");
//Continue the case
//Derivate case
$result = $ws->derivateCase("", $applicationUid, $delIndex);
$arrayResult = json_decode(json_encode($result), true);
if ($arrayResult["status_code"] == 0) {
$common->frontEndShow("TEXT", " - OK");
$this->log("CONTINUED-CASE", "Case #{$applicationNumber} continued, APP_UID: {$applicationUid}, PRO_UID: " . $arrayTimerEventData["PRJ_UID"]);
} else {
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
$this->log("CONTINUED-CASE", "Failed: " . $arrayResult["message"] . ", Case: #{$applicationNumber}, APP_UID: {$applicationUid}, PRO_UID: " . $arrayTimerEventData["PRJ_UID"]);
}
$flagRecord = true;
}
} else {
$this->log("INVALID-CONTINUE-DATE", "Continue date: {$continueCaseDate}, Case: #{$applicationNumber}, APP_UID: {$applicationUid}, PRO_UID: " . $arrayTimerEventData["PRJ_UID"]);
}
$counter++;
$flagNextRecord = true;
}
$start = $start + $limit;
} while ($flagNextRecord);
if (!$flagRecord) {
$common->frontEndShow("TEXT", "Not exists any record to continue a case, on date \"{$datetime}\"");
$this->log("NO-RECORDS", "Not exists any record to continue a case");
}
$common->frontEndShow("END");
$this->log("END-CONTINUE-CASES", "Date \"{$datetime}\": End continue the cases");
} catch (\Exception $e) {
throw $e;
}
}