Jump to content


Edit page only

edit update

  • Please log in to reply
1 reply to this topic

#1 Puskás Gábor

Puskás Gábor

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 04 August 2015 - 06:47 AM

Hi!

 

I use the Grocery CRUD in my project.

I want use the Grocery Crud's edit page in my user space.

 

The edit page is looks good for able user editing her profile datas. But I don't know how do that.

 

Eg.: http://myproject.tld/profile is need to looks like this http://myproject.tld.../index/edit/321 but I want prevent the user switch back to the whole table look, and/or do anything other than save her datas.

 

Any idea?

 

 

 

 



#2 marlaaragao

marlaaragao

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 05 August 2015 - 12:58 PM

Hi!

 

Your links are not working. I did this in my project. You must unset the operations (at least the list and back to list with unset_list() and unset_back_to_list()). When you render, grocery will raise an exception saying that you don't have permission to access the list operation (the grid). So you can catch it and redirect to the edit form. Example:

        $crud = new Grocery_CRUD();
        $crud->set_table($this->_table);
        
        $crud->unset_list(); 
        $crud->unset_back_to_list();
        
        $crud->unset_delete();
        $crud->unset_add();
        $crud->unset_read();
        $crud->unset_export();
        $crud->unset_print();
        
        try {
            
            $output = $crud->render(); //this will raise an exception when the action is list

            $this->template->load('template', 'default_view', $output);
            
        } catch (Exception $e) {

            if ($e->getCode() == 14) {  //The 14 is the code of the error on grocery CRUD (don't have permission).
                //redirect using your user id
                redirect(strtolower(__CLASS__) . '/' . strtolower(__FUNCTION__) . '/edit/' . $theUserID);
                
            } else {
                show_error($e->getMessage());
                return false;
            }
        }






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users