Wysyła nagłówki do klienta
@return \Mmi\Http\Response
493429
public function sendHeaders()
    {
        //iteracja po nagłówkach
        foreach ($this->_headers as $key => $header) {
            //usuwanie nagłówka z rejestru
            unset($this->_headers[$key]);
            //wysłanie nagłówka
            $header->send();
        }
        return $this;
    }
271782
public function createAction()
    {
        $this->getResponse()->setTypeJson();
        $cat = new \Cms\Orm\CmsCategoryRecord();
        $cat->name = $this->getPost()->name;
        $cat->parentId = ($this->getPost()->parentId > 0) ? $this->getPost()->parentId : null;
        $cat->order = $this->getPost()->order;
        $cat->active = false;
        $cat->status = \Cms\Orm\CmsCategoryRecord::STATUS_ACTIVE;
        if ($cat->save()) {
            $icon = '';
            $disabled = false;
            //ikona nieaktywnego wezla gdy nieaktywny
            if (!$cat->active) {
                $icon = $this->view->baseUrl . '/resource/cmsAdmin/images/folder-inactive.png';
            }
            //sprawdzenie uprawnień do węzła
            $acl = (new \CmsAdmin\Model\CategoryAclModel)->getAcl();
            if (!$acl->isAllowed(\App\Registry::$auth->getRoles(), $cat->id)) {
                $disabled = true;
                //ikona zablokowanego wezla gdy brak uprawnien
                $icon = $this->view->baseUrl . '/resource/cmsAdmin/images/folder-disabled.png';
            }
            return json_encode([
                'status' => true,
                'id' => $cat->id,
                'icon' => $icon,
                'disabled' => $disabled,
                'message' => $this->view->_('controller.category.create.message')
            ]);
        }
        return json_encode(['status' => false, 'error' => $this->view->_('controller.category.create.error')]);
    }
1266414
public function setup(\Mmi\Http\Request $request)
    {
        //aktywuje liście drzewa
        $activatedTree = $this->_setupActive($this->_config->build, $request->toArray());
        //uzupełnia breadcrumbs na podstawie aktywnych
        if (isset($activatedTree['tree'][0]['children'])) {
            //ustawia breadcrumby
            $this->_setupBreadcrumbs($activatedTree['tree'][0]['children']);
        }
        return $this;
    }
29524
public function editAction()
    {
        $form = new \CmsAdmin\Form\Text(new \Cms\Orm\CmsTextRecord($this->id));
        $this->view->textForm = $form;
        //brak wysłanych danych
        if (!$form->isMine()) {
            return;
        }
        //zapisany
        if ($form->isSaved()) {
            $this->getMessenger()->addMessage('messenger.text.text.saved', true);
            $this->getResponse()->redirect('cmsAdmin', 'text');
        }
        $this->getMessenger()->addMessage('messenger.text.text.error', false);
    }
337576
public function listAction()
    {
        \Mmi\App\FrontController::getInstance()->getResponse()->setHeader('Content-type', 'application/json');
        if (!$this->object || !$this->objectId || !$this->hash || !$this->t) {
            return '';
        }
        if ($this->hash != md5(\Mmi\Session\Session::getId() . '+' . $this->t . '+' . $this->objectId)) {
            return '';
        }
        $files = [];
        foreach (\Cms\Orm\CmsFileQuery::imagesByObject($this->object, $this->objectId)->find() as $file) {
            $files[] = ['title' => $file->original, 'value' => $file->getUrl('default', '')];
        }
        return json_encode($files);
    }
594538
public function indexAction()
    {
        $extractedDoc = $this->get('kreta_simple_api_doc.extractor.api_doc_extractor')->all();
        $htmlContent = $this->get('nelmio_api_doc.formatter.html_formatter')->format($extractedDoc);

        return new Response($htmlContent, 200, ['Content-Type' => 'text/html']);
    }
