public function create()
    {
        if (!userHasPermission('admin:blog:tag:' . $this->blog->id . ':create')) {

            unauthorised();
        }

        // --------------------------------------------------------------------------

        if ($this->input->post()) {

            $oFormValidation = Factory::service('FormValidation');

            $oFormValidation->set_rules('label', '', 'required');
            $oFormValidation->set_rules('description', '', '');
            $oFormValidation->set_rules('seo_title', '', 'max_length[150]');
            $oFormValidation->set_rules('seo_description', '', 'max_length[300]');
            $oFormValidation->set_rules('seo_keywords', '', 'max_length[150]');

            $oFormValidation->set_message('required', lang('fv_required'));
            $oFormValidation->set_message('max_length', lang('fv_max_length'));

            if ($oFormValidation->run()) {

                $aInsertData                    = array();
                $aInsertData['blog_id']         = $this->blog->id;
                $aInsertData['label']           = $this->input->post('label');
                $aInsertData['description']     = $this->input->post('description');
                $aInsertData['seo_title']       = $this->input->post('seo_title');
                $aInsertData['seo_description'] = $this->input->post('seo_description');
                $aInsertData['seo_keywords']    = $this->input->post('seo_keywords');

                if ($this->blog_tag_model->create($aInsertData)) {

                    $status  = 'success';
                    $message = 'Tag created successfully.';
                    $this->session->set_flashdata($status, $message);
                    redirect('admin/blog/tag/index/' . $this->blog->id . $this->isModal);

                } else {

                    $this->data['error']  = 'There was a problem creating the Tag. ';
                    $this->data['error'] .= $this->blog_tag_model->lastError();
                }

            } else {

                $this->data['error'] = lang('fv_there_were_errors');
            }
        }

        // --------------------------------------------------------------------------

        //  Page data
        $this->data['page']->title = 'Blog &rsaquo; Tags &rsaquo; Create';

        // --------------------------------------------------------------------------

        //  Fetch data
        $this->data['tags'] = $this->blog_tag_model->getAll();

        // --------------------------------------------------------------------------

        //  Load views
        Helper::loadView('edit');
    }
public function create()
    {
        if (!userHasPermission('admin:blog:tag:' . $this->blog->id . ':create')) {

            unauthorised();
        }

        // --------------------------------------------------------------------------

        if ($this->input->post()) {

            $oFormValidation = Factory::service('FormValidation');

            $oFormValidation->set_rules('label', '', 'required');
            $oFormValidation->set_rules('description', '', '');
            $oFormValidation->set_rules('seo_title', '', 'max_length[150]');
            $oFormValidation->set_rules('seo_description', '', 'max_length[300]');
            $oFormValidation->set_rules('seo_keywords', '', 'max_length[150]');

            $oFormValidation->set_message('required', lang('fv_required'));
            $oFormValidation->set_message('max_length', lang('fv_max_length'));

            if ($oFormValidation->run()) {

                $aInsertData                    = array();
                $aInsertData['blog_id']         = $this->blog->id;
                $aInsertData['label']           = $this->input->post('label');
                $aInsertData['description']     = $this->input->post('description');
                $aInsertData['seo_title']       = $this->input->post('seo_title');
                $aInsertData['seo_description'] = $this->input->post('seo_description');
                $aInsertData['seo_keywords']    = $this->input->post('seo_keywords');

                if ($this->blog_tag_model->create($aInsertData)) {

                    $status  = 'success';
                    $message = 'Tag created successfully.';
                    $this->session->set_flashdata($status, $message);
                    redirect('admin/blog/tag/index/' . $this->blog->id . $this->isModal);

                } else {

                    $this->data['error']  = 'There was a problem creating the Tag. ';
                    $this->data['error'] .= $this->blog_tag_model->lastError();
                }

            } else {

                $this->data['error'] = lang('fv_there_were_errors');
            }
        }

        // --------------------------------------------------------------------------

        //  Page data
        $this->data['page']->title = 'Blog &rsaquo; Tags &rsaquo; Create';

        // --------------------------------------------------------------------------

        //  Fetch data
        $this->data['tags'] = $this->blog_tag_model->getAll();

        // --------------------------------------------------------------------------

        //  Load views
        Helper::loadView('edit');
    }
public function create ( ) { if ( ! userHasPermission ( 'admin:blog:tag:' . $ this -> blog -> id . ':create' ) ) { unauthorised ( ) ; } // -------------------------------------------------------------------------- if ( $ this -> input -> post ( ) ) { $ oFormValidation = Factory :: service ( 'FormValidation' ) ; $ oFormValidation -> set_rules ( 'label' , '' , 'required' ) ; $ oFormValidation -> set_rules ( 'description' , '' , '' ) ; $ oFormValidation -> set_rules ( 'seo_title' , '' , 'max_length[150]' ) ; $ oFormValidation -> set_rules ( 'seo_description' , '' , 'max_length[300]' ) ; $ oFormValidation -> set_rules ( 'seo_keywords' , '' , 'max_length[150]' ) ; $ oFormValidation -> set_message ( 'required' , lang ( 'fv_required' ) ) ; $ oFormValidation -> set_message ( 'max_length' , lang ( 'fv_max_length' ) ) ; if ( $ oFormValidation -> run ( ) ) { $ aInsertData = array ( ) ; $ aInsertData [ 'blog_id' ] = $ this -> blog -> id ; $ aInsertData [ 'label' ] = $ this -> input -> post ( 'label' ) ; $ aInsertData [ 'description' ] = $ this -> input -> post ( 'description' ) ; $ aInsertData [ 'seo_title' ] = $ this -> input -> post ( 'seo_title' ) ; $ aInsertData [ 'seo_description' ] = $ this -> input -> post ( 'seo_description' ) ; $ aInsertData [ 'seo_keywords' ] = $ this -> input -> post ( 'seo_keywords' ) ; if ( $ this -> blog_tag_model -> create ( $ aInsertData ) ) { $ status = 'success' ; $ message = 'Tag created successfully.' ; $ this -> session -> set_flashdata ( $ status , $ message ) ; redirect ( 'admin/blog/tag/index/' . $ this -> blog -> id . $ this -> isModal ) ; } else { $ this -> data [ 'error' ] = 'There was a problem creating the Tag. ' ; $ this -> data [ 'error' ] .= $ this -> blog_tag_model -> lastError ( ) ; } } else { $ this -> data [ 'error' ] = lang ( 'fv_there_were_errors' ) ; } } // -------------------------------------------------------------------------- //  Page data $ this -> data [ 'page' ] -> title = 'Blog &rsaquo; Tags &rsaquo; Create' ; // -------------------------------------------------------------------------- //  Fetch data $ this -> data [ 'tags' ] = $ this -> blog_tag_model -> getAll ( ) ; // -------------------------------------------------------------------------- //  Load views Helper :: loadView ( 'edit' ) ; }
Create a new blog tag
@return void
Create a new blog tag