Revize 1703
Přidáno uživatelem David Raška před asi 12 roky(ů)
freenetis/trunk/kohana/application/models/device.php | ||
---|---|---|
*/
|
||
class Device_Model extends ORM
|
||
{
|
||
// type constants of devices (not all of them)
|
||
const TYPE_PC = 7;
|
||
const TYPE_CLIENT = 8;
|
||
const TYPE_ROUTER = 9;
|
||
const TYPE_SWITCH = 10;
|
||
const TYPE_NOTEBOOK = 17;
|
||
const TYPE_HOMEAP = 24;
|
||
const TYPE_VOIP = 26;
|
||
const TYPE_AP = 62;
|
||
const TYPE_MOBILE = 93;
|
||
const TYPE_TV = 94;
|
||
const TYPE_UPS = 95;
|
||
const TYPE_PLAYSTATION = 96;
|
||
const TYPE_OTHER = 97;
|
||
const TYPE_CAMERA = 98;
|
||
const TYPE_TABLET = 99;
|
||
const TYPE_PRINTER = 100;
|
||
const TYPE_DREAMBOX = 101;
|
||
const TYPE_SERVER = 102;
|
||
|
||
protected $has_many = array
|
||
(
|
freenetis/trunk/kohana/application/models/enum_type.php | ||
---|---|---|
* @param $value
|
||
* @return integer
|
||
*/
|
||
public function get_type_id($value)
|
||
public function get_type_id($value, $type_id = NULL)
|
||
{
|
||
$where_type = '';
|
||
|
||
if (!is_null($type_id))
|
||
{
|
||
$where_type = "AND type_id = " . intval($type_id);
|
||
}
|
||
|
||
$result = $this->db->query("
|
||
SELECT id
|
||
FROM enum_types
|
||
WHERE value = ?
|
||
COLLATE utf8_general_ci
|
||
WHERE value LIKE ? $where_type
|
||
", $value);
|
||
|
||
if ($result && $result->count())
|
freenetis/trunk/kohana/application/views/js/devices_map.php | ||
---|---|---|
*/
|
||
|
||
// IDE complementation
|
||
if (FALSE): ?><script type='text/javascript'><?php endif
|
||
|
||
if (FALSE): ?><script type='text/javascript'><?php endif;
|
||
$etm = new Enum_type_Model();
|
||
?>
|
||
var device_id = $('#device_id').val();
|
||
var depth = 2;
|
||
... | ... | |
'types' : {
|
||
'valid_children' : [ 'root' ],
|
||
'types' : {
|
||
'<?php echo Device_Model::TYPE_PC ?>' : {
|
||
'<?php echo $etm->get_type_id('pc', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/pc.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_CLIENT ?>' : {
|
||
'<?php echo $etm->get_type_id('client', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/client.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_ROUTER ?>' : {
|
||
'<?php echo $etm->get_type_id('router', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/router.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_SWITCH ?>' : {
|
||
'<?php echo $etm->get_type_id('switch', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/switch.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_NOTEBOOK ?>' : {
|
||
'<?php echo $etm->get_type_id('notebook', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/notebook.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_HOMEAP ?>' : {
|
||
'<?php echo $etm->get_type_id('home ap', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/homeap.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_VOIP ?>' : {
|
||
'<?php echo $etm->get_type_id('voip', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/voip.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_AP ?>' : {
|
||
'<?php echo $etm->get_type_id('ap', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/ap.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_MOBILE ?>' : {
|
||
'<?php echo $etm->get_type_id('tablet', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/mobile.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_TV ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/tv.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_CAMERA ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/camera.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_TABLET ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/tablet.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_PRINTER ?>' : {
|
||
'<?php echo $etm->get_type_id('server', Enum_type_Model::DEVICE_TYPE_ID) ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/printer.png'
|
||
}
|
||
},
|
||
'<?php echo Device_Model::TYPE_SERVER ?>' : {
|
||
'icon' : {
|
||
'image' : '<?php echo url::base() ?>media/images/icons/devices/server.png'
|
||
}
|
||
}
|
Také k dispozici: Unified diff
Opravy:
- #329: Odstraneni konstant zarizeni v trunku