łączenie wartości
@return array
506878
public function getMultioptions()
    {
        $array = [];
        foreach ((new \Cms\Orm\CmsTagQuery)->orderAscId()->findPairs('tag', 'tag') as $k => $t) {
            $array[$k] = $k;
        }

        return array_merge($this->getValue(), $array);
    }
360362
public function setAutoTagValue()
    {
        //brak rekordu
        if (!$this->_form->hasRecord()) {
            return $this;
        }
        //ustawianie wartości
        $this->setValue((new TagRelationModel($this->getOption('object') ? $this->getOption('object') : $this->_form->getFileObjectName(), $this->_form->getRecord()->getPk()))
                ->getTagRelations());
        //zwrot obiektu
        return $this;
    }
1004280
public function configAction()
    {
        //wyszukiwanie kategorii
        if ((null === $category = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->categoryId)) || $category->status != \Cms\Orm\CmsCategoryRecord::STATUS_DRAFT) {
            return;
        }
        //wyszukiwanie widgeta
        if (null === $widgetRecord = (new \Cms\Orm\CmsCategoryWidgetQuery)->findPk($this->widgetId)) {
            //brak widgeta
            return;
        }
        //wyszukiwanie relacji do edycji
        if (null === $widgetRelationRecord = (new \Cms\Orm\CmsCategoryWidgetCategoryQuery)
            ->whereCmsCategoryId()->equals($this->categoryId)
            ->andFieldCmsCategoryWidgetId()->equals($widgetRecord->id)
            ->findPk($this->id)) {
            //nowy rekord relacji
            $widgetRelationRecord = new \Cms\Orm\CmsCategoryWidgetCategoryRecord();
            //parametry relacji
            $widgetRelationRecord->cmsCategoryWidgetId = $widgetRecord->id;
            $widgetRelationRecord->cmsCategoryId = $this->categoryId;
            //maksymalna wartość posortowania
            $maxOrder = (new \Cms\Orm\CmsCategoryWidgetCategoryQuery)
                ->whereCmsCategoryId()->equals($this->categoryId)
                ->findMax('order');
            $widgetRelationRecord->order = $maxOrder !== null ? $maxOrder + 1 : 0;
        }
        //rekord widgeta do widoku
        $this->view->widgetRecord = $widgetRecord;
        //rekord do formularza to rekord wiązania
        $record = $widgetRelationRecord;
        //domyślna klasa formularza
        $widgetRecord->formClass = $widgetRecord->formClass ? : '\CmsAdmin\Form\CategoryAttributeWidgetForm';
        //instancja formularza
        $form = new $widgetRecord->formClass($record, ['widgetId' => $widgetRecord->id]);
        //wartości z zapisanej konfiguracji
        $formValues = $widgetRelationRecord->getConfig()->toArray();
        //nadpisanie wartościami z POSTA, jeśli zosały przesłane
        if (!$this->getPost()->isEmpty() && is_array($this->getPost()->__get($form->getBaseName()))) {
            $formValues = array_merge($formValues, $this->getPost()->__get($form->getBaseName()));
        }
        $form->setFromArray($formValues);
        //form zapisany
        if ($form->isSaved()) {
            //zapis konfiguracji
            $widgetRelationRecord->setConfigFromArray($record->getOptions());
            $this->getResponse()->redirect('cmsAdmin', 'categoryWidgetRelation', 'config');
        }
        //form do widoku
        $this->view->widgetRelationForm = $form;
    }
117252
public function navigation()
    {
        //brak wygenerowanych breadcrumbów
        if (null === $this->_breadcrumbs) {
            return $this->_buildBreadcrumbs();
        }
        //ustawienia domyślne
        return $this->setMaxDepth()
                ->setMinDepth()
                ->setActiveBranchOnly(false)
                ->setAllowedOnly(true);
    }
