protected function BeforeFullContent()
    {
        ?>
			<div class="Page<?php 
        if (!$this->RenderHeader) {
            echo " HideHeader";
        }
        if (!$this->RenderSidebar) {
            echo " HideSidebar";
        }
        ?>
">
				<nav class="Top">
					<a class="MenuButton" onclick="toggleSidebarExpanded(); return false;" href="#"><i class="fa fa-bars">&nbsp;</i></a>
					<img class="Logo" src="<?php 
        echo System::ExpandRelativePath("~/Images/Logo.png");
        ?>
" alt="<?php 
        echo System::GetConfigurationValue("Application.Name");
        ?>
" />
					<?php 
        $txtSearch = new TextBox();
        $txtSearch->ClassList[] = "SearchBar";
        $txtSearch->PlaceholderText = "Type to search for tasks";
        $txtSearch->SuggestionURL = "~/API/Search.php?q=%1";
        $txtSearch->Render();
        ?>
					<div class="UserInfo">
						<div class="DropDownButton">
							<i class="fa fa-user">&nbsp;</i>
							<img class="UserIcon" alt="" />
							<span class="UserName"><?php 
        $user = User::GetByID($_SESSION["Authentication.UserID"]);
        if ($user == null) {
            echo "Not logged in";
        } else {
            if ($user->DisplayName != null) {
                echo $user->DisplayName;
            } else {
                echo $user->UserName;
            }
        }
        ?>
</span>
							<div class="Menu DropDownMenu">
								<a href="<?php 
        echo System::ExpandRelativePath("~/account/settings.page");
        ?>
">
									<span class="Icon"><i class="fa fa-cogs">&nbsp;</i></span>
									<span class="Text">Change Settings</span>
								</a>
								<a href="<?php 
        echo System::ExpandRelativePath("~/account/logout.page");
        ?>
">
									<span class="Icon"><i class="fa fa-sign-out">&nbsp;</i></span>
									<span class="Text">Log Out</span>
								</a>
							</div>
						</div>
					</div>
				</nav>
				<nav class="Sidebar" id="__SidebarFrame">
					<ul>
					<?php 
        foreach ($this->SidebarButtons as $button) {
            $this->RenderSidebarButton($button);
        }
        ?>
					</ul>
					<div class="BackstageView">
						<div class="Content">
							<div class="Column" style="width: 25%;">
								<div class="Title">Tenants</div>
								<?php 
        $tenants = Tenant::Get();
        foreach ($tenants as $tenant) {
            echo "<a href=\"" . System::ExpandRelativePath("~/tenant/modify/" . $tenant->URL) . "\">" . $tenant->URL . "</a>";
        }
        ?>
								
								<div class="Title">Actions</div>
								<a href="<?php 
        echo System::ExpandRelativePath("~/account/logout.page");
        ?>
"><i class="fa fa-sign-out"></i> <span class="Text">Log Out</span></a>
							</div>
							<div class="Column">
								<div class="Title">About</div>
								<div><img src="<?php 
        echo System::ExpandRelativePath("~/Images/Billboard.png");
        ?>
" /></div>
								<p>
									PhoenixSNS version 1.0
								</p>
							</div>
						</div>
					</div>
				</nav>
				<header>
					<div class="Title" id="__TitleFrame"><?php 
        echo $this->Title;
        ?>
</div>
					<div class="Subtitle" id="__SubtitleFrame"><?php 
        echo $this->Subtitle;
        ?>
</div>
					<div class="Buttons">
					<?php 
        foreach ($this->HeaderButtons as $button) {
            echo "<a class=\"Button";
            if ($button->CssClass != "") {
                echo " " . $button->CssClass;
            }
            echo "\"";
            if ($button->TargetURL != "") {
                echo " href=\"" . System::ExpandRelativePath($button->TargetURL) . "\"";
            }
            if ($button->TargetScript != "") {
                echo " onclick=\"" . $button->TargetScript . "\"";
            }
            echo ">";
            if ($button->IconName != "") {
                echo "<i class=\"fa " . $button->IconName . "\">&nbsp;</i>";
            }
            echo "<span class=\"Text\">";
            echo $button->Title;
            echo "</span>";
            echo "</a>";
        }
        ?>
					</div>
				</header>
				<div class="Content" id="__ContentFrame">
					<script type="text/javascript">
						function nav(url)
						{
							// disable AJAX navigation temporarily until it's figured out
							return true;
							
							// Add an item to the history log
							history.pushState(url, "", url);
							loadc(url);
							setSidebarExpanded(false);
							return false;
						}
						function toggleSidebarExpanded()
						{
							setSidebarExpanded(!getSidebarExpanded());
						}
						function getSidebarExpanded()
						{
							var u = document.getElementById("__SidebarFrame");
							return (u.className == "Sidebar Expanded");
						}
						function setSidebarExpanded(value)
						{
							var u = document.getElementById("__SidebarFrame");
							if (value)
							{
								u.className = "Sidebar Expanded";
							}
							else
							{
								u.className = "Sidebar";
							}
						}
						function loadc(url)
						{
							if (url == null) url = "";
							
							var contentFrame = document.getElementById("__ContentFrame");
							if (url.indexOf('?') != -1)
							{
								url += "&partial";
							}
							else
							{
								url += "?partial";
							}
							WebFramework.Navigation.LoadPartialContent(url, contentFrame);
							
							var event = new Event("load");
							window.dispatchEvent(event);
						}
						function setTitles(title, subtitle)
						{
							if (title)
							{
								var titleFrame = document.getElementById("__TitleFrame");
								titleFrame.innerHTML = title;
							}
							if (subtitle)
							{
								var subtitleFrame = document.getElementById("__SubtitleFrame");
								subtitleFrame.innerHTML = subtitle;
							}
						}
						
						// Revert to a previously saved state
						window.addEventListener('popstate', function(event)
						{
							loadc(event.state);
						});
						window.addEventListener("load", function(e)
						{
							var url = window.location.pathname.substring(1);
							var sidebar = document.getElementById("__SidebarFrame");
							var navs = sidebar.childNodes;
							for (var i = 0; i < navs.length; i++)
							{
								if (navs[i].tagName != "A") continue;
								if (navs[i].attributes["data-id"] != null && navs[i].attributes["data-id"].value == url)
								{
									navs[i].className = "Selected";
								}
								else
								{
									navs[i].className = "";
								}
							}
						});
					</script>
			<?php 
    }
