Exemplo n.º 1
0
 /**
  * Статичный метод обработки сгенерированного события:
  * - событие может просто записаться в базу для дальнейшего выполнения 
  * - а может сразу выполниться
  * @param string $event - событие
  * @param array $params - массив с параметрами события
  * @param bool $needRealExecute - нужно ли сразу выполнять событие
  */
 public function executeEvent($event, $params, $needRealExecute = false)
 {
     // проверяем, есть ли для данного проекта обработчик этого события
     if (file_exists($this->rootPath . 'workflow/projects/' . $this->project['projectID'] . '/Event/' . $event . '.php')) {
         if (file_exists($this->rootPath . 'workflow/projects/' . $this->project['projectID'] . '/settings.php')) {
             include_once $this->rootPath . 'workflow/projects/' . $this->project['projectID'] . '/settings.php';
         }
         $eventData = array('dt' => date('d-m-Y H:i:s'), 'projectID' => $this->project['projectID'], 'event_type' => $event, 'params' => json_encode($params), 'done' => 0, 'locked' => 0);
         $eventID = $this->registry->getDbHelper('WorkflowHelper')->addEvent($eventData);
         $eventData['eventID'] = $eventID;
         if ($needRealExecute) {
             $this->registry->getModel('Tasks')->executeEvent($eventData);
         }
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Global implementation of Interfaces\Persistent
  * @return persistr\Interfaces\Model
  */
 function getModel()
 {
     return Registry::getModel($this);
 }
Exemplo n.º 3
0
$registry->createAndStoreModel('Rating', 'rating');
$registry->createAndStoreModel('Review', 'review');
$registry->createAndStoreModel('Checkout', 'checkout');
$registry->createAndStoreModel('UploadFiles', 'upload');
$registry->getObject('url')->getURLData();
$registry->storeSetting('default', 'view');
$registry->storeSetting('template', 'template');
$registry->storeSetting('authentication', 'authenticate');
$registry->storeSetting('Book Store', 'sitename');
$registry->storeSetting('https://', 'protocol');
$registry->storeSetting($registry->getSetting('protocol') . 'localhost/bookstore/', 'siteurl');
include 'protected/config/config.php';
// create database connection
$registry->getObject('db')->newConnection(DB_SERVER, DB_NAME, DB_USER, DB_PASS);
// process authentication
$registry->getModel('authenticate')->checkForAuthentication();
if ($registry->getModel('authenticate')->isLoggedIn() === true) {
    $registry->getObject('template')->username = $registry->getObject('session')->get('firstName');
    $registry->getObject('template')->loggedIn = $registry->getModel('authenticate')->isLoggedIn();
}
// loads list of categories for sidebar menu
// limits display on 12 categories randomly ordered
$registry->getObject('template')->sidebarCategories = $registry->getModel('categories')->categoriesForSidebar();
// loads list of authors for sidebar menu
// limit display on 12 authors randomly ordered
$registry->getObject('template')->sidebarAuthors = $registry->getModel('authors')->authorsForSidebar();
// loads 4 new released products for main header slider
$registry->getObject('template')->newProducts = $registry->getModel('products')->selectNewReleases();
// loads list of categories for making SEO URL with hyphens
$categories = $registry->getModel('categories')->selectCategoriesForUrl();
$registry->getObject('template')->urlCategories = $registry->getObject('url')->makeUrlFromData($categories, 'category');