1168483
public function getArray()
    {
        $current_folder_id  = $this->get('cms.context')->getCurrentFolderId();
        $router             = $this->get('router');
        $t                  = $this->get('translator');

        // @todo кеширование по языку и юзеру.
        $data = [
            'left' => [
                'administration' => [
                    'title' => $t->trans('Administration'),
                    'descr' => '',
                    'icon' => 'admin',
                    'onlyicon' => true,
                    'uri'   => $router->generate('cms_admin_index'),
                ],
                'menu' => [
                    'title' => $t->trans('Menu'),
                    'descr' => '',
                    'icon' => 'menu',
                    'items' => [
                        'structure' => [
                            'title' => $t->trans('Site structure'),
                            'icon'  => 'structure',
                            'uri'   => $router->generate('cms_admin_structure'),
                        ],
                        'modules' => [
                            'title' => $t->trans('Modules'),
                            'icon'  => 'modules',
                            'uri'   => $router->generate('cms_admin_module'),
                        ],
                        'files' => [
                            'title' => $t->trans('Files'),
                            'icon'  => 'file',
                            'uri'   => $router->generate('cms_admin_files'),
                        ],
                        'regions' => [
                            'title' => $t->trans('Regions'),
                            'icon'  => 'area',
                            'uri'   => $router->generate('cms_admin_structure_region'),
                        ],
                        'users' => [
                            'title' => $t->trans('Users'),
                            'icon'  => 'users',
                            'uri'   => $router->generate('cms_admin_user'),
                        ],
                        'config' => [
                            'title' => $t->trans('Configuration'),
                            'icon'  => 'conf',
                            'uri'   => $router->generate('smart_core_settings'),
                        ],
                        'appearance' => [
                            'title' => $t->trans('Appearance'),
                            'icon'  => 'code',
                            'uri'   => $router->generate('cms_admin_appearance'),
                        ],
                        'reports' => [
                            'title' => $t->trans('Reports'),
                            'icon' => 'report',
                            'uri' => $router->generate('cms_admin_reports'),
                        ],
                        /*
                        'help' => [
                            'title' => $t->trans('Help'),
                            'icon' => 'question-sign',
                            'uri' => $router->generate('cms_admin_help'),
                        ],
                        */
                    ],
                ],
                'structure' => [
                    'title' => '',
                    'descr' => $t->trans('Structure'),
                    'icon'  => 'folder',
                    'onlyicon' => true,
                    'items' => [
                        'folder_edit' => [
                            'title' => $t->trans('Edit folder'),
                            'icon'  => 'edit-toolbar',
                            'uri'   => $router->generate('cms_admin_structure_folder', ['id' => $current_folder_id]),
                        ],
                        'folder_new' => [
                            'title' => $t->trans('Create folder'),
                            'icon'  => 'add',
                            'uri'   => $router->generate('cms_admin_structure_folder_create_in_folder', ['parent' => $current_folder_id]),
                        ],
                        'add_module' => [
                            'title' => $t->trans('Add module'),
                            'icon'  => 'add',
                            'uri'   => $router->generate('cms_admin_structure_node_create_in_folder', ['folder_pid' => $current_folder_id]),
                        ],
                    ],
                ],
            ],
            'right' => [
                //'eip_toggle' => ['Режим правки: ОТКЛ', 'Режим правки: ВКЛ.'], // @todo перевод // [$t->trans('Viewing'), $t->trans('Edit')],
                'user' => [
                    'title' => $this->container->get('security.token_storage')->getToken()->getUser()->getUserName(),
                    'icon' => 'user-setting',
                    'items' => [
                        /*
                        'admin' => [
                            'title' => $t->trans('Control panel'),
                            'uri'   => $router->generate('cms_admin_index'),
                            'icon'  => 'cog',
                            'overalay' => false,
                        ],
                        */
                        'profile' => [
                            'title' => $t->trans('My profile'),
                            'uri'   => $router->generate('cms_admin_user_edit', ['id' => $this->container->get('security.token_storage')->getToken()->getUser()->getId()]),
                            'icon'  => 'profile',
                            'overalay' => false,
                        ],
                        'logout' => [
                            'title' => $t->trans('Logout'),
                            'uri'   => $router->generate('cms_admin_logout'),
                            'icon'  => 'exit',
                            'overalay' => false,
                        ],
                    ],
                ],
            ],
            'notifications' => [],
        ];

        foreach ($this->get('cms.node')->getNodes() as $node) {
            if ($node->getControlsInToolbar() == Node::TOOLBAR_ONLY_IN_SELF_FOLDER) {
                foreach ($node->getFrontControls() as $controls) {
                    if (isset($controls['default']) and $controls['default'] == true) {
                        $data['left']['node_'.$node->getId()] = [
                            'title' => $controls['title'],
                            'descr' => isset($controls['descr']) ? $controls['descr'] : '',
                            'uri'   => $controls['uri'],
                        ];
                    }
                }
            }
        }

        foreach ($this->get('cms.module')->all() as $module) {
            $notices = $module->getNotifications();

            if (!empty($notices)) {
                $data['notifications'][$module->getName()] = $notices;
            }
        }

        return $data;
    }
