当前位置: 首页>>代码示例>>PHP>>正文


PHP show_view函数代码示例

本文整理汇总了PHP中show_view函数的典型用法代码示例。如果您正苦于以下问题:PHP show_view函数的具体用法?PHP show_view怎么用?PHP show_view使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了show_view函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: view_se

function view_se()
{
    require_once __DIR__ . '/../utils.php';
    require_once __DIR__ . '/../../../web_portal/components/Get_User_Principle.php';
    if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
        throw new Exception("An id must be specified");
    }
    $id = $_GET['id'];
    //get user for case that portal is read only and user is admin, so they can still see edit links
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    $serv = \Factory::getServiceService();
    $params['authenticated'] = false;
    if ($user != null) {
        $params['authenticated'] = true;
    }
    $params['portalIsReadOnly'] = portalIsReadOnlyAndUserIsNotAdmin($user);
    $se = $serv->getService($id);
    // Does current viewer have edit permissions over object ?
    $params['ShowEdit'] = false;
    if ($user != null && count($serv->authorizeAction(\Action::EDIT_OBJECT, $se, $user)) >= 1) {
        $params['ShowEdit'] = true;
    }
    $title = $se->getHostName() . " - " . $se->getServiceType()->getName();
    $params['se'] = $se;
    $params['sGroups'] = $se->getServiceGroups();
    $params['Scopes'] = $serv->getScopesWithParentScopeInfo($se);
    // Show upcoming downtimes and downtimes that started within the last thirty days
    $downtimes = $serv->getDowntimes($id, 31);
    $params['Downtimes'] = $downtimes;
    show_view("service/view_service.php", $params, $title);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:32,代码来源:view_service.php

示例2: delete_project

function delete_project()
{
    if (true) {
        throw new Exception("Project deletion is disabled - see controller to enable");
    }
    if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
        throw new Exception("An id must be specified");
    }
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    //Check the portal is not in read only mode, returns exception if it is and user is not an admin
    checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    //Get the project from the id
    $serv = \Factory::getProjectService();
    $project = $serv->getProject($_REQUEST['id']);
    //keep the name to display later
    $params['Name'] = $project->getName();
    // Delete the project. This fuction will check the user is allowed to
    // perform this action and throw an error if not (only gocdb admins allowed).
    // Project deletion does not delete child NGIs and automatically cascade
    // deletes the user Roles over the OwnedEntity.
    try {
        $serv->deleteProject($project, $user);
    } catch (\Exception $e) {
        show_view('error.php', $e->getMessage());
        die;
    }
    show_view("project/deleted_project.php", $params, $params['Name'] . 'deleted');
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:29,代码来源:delete_project.php

示例3: showAllServiceGroups

