PM-939 "Support for Message-Event (Message-Event CRON)"

- Se a completado el envio de mensajes (para que el caso
  se "despause") para los eventos "INTERMEDIATE-CATCH-MESSAGE-EVENT"
This commit is contained in:
Victor Saisa Lopez
2015-02-24 14:07:29 -04:00
parent b7fbaffc64
commit 48c6195b8a
12 changed files with 309 additions and 45 deletions

View File

@@ -8,6 +8,8 @@ class MessageApplication
"limit" => "LIMIT"
);
private $frontEnd = false;
/**
* Verify if exists the Message-Application
*
@@ -207,6 +209,102 @@ class MessageApplication
}
}
/**
* Set front end flag
*
* @param bool $flag Flag
*
* return void
*/
public function setFrontEnd($flag)
{
try {
$this->frontEnd = $flag;
} catch (Exception $e) {
throw $e;
}
}
/**
* Progress bar
*
* @param int $total Total
* @param int $count Count
*
* return string Return a string that represent progress bar
*/
public function progressBar($total, $count)
{
try {
$p = (int)(($count * 100) / $total);
$n = (int)($p / 2);
return "[" . str_repeat("|", $n) . str_repeat(" ", 50 - $n) . "] $p%";
} catch (Exception $e) {
throw $e;
}
}
/**
* Show front end
*
* @param string $option Option
* @param string $data Data string
*
* return void
*/
public function frontEndShow($option, $data = "")
{
try {
if (!$this->frontEnd) {
return;
}
$numc = 100;
switch ($option) {
case "BAR":
echo "\r" . "| " . $data . str_repeat(" ", $numc - 2 - strlen($data));
break;
case "TEXT":
echo "\r" . "| " . $data . str_repeat(" ", $numc - 2 - strlen($data)) . "\n";
break;
default:
//START, END
echo "\r" . "+" . str_repeat("-", $numc - 2) . "+" . "\n";
break;
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Merge and get variables
*
* @param array $arrayVariableName Variables
* @param array $arrayVariableValue Values
*
* return array Return an array
*/
public function mergeVariables(array $arrayVariableName, array $arrayVariableValue)
{
try {
$arrayVariable = array();
foreach ($arrayVariableName as $key => $value) {
if (preg_match("/^@[@%#\?\x24\=]([A-Za-z_]\w*)$/", $value, $arrayMatch) && isset($arrayVariableValue[$key])) {
$arrayVariable[$arrayMatch[1]] = $arrayVariableValue[$key];
}
}
//Return
return $arrayVariable;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get all Message-Applications
*