280516
public function validateAction()
    {
        //typ odpowiedzi: plain
        $this->getResponse()->setTypePlain();
        //wyłączenie layoutu
        $this->view->setLayoutDisabled();

        //sprawdzenie obecności obowiązkowych pól w poscie
        if (!$this->getPost()->class || !$this->getPost()->field) {
            return '';
        }
        //nazwa klasy forma
        $className = $this->getPost()->class;
        //klasa rekordu
        $recordClassName = $this->getPost()->recordClass;
        //powoływanie forma
        $form = new $className($recordClassName ? new $recordClassName($this->getPost()->recordId ? $this->getPost()->recordId : null) : null);
        /* @var $form \Mmi\Form\Form */
        //pobieranie elementu do walidacji
        $element = $form->getElement($this->getPost()->field);
        //jeśli brak elementu - wyjście
        if (!$element instanceof \Mmi\Form\Element\ElementAbstract) {
            return '';
        }
        //ustawienie wartości elementu
        $element->setValue(urldecode($this->getPost()->value));
        //walidacja i zwrot wyniku
        if (!$element->isValid()) {
            $this->view->errors = $element->getErrors();
            return;
        }
        //poprawna walidacja
        return '';
    }
271595
public function sortAction()
    {
        $this->getResponse()->setTypePlain();
        //brak pola
        if (null === $serial = $this->getPost()->__get('widget-item')) {
            return $this->view->getTranslate()->_('Przenoszenie nie powiodło się');
        }
        //sortowanie
        (new \Cms\Model\CategoryWidgetModel($this->categoryId))
            ->sortBySerial($serial);
        //pusty zwrot
        return '';
    }
1057386
public function get()
    {
        //iteracja po danych
        foreach ($this->_data as $key => $item) {
            if ($this->_elapsed == 0) {
                $this->_data[$key]['percent'] = 0;
                continue;
            }
            $this->_data[$key]['percent'] = 100 * $item['elapsed'] / $this->_elapsed;
        }
        return $this->_data;
    }
515386
public function getCreationDate()
    {
        //DateTimeOriginal to najlepsze źródło
        if (isset($this->_exif['DateTimeOriginal']) && substr($this->_exif['DateTimeOriginal'], 0, 4) != '0000') {
            return date('Y-m-d H:i:s', strtotime($this->_exif['DateTimeOriginal']));
        }
        //brak DateTimeOriginal, próba z DateTime
        if (isset($this->_exif['DateTime']) && substr($this->_exif['DateTime'], 0, 4) != '0000') {
            return date('Y-m-d H:i:s', strtotime($this->_exif['DateTime']));
        }
        //w pozostałych przypadkach - data utworzenia pliku
        if (!isset($this->_exif['FileDateTime']) && substr($this->_exif['DateTime'], 0, 4) != '0000') {
            return date('Y-m-d H:i:s', strtotime($this->_exif['FileDateTime']));
        }
    }
