public function setup(Model $model, $settings = array())
 {
     if (empty($settings['calendarId'])) {
         $settings['calendarId'] = Configure::read('Google.Events.calendarId');
     }
     if (empty($settings['calendarId']) && class_exists('AppPreference')) {
         $settings['calendarId'] = AppPreference::get('Google.calendar_id');
     }
     if (!isset($this->settings[$model->alias])) {
         $this->settings[$model->alias] = array('scope' => array());
     }
     $this->settings[$model->alias] = array_merge($this->settings[$model->alias], (array) $settings);
 }
 public function input($options = array())
 {
     extract($options);
     if (empty($album)) {
         $album = AppPreference::get('vimeo_album');
     }
     $videos = ClassRegistry::init('Vimeo.VimeoAlbums')->getVideosListByTitle($album);
     $connectUrl = array('plugin' => 'vimeo', 'controller' => 'vimeo', 'action' => 'connect');
     if (isset($url)) {
         $url = serialize($url);
         $url = bin2hex($url);
         $connectUrl[] = $url;
     }
     $options = array('type' => 'select', 'options' => isset($videos) ? $videos : null, 'empty' => 'Select', 'between' => $this->Html->div('note', "please " . $this->Html->link('connect', $connectUrl) . " CMS with your Vimeo account to see list with your videos"));
     if (isset($optionsOnly) && $optionsOnly) {
         return $options;
     } else {
         return $this->Form->inputs(array('legend' => __('Video (*optional)'), 'video_id' => $options));
     }
 }