當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Device::delete方法代碼示例

本文整理匯總了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");
	}
開發者ID:JDougherty,項目名稱:Network-Management-System,代碼行數:9,代碼來源:devices.php

示例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);
}
開發者ID:alj56,項目名稱:emoncms,代碼行數:53,代碼來源:device_controller.php

示例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');
開發者ID:nguyentien,項目名稱:ps3,代碼行數:31,代碼來源:device.php

示例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);
     }
 }
開發者ID:khiconit,項目名稱:Device-manager,代碼行數:35,代碼來源:ManagementAdmin.class.php

示例5: gettext

    ?>
 </a>
      &nbsp;&nbsp;&nbsp;<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>
開發者ID:jhbsz,項目名稱:ossimTest,代碼行數:31,代碼來源:deletedevice.php


注:本文中的Device::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。