本文整理汇总了PHP中Notifications::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifications::getAll方法的具体用法?PHP Notifications::getAll怎么用?PHP Notifications::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notifications
的用法示例。
在下文中一共展示了Notifications::getAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* @url GET run
*/
public function run()
{
try {
$session = Session::singleton();
$db = Database::singleton();
$allowedRoles = (array) Config::get('allowedRolesForRunFunction', 'execEngine');
if (Config::get('loginEnabled') && !is_null($allowedRoles)) {
$ok = false;
$sessionRoles = Role::getAllSessionRoles();
foreach ($sessionRoles as $role) {
if (in_array($role->label, $allowedRoles)) {
$ok = true;
}
}
if (!$ok) {
throw new Exception("You do not have access to run the exec engine", 401);
}
}
$session->setRole();
ExecEngine::runAllRules();
$db->closeTransaction('Run completed', false, true, false);
$result = array('notifications' => Notifications::getAll());
return $result;
} catch (Exception $e) {
throw new RestException($e->getCode(), $e->getMessage());
}
}
示例2: run
/**
* @url GET run
* @param array $roleIds
*/
public function run($roleIds = null)
{
try {
$session = Session::singleton();
$session->activateRoles($roleIds);
// Check sessionRoles if allowedRolesForRunFunction is specified
$allowedRoles = Config::get('allowedRolesForRunFunction', 'execEngine');
if (!is_null($allowedRoles)) {
$ok = false;
foreach ($session->getSessionRoles() as $role) {
if (in_array($role->label, $allowedRoles)) {
$ok = true;
}
}
if (!$ok) {
throw new Exception("You do not have access to run the exec engine", 401);
}
}
ExecEngine::run(true);
$db = Database::singleton();
$db->closeTransaction('Run completed', false, true, false);
$result = array('notifications' => Notifications::getAll());
return $result;
} catch (Exception $e) {
throw new RestException($e->getCode(), $e->getMessage());
}
}
示例3: ParseFile
public function ParseFile()
{
Notifications::addLog('------------------------- EXCEL IMPORT STARTED -------------------------', 'ExcelImport');
$this->ProcessFileContent();
Notifications::addLog('------------------------- END OF EXCEL IMPORT -------------------------', 'ExcelImport');
// Close transaction => ROLLBACK or COMMIT.
$this->db->closeTransaction('File uploaded', false, true, false);
return Notifications::getAll();
}
示例4: logout
/**
* @url GET logout
*/
public function logout()
{
try {
$session = Session::singleton();
$db = Database::singleton();
$db->deleteAtom(session_id(), 'SESSION');
$db->closeTransaction('Logout successfull', false, true, false);
return array('notifications' => Notifications::getAll());
} catch (Exception $e) {
throw new RestException($e->getCode(), $e->getMessage());
}
}
示例5: getAllNotifications
/**
* @url GET notifications/all
* @param array $roleIds
*/
public function getAllNotifications($roleIds = null)
{
try {
$session = Session::singleton();
$session->activateRoles($roleIds);
RuleEngine::getProcessViolationsFromDB($session);
return Notifications::getAll();
} catch (Exception $e) {
throw new RestException($e->getCode(), $e->getMessage());
}
}
示例6: post
public function post(&$interface, $request_data, $requestType)
{
switch ($requestType) {
case 'feedback':
$databaseCommit = false;
break;
case 'promise':
$databaseCommit = true;
break;
default:
throw new Exception("Unkown request type '{$requestType}'. Supported are: 'feedback', 'promise'", 500);
}
// Get current state of atom
$before = $this->getContent($interface, true, $this->id);
$before = current($before);
// current(), returns first item of array. This is valid, because put() concerns exactly 1 atom.
// Determine differences between current state ($before) and requested state ($request_data)
$patches = JsonPatch::diff($before, $request_data);
// Skip remove operations, because it is a POST operation and there are no values in de DB yet
$patches = array_filter($patches, function ($patch) {
return $patch['op'] != 'remove';
});
// Patch
foreach ((array) $patches as $key => $patch) {
switch ($patch['op']) {
case "replace":
$this->doPatchReplace($patch, $interface, $before);
break;
case "add":
$this->doPatchAdd($patch, $interface, $before);
break;
case "remove":
$this->doPatchRemove($patch, $interface, $before);
break;
default:
throw new Exception("Unknown patch operation '" . $patch['op'] . "'. Supported are: 'replace', 'add' and 'remove'", 501);
}
}
// $databaseCommit defines if transaction should be committed or not when all invariant rules hold. Returns if invariant rules hold.
$invariantRulesHold = $this->database->closeTransaction($this->concept . ' created', false, $databaseCommit);
return array('patches' => $patches, 'content' => current((array) $this->newContent), 'notifications' => Notifications::getAll(), 'invariantRulesHold' => $invariantRulesHold, 'requestType' => $requestType);
}
示例7: getAllNotifications
/**
* @url GET notifications/all
* @param int $roleId
*/
public function getAllNotifications($roleId = 0)
{
try {
$session = Session::singleton();
$session->setRole($roleId);
$session->role->getViolations();
return Notifications::getAll();
} catch (Exception $e) {
throw new RestException($e->getCode(), $e->getMessage());
}
}