Skip to content
Snippets Groups Projects
Select Git revision
  • dc3128e4894fdcad287d906e360dbd2ce14e07b3
  • 3.9 default
  • develop
  • 6.0
  • 5.0
  • 4.0
  • scrutinizer-patch-4
  • scrutinizer-patch-3
  • scrutinizer-patch-2
  • scrutinizer-patch-1
  • 3.7
  • 3.8
  • 3.6
  • 3.9_backported
  • 3.8_backported
  • 3.7_backported
  • 3.5
  • 3.6_backported
  • 3.5_backported
  • 3.4
  • 3.3_backported
  • 6.0.4
  • 6.0.3
  • 5.0.7
  • 6.0.2
  • 6.0.1
  • 5.0.6
  • 6.0.0
  • 5.0.5
  • 6.0.0-rc
  • 5.0.4
  • 6.0.0-beta
  • 5.0.3
  • 4.0.6
  • 5.0.2
  • 5.0.1
  • 4.0.5
  • 5.0.0
  • 4.0.4
  • 5.0.0-rc2
  • 5.0.0-rc1
41 results

mysqli.lib.php

Blame
  • TestformController.php 2.54 KiB
    <?php
    
    class TestFormController extends Nmc_Controller_Action
    {
        public function __construct()
        {
            //
        }
    
        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();
        }
    
        public function viewAction()
        {
            $in = $this->_getAllParams();
            $id = Zend_Filter::getInt($in['URI_PARAMS'][0]);
            $table = new TestAddressBook();
            $record = $table->find($id);
    
            $out = new Nmc_View_Unl();
            $out->assign('page', 'viewAddress');
            $out->assign('record', $record);
            echo $out->render();
        }
    
        public function addAction()
        {
            $out = new Nmc_View_Unl();
            $out->page = 'addAddress';
            echo $out->render();
        }
    
        public function editAction()
        {
            $in = $this->_getAllParams();
            $id = Zend_Filter::getInt($in['URI_PARAMS'][0]);
            $table = new TestAddressBook();
            $record = $table->find($id);
    
            $out = new Nmc_View_Unl();
            $out->assign('page', 'editAddress');
            $out->assign('record', $record);
            echo $out->render();
        }
    
        public function saveAction()
        {
            $in = new Zend_Filter_Input($this->_getAllParams());
            $id = $in->getInt('id');
    
            $table = new TestAddressBook();
            if($id < 0) {
                $record = $table->fetchNew();
            } else {
                $record = $table->find($id);
            }
    
            $record->firstName = $in->getAlnum('firstName');
            $record->lastName = $in->getAlnum('lastName');
            $record->phone = $in->getAlnum('phone');
            $record->address = $in->getAlnum('address');
            $record->zip = $in->getAlnum('zip');
            $record->save();
    
            if($id < 0) {
                $id = $table->getAdapter()->lastInsertId();
            }
    
            $out = new Nmc_View_Unl();
            $out->refresh = '/testform/view/' . $id;
            echo $out->render();
        }
    }
    
    ?>