public function setDefault($id)
    {
        $this->loadModel('Locale.Languages');
        $this->loadModel('System.Options');
        $language = $this->Languages->get($id);

        if ($language->status) {
            if ($this->Options->update('default_language', $language->code)) {
                $this->Flash->success(__d('locale', 'Default language changed!'));
            } else {
                $this->Flash->danger(__d('locale', 'Default language could not be changed.'));
            }
        } else {
            $this->Flash->danger(__d('locale', 'You cannot set as default a disabled language.'));
        }

        $this->title(__d('locale', 'Set Default Language'));
        $this->redirect($this->referer());
    }
public function setDefault($id)
    {
        $this->loadModel('Locale.Languages');
        $this->loadModel('System.Options');
        $language = $this->Languages->get($id);

        if ($language->status) {
            if ($this->Options->update('default_language', $language->code)) {
                $this->Flash->success(__d('locale', 'Default language changed!'));
            } else {
                $this->Flash->danger(__d('locale', 'Default language could not be changed.'));
            }
        } else {
            $this->Flash->danger(__d('locale', 'You cannot set as default a disabled language.'));
        }

        $this->title(__d('locale', 'Set Default Language'));
        $this->redirect($this->referer());
    }
public function setDefault ( $ id ) { $ this -> loadModel ( 'Locale.Languages' ) ; $ this -> loadModel ( 'System.Options' ) ; $ language = $ this -> Languages -> get ( $ id ) ; if ( $ language -> status ) { if ( $ this -> Options -> update ( 'default_language' , $ language -> code ) ) { $ this -> Flash -> success ( __d ( 'locale' , 'Default language changed!' ) ) ; } else { $ this -> Flash -> danger ( __d ( 'locale' , 'Default language could not be changed.' ) ) ; } } else { $ this -> Flash -> danger ( __d ( 'locale' , 'You cannot set as default a disabled language.' ) ) ; } $ this -> title ( __d ( 'locale' , 'Set Default Language' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
Sets the given language as site's default language.

@param int $id Language's ID
@return void Redirects to previous page
Sets the given language as site s default language .