Device::save($device); die('1'); } // Update if (isset($_POST['update'])) { $device = new Device(); $device->set_id((int) $_POST['id']); $device->set_uid((string) $_POST['uid']); $device->set_name((string) $_POST['name']); // Get default cost for device if ($_POST['default']) { foreach (System::getValue() as $r) { if ($r->get_var() == 'default_cost') { $device->set_cost($r->get_val()); } } } else { $device->set_cost((double) $_POST['cost']); } $device->set_range((int) $_POST['range']); Device::save($device); die('1'); } // Delete if (isset($_POST['delete'])) { Device::delete((int) $_POST['id']); die('1'); } $devices = Device::getAll(); $smarty->assign('devices', $devices); $smarty->display('device.tpl');
include_once 'class/payment_menu.class.php'; $device_id = (int) $_GET['id']; $start = 0; $stop = 0; // Get device by id for get cost only $device = Device::getById($device_id); // Get payment of device $payment = Payment::getByDevice($device_id); if ($payment) { if ($payment->get_start()) { $start = 1; } if ($payment->get_stop()) { $stop = 1; } // Assign list menu in payment $smarty->assign('list_payment_menu', Payment_Menu::getByPayment($payment->get_id())); // Assign payment $smarty->assign('payment', $payment); } // List menu $list_menu = Menu::getAll(); // List device for switch device $list_device = Device::getAll(); $smarty->assign('start', $start); $smarty->assign('stop', $stop); $smarty->assign('device', $device); $smarty->assign('list_device', $list_device); $smarty->assign('list_menu', $list_menu); $smarty->assign('menu', 1); $smarty->display('detail.tpl');
if ($foo == 'delete') { $id = $_GPC['id']; $c = new Device(); $c->remove($id); message('成功删除设备信息', $this->createWebUrl('devices', array('id' => $id))); } if ($foo == 'list') { $c = new Device(); $filters = array(); $filters['title'] = $_GPC['title']; $filters['uuid'] = $_GPC['uuid']; $filters['major'] = $_GPC['major']; $filters['minor'] = $_GPC['minor']; $filters['audit_status'] = $_GPC['audit_status']; $filters['audit_comment'] = $_GPC['audit_comment']; $filters['status'] = $_GPC['status']; $pindex = intval($_GPC['page']); $pindex = max($pindex, 1); $psize = 5; $total = 0; $ds = $c->getAll($filters, $pindex, $psize, $total); if (!empty($ds)) { $a = new Activity(); foreach ($ds as &$row) { $row['activity'] = $a->getOne($row['activity']); } unset($row); } $pager = pagination($total, $pindex, $psize); include $this->template('device-list'); }
<?php include_once 'include/connect.php'; include_once 'class/range.class.php'; include_once 'class/device.class.php'; $results = Range::getAll(); $width = 0; // Assign value for range if ($results) { $width = (960 - count($results) * 20) / count($results); } $smarty->assign('ranges', $results); $smarty->assign('devices', Device::getAll()); $smarty->assign('width', $width); $smarty->assign('menu', 1); $smarty->display('dashboard.tpl');
} } } if ($_GPC['type'] == 'unbind') { foreach ($devices as $did) { $device = $d->getOne($did); if (!empty($device)) { $ret = $api->setDevicePages($device['device_id'], array(intval($activity['page'])), false); $d->touchActivity($did, 0); } } } } $filters = array(); $filters['activity'] = $id; $binds = $d->getAll($filters); $filters = array(); $filters['status'] = 'active'; $filters['notactivity'] = $id; $unbinds = $d->getAll($filters); if (!empty($unbinds)) { foreach ($unbinds as &$row) { $row['activity'] = $a->getOne($row['activity']); } unset($row); } $url = $this->createMobileUrl('activity', array('actid' => $activity['actid'])); $activity['surl'] = $url; $url = substr($url, 2); $url = $_W['siteroot'] . 'app/' . $url; $activity['url'] = $url;