OSDN Git Service

Initial commit at SoulDrops 2nd season analyzer module.
[mulab/sd2nd.git] / trust_path / modules / sd2nd / forms / AbilityFilterForm.class.php
1 <?php
2 /**
3  * @file
4  * @package sd2nd
5  * @version $Id$
6 **/
7
8 if(!defined('XOOPS_ROOT_PATH'))
9 {
10     exit;
11 }
12
13 require_once SD2ND_TRUST_PATH . '/class/AbstractFilterForm.class.php';
14
15 define('SD2ND_ABILITY_SORT_KEY_ABILITY_ID', 1);
16 define('SD2ND_ABILITY_SORT_KEY_ABILITY_NAME', 2);
17 define('SD2ND_ABILITY_SORT_KEY_DESCRIPTION', 3);
18 define('SD2ND_ABILITY_SORT_KEY_ABILITY_COST', 4);
19 define('SD2ND_ABILITY_SORT_KEY_REGIST_TIME', 5);
20 define('SD2ND_ABILITY_SORT_KEY_DEFAULT', SD2ND_ABILITY_SORT_KEY_ABILITY_ID);
21
22 /**
23  * Sd2nd_AbilityFilterForm
24 **/
25 class Sd2nd_AbilityFilterForm extends Sd2nd_AbstractFilterForm
26 {
27     /**
28      * @var  string[]
29      * 
30      * @public
31     **/
32     var $mSortKeys = array(
33         SD2ND_ABILITY_SORT_KEY_ABILITY_ID => 'ability_id',
34         SD2ND_ABILITY_SORT_KEY_ABILITY_NAME => 'ability_name',
35         SD2ND_ABILITY_SORT_KEY_DESCRIPTION => 'description',
36         SD2ND_ABILITY_SORT_KEY_ABILITY_COST => 'ability_cost',
37         SD2ND_ABILITY_SORT_KEY_REGIST_TIME => 'regist_time'
38     );
39
40     /**
41      * getDefaultSortKey
42      * 
43      * @param   void
44      * 
45      * @return  void
46     **/
47     public function getDefaultSortKey()
48     {
49         return SD2ND_ABILITY_SORT_KEY_DEFAULT;
50     }
51
52     /**
53      * fetch
54      * 
55      * @param   void
56      * 
57      * @return  void
58     **/
59     public function fetch()
60     {
61         parent::fetch();
62     
63         $request =& XCube_Root::getSingleton()->mContext->mRequest;
64     
65         if (($value = $request->getRequest('regist_time')) != null) {
66             $this->_mCriteria->add(new Criteria('regist_time', $value));
67         }
68         $this->mNavi->addExtra('regist_time', $value);
69     
70         if (ctype_digit($value = $request->getRequest('ability_cost'))) {
71             $this->_mCriteria->add(new Criteria('ability_cost', $value));
72         }
73         else
74         {
75             $value = null;
76         }
77         $this->mNavi->addExtra('ability_cost', $value);
78     
79         $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
80     }
81 }
82
83 ?>