Exemplo n.º 1
0
 /**
  * @return FrontendModule
  */
 protected function FrontendModule()
 {
     if (!$this->frontendModule) {
         $this->frontendModule = ClassFinder::CreateFrontendModule($this->Value('Module'));
     }
     return $this->frontendModule;
 }
Exemplo n.º 2
0
 /**
  * Initializes a new content branch
  * @param mixed $item The content tree item
  */
 function __construct($item)
 {
     $this->item = $item;
     $this->tree = $this->TreeProvider();
     $this->child = $this->tree->FirstChildOf($this->item);
     $this->content = $this->tree->ContentByItem($this->item);
     $this->module = ClassFinder::CreateFrontendModule($this->content->GetType());
     $this->module->SetTreeItem($this->tree, $this->item);
 }
Exemplo n.º 3
0
 protected function Init()
 {
     $this->bundlesModules = ClassFinder::BackendNavModules();
     $coreModules = $this->bundlesModules['Core'];
     //unset overview module
     unset($coreModules[0]);
     $this->bundlesModules['Core'] = array_values($coreModules);
     return parent::Init();
 }
Exemplo n.º 4
0
 /**
  * Renders the content
  * @return string Returns the rendered content
  */
 function Render()
 {
     if (!self::Guard()->Allow(Action::Read(), $this->content)) {
         return '';
     }
     ContentTranslator::Singleton()->SetContent($this->content);
     $module = ClassFinder::CreateFrontendModule($this->content->GetType());
     $module->SetTreeItem($this->tree, $this->item);
     return $module->Render();
 }
Exemplo n.º 5
0
 /**
  * Initializes the bundle and module names
  * @param array $idParts
  */
 private function InitModule(array $idParts)
 {
     if (count($idParts) < 1 || count($idParts) > 2) {
         //TODO: Message
         Response::Redirect(BackendRouter::ModuleUrl(new TemplateList()));
     }
     $this->module = ClassFinder::CreateFrontendModule($idParts[0]);
     if (!$this->module instanceof FrontendModule || !$this->module->AllowCustomTemplates()) {
         //TODO: Message
         Response::Redirect(BackendRouter::ModuleUrl(new TemplateList()));
     }
 }
Exemplo n.º 6
0
 /**
  * Loads installed bundles to the frontend
  * @param Site $site
  */
 static function LoadInstalledToFrontend(Site $site)
 {
     $bundles = InstalledBundle::Schema()->Fetch();
     foreach ($bundles as $bundle) {
         $manifest = ClassFinder::Manifest($bundle->GetBundle());
         $manifest->LoadToFrontend($site);
     }
 }
Exemplo n.º 7
0
 /**
  * The removel template module
  * @param array $idParts
  * @return FrontendModule
  */
 protected function RemovalTemplateModule(array $idParts)
 {
     if (count($idParts) != 2) {
         return null;
     }
     $module = ClassFinder::CreateFrontendModule($idParts[0]);
     return $module instanceof FrontendModule && $module->AllowCustomTemplates() ? $module : null;
 }
Exemplo n.º 8
0
 /**
  * Gets all backend module names for a bundle
  * @param string $bundle The bundle name
  * @return string Returns the module names
  */
 protected function Modules($bundle)
 {
     $modules = PathUtil::BackendModules($bundle);
     $result = array();
     foreach ($modules as $module) {
         $instance = ClassFinder::CreateBackendModule(ClassFinder::CalcModuleType($bundle, $module));
         if ($instance instanceof BackendModule) {
             $result[] = $module;
         }
     }
     return $result;
 }
Exemplo n.º 9
0
 /**
  * Initializes the side navigation
  */
 protected function Init()
 {
     $this->bundleModules = ClassFinder::BackendNavModules();
     return parent::Init();
 }
Exemplo n.º 10
0
 /**
  * Returns the module type, composed by bundle and module name
  * @return string Returns a simplified type string
  */
 static function MyType()
 {
     return ClassFinder::ModuleType(new static());
 }
Exemplo n.º 11
0
 /**
  * Installs a dependency
  * @param BundleDependency $dependency
  * @return boolean
  */
 private function InstallDependency(BundleDependency $dependency)
 {
     $bundle = $dependency->BundleName();
     if (array_key_exists($bundle, $this->failedBundles)) {
         return false;
     }
     $installedVersion = $this->InstalledVersion($bundle);
     $manifest = ClassFinder::Manifest($bundle);
     if (!$installedVersion || version_compare($installedVersion, $manifest->Version()) < 0) {
         if (!$this->InstallBundle($bundle)) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 12
0
 /**
  * Gets the module from request url
  * @return ModuleBase Returns the backend module
  */
 static function UrlModule()
 {
     $module = Request::GetData('module');
     return ClassFinder::CreateBackendModule($module);
 }