Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Filtry i kolejność wykonywania
sf
post
Post #1





Grupa: Zarejestrowani
Postów: 1 597
Pomógł: 30
Dołączył: 19.02.2003
Skąd: Tychy

Ostrzeżenie: (0%)
-----


Posiadam klasę HFilters:
  1. <?php
  2. class HFilters
  3. {
  4. private $aFilterList = array();
  5.  
  6.  
  7. private $oContext;
  8.  
  9.  
  10. public function __construct(& $oContext)
  11. {
  12. $this->oContext = & $oContext;
  13. }
  14.  
  15.  
  16. public function add(iFilter $oFilter, $iPreWeight = 10, $iPostWeight = 10)
  17. {
  18. $this->aFilterList[] = $oFilter;
  19. }
  20.  
  21.  
  22. public function pre()
  23. {
  24. foreach($this->aFilterList as $oFilter) {
  25. $oFilter->pre($this->oContext);
  26. }
  27. }
  28.  
  29.  
  30. public function post()
  31. {
  32. foreach($this->aFilterList as $oFilter) {
  33. $oFilter->post($this->oContext);
  34. }
  35. }
  36. }
  37. ?>


IFilter wygląda następująco:
  1. <?php
  2. interface iFilter
  3. {
  4. public function pre($oContext);
  5.  
  6.  
  7. public function post($oContext);
  8. }
  9. ?>


Mam problem z zaimplementowaniem kolejności wykonywania metod pre() i post() w HFilter wg ustalonwej wagi podanej w metodzie add(). Czy ktoś ma jakiś pomysł?

Ten post edytował sf 7.03.2007, 13:30:49
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 17.11.2025 - 08:25