コード例 #1
0
 /**
  * @inheritdoc
  */
 public function toDesignModeHtml()
 {
     // TODO: Das muss hier raus, damit man Polymorphie nutzen kann
     if ($this->re_module == '') {
         return new HtmlControl(null);
     }
     $module = Modules::getModule($this->re_module);
     if ($module == null) {
         return new HtmlControl(null);
     }
     $action = $module->getAction($this->re_action);
     $div = Html::createElement('div')->addCssClass('panel panel-info')->addInnerHtml("<div class=\"panel-heading\">\n                    <span class=\"label label-default\">{$module->name}</span>\n                    <em>{$action->description}</em>\n                    <small>[{$this->re_parameter}]</small>\n                </div>");
     $divInner = Html::createElement('div')->addTo($div)->addCssClass('panel-body');
     $btnGroup = new \NewFrontiers\Controls\StdControls\ButtonGroupControl(null, 'btnGroup' . $this->id);
     $divInner->addInnerHtml($btnGroup);
     $btnDelete = new ButtonControl($btnGroup, 'btnDelete' . $this->id);
     $btnDelete->setCaption(' ')->setIcon('minus')->addCssClass('confirm')->addCssClass('btn-danger')->setLink('site', 'deleteRegion', array('id' => $this->id));
     $btnEdit = new ButtonControl($btnGroup, 'btnEdit' . $this->id);
     $btnEdit->setCaption('')->setIcon('edit')->addCssClass('nfs-modal')->addCssClass('btn-primary')->setLink('site', 'editRegion', array('id' => $this->id));
     $btnUp = new ButtonControl($btnGroup, 'btnUp' . $this->id);
     $btnUp->setCaption('')->setIcon('arrow-up')->setLink('site', 'regionUp', array('id' => $this->id));
     $btnDown = new ButtonControl($btnGroup, 'btnDown' . $this->id);
     $btnDown->setCaption('')->setIcon('arrow-down')->setLink('site', 'regionDown', array('id' => $this->id));
     $result = new HtmlControl(null, 'region' . $this->id);
     $result->setInnerHtml($div->render());
     return $result;
 }
コード例 #2
0
 protected function createControls()
 {
     $button = new ButtonControl($this, 'button');
     $button->setCaption('Neues Modul anlegen')->setLink('modView', 'newModule')->setIcon('plus')->addCssClass('nfs-modal')->setButtonClass(ButtonControl::BUTTON_PRIMARY);
     $listView = new ListViewControl($this, 'lv');
     $listView->setSkinfile(__DIR__ . '/ModuleListView.skin');
     $listView->setItemSkinFile(__DIR__ . '/ModuleListItem.skin');
     $listView->setVar('header', '<th>Name</th><th>Beschreibung</th><th>Version</th><th>Autor</th><th>&nbsp;</th>');
     $listView->addItems(Modules::getAllModules());
 }
コード例 #3
0
 /**
  * @param BaseEntity $entity
  * @param array $param
  * @return $this
  */
 public function setEntity($entity, $param = array())
 {
     $this->entity = $entity;
     $class = explode('\\', get_class($entity));
     $class = $class[count($class) - 1];
     $this->setLink($this->entity->getModuleName(), 'init' . $class, $param);
     $action = Modules::getModule($this->entity->getModuleName())->getAction('init' . $class);
     if ($action != null) {
         $this->berechtigt = $action->isBerechtigt();
     }
     return $this;
 }
コード例 #4
0
 public function toHtml()
 {
     $panel = new Html('div');
     $panel->addAttribute('id', 'actionLookup');
     $select = new Html('select');
     $select->addCssClass('lookup')->addCssClass('form-control');
     $select->addAttribute('name', $this->id);
     $select->addTo($panel);
     $actions = array();
     if (isset($this->module)) {
         $actions = Modules::getModule($this->module)->getAllMenuActions();
     }
     foreach ($actions as $action) {
         $option = new Html('option');
         $option->addAttribute('value', $action->name)->addInnerHtml($action->description);
         if ($action->name == $this->selectedItem) {
             $option->addAttribute('selected', 'selected');
         }
         $select->addInnerHtml($option);
     }
     return $panel->render();
 }
