public function edit($groupId = null)
    {
        $this->requireAdmin();

        if (!is_null($groupId)) {
            $group = $this->groupStore->getById($groupId);
        } else {
            $group = new ProjectGroup();
        }

        if ($this->request->getMethod() == 'POST') {
            $group->setTitle($this->getParam('title'));
            $this->groupStore->save($group);

            $response = new b8\Http\Response\RedirectResponse();
            $response->setHeader('Location', PHPCI_URL.'group');
            return $response;
        }

        $form = new Form();
        $form->setMethod('POST');
        $form->setAction(PHPCI_URL . 'group/edit' . (!is_null($groupId) ? '/' . $groupId : ''));

        $title = new Form\Element\Text('title');
        $title->setContainerClass('form-group');
        $title->setClass('form-control');
        $title->setLabel('Group Title');
        $title->setValue($group->getTitle());

        $submit = new Form\Element\Submit();
        $submit->setValue('Save Group');

        $form->addField($title);
        $form->addField($submit);

        $this->view->form = $form;
    }
public function edit($groupId = null)
    {
        $this->requireAdmin();

        if (!is_null($groupId)) {
            $group = $this->groupStore->getById($groupId);
        } else {
            $group = new ProjectGroup();
        }

        if ($this->request->getMethod() == 'POST') {
            $group->setTitle($this->getParam('title'));
            $this->groupStore->save($group);

            $response = new b8\Http\Response\RedirectResponse();
            $response->setHeader('Location', PHPCI_URL.'group');
            return $response;
        }

        $form = new Form();
        $form->setMethod('POST');
        $form->setAction(PHPCI_URL . 'group/edit' . (!is_null($groupId) ? '/' . $groupId : ''));

        $title = new Form\Element\Text('title');
        $title->setContainerClass('form-group');
        $title->setClass('form-control');
        $title->setLabel('Group Title');
        $title->setValue($group->getTitle());

        $submit = new Form\Element\Submit();
        $submit->setValue('Save Group');

        $form->addField($title);
        $form->addField($submit);

        $this->view->form = $form;
    }
public function edit ( $ groupId = null ) { $ this -> requireAdmin ( ) ; if ( ! is_null ( $ groupId ) ) { $ group = $ this -> groupStore -> getById ( $ groupId ) ; } else { $ group = new ProjectGroup ( ) ; } if ( $ this -> request -> getMethod ( ) == 'POST' ) { $ group -> setTitle ( $ this -> getParam ( 'title' ) ) ; $ this -> groupStore -> save ( $ group ) ; $ response = new b8 \ Http \ Response \ RedirectResponse ( ) ; $ response -> setHeader ( 'Location' , PHPCI_URL . 'group' ) ; return $ response ; } $ form = new Form ( ) ; $ form -> setMethod ( 'POST' ) ; $ form -> setAction ( PHPCI_URL . 'group/edit' . ( ! is_null ( $ groupId ) ? '/' . $ groupId : '' ) ) ; $ title = new Form \ Element \ Text ( 'title' ) ; $ title -> setContainerClass ( 'form-group' ) ; $ title -> setClass ( 'form-control' ) ; $ title -> setLabel ( 'Group Title' ) ; $ title -> setValue ( $ group -> getTitle ( ) ) ; $ submit = new Form \ Element \ Submit ( ) ; $ submit -> setValue ( 'Save Group' ) ; $ form -> addField ( $ title ) ; $ form -> addField ( $ submit ) ; $ this -> view -> form = $ form ; }
Add or edit a project group.
@param null $groupId
@return void|b8\Http\Response\RedirectResponse
Add or edit a project group .