Пример #1
0
 /**
  * Sets a list of languages to the view which can be used in selects
  *
  * @deprecated No fallback provided, use the Utils plugin in your app directly
  * @param string $viewVar View variable name, default is languages
  * @throws MissingPluginException
  * @return void
  * @link https://github.com/CakeDC/utils
  */
 protected function _setLanguages($viewVar = 'languages')
 {
     $this->_pluginLoaded('Utils');
     $Languages = new Languages();
     $this->set($viewVar, $Languages->lists('locale'));
 }
Пример #2
0
 /**
  * Sets a list of languages to the view which can be used in selects
  *
  * @deprecated No fallback provided, use the Utils plugin in your app directly
  * @param string View variable name, default is languages
  * @return void
  * @link https://github.com/CakeDC/utils
  */
 protected function _setLanguages($viewVar = 'languages')
 {
     if (!App::import('Lib', 'Utils.Languages')) {
         throw new MissingPluginException(array('plugin' => 'Utils'));
     }
     $Languages = new Languages();
     $this->set($viewVar, $Languages->lists('locale'));
 }
Пример #3
0
 /**
  * Sets a list of languages to the view which can be used in selects
  *
  * @param string View variable name, default is languages
  * @return void
  */
 protected function _setLanguages($viewVar = 'languages')
 {
     App::import('Lib', 'Utils.Languages');
     $Languages = new Languages();
     $this->set($viewVar, $Languages->lists('locale'));
 }
Пример #4
0
 /**
  * Admin edit for category.
  *
  * @param string $id, category id 
  */
 public function admin_edit($id = null)
 {
     try {
         $actualLanguages = $this->Category->getSupportedLanguages();
         App::uses('Languages', 'Utils.Lib');
         $Languages = new Languages();
         $languages = $Languages->lists('locale');
         $this->set(compact('languages', 'actualLanguages'));
         $result = $this->Category->edit($id, null, $this->request->data);
         if ($result === true) {
             $this->Session->setFlash(__d('categories', 'Category saved'));
             $this->redirect(array('action' => 'view', $this->Category->data[$this->Category->alias]['slug']));
         } else {
             $this->request->data = $result;
         }
     } catch (OutOfBoundsException $e) {
         $this->Session->setFlash($e->getMessage());
         $this->redirect('/');
     }
     $categories = $this->Category->find('list');
     $users = $this->Category->User->find('list');
     $this->set(compact('categories', 'users'));
 }