當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Permissions::findAll方法代碼示例

本文整理匯總了PHP中Permissions::findAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Permissions::findAll方法的具體用法?PHP Permissions::findAll怎麽用?PHP Permissions::findAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Permissions的用法示例。


在下文中一共展示了Permissions::findAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getPermissionsBySource

 static function getPermissionsBySource()
 {
     $sources = array();
     $permissions = Permissions::findAll();
     //findAll
     if (is_array($permissions)) {
         foreach ($permissions as $permission) {
             if (!isset($sources[$permission->getSource()])) {
                 $sources[$permission->getSource()] = array();
             }
             // if
             $sources[$permission->getSource()][] = array($permission->getName(), $permission->getId());
         }
         // foreach
     }
     // if
     return $sources;
 }
開發者ID:bklein01,項目名稱:Project-Pier,代碼行數:18,代碼來源:Permissions.class.php

示例2: removeSource

 static function removeSource($source)
 {
     $permissions = Permissions::findAll(array('conditions' => "`source` = '" . $source . "'"));
     if (is_array($permissions)) {
         foreach ($permissions as $permission) {
             $userpermissions = ProjectUserPermissions::findAll(array('conditions' => "`permission_id` = '" . $permission->getId() . "'"));
             foreach ($userpermissions as $userpermission) {
                 $userpermission->delete();
             }
             $permission->delete();
         }
         return true;
         // permission already exists
     }
     return false;
     // permission source does not exist
 }
開發者ID:469306621,項目名稱:Languages,代碼行數:17,代碼來源:PermissionManager.class.php

示例3: removeSource

 static function removeSource($source)
 {
     $permissions = Permissions::findAll(array('conditions' => "`source` = '" . $source . "'"));
     if (is_array($permissions)) {
         foreach ($permissions as $permission) {
             PermissionManager::removeUserPermissions($permission);
             $permission->delete();
         }
         return true;
         // permission source removed
     }
     return false;
     // permission source does not exist
 }
開發者ID:federosky,項目名稱:ProjectPier-Core,代碼行數:14,代碼來源:PermissionManager.class.php

示例4: lang

<?php

$page_title = lang('permissions');
set_page_title($page_title);
project_crumbs(lang('permissions'));
add_stylesheet_to_page('project/permissions.css');
$source = array();
$names = array();
$source_id = 0;
$name_id = 0;
$xpermissions = Permissions::findAll();
// findAll
if (is_array($permissions)) {
    foreach ($xpermissions as $permission) {
        $source_id++;
        $sources[$permission->getSource()] = option_tag($permission->getSource(), $source_id);
        $name_id++;
        $names[$permission->getName()] = option_tag($permission->getName(), $name_id);
    }
    // foreach
}
// if
$this->includeTemplate(get_template_path('project/pageactions'));
$quoted_permissions = array();
foreach ($permissions as $permission_id => $permission_text) {
    $quoted_permissions[] = "'{$permission_id}'";
}
// foreach
if (isset($companies) && is_array($companies) && count($companies)) {
    ?>
<form action="<?php 
開發者ID:bklein01,項目名稱:Project-Pier,代碼行數:31,代碼來源:permissions.php


注:本文中的Permissions::findAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。