renameItem() public method

Rename item
public renameItem ( string $src, string $dest ) : void
$src string
$dest string
return void
Ejemplo n.º 1
0
 public function renameAction()
 {
     $path = $this->parsePath();
     $file = $this->_getParam('file');
     if (is_array($file)) {
         $file = array_shift($file);
     }
     try {
         $name = $this->formatName($this->_getParam('name'), null);
         $this->service->renameItem("{$path}/{$file}", $name);
         $this->clearCompiledTemplate("{$path}/{$file}");
         $this->_helper->flashMessenger(getGS("Template object '\$1' was renamed to '\$2'.", $file, $name));
     } catch (\InvalidArgumentException $e) {
         $this->_helper->flashMessenger(array('error', $e->getMessage()));
     }
     $this->_redirect(urldecode($this->_getParam('next')), array('prependBase' => false));
 }
Ejemplo n.º 2
0
 public function renameAction()
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     $path = $this->parsePath();
     $file = $this->_getParam('file');
     if (is_array($file)) {
         $file = array_shift($file);
     }
     try {
         $name = $this->formatName($this->_getParam('name'), null);
         $this->service->renameItem("{$path}/{$file}", $name);
         $this->clearCompiledTemplate("{$path}/{$file}");
         $this->_helper->flashMessenger($translator->trans("Template object \$1 was renamed to \$2.", array('$1' => $file, '$2' => $name), 'themes'));
     } catch (\InvalidArgumentException $e) {
         $this->_helper->flashMessenger(array('error', $e->getMessage()));
     }
     $this->_redirect(urldecode($this->_getParam('next')), array('prependBase' => false));
 }