/**
  * Return singleton
  * @return Application_Model_FilesystemSharesMapper
  */
 public static function i()
 {
     if (self::$instance === null) {
         self::$instance = new Application_Model_FilesystemSharesMapper();
     }
     return self::$instance;
 }
 /**
  * Restore backupped shared directories
  * This is not a trigger of plugin API. It's called by Backupper plugin
  */
 function restoreItems($items)
 {
     $shares = Application_Model_FilesystemSharesMapper::i()->fetchAll();
     // cleaning up all shares
     foreach ($shares as $share) {
         Application_Model_FilesystemSharesMapper::i()->delete($share);
     }
     foreach (@$items['shares'] as $shareInfo) {
         $share = new Application_Model_FilesystemShare();
         $share->setPath(@$shareInfo['path'])->setImage(@$shareInfo['image'])->setLabel(@$shareInfo['label']);
         // i don't set id, or db adapter will try to update old data that i cleaned
         Application_Model_FilesystemSharesMapper::i()->save($share);
     }
     return X_Env::_('p_filesystem_backupper_restoreditems') . ": " . count($items['shares']);
     //return parent::restoreItems($items);
 }
 function editAction()
 {
     $shareId = $this->getRequest()->getParam('id', false);
     if ($shareId === false) {
         $this->_helper->flashMessenger(X_Env::_('p_filesystem_err_invaliddata'));
         $this->_helper->redirector('index', 'filesystem');
     }
     $share = new Application_Model_FilesystemShare();
     Application_Model_FilesystemSharesMapper::i()->find($shareId, $share);
     if (is_null($share->getId())) {
         $this->_helper->flashMessenger(X_Env::_('p_filesystem_err_invaliddata'));
         $this->_helper->redirector('index', 'filesystem');
     }
     $defaults = array('id' => $share->getId(), 'label' => $share->getLabel(), 'path' => $share->getPath());
     $form = new Application_Form_FileSystemShare();
     $form->setAction($this->_helper->url('save', 'filesystem'));
     $form->setDefaults($defaults);
     $this->view->form = $form;
 }