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')]);
    }
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')]);
    }
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' ) ] ) ; }
Tworzenie nowej strony
Tworzenie nowej strony