Beispiel #2
0
 /**
  * Counts the Tenants that match the given criteria.
  * @param boolean $includeActive True to include active tenants in the results; false to exclude active tenants.
  * @param boolean $includeInactive True to include inactive tenants in the results; false to exclude inactive tenants.
  * @return int The number of Tenants which match the given criteria.
  */
 public static function Count($includeActive = true, $includeInactive = true)
 {
     $tenants = Tenant::Get();
     $count = 0;
     foreach ($tenants as $tenant) {
         if ($includeActive && !$tenant->IsExpired() || $tenant->IsExpired() && $includeInactive) {
             $count++;
         }
     }
     return $count;
 }
    protected function RenderContent()
    {
        $tenants = Tenant::Get();
        ?>
		<p>There are <?php 
        echo count($tenants);
        ?>
 tenants in total.</p>
		<?php 
        $countActive = 0;
        $countExpired = 0;
        foreach ($tenants as $tenant) {
            if ($tenant->IsExpired()) {
                $countExpired++;
            } else {
                $countActive++;
            }
        }
        $disclosure = new Disclosure();
        $disclosure->Title = "Active Tenants (" . $countActive . ")";
        $disclosure->Expanded = true;
        $disclosure->BeginContent();
        /*
        $lv = new ListView("lvInactive");
        $lv->Columns = array
        (
        	new ListViewColumn("chTenantName", "Tenant Name"),
        	new ListViewColumn("chTenantType", "Tenant Type"),
        	new ListViewColumn("chDataCenters", "Data Centers"),
        	new ListViewColumn("chPaymentPlan", "Payment Plan"),
        	new ListViewColumn("chActivationDate", "Activation Date"),
        	new ListViewColumn("chTerminationDate", "Termination Date"),
        	new ListViewColumn("chDescription", "Description"),
        	new ListViewColumn("chActions", "Actions")
        );
        */
        $lv = new ListView();
        $lv->EnableRowCheckBoxes = true;
        $lv->Width = "100%";
        $lv->Columns = array(new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcTenantType", "Type"), new ListViewColumn("lvcPaymentPlan", "Payment Plan"), new ListViewColumn("lvcDataCenters", "Data Centers"), new ListViewColumn("lvcStartDate", "Start Date"), new ListViewColumn("lvcEndDate", "End Date"));
        foreach ($tenants as $tenant) {
            if ($tenant->IsExpired()) {
                continue;
            }
            $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcDescription", "<div class=\"Title\">" . $tenant->URL . "</div><div class=\"Content\">" . $tenant->Description . "</div>" . "<div class=\"Footer\" style=\"padding: 8px;\">" . "<a class=\"Button Default\" href=\"" . System::ExpandRelativePath("~/tenant/launch/" . $tenant->URL) . "\" target=\"_blank\">Launch</a>" . "<span class=\"Separator\" />" . "<a class=\"Button\" href=\"" . System::ExpandRelativePath("~/tenant/modify/" . $tenant->URL) . "\">Modify</a>" . "<a class=\"Button\" href=\"" . System::ExpandRelativePath("~/tenant/clone/" . $tenant->URL) . "\">Clone</a>" . "<a class=\"Button\" href=\"" . System::ExpandRelativePath("~/tenant/delete/" . $tenant->URL) . "\">Delete</a>" . "</div>", $tenant->Description . " " . $tenant->URL), new ListViewItemColumn("lvcTenantType", $tenant->Type->Title), new ListViewItemColumn("lvcPaymentPlan", $tenant->PaymentPlan->Title), new ListViewItemColumn("lvcDataCenters", null), new ListViewItemColumn("lvcStartDate", $tenant->BeginTimestamp == null ? "(none)" : $tenant->BeginTimestamp), new ListViewItemColumn("lvcEndDate", $tenant->EndTimestamp == null ? "(none)" : $tenant->EndTimestamp)));
            /*
            ?>
            	<div class="Footer">
            		<a class="Button Default" href="<?php echo(System::ExpandRelativePath("~/tenant/launch/" . $tenant->URL)); ?>" target="_blank">Launch</a>
            		<span class="Separator" />
            		<a class="Button" onclick="return nav('/tenant/modify/<?php echo($tenant->URL); ?>');" href="<?php echo(System::ExpandRelativePath("~/tenant/modify/" . $tenant->URL)); ?>">Modify</a>
            		<a class="Button" href="<?php echo(System::ExpandRelativePath("~/tenant/clone/" . $tenant->URL)); ?>">Clone</a>
            		<a class="Button" href="<?php echo(System::ExpandRelativePath("~/tenant/delete/" . $tenant->URL)); ?>">Delete</a>
            	</div>
            </div>
            <?php
            */
        }
        $lv->Render();
        $disclosure->EndContent();
        $disclosure = new Disclosure();
        $disclosure->Title = "Inactive Tenants (" . $countExpired . ")";
        $disclosure->Expanded = true;
        $disclosure->BeginContent();
        $lv = new ListView();
        $lv->EnableRowCheckBoxes = true;
        $lv->Width = "100%";
        $lv->Columns = array(new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcTenantType", "Type"), new ListViewColumn("lvcPaymentPlan", "Payment Plan"), new ListViewColumn("lvcDataCenters", "Data Centers"), new ListViewColumn("lvcStartDate", "Start Date"), new ListViewColumn("lvcEndDate", "End Date"));
        foreach ($tenants as $tenant) {
            if (!$tenant->IsExpired()) {
                continue;
            }
            $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcDescription", "<div class=\"Title\">" . $tenant->URL . "</div><div class=\"Content\">" . $tenant->Description . "</div>", $tenant->Description . " " . $tenant->URL), new ListViewItemColumn("lvcTenantType", $tenant->Type->Title), new ListViewItemColumn("lvcPaymentPlan", $tenant->PaymentPlan->Title), new ListViewItemColumn("lvcDataCenters", null), new ListViewItemColumn("lvcStartDate", $tenant->BeginTimestamp == null ? "(none)" : $tenant->BeginTimestamp), new ListViewItemColumn("lvcEndDate", $tenant->EndTimestamp == null ? "(none)" : $tenant->EndTimestamp)));
        }
        $lv->Render();
        $disclosure->EndContent();
    }