function showAllServiceGroups()
{
    require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
    $scope = '%%';
    if (!empty($_GET['scope'])) {
        $scope = $_GET['scope'];
    }
    $scopes = \Factory::getScopeService()->getScopes();
    $sgKeyNames = "";
    if (isset($_GET['sgKeyNames'])) {
        $sgKeyNames = $_GET['sgKeyNames'];
    }
    $sgKeyValues = "";
    if (isset($_GET['selectedSGKeyValue'])) {
        $sgKeyValues = $_GET['selectedSGKeyValue'];
    }
    $sGroups = \Factory::getServiceGroupService()->getServiceGroups($scope, $sgKeyNames, $sgKeyValues);
    $exServ = \Factory::getExtensionsService();
    /* Doctrine will provide keynames that are the same even when selecting distinct becase the object
     * is distinct even though the name is not unique. To avoid showing the same name repeatdly in the filter
     * we will load all the keynames into an array before making it unique
     */
    $keynames = array();
    foreach ($exServ->getServiceGroupExtensionsKeyNames() as $extension) {
        $keynames[] = $extension->getKeyName();
    }
    $keynames = array_unique($keynames);
    $params['sGroups'] = $sGroups;
    $params['scopes'] = $scopes;
    $params['selectedScope'] = $scope;
    $params['selectedSGKeyName'] = $sgKeyNames;
    $params['selectedSGKeyValue'] = $sgKeyValues;
    $params['sgKeyName'] = $keynames;
    show_view("service_group/view_all.php", $params);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:35,代码来源:view_all.php

示例4: submit

function submit()
{
    //Only administrators can delete sites, double check user is an administrator
    checkUserIsAdmin();
    if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
        throw new Exception("An id must be specified");
    }
    if (isset($_REQUEST['id'])) {
        $ngi = \Factory::getNgiService()->getNgi($_REQUEST['id']);
    } else {
        throw new \Exception("A NGI must be specified in the url");
    }
    //save name to display later
    $params['Name'] = $ngi->getName();
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    //remove ngi
    try {
        \Factory::getNgiService()->deleteNgi($ngi, $user);
    } catch (\Exception $e) {
        show_view('error.php', $e->getMessage());
        die;
    }
    show_view('/site/deleted_site.php', $params);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:25,代码来源:delete_ngi.php

示例5: search_ses

function search_ses()
{
    if (!isset($_REQUEST['term'])) {
        return "";
    } else {
        $searchTerm = strip_tags(trim($_REQUEST['term']));
    }
    if (1 === preg_match("/[';\"]/", $searchTerm)) {
        throw new Exception("Invalid char in search term");
    }
    if (substr($searchTerm, 0, 1) != '%') {
        $searchTerm = '%' . $searchTerm;
    }
    if (substr($searchTerm, -1) != '%') {
        $searchTerm = $searchTerm . '%';
    }
    require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
    try {
        $ses = \Factory::getServiceService()->getSes($searchTerm, null, null, null, null, null, null, null, null, null, null, null, true);
    } catch (Exception $ex) {
        show_view('error.php', $ex->getMessage() . "<br /><br />Please contact the " . "<a href=\"index.php?Page_Type=Static_HTML&Page=Help_And_Contact\">" . "GOCDB support team</a> if you need help with this issue.");
    }
    $params = array('ses' => $ses);
    show_view('service_group/se_search.php', $params, null, true);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:25,代码来源:search_ses.php

示例6: view_revoke_request

function view_revoke_request()
{
    require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
    require_once __DIR__ . '/../../components/Get_User_Principle.php';
    require_once __DIR__ . '/../utils.php';
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    if ($user == null) {
        throw new Exception("Unregistered users can't revoke roles");
    }
    //Check the portal is not in read only mode, returns exception if it is and user is not an admin
    checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    $requestId = $_POST['id'];
    if (!isset($requestId) || !is_numeric($requestId)) {
        throw new LogicException("Invalid role id");
    }
    // Either a self revocation or revoke is requested by 2nd party
    // check to see that user has permission to revoke role
    $role = \Factory::getRoleService()->getRoleById($requestId);
    \Factory::getRoleService()->revokeRole($role, $user);
    if ($role->getUser() != $user) {
        // revoke by 2nd party
        show_view('political_role/role_revoked.php');
    } else {
        // Self revocation
        show_view('political_role/role_self_revoked.php');
    }
    die;
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:29,代码来源:revoke_request.php

示例7: show_all_projects

function show_all_projects()
{
    require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
    $projects = \Factory::getProjectService()->getProjects();
    $params['Projects'] = $projects;
    show_view('project/view_all.php', $params, "Projects");
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:7,代码来源:view_all.php

示例8: my_sites

function my_sites()
{
    require_once __DIR__ . '/../../../lib/Gocdb_Services/Factory.php';
    require_once __DIR__ . '/../components/Get_User_Principle.php';
    $params = array();
    $userServ = \Factory::getUserService();
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    if (is_null($user)) {
        show_view('error.php', "Unregistered users can't hold a role over sites, NGIs or service groups.");
        die;
    }
    $sites = $userServ->getSitesFromRoles($user);
    if (!empty($sites)) {
        $params['sites_from_roles'] = $sites;
    }
    $sGroups = $userServ->getSGroupsFromRoles($user);
    if (!empty($sGroups)) {
        $params['sgroups_from_roles'] = $sGroups;
    }
    $ngis = $userServ->getNgisFromRoles($user);
    if (!empty($ngis)) {
        $params['ngis_from_roles'] = $ngis;
    }
    $projects = $userServ->getProjectsFromRoles($user);
    if (!empty($projects)) {
        $params['projects_from_roles'] = $projects;
    }
    $title = "My Sites and Groups";
    show_view('my_sites.php', $params, $title);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:31,代码来源:my_sites.php

示例9: submit

/**
 * Processes an edit service request from a web request
 * @param \User $user current user
 * @return null
 */
function submit(\User $user = null)
{
    $serv = \Factory::getNgiService();
    $newValues = getNgiDataFromWeb();
    $ngi = $serv->getNgi($newValues['ID']);
    $ngi = $serv->editNgi($ngi, $newValues, $user);
    $params = array('ngi' => $ngi);
    show_view('ngi/ngi_updated.php', $params);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:14,代码来源:edit_ngi.php

示例10: show_xml

function show_xml()
{
    try {
        $xml = Factory::getSiteService()->getGoogleMapXMLString();
    } catch (Exception $e) {
        show_view('error.php', $e->getMessage(), "Error");
    }
    $params['XML'] = $xml;
    show_view('sitesForGoogleMapXML.php', $params, null, true);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:10,代码来源:sitesForGoogleMapXML.php

示例11: show_all

function show_all()
{
    //Check the user has permission to see the page, will throw exception
    //if correct permissions are lacking
    checkUserIsAdmin();
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    $serviceTypes = \Factory::getServiceTypeService()->getServiceTypes();
    $params['ServiceTypes'] = $serviceTypes;
    $params['portalIsReadOnly'] = portalIsReadOnlyAndUserIsNotAdmin($user);
    show_view('admin/view_service_types.php', $params, 'Service Types');
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:12,代码来源:view_service_types.php

示例12: draw

/**
 *  Draws a form to add a new site property
 * @param \User $user current user 
 * @return null
 */
function draw(\User $user = null)
{
    if (is_null($user)) {
        throw new Exception("Unregistered users can't add a site property.");
    }
    $serv = \Factory::getSiteService();
    $site = $serv->getSite($_REQUEST['site']);
    //Check user has permissions to add site property
    $serv->validatePropertyActions($user, $site);
    $params = array('site' => $site);
    show_view("site/add_site_property.php", $params);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:17,代码来源:add_site_property.php

示例13: view_ngi

function view_ngi()
{
    require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
    require_once __DIR__ . '/../utils.php';
    require_once __DIR__ . '/../../../web_portal/components/Get_User_Principle.php';
    if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
        throw new Exception("An id must be specified");
    }
    $ngiId = $_GET['id'];
    //get user for case that portal is read only and user is admin, so they can still see edit links
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    $params['portalIsReadOnly'] = portalIsReadOnlyAndUserIsNotAdmin($user);
    $params['UserIsAdmin'] = false;
    if (!is_null($user)) {
        $params['UserIsAdmin'] = $user->isAdmin();
    }
    $params['authenticated'] = false;
    if ($user != null) {
        $params['authenticated'] = true;
    }
    $ngiServ = \Factory::getNgiService();
    $siteServ = \Factory::getSiteService();
    $ngi = $ngiServ->getNgi($ngiId);
    // Does current viewer have edit permissions over NGI ?
    $params['ShowEdit'] = false;
    if (count($ngiServ->authorizeAction(\Action::EDIT_OBJECT, $ngi, $user)) >= 1) {
        $params['ShowEdit'] = true;
    }
    // Add ngi to params
    $params['ngi'] = $ngi;
    // Add all roles over ngi to params
    $allRoles = $ngi->getRoles();
    $roles = array();
    foreach ($allRoles as $role) {
        if ($role->getStatus() == \RoleStatus::GRANTED) {
            $roles[] = $role;
        }
    }
    $params['roles'] = $roles;
    // Add ngi's project to params
    $projects = $ngi->getProjects();
    $params['Projects'] = $projects;
    // Add sites and scopes to params
    $params['SitesAndScopes'] = array();
    foreach ($ngi->getSites() as $site) {
        $params['SitesAndScopes'][] = array('Site' => $site, 'Scopes' => $siteServ->getScopesWithParentScopeInfo($site));
    }
    // Add RoleActionRecords to params
    $params['RoleActionRecords'] = \Factory::getRoleService()->getRoleActionRecordsById_Type($ngi->getId(), 'ngi');
    show_view('ngi/view_ngi.php', $params, $ngi->getName());
    die;
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:53,代码来源:view_ngi.php

示例14: site_downtimes

function site_downtimes()
{
    require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
    $serv = \Factory::getSiteService();
    $site = $serv->getSite($_REQUEST['id']);
    $downtimes = $serv->getDowntimes($_REQUEST['id'], null);
    $params['site'] = $site;
    $params['downtimes'] = $downtimes;
    $title = "{$site} downtimes";
    show_view('site/site_downtimes.php', $params, $title);
    return;
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:12,代码来源:site_downtimes.php

示例15: view_user

function view_user()
{
    require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
    require_once __DIR__ . '/../../components/Get_User_Principle.php';
    if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
        throw new Exception("An id must be specified");
    }
    $userId = $_GET['id'];
    $user = \Factory::getUserService()->getUser($userId);
    if ($user === null) {
        throw new Exception("No user with that ID");
    }
    $params['user'] = $user;
    // get the targetUser's roles
    $roles = \Factory::getRoleService()->getUserRoles($user, \RoleStatus::GRANTED);
    //$user->getRoles();
    $callingUser = \Factory::getUserService()->getUserByPrinciple(Get_User_Principle());
    // can the calling user revoke the targetUser's roles?
    if ($user != $callingUser) {
        foreach ($roles as $r) {
            //$ownedEntityDetail = $r->getOwnedEntity()->getName(). ' ('. $r->getOwnedEntity()->getType().')';
            $authorisingRoleNames = \Factory::getRoleService()->authorizeAction(\Action::REVOKE_ROLE, $r->getOwnedEntity(), $callingUser);
            if (count($authorisingRoleNames) >= 1) {
                $allAuthorisingRoleNames = '';
                foreach ($authorisingRoleNames as $arName) {
                    $allAuthorisingRoleNames .= $arName . ', ';
                }
                $allAuthorisingRoleNames = substr($allAuthorisingRoleNames, 0, strlen($allAuthorisingRoleNames) - 2);
                $r->setDecoratorObject('[' . $allAuthorisingRoleNames . '] ');
            }
        }
    } else {
        // current user is viewing their own roles, so they can revoke their own roles
        foreach ($roles as $r) {
            $r->setDecoratorObject('[Self revoke own role]');
        }
    }
    // Check to see if the current calling user has permission to edit the target user
    try {
        \Factory::getUserService()->editUserAuthorization($user, $callingUser);
        $params['ShowEdit'] = true;
    } catch (Exception $e) {
        $params['ShowEdit'] = false;
    }
    /* @var $authToken \org\gocdb\security\authentication\IAuthentication */
    $authToken = Get_User_AuthToken();
    $params['authAttributes'] = $authToken->getDetails();
    $params['roles'] = $roles;
    $params['portalIsReadOnly'] = \Factory::getConfigService()->IsPortalReadOnly();
    $title = $user->getFullName();
    show_view("user/view_user.php", $params, $title);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:52,代码来源:view_user.php


注:本文中的show_view函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。