示例#1
0
 protected function Initialize()
 {
     parent::Initialize();
     $path = System::GetVirtualPath();
     $pagename = $path[1];
     switch ($pagename) {
         case "members":
             $this->BreadcrumbItems = array(new BreadcrumbItem("~/community", "Community"), new BreadcrumbItem("~/community/members", "Members"));
             break;
         case "groups":
             $this->BreadcrumbItems = array(new BreadcrumbItem("~/community", "Community"), new BreadcrumbItem("~/community/groups", "Groups"));
             break;
         case "pages":
             $this->BreadcrumbItems = array(new BreadcrumbItem("~/community", "Community"), new BreadcrumbItem("~/community/pages", "Pages"));
             break;
         case "forums":
             $this->BreadcrumbItems = array(new BreadcrumbItem("~/community", "Community"), new BreadcrumbItem("~/community/forums", "Forums"));
             break;
     }
 }
示例#2
0
function displayProfileTitle()
{
    $path = System::GetVirtualPath();
    $id = $path[1];
    $CurrentTenant = Tenant::GetCurrent();
    $objUser = $CurrentTenant->GetObject("User");
    $thisuser = $objUser->GetInstance(new TenantQueryParameter("URL", $id));
    if ($thisuser == null) {
        return;
    }
    ?>
	<div class="ProfileTitle">
		<?php 
    mmo_display_user_badges_by_user($thisuser);
    ?>
		<span class="ProfileUserName"><?php 
    echo $thisuser->LongName;
    ?>
</span>
		<?php 
    if ($action != "customize") {
        ?>
			<span class="ProfileControlBox">
			<?php 
        if ($CurrentUser != null && $thisuser->ID != $CurrentUser->ID) {
            if (mmo_has_user_friend_request(null, $thisuser)) {
                ?>
				<a href="<?php 
                echo System::$Configuration["Application.BasePath"];
                ?>
/community/members/<?php 
                echo $id;
                ?>
/Disconnect">Withdraw Friend Request</a>
				<?php 
            } else {
                if (mmo_has_user_friend_request($thisuser, $CurrentUser)) {
                    ?>
				<a href="<?php 
                    echo System::$Configuration["Application.BasePath"];
                    ?>
/community/members/<?php 
                    echo $id;
                    ?>
/Connect/<?php 
                    echo mmo_get_user_friendship_auth_key($thisuser, $CurrentUser);
                    ?>
">Confirm Friendship</a>
				<?php 
                } else {
                    if ($CurrentUser->HasFriend($thisuser)) {
                        ?>
				<a href="<?php 
                        echo System::$Configuration["Application.BasePath"];
                        ?>
/community/members/<?php 
                        echo $id;
                        ?>
/Disconnect"><?php 
                        echo LanguageString::GetByName("friend_disconnect");
                        ?>
</a>
				<?php 
                    } else {
                        ?>
				<a href="<?php 
                        echo System::$Configuration["Application.BasePath"];
                        ?>
/community/members/<?php 
                        echo $id;
                        ?>
/Connect"><?php 
                        echo LanguageString::GetByName("friend_connect");
                        ?>
</a>
				<?php 
                    }
                }
            }
            ?>
			<form action="<?php 
            echo System::$Configuration["Application.BasePath"];
            ?>
/Account/Messages/Create" method="POST">
				<input type="hidden" name="message_receiver" value="<?php 
            echo $thisuser->ID;
            ?>
" />
				<input class="LinkButton" type="submit" value="<?php 
            echo LanguageString::GetByName("message_send");
            ?>
" />
			</form>
			<a href="<?php 
            echo System::$Configuration["Application.BasePath"];
            ?>
/community/members/<?php 
            echo $id;
            ?>
/trade/"><?php 
            echo LanguageString::GetByName("resource_trade");
            ?>
</a>
			<a href="<?php 
            echo System::$Configuration["Application.BasePath"];
            ?>
/community/members/<?php 
            echo $id;
            ?>
/block" onclick="/* ReportBlockDialog.Show(); return false; */">Report/Block</a>
			<?php 
        }
        if ($thisuser->IsAuthenticated) {
            ?>
				<a href="<?php 
            echo System::$Configuration["Application.BasePath"];
            ?>
/community/members/<?php 
            echo $id;
            ?>
/Customize">Customize Profile</a>
			<?php 
        }
    }
    ?>
			</span>
	</div>
<?php 
}
示例#3
0
    			?>
    			<a href="<?php echo(System::ExpandRelativePath("~/community/members/" . $thisuser->ShortName . "/shoutout/messages/" . $message->ID . "/praises.mmo")); ?>" onclick="DisplayPraiseDialog(<?php echo($message->ID); ?>); return false;"><?php echo(LanguageString::GetByName("praise")); ?> (<?php echo(count($praises)) ?>)</a> | <a href="<?php echo(System::ExpandRelativePath("~/community/members/" . $thisuser->ShortName . "/shoutout/messages/" . $message->ID . "/comments.mmo")); ?>"><?php echo(LanguageString::GetByName("comment")); ?></a>
    			<?php
    			}
    			if ($message->Sender->ID == $CurrentUser->ID)
    			{
    			?>
    			| <a href="<?php echo(System::ExpandRelativePath("~/community/members/" . $thisuser->ShortName . "/shoutout/messages/" . $message->ID . "/edit.mmo")); ?>"><?php echo(LanguageString::GetByName("edit")); ?></a> | <a href="<?php echo(System::ExpandRelativePath("~/community/members/" . $thisuser->ShortName . "/shoutout/messages/" . $message->ID . "/remove.mmo")); ?>"><?php echo(LanguageString::GetByName("remove")); ?></a>
    			<?php
    			}
    		?>
    	</span>
    </div>
    */
}
$path = System::GetVirtualPath();
if (count($path) > 3 && $path[3] == "messages") {
    $message_id = $path[4];
    if (is_numeric($message_id)) {
        switch ($path[5]) {
            case "comments.mmo":
                $message = ShoutoutMessage::GetByID($message_id);
                $comments = $message->GetComments();
                foreach ($comments as $comment) {
                    $comment->Render();
                }
                return;
            case "edit.mmo":
                return;
            case "praise.mmo":
                $message = ShoutoutMessage::GetByID($message_id);
    protected function RenderContent()
    {
        ?>
			<form method="POST" onsubmit="return form_OnSubmit();">
				<?php 
        $tbs = new TabContainer("tbsTabs");
        $tbs->TabPages[] = new TabPage("tabGeneralInformation", "General Information", null, null, null, function () {
            $fv = new FormView();
            $fv->Items[] = new FormViewItemText("txtTenantURL", "tenant_URL", "Name", $this->Tenant->URL);
            $fvTenantTypes = array();
            $tenanttypes = TenantType::Get();
            foreach ($tenanttypes as $tenanttype) {
                $fvTenantType = new FormViewItemChoiceValue($tenanttype->Title, $tenanttype->ID);
                $fvTenantType->Selected = $this->Tenant != null && $this->Tenant->Type != null && $tenanttype->ID == $this->Tenant->Type->ID;
                $fvTenantTypes[] = $fvTenantType;
            }
            $fv->Items[] = new FormViewItemChoice("cboTenantType", "tenant_TypeID", "Type", null, $fvTenantTypes);
            $fv->Items[] = new FormViewItemBoolean("chkStatus", "tenant_Status", "Status", $this->Tenant->Status == TenantStatus::Enabled);
            $fvDataCenters = array();
            $datacenters = DataCenter::Get();
            foreach ($datacenters as $datacenter) {
                $fvDataCenter = new FormViewItemChoiceValue($datacenter->Title, $datacenter->ID);
                $fvDataCenter->Selected = $this->Tenant != null && $this->Tenant->DataCenters->Contains($datacenter);
                $fvDataCenters[] = $fvDataCenter;
            }
            $fv->Items[] = new FormViewItemChoice("cboDataCenter", "tenant_DataCenterIDs", "Data centers", null, $fvDataCenters, true);
            $fvPaymentPlans = array();
            $paymentplans = PaymentPlan::Get();
            foreach ($paymentplans as $paymentplan) {
                $fvPaymentPlan = new FormViewItemChoiceValue($paymentplan->Title, $paymentplan->ID);
                $fvPaymentPlan->Selected = $this->Tenant != null && $this->Tenant->PaymentPlan != null && $paymentplan->ID == $this->Tenant->PaymentPlan->ID;
                $fvPaymentPlans[] = $fvPaymentPlan;
            }
            $fv->Items[] = new FormViewItemChoice("cboPaymentPlan", "tenant_PaymentPlanID", "Payment plan", null, $fvPaymentPlans);
            $fv->Items[] = new FormViewItemDateTime("txtActivationDate", "tenant_BeginTimestamp", "Activation date", $this->Tenant != null ? $this->Tenant->BeginTimestamp : null, true);
            $fv->Items[] = new FormViewItemDateTime("txtTerminationDate", "tenant_EndTimestamp", "Termination date", $this->Tenant != null ? $this->Tenant->EndTimestamp : null, true);
            $fv->Items[] = new FormViewItemMemo("txtDescription", "tenant_Description", "Description", $this->Tenant->Description);
            $fv->Render();
        });
        $path = System::GetVirtualPath();
        if ($path[1] != "clone") {
            $tbs->TabPages[] = new TabPage("tabCustomProperties", "Custom Properties", null, null, null, function () {
                $lv = new ListView();
                $lv->Width = "100%";
                $lv->EnableAddRemoveRows = true;
                $lv->Columns = array(new ListViewColumn("lvcProperty", "Property"), new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcValue", "Value"));
                $properties = $this->Tenant->GetProperties();
                foreach ($properties as $property) {
                    $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcProperty", $property->Name), new ListViewItemColumn("lvcDescription", $property->Description), new ListViewItemColumn("lvcValue", null, null, function ($property) {
                        $property->DataType->RenderEditor($this->Tenant->GetPropertyValue($property), "Property_" . $property->ID);
                    }, $property)));
                }
                $lv->Render();
            });
            $tbs->TabPages[] = new TabPage("tabEnabledModules", "Enabled Modules", null, null, null, function () {
                $lv = new ListView();
                $lv->Width = "100%";
                $lv->EnableRowCheckBoxes = true;
                $lv->Columns = array(new ListViewColumn("lvcModule", "Module"), new ListViewColumn("lvcDescription", "Description"));
                $modules = Module::Get(null);
                foreach ($modules as $module) {
                    $item = new ListViewItem(array(new ListViewItemColumn("lvcModule", "<a href=\"" . System::ExpandRelativePath("~/tenant/modify/" . $this->Tenant->URL . "/modules/" . $module->ID . "\">" . $module->Title . "</a>", $module->Title)), new ListViewItemColumn("lvcDescription", $module->Description)));
                    $item->Checked = $this->Tenant->HasModule($module);
                    $lv->Items[] = $item;
                }
                $lv->Render();
            });
            $tbs->TabPages[] = new TabPage("tabGlobalObjects", "Global Objects", null, null, null, function () {
                $lv = new ListView();
                $lv->Width = "100%";
                $lv->EnableAddRemoveRows = true;
                $lv->Columns = array(new ListViewColumn("lvcObject", "Object"), new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcInstances", "Instances"));
                $objects = TenantObject::Get(null, $this->Tenant);
                foreach ($objects as $object) {
                    $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcObject", $object->Name), new ListViewItemColumn("lvcDescription", $object->Description), new ListViewItemColumn("lvcInstances", "<a href=\"" . System::ExpandRelativePath("~/tenant/modify/" . $this->Tenant->URL . "/objects/" . $object->ID . "/instances") . "\">" . $object->CountInstances() . "</a>")));
                }
                $lv->Render();
            });
        }
        $tbs->SelectedTab = $tbs->TabPages[0];
        $tbs->Render();
        ?>
				<div class="Buttons">
					<input class="Button Default" type="submit" value="Save Changes" />
					<a class="Button" onclick="return nav('/tenant');" href="<?php 
        echo System::ExpandRelativePath("~/tenant");
        ?>
">Cancel</a>
				</div>
			</form>
			<script type="text/javascript">
			var TenantManagementPageMode =
			{
				"Create": 1,
				"Modify": 2
			}
			<?php 
        if ($this->Mode == TenantManagementPageMode::Create) {
            echo "var Mode = TenantManagementPageMode.Create;";
        } else {
            if ($this->Mode == TenantManagementPageMode::Modify) {
                echo "var Mode = TenantManagementPageMode.Modify;";
            }
        }
        ?>
			function form_OnSubmit()
			{
				if (Mode == TenantManagementPageMode.Create)
				{
					var xhr = new XMLHttpRequest();
					var tenantName = document.getElementById('txtTenantURL').value;
					
					xhr.open("GET", "/API/Tenant.php?action=exists&q=" + tenantName, false);
					xhr.send(null);
					
					var obj = JSON.parse(xhr.responseText);
					if (obj.result == "success" && obj.exists)
					{
						Notification.Show("Tenant '" + tenantName + "' already exists", "Please specify a unique tenant name", "Error");
						return false;
					}
				}
				
				Notification.Show("Changes were saved successfully", "Taking you back to the Tenant Management page", "Success");
				return true;
			}
			</script>
			<?php 
    }