1088017
public function removeAction()
    {
        $this->getResponse()->setTypePlain();
        if (!$this->id) {
            return $this->view->getTranslate()->_('Usuwanie nie powiodło się, brak pliku');
        }
        $file = (new CmsFileQuery)->findPk($this->id);
        if (!$file || $this->hash != $file->getHashName()) {
            return $this->view->getTranslate()->_('Usuwanie nie powiodło się');
        }
        $file->delete();
        return '';
    }
138286
public function editAction()
    {
        $this->getResponse()->setTypeJson();
        $error = json_encode(['error' => 'Edycja nie powiodła się, brak pliku']);
        //brak id
        if (!$this->id) {
            return $error;
        }
        //brak pliku
        if (null === ($file = (new CmsFileQuery)->findPk($this->id))) {
            return $error;
        }
        //błędny plik
        if ($this->hash != $file->getHashName()) {
            return $error;
        }
        //zapis
        $postData = $this->getPost()->toArray();
        if (!empty($postData)) {
            $file->setFromArray($postData)
                ->save();
        }
        //json na potrzeby wyświetlenia formularza
        return $file->toJson();
    }
735450
protected function _buildBreadcrumbs()
    {
        //obiekt nawigatora niezdefiniowany
        if (null === self::$_navigation) {
            return $this;
        }
        //pobieranie breadcrumbów
        $data = $this->getBreadcrumbsData();
        //błędny format danych
        if (!is_array($data)) {
            return $this;
        }
        //inicjalizacja zmiennych
        $title = [];
        $breadcrumbs = [];
        $descriptions = [];
        $i = 0;
        //iteracja po odwróconej tablicy breadcrumbów
        foreach (array_reverse($data) as $breadcrumb) {
            $i++;
            $breadcrumb['label'] = isset($breadcrumb['label']) ? $breadcrumb['label'] : '';
            //dodawanie breadcrumbów (ostatni nie ma linku)
            $breadcrumbs[] = ($i == 1) ? ('<span>' . strip_tags($breadcrumb['label']) . '</span>') :
                ('<a href="' . $breadcrumb['uri'] . '">' . strip_tags($breadcrumb['label']) . '</a>');
            //liść wyłączony (poza ostatnim)
            if (($i != 1) && $breadcrumb['disabled']) {
                continue;
            }
            //dodawanie tytułu
            $title[] = isset($breadcrumb['title']) ? strip_tags($breadcrumb['title']) : strip_tags($breadcrumb['label']);
            //dodawanie opisów
            if (isset($breadcrumb['description'])) {
                $descriptions[] = strip_tags($breadcrumb['description']);
            }
            //ustawiony jest tytuł - nie łączymy z poprzednikami
            if (isset($breadcrumb['title'])) {
                break;
            }
        }
        //ustawianie pól
        return $this->setTitle(trim(implode($this->_metaSeparator, $title)))
                ->setDescription(trim(implode($this->_metaSeparator, $descriptions)))
                //breadcrumby muszą zostać odwrócone
                ->setBreadcrumbs(trim(implode($this->_separator, array_reverse($breadcrumbs))));
    }
987146
public function currentAction()
    {
        $objectId = !empty($this->getPost()->objectId) ? $this->getPost()->objectId : null;
        switch ($this->getPost()->fileTypes) {
            case 'images' :
                //zapytanie o obrazki
                $query = CmsFileQuery::imagesByObject($this->getPost()->object, $objectId);
                break;
            case 'notImages' :
                //wszystkie pliki bez obrazków
                $query = CmsFileQuery::notImagesByObject($this->getPost()->object, $objectId);
                break;
            default :
                //domyślne zapytanie o wszystkie pliki
                $query = CmsFileQuery::byObject($this->getPost()->object, $objectId);
        }

        $records = $query->find();
        foreach ($records as $record) {
            $record->data = $record->data->toArray();
        }

        //zwrot json'a z plikami
        return json_encode([
            'result' => 'OK',
            'files' => $records->toArray()
        ]);
    }