55765
public function getSubItems()
    {
        return array_key_exists('polozkyFaktury', $this->getData()) ? $this->getDataValue('polozkyFaktury')
                : (array_key_exists('polozkyDokladu', $this->getData()) ? $this->getDataValue('polozkyDokladu')
                : null);
    }
440377
public function getGrouppedAttributeValues()
    {
        $grouppedByAttributeKey = new \Mmi\DataObject();
        //wyszukiwanie wartości
        foreach ($this->getAttributeValues() as $record) {
            //pobieranie klucza atrybutu (w celu zgrupowania
            $key = $record->getJoined('cms_attribute')->key;
            if ($record->getJoined('cms_attribute_type')->multiple) {
                if (!$grouppedByAttributeKey->$key) {
                    $grouppedByAttributeKey->$key = new \Mmi\Orm\RecordCollection;
                }
                $grouppedByAttributeKey->$key->append($record);
                continue;
            }
            //atrybut to uploader
            if ($record->getJoined('cms_attribute_type')->uploader) {
                //dołączanie plików
                $grouppedByAttributeKey->$key = \Cms\Orm\CmsFileQuery::byObject($record->value, $this->_objectId)->find();
                continue;
            }
            //atrybut zwykły
            $grouppedByAttributeKey->$key = $record->value;
        }
        //zwrot zgrupowanych wartości atrybutów
        return $grouppedByAttributeKey;
    }
444864
public function toArray()
	{
		$list = parent::toArray();

		$list['locale.site.siteid'] = $this->getSiteId();
		$list['locale.site.code'] = $this->getCode();
		$list['locale.site.label'] = $this->getLabel();
		$list['locale.site.config'] = $this->getConfig();
		$list['locale.site.status'] = $this->getStatus();

		return $list;
	}
772775
public static function getVendorModules()
    {
        $modules = [];
        //iteracja po vendorach
        foreach (self::getVendors() as $vendor) {
            //iteracja po modułach
            foreach (new \DirectoryIterator($vendor) as $module) {
                if (!$module->isDir() || $module->isDot() || !self::_moduleValid($module->getPathname())) {
                    continue;
                }
                $modules[] = $module->getPathname();
            }
        }
        return $modules;
    }
275078
protected function _copyCategory()
    {
        $this->_createCopyRecord();
        $this->_copy->active = $this->_category->active;
        //ustawienie daty dodania na oryginalną kategorię
        $this->_copy->dateAdd = $this->_category->dateAdd;
        //nadawanie id oryginału (chyba że już nadany w przypadku rekordów z historii)
        $this->_copy->cmsCategoryOriginalId = $this->_category->cmsCategoryOriginalId ? $this->_category->cmsCategoryOriginalId : $this->_category->getPk();
        $this->_copy->status = \Cms\Orm\CmsCategoryRecord::STATUS_DRAFT;
        return $this->_copy->save();
    }
842861
public function getWidgetModel()
    {
        //próba pobrania modelu widgetu z cache
        if (null === $widgetModel = \App\Registry::$cache->load($cacheKey = 'category-widget-model-' . $this->id)) {
            //pobieranie modelu widgetu
            \App\Registry::$cache->save($widgetModel = new \Cms\Model\CategoryWidgetModel($this->id), $cacheKey, 0);
        }
        //zwrot atrybutów
        return $widgetModel;
    }
