57 lines
1.1 KiB
PHP
57 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace mt;
|
|
|
|
use phpcommon;
|
|
|
|
class FirstTopup
|
|
{
|
|
|
|
public static function get($id)
|
|
{
|
|
return getXVal(self::getMetaList(), $id);
|
|
}
|
|
|
|
public static function getByGroup($group)
|
|
{
|
|
self::all();
|
|
return getXVal(self::$groupList, $group);
|
|
}
|
|
|
|
public static function getGroups()
|
|
{
|
|
self::all();
|
|
return self::$groupList;
|
|
}
|
|
|
|
public static function all()
|
|
{
|
|
if (!self::$firstTopupList) {
|
|
self::$firstTopupList = array();
|
|
self::$groupList = array();
|
|
|
|
foreach (self::getMetaList() as $meta) {
|
|
array_push(self::$firstTopupList, $meta);
|
|
if (!getXVal(self::$groupList, $meta['group'], null)) {
|
|
self::$groupList[$meta['group']] = array();
|
|
}
|
|
array_push(self::$groupList[$meta['group']], $meta);
|
|
}
|
|
}
|
|
|
|
return self::$firstTopupList;
|
|
}
|
|
|
|
protected static function getMetaList()
|
|
{
|
|
if (!self::$metaList) {
|
|
self::$metaList = getMetaTable('FirstTopup@FirstTopup.php');
|
|
}
|
|
return self::$metaList;
|
|
}
|
|
|
|
protected static $groupList;
|
|
protected static $firstTopupList;
|
|
protected static $metaList;
|
|
}
|