本文整理汇总了PHP中Device::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::delete方法的具体用法?PHP Device::delete怎么用?PHP Device::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Device
的用法示例。
在下文中一共展示了Device::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id)
{
$data = array();
$device = new Device($id);
$device->delete();
redirect("/", "refresh");
}
示例2: device_controller
function device_controller()
{
global $session, $route, $mysqli, $user, $redis;
$result = false;
require_once "Modules/device/device_model.php";
$device = new Device($mysqli, $redis);
if ($route->format == 'html') {
if ($route->action == "view" && $session['write']) {
$devices_templates = $device->get_templates();
$result = view("Modules/device/Views/device_view.php", array('devices_templates' => $devices_templates));
}
if ($route->action == 'api') {
$result = view("Modules/device/Views/device_api.php", array());
}
}
if ($route->format == 'json') {
if ($route->action == 'list') {
if ($session['userid'] > 0 && $session['write']) {
$result = $device->get_list($session['userid']);
}
} elseif ($route->action == "create") {
if ($session['userid'] > 0 && $session['write']) {
$result = $device->create($session['userid']);
}
} elseif ($route->action == "listtemplates") {
if ($session['userid'] > 0 && $session['write']) {
$result = $device->get_templates();
}
} else {
$deviceid = (int) get('id');
if ($device->exist($deviceid)) {
$deviceget = $device->get($deviceid);
if (isset($session['write']) && $session['write'] && $session['userid'] > 0 && $deviceget['userid'] == $session['userid']) {
if ($route->action == "get") {
$result = $deviceget;
}
if ($route->action == "delete") {
$result = $device->delete($deviceid);
}
if ($route->action == 'set') {
$result = $device->set_fields($deviceid, get('fields'));
}
if ($route->action == 'inittemplate') {
$result = $device->init_template($deviceid);
}
}
} else {
$result = array('success' => false, 'message' => 'Device does not exist');
}
}
}
return array('content' => $result);
}
示例3: die
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');
示例4: Device
public static function Device($type, $data)
{
require_once 'device.class.php';
$class = new Device();
$status = false;
$class->setData($data);
$class->filter = ManagementFunction::getPostVariable('filter');
switch ($type) {
case 'add':
$status = $class->add();
break;
case 'update':
$status = $class->update();
break;
case 'delete':
$status = $class->delete();
break;
case 'getsingle':
$status = $class->getsingle();
break;
case 'getpage':
$status = $class->getpage();
break;
case 'search':
$status = $class->search();
break;
default:
break;
}
if ($status) {
wp_send_json_success($status);
} else {
wp_send_json_error($class->error);
}
}
示例5: gettext
?>
</a>
<a href="host.php">
<?php
echo gettext("No");
?>
</a>
</p>
<?php
exit;
}
require_once 'ossim_db.inc';
require_once 'classes/Device.inc';
$db = new ossim_db();
$conn = $db->connect();
Device::delete($conn, $ip);
$db->close($conn);
?>
<p> <?php
echo gettext("Device deleted");
?>
</p>
<p><a href="host.php">
<?php
echo gettext("Back");
?>
</a></p>
</body>
</html>