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


PHP Role::getAllRoles方法代码示例

本文整理汇总了PHP中Role::getAllRoles方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::getAllRoles方法的具体用法?PHP Role::getAllRoles怎么用?PHP Role::getAllRoles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Role的用法示例。


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

示例1: getRole

 public static function getRole($id)
 {
     foreach (Role::getAllRoles() as $role) {
         if ($role->getID() === $id) {
             return $role;
         }
     }
     throw new Exception($id . " is not a known role ID.");
 }
开发者ID:KasaiDot,项目名称:Zero-Fansub-website,代码行数:9,代码来源:Role.php

示例2: getRoleByName

 public static function getRoleByName($roleName)
 {
     foreach (Role::getAllRoles() as $arr) {
         if ($arr['name'] == $roleName) {
             return new Role($arr['id']);
         }
     }
     return false;
     // when $roleName is not found in $allRoles
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:10,代码来源:Role.php

示例3: getCode

 /**
  *
  * @return string 
  */
 public function getCode()
 {
     $res = "<select name=\"" . $this->name . "\" style=\"" . $this->style . "\">";
     $roles = Role::getAllRoles();
     if ($roles) {
         foreach ($roles as $role) {
             if (!$this->hideSpecialRoles || $role->ID != 1 && $role->ID != 3) {
                 if ($this->value == $role->ID) {
                     $res .= "<option value=\"" . $role->ID . "\" selected=\"selected\">" . htmlentities($role->name) . "</option>";
                 } else {
                     $res .= "<option value=\"" . $role->ID . "\">" . htmlentities($role->name) . "</option>";
                 }
             }
         }
     }
     $res .= "</select>";
     return $res;
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:22,代码来源:roleselector.php

示例4: getAllProcessRuleNames

 public static function getAllProcessRuleNames()
 {
     global $allRules;
     // from Generics.php
     $allRoles = Role::getAllRoles();
     // list of all process rules
     $processRuleNames = array();
     foreach ($allRoles as $role) {
         $processRuleNames = array_merge($processRuleNames, $role['ruleNames']);
     }
     return $processRuleNames;
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:12,代码来源:RuleEngine.php

示例5: foreach

/admin.php?area=roles&action=add">Add New</a>
	
				<?php 
    if (Role::getAllRoles()) {
        ?>
				
					<table class="table">
						<thead>
							<tr>
								<th>Title</th>
							</tr>
						</thead>
						<tbody>
						
						<?php 
        foreach (Role::getAllRoles() as $role) {
            ?>
							<tr>
								<td class="app_list_data app_list_title">
									<a href="<?php 
            echo $app->url;
            ?>
/admin.php?area=roles&action=view&id=<?php 
            echo $role->getID();
            ?>
"><?php 
            echo $role->getName();
            ?>
</a>
								</td>
							</tr>
开发者ID:Hackmastr,项目名称:apps-base,代码行数:31,代码来源:template-admin-role.php

示例6: display

 public function display()
 {
     $template = new Template();
     $template->load("site_edit");
     $page = new Page();
     if (isset($_GET['site'])) {
         $page->loadProperties(DataBase::Current()->EscapeString($_GET['site']));
         if (isset($_POST['save'])) {
             $oldpage = $page;
             $page->title = $_POST['title'];
             $page->menu = $_POST['menu'];
             $page->getMeta()->description = $_POST['meta-description'];
             $page->getMeta()->keywords = $_POST['meta-keywords'];
             $page->getMeta()->robots = $_POST['meta-robots'];
             $page->alias = $page->getDir() . $_POST['localalias'];
             $page->ownerid = $_POST['owner'];
             $page->canonical = $_POST['canonical'];
             $page->advancedHtmlHeader = $_POST['advanced_html_header'];
             $page->SetChangeFrequence($_POST['change_frequence']);
             if (isset($_POST['in_sitemap'])) {
                 $page->inSitemap = $_POST['in_sitemap'];
             } else {
                 $page->inSitemap = false;
             }
             $page->priority = $_POST['priority'];
             $page->save();
             $page->getEditor()->save($page, $oldpage);
             Role::clearAccess($page);
             if ($_POST['rights']) {
                 foreach ($_POST['rights'] as $right) {
                     $role = new Role();
                     $role->load($right);
                     $role->allowAccess($page);
                 }
             }
         } else {
             if (isset($_POST['menu'])) {
                 $page->title = $_POST['title'];
                 $page->alias = $page->getDir() . $_POST['localalias'];
                 $page->menu = $_POST['menu'];
                 $page->getEditor()->content = $_POST['content'];
             }
         }
         $url = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $page->alias);
         $template->assign_var("PATH", $url);
         $template->assign_var("ALIAS", $page->alias);
         $template->assign_var("LOCALALIAS", $page->getLocalAlias());
         if (!isset($_POST['menu'])) {
             foreach (Role::getAllRoles() as $role) {
                 $index = $template->add_loop_item("RIGHTS");
                 $template->assign_loop_var("RIGHTS", $index, "LABEL", "/");
                 $template->assign_loop_var("RIGHTS", $index, "VALUE", $role->ID);
                 $template->assign_loop_var("RIGHTS", $index, "NAME", $role->name);
                 if ($role->canAccess($page)) {
                     $template->assign_loop_var("RIGHTS", $index, "SELECTED", "selected=\"1\" ");
                 } else {
                     $template->assign_loop_var("RIGHTS", $index, "SELECTED", "");
                 }
             }
         } else {
             foreach (Role::getAllRoles() as $role) {
                 $index = $template->add_loop_item("RIGHTS");
                 $template->assign_loop_var("RIGHTS", $index, "LABEL", "/");
                 $template->assign_loop_var("RIGHTS", $index, "VALUE", $role->ID);
                 $template->assign_loop_var("RIGHTS", $index, "NAME", $role->name);
                 if (isset($_POST['rights']) && in_array($role->ID, $_POST['rights'])) {
                     $template->assign_loop_var("RIGHTS", $index, "SELECTED", "selected=\"1\" ");
                 } else {
                     $template->assign_loop_var("RIGHTS", $index, "SELECTED", "");
                 }
             }
         }
         $index = $template->add_loop_item("MENU");
         $template->assign_loop_var("MENU", $index, "VALUE", "0");
         $template->assign_loop_var("MENU", $index, "NAME", "-- " . Language::DirectTranslate("NO_MENU") . " --");
         $template->assign_loop_var("MENU", $index, "SELECTED", "");
         foreach (sys::getMenues($_SESSION['dir']) as $menu) {
             $index = $template->add_loop_item("MENU");
             $template->assign_loop_var("MENU", $index, "VALUE", $menu->id);
             $template->assign_loop_var("MENU", $index, "NAME", $menu->name);
             if (isset($_POST['menu']) && $_POST['menu'] == $menu->id) {
                 $template->assign_loop_var("MENU", $index, "SELECTED", "selected=\"1\" ");
             } else {
                 if (!isset($_POST['menu']) && $menu->id == $page->menu) {
                     $template->assign_loop_var("MENU", $index, "SELECTED", "selected=\"1\" ");
                 } else {
                     $template->assign_loop_var("MENU", $index, "SELECTED", "");
                 }
             }
         }
         if (isset($_POST['menu'])) {
             $template->assign_var("MENUPREVIEW", Menu::getCode($_POST['menu'], "<ul>", "</ul>", "<li>", "</li>", ""));
         } else {
             if ($page->menu > 0) {
                 $template->assign_var("MENUPREVIEW", Menu::getCode($page->menu, "<ul>", "</ul>", "<li>", "</li>", ""));
             } else {
                 $template->assign_var("MENUPREVIEW", "");
             }
         }
         $template->assign_var("METADESCRIPTION", htmlentities($page->getMeta()->description));
//.........这里部分代码省略.........
开发者ID:srueegger,项目名称:1zu12bB,代码行数:101,代码来源:pageeditpage.php


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