Ejemplo n.º 1
0
 /**
  * Creates a new DataCenter with the given details
  * @param string $title The title of the DataCenter to create
  * @param string $hostname The host name or IP address of the DataCenter
  * @param string $description A short description of the DataCenter
  * @return \PhoenixSNS\Objects\DataCenter|NULL The newly-created DataCenter object with the given details, or NULL if the creation operation failed.
  */
 public static function Create($title, $hostname, $description = null)
 {
     $item = new DataCenter();
     $item->Title = $title;
     $item->HostName = $hostname;
     $item->Description = $description;
     if ($item->Update()) {
         return $item;
     }
     return null;
 }
Ejemplo n.º 2
0
				</div>
			</form>
			<?php 
    }
}
System::$Modules[] = new \WebFX\Module("net.phoenixsns.TenantManager.DataCenter", array(new ModulePage("data-centers", array(new ModulePage("", function ($page, $path) {
    $page = new DataCenterMainPage();
    $page->Render();
    return true;
}), new ModulePage("create", function ($page, $path) {
    $datacenter = new DataCenter();
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $datacenter->Title = $_POST["datacenter_Title"];
        $datacenter->Description = $_POST["datacenter_Description"];
        $datacenter->HostName = $_POST["datacenter_HostName"];
        $datacenter->Update();
        System::Redirect("~/data-centers");
    } else {
        $page = new DataCenterManagementPage();
        $page->CurrentObject = null;
        $page->Render();
    }
    return true;
}), new ModulePage("modify", function ($page, $path) {
    $datacenter = DataCenter::GetByID($path[0]);
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $datacenter->Title = $_POST["datacenter_Title"];
        $datacenter->Description = $_POST["datacenter_Description"];
        $datacenter->HostName = $_POST["datacenter_HostName"];
        $datacenter->Update();
        // if ($_GET["close"] == "1")