diff options
| author | Simon | 2011-03-02 16:18:07 +0100 |
|---|---|---|
| committer | Simon | 2011-03-02 16:18:07 +0100 |
| commit | c6fad905aaa3889c943e93abcff5e50d94340277 (patch) | |
| tree | 9d75a842e70d5ddce1ce348df9bf58bcb1e7cf53 /application | |
| parent | filter controller - index action geƤndert (diff) | |
| download | pbs2-c6fad905aaa3889c943e93abcff5e50d94340277.tar.gz pbs2-c6fad905aaa3889c943e93abcff5e50d94340277.tar.xz pbs2-c6fad905aaa3889c943e93abcff5e50d94340277.zip | |
filter geupdated && mein kleines todo
Diffstat (limited to 'application')
| -rw-r--r-- | application/configs/application.ini | 2 | ||||
| -rw-r--r-- | application/controllers/FilterController.php | 42 | ||||
| -rw-r--r-- | application/forms/FilterAdd.php | 28 | ||||
| -rw-r--r-- | application/forms/FilterCreate.php | 13 | ||||
| -rw-r--r-- | application/views/scripts/filter/addfilter.phtml | 3 | ||||
| -rw-r--r-- | application/views/scripts/filter/index.phtml | 10 |
6 files changed, 68 insertions, 30 deletions
diff --git a/application/configs/application.ini b/application/configs/application.ini index 6970da3..9bfaec2 100644 --- a/application/configs/application.ini +++ b/application/configs/application.ini @@ -10,7 +10,7 @@ resources.frontController.params.displayExceptions = 0 resources.db.adapter = PDO_MYSQL resources.db.params.host = localhost resources.db.params.username = root -resources.db.params.password = lsfks +resources.db.params.password = 123456 resources.db.params.dbname = pbs resources.db.isDefaultTableAdapter = true diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php index 37aafb4..da8e404 100644 --- a/application/controllers/FilterController.php +++ b/application/controllers/FilterController.php @@ -2,29 +2,41 @@ class FilterController extends Zend_Controller_Action { - private $_filtermapper; + + private $_filtermapper = null; + public function init() { - try{ - $this->_filtermapper = new Application_Model_FilterMapper(); - }catch (Zend_Exception $e) { - echo "Error message 1: " . $e->getMessage() . "\n"; - } - /* Initialize action controller here */ - + try{ + $this->_filtermapper = new Application_Model_FilterMapper(); + }catch (Zend_Exception $e) { + echo "Error message 1: " . $e->getMessage() . "\n"; + } + /* Initialize action controller here */ } public function indexAction() { - try{ - $this->_filtermapper = new Application_Model_FilterMapper(); - $this->view->filters = $this->_filtermapper->fetchAll(); - - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; - } + try{ + $this->_filtermapper = new Application_Model_FilterMapper(); + $this->view->filters = $this->_filtermapper->fetchAll(); + + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + + public function addfilterAction() + { + $db = Zend_Db_Table::getDefaultAdapter(); + + $addfilterform = new Application_Form_FilterAdd(); + + $this->view->addfilterform = $addfilterform; } } + + diff --git a/application/forms/FilterAdd.php b/application/forms/FilterAdd.php new file mode 100644 index 0000000..969f07b --- /dev/null +++ b/application/forms/FilterAdd.php @@ -0,0 +1,28 @@ +<?php + +class Application_Form_FilterAdd extends Zend_Form +{ + + public function init() + { + $this->setName("Register"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + $this->addElement('submit', 'register', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Login', + )); + } + + +} + diff --git a/application/forms/FilterCreate.php b/application/forms/FilterCreate.php deleted file mode 100644 index e239b94..0000000 --- a/application/forms/FilterCreate.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -class Application_Form_FilterCreate extends Zend_Form -{ - - public function init() - { - /* Form Elements & Other Definitions Here ... */ - } - - -} - diff --git a/application/views/scripts/filter/addfilter.phtml b/application/views/scripts/filter/addfilter.phtml new file mode 100644 index 0000000..3c87e1e --- /dev/null +++ b/application/views/scripts/filter/addfilter.phtml @@ -0,0 +1,3 @@ +<?php +$this->addfilterform->setAction($this->url()); +echo $this->addfilterform; diff --git a/application/views/scripts/filter/index.phtml b/application/views/scripts/filter/index.phtml index 7162786..0f9b51e 100644 --- a/application/views/scripts/filter/index.phtml +++ b/application/views/scripts/filter/index.phtml @@ -1,8 +1,16 @@ <h1>Filters</h1> +<p><a href="<?php echo $this->url( + array( + 'controller' => 'filter', + 'action' => 'addfilter' + ), + 'default', + true) ?>">add new filter</a></p> + <?php if ($this->filters): ?> <!-- A table of filters. --> - <table> + <table border=1> <tr> <th>filterid</th> </tr> |