150953
public function deleteRoleAction()
    {
        //wyszukiwanie i usuwanie roli
        if ((null !== $role = (new \Cms\Orm\CmsRoleQuery)->findPk($this->id))) {
            $this->getMessenger()->addMessage(($deleteResult = (bool) $role->delete()) ? 'messenger.acl.role.deleted' : 'messenger.acl.role.delete.error', $deleteResult);
        }
        //redirect
        $this->getResponse()->redirect('cmsAdmin', 'acl', 'index', ['roleId' => $this->id]);
    }
1179840
public function previewAction()
    {
        //wyłączenie layout
        $this->view->setLayoutDisabled();
        //wyszukiwanie kategorii
        if (null === $this->view->category = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->categoryId)) {
            $this->getResponse()->redirect('cmsAdmin', 'category', 'tree');
        }
    }
281384
public function moveAction()
    {
        $this->getResponse()->setTypeJson();
        //brak kategorii
        if (null === $masterCategory = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->getPost()->id)) {
            return json_encode(['status' => false, 'error' => $this->view->_('controller.category.move.error.missing')]);
        }
        //domyślnie nie ma drafta - alias
        $draft = $masterCategory;
        //zmiana parenta tworzy draft
        if ($this->getPost()->parentId != $masterCategory->parentId) {
            //tworzenie draftu
            $draft = (new \Cms\Model\CategoryDraft($masterCategory))->createAndGetDraftForUser(\App\Registry::$auth->getId(), true);
        }
        //zapis kolejności
        $draft->parentId = ($this->getPost()->parentId > 0) ? $this->getPost()->parentId : null;
        $draft->order = $this->getPost()->order;
        //próba zapisu
        return ($draft->save() && $draft->commitVersion()) ? json_encode(['status' => true, 'id' => $masterCategory->id, 'message' => $this->view->_('controller.category.move.message')]) : json_encode(['status' => false, 'error' => $this->view->_('controller.category.move.error')]);
    }
248176
public function setForm(\Mmi\Form\Form $form)
    {
        parent::setForm($form);
        //nazwa pola
        $namespace = $form->getBaseName();
        $fieldName = $this->getName();
        $files = \Mmi\App\FrontController::getInstance()->getRequest()->getFiles();
        //brak pliku
        if (!isset($files->{$namespace})) {
            return $this;
        }
        foreach (($files->{$namespace})->toArray() as $file){
            //opakowanie w array jeśli plik jest jeden
            if ($file instanceof \Mmi\Http\RequestFile) {
                $this->_files[] = $file;
            }
        }

        return $this;
    }
80559
public function getMvcPreviewParamsAsRequest()
    {
        $mvcParams = [];
        //parsowanie ciągu
        parse_str($this->mvcPreviewParams, $mvcParams);
        return new \Mmi\Http\Request($mvcParams);
    }
1057314
public function thumbnailAction()
    {
        if (!$this->getPost()->cmsFileId) {
            return $this->_jsonError(179);
        }
        //szukamy rekordu pliku
        if (null !== $record = (new CmsFileQuery)->findPk($this->getPost()->cmsFileId)) {
            //sprawdzenie czy obrazek
            if ($record->class === 'image') {
                try {
                    $thumb = new \Cms\Mvc\ViewHelper\Thumb();
                    $url = $thumb->thumb($record, 'scaley', '60');
                    if (!empty($url)) {
                        return json_encode(['result' => 'OK', 'url' => $url]);
                    }
                } catch (\Exception $ex) {
                    
                }
            }
        }
        return $this->_jsonError(179);
    }
940315
public function fetchLabel()
    {
        //brak labelki
        if (!$this->getOption('data-label')) {
            return;
        }
        $requiredClass = '';
        $required = '';
        //html znaku wymagania
        if ($this->getRequired()) {
            $requiredClass = ' class="required"';
            $required = '<span class="required">' . $this->getOption('data-requiredAsterisk') . '</span>';
        }
        //tłumaczenie labelki
        $label = $this->getOption('data-label');
        //rendering
        return '<label' . $requiredClass . '>' . $label . $this->getOption('data-labelPostfix') . $required . '</label>';
    }