/** * New tab. */ public function action_new() { $tab = new CustomTab(); // Check if the form has been submitted. if (Request::method() == 'post') { $tab->set(array('label' => Request::post('label'), 'url' => Request::post('url'), 'groups' => implode(',', Request::post('groups', \traq\models\Group::all_group_ids())), 'display_order' => Request::post('display_order', 0), 'project_id' => Request::post('project_id', 0))); // Save and reidrect if ($tab->save()) { Request::redirectTo('/admin/custom_tabs'); } } View::set(compact('tab')); }