Example #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;
 }
Example #2
0
 /**
  * Global implementation of Interfaces\Persistent
  * @return persistr\Interfaces\Model
  */
 function getModel()
 {
     return Registry::getModel($this);
 }
Example #3
0
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');
// loads list of authors for making SEO URL with hyphens
$authors = $registry->getModel('authors')->selectAuthorsForUrl();
$registry->getObject('template')->urlAuthors = $registry->getObject('url')->makeUrlFromData($authors, 'authorName');
// loads list of products for making SEO URL with hyphens
$products = $registry->getModel('products')->selectProductsForUrl();
$registry->getObject('template')->urlProducts = $registry->getObject('url')->makeUrlFromMultipleData($products, ['book_id', 'title']);
// checking if flash messages exists
$registry->getObject('template')->flashMessage = $registry->getObject('session')->checkFlashMessage('message');
$registry->getObject('template')->rateMessage = $registry->getObject('session')->checkFlashMessage('rate');
$registry->getObject('template')->reviewMessage = $registry->getObject('session')->checkFlashMessage('review');
$registry->getObject('template')->voucherNotice = $registry->getObject('session')->checkFlashMessage('voucherNotice');
$registry->getObject('template')->reviewHelpful = $registry->getObject('session')->checkFlashMessage('reviewHelpful');
// dealing with small basket in the header
if ($registry->getModel('basket')->isChecked() == false) {
    $registry->getModel('basket')->checkBasket();
}
if ($registry->getModel('basket')->isEmpty() == false) {