1: <?php
2: /**
3: * Ulaform_Action Class
4: *
5: * Copyright 2003-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (GPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/gpl.
9: *
10: * @author Marko Djukic <marko@oblo.com>
11: * @package Ulaform
12: */
13: class Ulaform_Action {
14:
15: /**
16: * A hash containing any parameters for the current action driver.
17: *
18: * @var array
19: */
20: protected $_params = array();
21:
22: /**
23: * Constructor
24: *
25: * @param array $params Any parameters needed for this action driver.
26: */
27: public function __construct($params)
28: {
29: $this->_params = $params;
30: }
31:
32: /**
33: * Returns a list of available action drivers.
34: *
35: * @return array An array of available drivers.
36: */
37: static public function getDrivers()
38: {
39: static $drivers = array();
40: if (!empty($drivers)) {
41: return $drivers;
42: }
43:
44: $driver_path = dirname(__FILE__) . '/Action/';
45: $drivers = array();
46:
47: if ($driver_dir = opendir($driver_path)) {
48: while (false !== ($file = readdir($driver_dir))) {
49: /* Hide dot files and non .php files. */
50: if (substr($file, 0, 1) != '.' && substr($file, -4) == '.php') {
51: $driver = substr($file, 0, -4);
52: $driver_info = Ulaform::getActionInfo($driver);
53: $drivers[$driver] = $driver_info['name'];
54: }
55: }
56: closedir($driver_dir);
57: }
58:
59: return $drivers;
60: }
61:
62: }
63: