Beispiel #1
0
 /**
  * Init application
  * 
  * @param \Zend\ModuleManager\ModuleEvent $e
  */
 public function initApplication(ModuleEvent $e)
 {
     // init user identity
     $this->initUserIdentity();
     // init time zone
     $this->initTimeZone();
     // clear users caches
     $eventManager = LayoutEvent::getEventManager();
     $eventManager->attach(LayoutEvent::UNINSTALL, function ($e) {
         UserCacheUtility::clearUserCache();
     });
     $eventManager = LocalizationEvent::getEventManager();
     $eventManager->attach(LocalizationEvent::UNINSTALL, function ($e) {
         UserCacheUtility::clearUserCache();
     });
 }
 /**
  * Uninnstall custom layout
  *
  * @param array $layout
  *      integer id
  *      string name
  *      string type 
  *      string version 
  *      string vendor 
  *      string vendor_email 
  * @return boolean|string
  */
 public function uninstallCustomLayout(array $layout)
 {
     try {
         $this->adapter->getDriver()->getConnection()->beginTransaction();
         // clear caches
         $this->clearLayoutCaches();
         $query = $this->delete('layout_list')->where(['id' => $layout['id']]);
         $statement = $this->prepareStatementForSqlObject($query);
         $statement->execute();
         $this->adapter->getDriver()->getConnection()->commit();
     } catch (Exception $e) {
         $this->adapter->getDriver()->getConnection()->rollback();
         ApplicationErrorLogger::log($e);
         return $e->getMessage();
     }
     // fire the uninstall custom layout event
     LayoutEvent::fireUninstallCustomLayoutEvent($layout['name']);
     return true;
 }