当前位置: 首页>>代码示例>>PHP>>正文


PHP Notifications::getAll方法代码示例

本文整理汇总了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());
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:30,代码来源:ExecEngineApi.php

示例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());
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:ampersand,代码行数:31,代码来源:ExecEngineApi.php

示例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();
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:9,代码来源:ExcelImport.php

示例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());
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:15,代码来源:OAuthLoginApi.php

示例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());
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:ampersand,代码行数:15,代码来源:Api.php

示例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);
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:42,代码来源:Atom.php

示例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());
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:15,代码来源:Api.php


注:本文中的Notifications::getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。