/
Form.php
47 lines (42 loc) · 1012 Bytes
/
Form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
//
// +------------------------------------------------------------------------+
// | Gecko Framework |
// +------------------------------------------------------------------------+
//
/**
* Form loading for Zend_Form
*
* @package Gecko;
* @author Christopher Valderrama <valderrama.christopher@gmail.com>
* @copyright Copyright (c) 2009
* @version $Id$2.0
**/
class Gecko_Form {
/**
* The Model Path
* @var string
*/
private static $_formPath = '';
/**
* Sets the default Form Path
*
* @param string $sPath
* @return void
*/
public static function setDefaultFormPath($sPath) {
self::$_formPath = $sPath;
}
/**
* Loads a Form from the Form Path
*
* @param string $sModel
* @return mixed
*/
public static function factory($sForm) {
$sFormFile = $sForm . '.php';
$sFormClass = 'Form_' . $sForm;
Zend_Loader::loadFile($sFormFile, self::$_formPath);
return new $sFormClass();
}
}