Skip to content
Snippets Groups Projects
Select Git revision
  • 60941f0c15f5b2d53e0d8ac765d256e332201063
  • master default
  • disable-new-requests
  • fix-bulletin-view-missing-notes-error
  • add-missing-queue-managers
  • projects-task-53
  • projects-task-51
  • projects-task-43
  • projects-task-24
  • projects-task-31
  • projects-task-32
  • projects-task-8
  • project-setup-docs
  • projects-task-28
  • projects-task-27
  • projects-task-9
  • projects-task-7
  • mass-update-course-codes-in-sections
  • wdn-four
  • learning-outcomes
  • additional-bulletin-pages
  • svn-redesign
  • svn-popups
  • svn-trunk
  • svn-performance
  • svn-tim
26 results

RequestController.php

Blame
  • TestformController.php 2.67 KiB
    <?php
    
    class TestFormController extends Nmc_Controller_Action
    {
    
        public function indexAction()
        {
            $record = CourseGenerations::fetchBySubjectNumberLetter('CSCE', 155);
            $newRecord = clone $record;
            $newRecord->title = 'Computer Science I, part 2';
            $newRecord->save();
    
            /*
            $sem = new Nmc_Semaphore('tnohu');
            $sem->lock();
            header('Content-type: text');
            echo "doing stuff...\n";
            sleep(10);
            echo "done!\n";
            $sem->unlock();
            */
    
            //return $this->viewAction();
        }
    
        public function listAction()
        {
            $table = new TestAddressBook();
            $recrods = $table->fetchAll();
            $out = new Nmc_View_Unl();
            $out->assign('page', 'listAddress');
            $out->assign('records', $recrods);
            echo $out->render('index.xhtml');
        }
    
        public function viewAction()
        {
            $in = $this->getRequest();
            $id = Zend_Filter_Int::filter($in->getParam(0));
            $table = new TestAddressBook();
            $record = $table->find($id);
    
            $out = new Nmc_View_Unl();
            $out->assign('page', 'viewAddress');
            $out->assign('record', $record);
            echo $out->render('index.xhtml');
        }
    
        public function addAction()
        {
            $out = new Nmc_View_Unl();
            $out->page = 'addAddress';
            echo $out->render('index.xhtml');
        }
    
        public function editAction()
        {
            $in = $this->getRequest();
            $id = Zend_Filter_Int::filter($in->getParam(0));
            $table = new TestAddressBook();
            $record = $table->find($id);
    
            $out = new Nmc_View_Unl();
            $out->assign('page', 'editAddress');
            $out->assign('record', $record);
            echo $out->render('index.xhtml');
        }
    
        public function saveAction()
        {
            $in = $this->getRequest();
            $id = Zend_Filter_Int::filter($in->getPost('id'));
    
            $table = new TestAddressBook();
            if($id < 0) {
                $record = $table->fetchNew();
            } else {
                $record = $table->find($id);
            }
    
            $record->firstName = Zend_Filter_Alnum::filter($in->getPost('firstName'));
            $record->lastName = Zend_Filter_Alnum::filter($in->getPost('lastName'));
            $record->phone = Zend_Filter_Alnum::filter($in->getPost('phone'));
            $record->address = Zend_Filter_Alnum::filter($in->getPost('address'));
            $record->zip = Zend_Filter_Alnum::filter($in->getPost('zip'));
            $record->save();
    
            if($id < 0) {
                $id = $table->getAdapter()->lastInsertId();
            }
    
            $out = new Nmc_View_Unl();
            $out->refresh = '/testform/view/' . $id;
            echo $out->render('index.xhtml');
        }
    }
    
    ?>