/** * Fungsi inisialisasi form */ public function init() { parent::init(); // Form Attribute $this->setMethod('get'); $this->addAttribs(array('id' => 'dirSearchForm', 'action' => $this->_baseUrlHelper->baseUrl() . '/directory/search')); $this->setAttrib('accept-charset', 'utf-8'); // Element Form // -> Type $classDirectoryDb = new Model_DbTable_ClassificationDirectory(); $classDirectory = $classDirectoryDb->getAllForMenu(); $this->addElement('select', 'dirType', array('decorators' => $this->elementDecorators, 'label' => 'Type', 'multiOptions' => $classDirectory)); // -> Name $this->addElement('text', 'dirName', array('decorators' => $this->elementDecorators, 'label' => 'Name')); // -> Location $this->addElement('text', 'dirLocation', array('decorators' => $this->elementDecorators, 'label' => 'Location')); }
/** * IS: Parameter type, name, location terdeklarasi * FS: Mengirimkan ke viewer: customName, directory * Desc: Fungsi untuk menampilkan list hasil pencarian */ public function searchAction() { // Param $type = $this->_getParam('type'); $name = $this->_getParam('name'); $location = $this->_getParam('location'); // Model $directoryDb = new Model_DbTable_Directory(); $classDirDb = new Model_DbTable_ClassificationDirectory(); // Data $directoryQuery = $directoryDb->getSearch($type, $name, $location); $classDir = $classDirDb->getAllForMenu(); // View $this->view->customName = $classDir[$type] . '(s)'; $this->view->directory = parent::setPaginator($directoryQuery); }