Blame | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** ActivationCodes Controller** @property ActivationCode $ActivationCode* @property PaginatorComponent $Paginator*/class ActivationCodesController extends AppController {/*** Components** @var array*/public $components = array('Paginator');/*** admin_index method** @return void*/public function admin_index() {$this->ActivationCode->recursive = 0;$this->set('activationCodes', $this->Paginator->paginate());}/*** admin_view method** @throws NotFoundException* @param string $id* @return void*/public function admin_view($id = null) {if (!$this->ActivationCode->exists($id)) {throw new NotFoundException(__('Invalid activation code'));}$options = array('conditions' => array('ActivationCode.' . $this->ActivationCode->primaryKey => $id));$this->set('activationCode', $this->ActivationCode->find('first', $options));}/*** admin_add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$this->ActivationCode->create();if ($this->ActivationCode->save($this->request->data)) {$this->Session->setFlash(__('The activation code has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The activation code could not be saved. Please, try again.'));}}}/*** admin_edit method** @throws NotFoundException* @param string $id* @return void*/public function admin_edit($id = null) {if (!$this->ActivationCode->exists($id)) {throw new NotFoundException(__('Invalid activation code'));}if ($this->request->is(array('post', 'put'))) {if ($this->ActivationCode->save($this->request->data)) {$this->Session->setFlash(__('The activation code has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The activation code could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('ActivationCode.' . $this->ActivationCode->primaryKey => $id));$this->request->data = $this->ActivationCode->find('first', $options);}}/*** admin_delete method** @throws NotFoundException* @param string $id* @return void*/public function admin_delete($id = null) {$this->ActivationCode->id = $id;if (!$this->ActivationCode->exists()) {throw new NotFoundException(__('Invalid activation code'));}$this->request->onlyAllow('post', 'delete');if ($this->ActivationCode->delete()) {$this->Session->setFlash(__('The activation code has been deleted.'));} else {$this->Session->setFlash(__('The activation code could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}}