コード例 #5
0
 public function toHtml()
 {
     $select = new Html('select');
     $select->addCssClass('lookup')->addCssClass('form-control');
     $select->addAttribute('name', $this->id);
     $select->addAttribute('id', $this->id);
     $modules = Modules::getAllModules();
     $option = new Html('option');
     $option->addAttribute('value', '0')->addInnerHtml('-- bitte wählen --');
     $select->addInnerHtml($option);
     foreach ($modules as $module) {
         if (!$module instanceof Module) {
             continue;
         }
         $option = new Html('option');
         $option->addAttribute('value', $module->qualifiedName)->addInnerHtml($module->description);
         if ($module->name == $this->selectedItem) {
             $option->addAttribute('selected', 'selected');
         }
         $select->addInnerHtml($option);
     }
     return $select->render();
 }
コード例 #6
0
 /**
  * Speichert das Modul mit Hilfe des ModuleProviders
  */
 public function save()
 {
     Modules::saveModule($this);
 }
コード例 #7
0
 /**
  * Gibt das HTML Markup aus. Die Funktion hinter dem Wrapper wird jetzt erst aufgerufen!
  * @return string
  * @throws Exception
  */
 public function toHtml()
 {
     // Erzeugen des neuen Requests
     $request = Application::getCurrentRequest()->createSubRequest();
     $request->module = $this->module;
     $request->action = $this->action;
     $request->embedded = true;
     $request->setViaArray($this->param);
     $module = Modules::getModule($this->module);
     if ($module == null) {
         throw new Exception("[Wrapper] Modul {$this->module} konnte nicht geladen werden");
     }
     $controller = $module->createController($request);
     if ($controller->hatBerechtigung()) {
         $response = $controller->execute($request);
         Logging::warning((string) $response->getContent());
         if ($response->getContent() instanceof View) {
             $result = '<div id="' . $this->id . '" class="wrapper">' . $response->getContent()->render() . '</div>';
         } else {
             $result = 'NO VIEW';
         }
     } else {
         $result = '<div class="alert alert-danger">Für diese Funktion haben Sie keine ausreichende Berechtigung</div>';
     }
     // Ergebnis in einem Panel verpacken
     if ($this->showInPanel) {
         $panel = new CaptionedPanelControl(null, 'panel-' . $this->id);
         $panel->setCaption($this->panelCaption);
         $panel->setCollapsed($this->panelCollapsed);
         $html = new HtmlControl($panel);
         $html->setInnerHtml($result);
         $result = $panel->toHtml();
     }
     return $result;
 }
コード例 #8
0
 /**
  * Definition auslesen und entsprechnd die Felder und Arrays mit
  * Objekten befüllen
  * @param $module
  * @param EntityDefinition $definition
  */
 protected function entityAufbauen($module, EntityDefinition $definition)
 {
     if ($module === null || $definition === null) {
         return;
     }
     $this->primaryKey = $this->definition->primaryKey;
     if ($definition->extends !== '') {
         list($moduleStr, $entityName) = explode(':', $definition->extends);
         $moduleObj = Modules::getModule($moduleStr);
         $entityObj = $moduleObj->getEntity($entityName);
         $this->entityAufbauen($moduleObj, $entityObj);
     }
     foreach ($definition->fields as $field) {
         $this->felder[$field->name] = clone $field;
         $this->felder[$field->name]->setEntity($this);
     }
     foreach ($definition->relations as $relation) {
         $this->relationen[$relation->name] = clone $relation;
         $this->relationen[$relation->name]->setOwner($this);
     }
     foreach ($definition->lookupFields as $lookup) {
         $this->lookupFelder[$lookup->name] = clone $lookup;
         $this->lookupFelder[$lookup->name]->setEntity($this);
     }
 }