837815
public function detailsAction()
    {
        if (!$this->getPost()->cmsFileId) {
            return $this->_jsonError(185);
        }
        //szukamy rekordu pliku
        if (null == $record = (new CmsFileQuery)->findPk($this->getPost()->cmsFileId)) {
            return $this->_jsonError(185);
        }
        //wycinamy rozszerzenie z nazwy oryginalnego pliku do edycji
        //pozycja ostatniej kropki w nazwie
        $pointPosition = strrpos($record->original, '.');
        if ($pointPosition !== false) {
            $record->original = substr($record->original, 0, $pointPosition);
        }
        $data = [];
        if ($record->data instanceof \Mmi\DataObject) {
            //parametry
            $data = $record->data->toArray();
        }
        $data['urlFile'] = ((\App\Registry::$config->cdn) ? : $record->getUrl());
        if ($record->data->posterFileName) {
            $data['poster'] = $record->getPosterUrl();
        }    
        return json_encode(['result' => 'OK', 'record' => $record, 'data' => $data]);
    }
1156079
public function fetchField()
    {
        $view = \Mmi\App\FrontController::getInstance()->getView();
        $view->headScript()->appendFile('/resource/cmsAdmin/js/tiny/tinymce.min.js');

        //bazowa wspólna konfiguracja
        $this->_baseConfig($view);
        //tryb edytora
        $mode = $this->getMode() ? $this->getMode() : 'default';
        //metoda konfiguracji edytora
        $modeConfigurator = '_mode' . ucfirst($mode);
        if (method_exists($this, $modeConfigurator)) {
            $this->$modeConfigurator();
        }

        $class = $this->getOption('id');
        $this->setOption('class', trim($this->getOption('class') . ' ' . $class));
        $object = 'tmp-' . $this->getUploaderObject();
        $objectId = $this->getUploaderId();
        $t = round(microtime(true));
        $hash = md5(\Mmi\Session\Session::getId() . '+' . $t . '+' . $objectId);
        //tworzenie kopii plików załadowanych do TinyMce
        $this->_createTempFiles();
        //aktualizacja wartości pola - poprawka ścieżek do plików
        $this->_updateValue();
        //dołączanie skryptu
        $view->headScript()->appendScript("
			tinyMCE.init({
				selector: '." . $class . "',
				language: request.locale,
				" . $this->_renderConfig('theme', 'theme', 'modern') . "
				" . $this->_renderConfig('skin', 'skin', 'lightgray') . "
				" . $this->_renderConfig('plugins', 'plugins') . "
				" . $this->_renderConfig('contextmenu', 'contextMenu') . "
				" . $this->_renderConfig('width', 'width', '') . "
				" . $this->_renderConfig('height', 'height', 320) . "
				" . $this->_renderConfig('resize', 'resize', true) . "
				" . $this->_renderConfig('menubar', 'menubar', true) . "
				" . $this->_renderConfig('image_advtab', 'imageAdvanceTab', true) . "
				" . $this->_renderConfig('font_formats', 'fontFormats') . "
				" . $this->_renderConfig('fontsize_formats', 'fontSizeFormats') . "
				" . $this->_renderConfig('content_css', 'css') . "
				" . $this->_renderConfigN('toolbar', 'toolbars') . "
				" . $this->_renderConfig('image_caption', 'imageCaption', false) . "
				" . ($this->getCustomConfig() ? trim($this->getCustomConfig(), ",") . "," : "") . "
				" . $this->_other . "
				" . $this->_common . "
				hash: '$hash',
				object: '$object',
				objectId: '$objectId',
				time: '$t',
				baseUrl: '" . $view->baseUrl . "',
                image_list: '" . $view->baseUrl . "' + '/?module=cms&controller=file&action=list&object=$object&objectId=$objectId&t=$t&hash=$hash',
                branding: false
			});
		");

        //unsety zbędnych opcji
        $this->unsetMode()->unsetCustomConfig()->unsetCss()->unsetTheme()->unsetSkin()
            ->unsetPlugins()->unsetContextMenu()->unsetResize()->unsetMenubar()
            ->unsetImageAdvanceTab()->unsetFontFormats()->unsetFontSizeFormats()
            ->unsetToolbars()->unsetImageCaption();

        return parent::fetchField();
    }