_file = WWW_PATH . '/rev'; if (false === $this->_doc->getAuth()->getSuMode()) { $this->redirect(BASE_URL . '/admin'); } return $this; } protected function _doEdit() { $form = $this->_getEditForm(); $data = array(); if (file_exists($this->_file)) { $data['revision'] = (int) file_get_contents($this->_file); } $form->setDefaults($data); $this->_addFormItem($form); return $this; } protected function _getEditForm(array $options = array()) { $form = $this->_getFormInstance('edit', $options); return $form; } protected function _doUpdate() { $form = $this->_getEditForm(); if ($form->validate()) { $revision = $form->getValue('revision'); if ($revision) { file_put_contents($this->_file, $revision); } else { if (file_exists($this->_file)) { unlink($this->_file); } } $this->_postUpdate(); $this->_setBackMessage('Revision has been updated'); $this->_doBack(); } else { $this->_addFormItem($form); } return $this; } }