コード例 #9
0
 /**
  * Diese Methode führt den übergebenen Request aus. Für die Dauer der Ausführung
  * ist der Request über Application::getRequest abrufbar. Danach wird wieder auf
  * den alten Kontext gewechselt, wenn es denn vorher einen gab
  *
  * @param Request $request
  * @return mixed
  */
 public function handleRequest(Request $request)
 {
     $response = null;
     Profiler::startSection('Application.handleRequest');
     $oldRequest = $this->request;
     $this->request = $request;
     $this->preRequest($request);
     // Geschäftsmodul laden und entsprechenden Controller erzeugen
     $moduleObj = Modules::getModule($request->module);
     if ($moduleObj === null) {
         Logging::error("Modul {$request->module} konnte nicht geladen werden");
         $this->showError();
     } else {
         $controller = $moduleObj->createController($this->request);
         if ($controller !== null) {
             $response = $this->executeRequestViaController($controller, $request);
         } else {
             Logging::error("Controller für Modul {$request->module} konnte nicht geladen werden");
             $this->showError();
         }
     }
     $this->postRequest($request, $response);
     $this->request = $oldRequest;
     Profiler::endSection('Application.handleRequest');
     return $response;
 }
コード例 #10
0
 /**
  * Wird nach einem AJAX Request aufgerufen um das Grid zu konfigurieren
  * @param <type> $config Array mit den statischen Config-Daten (Name, Spalten, etc)
  * @param <type> $sort Array mit den dynamischen Config-Daten (Sortierung, etc)
  */
 public function loadFromConfigArray($config, $sort = null)
 {
     $this->id = $config['id'];
     $entity = $config['entity'];
     $module = $config['module'];
     $this->sortable = $config['sortable'];
     $this->groupColumn = $config['groupColumn'];
     $this->renderGrouped = $config['renderGrouped'];
     $this->searchParam = unserialize($config['parameter']);
     $this->sum = $config['sum'];
     $this->recordsPerPage = $config['recordsPerPage'];
     $this->showHeader = $config['showHeader'];
     $this->paginationOnTop = $config['paginationOnTop'];
     //$this->trCssTemplate = $config['trCssTemplate'];
     $moduleObj = Modules::getModule($module)->createController(new Request());
     $this->entity = new $entity();
     $this->page = 1;
     if (isset($sort)) {
         $this->sorting = $sort;
     }
     foreach ($config['columns'] as $column) {
         // TODO: Refactoren
         switch ($column['type']) {
             case 0:
                 $temp = new GridColumn();
                 break;
             case 2:
                 $temp = new GridColumnLink();
                 break;
         }
         $temp->loadFromConfigArray($column);
         $this->addColumn($temp);
     }
 }
コード例 #11
0
 public function forwardEngineerAll()
 {
     $module = Modules::getModule($this->request->id);
     $module->model->forwardEngineer();
 }
コード例 #12
0
 public function migrateDatabase()
 {
     $module = Modules::getModule($this->getModulename());
     $module->model->forwardEngineer();
 }
コード例 #13
0
 /**
  * @return Breeze\StructuralType
  */
 public function getMetatadata()
 {
     // Kopf
     $type = new Breeze\StructuralType();
     $type->shortName = $this->getResourceName();
     $type->namespace = 'Nostromo';
     // TODO
     $type->autoGeneratedKeyType = 'Identity';
     $type->defaultResourceName = $this->getResourceName();
     // Primärschlüssel
     $property = $type->addDataProperty();
     $property->name = 'id';
     $property->dataType = 'Int32';
     $property->isPartOfKey = true;
     // TODO: Unschön....
     $felder = $this->entityDefinition->fields;
     if ($this->entityDefinition->extends !== '') {
         list($moduleStr, $entityName) = explode(':', $this->entityDefinition->extends);
         $moduleObj = Modules::getModule($moduleStr);
         $entityObj = $moduleObj->getEntity($entityName);
         $felder = array_merge($felder, $entityObj->fields);
     }
     // Felder
     foreach ($this->mapping as $map) {
         /** @var ModelField $field */
         $field = $felder[$map->getProperty()];
         if ($field !== null) {
             $property = $type->addDataProperty();
             $property->name = $map->getJsonName();
             $property->dataType = BreezeMapping::getBreezeDataType($field->getType());
         }
         // TODO: maxlength
     }
     return $type;
 }