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


PHP Action::getAllFromDb方法代码示例

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


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

示例1: testActionsMatchDatabase

 function testActionsMatchDatabase()
 {
     $all_db_actions = Action::getAllFromDb(['flag_delete' => FALSE], $this->DB);
     $this->assertEqual(count(Action::$VALID_ACTIONS), count($all_db_actions));
     $action_db_names = Db_Linked::arrayOfAttrValues($all_db_actions, 'name');
     foreach (Action::$VALID_ACTIONS as $va) {
         $this->assertTrue(in_array($va, $action_db_names), "'{$va}' missing from database");
     }
     foreach ($action_db_names as $db_a) {
         $this->assertTrue(in_array($db_a, Action::$VALID_ACTIONS), "'{$db_a}' missing from VALID_ACTIONS");
     }
 }
开发者ID:cwarren,项目名称:digitalfieldnotebooks,代码行数:12,代码来源:TestOfAction.class.php

示例2: testCanActOnTarget_Pub_Verify

 function testCanActOnTarget_Pub_Verify()
 {
     $n2 = Notebook::getOneFromDb(['notebook_id' => 1003], $this->DB);
     // owned by 102
     $actions_list = Action::getAllFromDb([], $this->DB);
     $actions = [];
     foreach ($actions_list as $act_elt) {
         $actions[$act_elt->name] = $act_elt;
     }
     $rat = new Role_Action_Target(['last_user_id' => 110, 'role_id' => 3, 'action_id' => 1, 'target_type' => 'notebook', 'target_id' => 1003, 'DB' => $this->DB]);
     $rat->updateDb();
     $this->assertTrue($rat->matchesDb);
     // basic, field user
     $u = User::getOneFromDb(['user_id' => 101], $this->DB);
     $this->assertFalse($n2->flag_workflow_published);
     $this->assertFalse($n2->flag_workflow_validated);
     $this->assertFalse($u->canActOnTarget($actions['view'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['edit'], $n2));
     $this->assertTrue($u->canActOnTarget($actions['create'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['delete'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['publish'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['verify'], $n2));
     $n2->flag_workflow_published = true;
     $n2->updateDb();
     $this->assertTrue($n2->matchesDb);
     $u->clearCaches();
     $this->assertFalse($u->canActOnTarget($actions['view'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['edit'], $n2));
     $this->assertTrue($u->canActOnTarget($actions['create'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['delete'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['publish'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['verify'], $n2));
     $n2->flag_workflow_validated = true;
     $n2->updateDb();
     $this->assertTrue($n2->matchesDb);
     $u->clearCaches();
     $this->assertTrue($u->canActOnTarget($actions['view'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['edit'], $n2));
     $this->assertTrue($u->canActOnTarget($actions['create'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['delete'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['publish'], $n2));
     $this->assertFalse($u->canActOnTarget($actions['verify'], $n2));
 }
开发者ID:cwarren,项目名称:digitalfieldnotebooks,代码行数:43,代码来源:TestOfUser.class.php

示例3: createAllTestData

function createAllTestData($dbConn)
{
    createTestData_Authoritative_Plants($dbConn);
    createTestData_Authoritative_Plant_Extras($dbConn);
    createTestData_Metadata_Structures($dbConn);
    createTestData_Metadata_Term_Sets($dbConn);
    createTestData_Metadata_Term_Values($dbConn);
    createTestData_Metadata_References($dbConn);
    createTestData_Notebooks($dbConn);
    createTestData_Notebook_Pages($dbConn);
    createTestData_Notebook_Page_Fields($dbConn);
    createTestData_Role_Action_Targets($dbConn);
    createTestData_Specimens($dbConn);
    createTestData_Specimen_Images($dbConn);
    createTestData_Users($dbConn);
    createTestData_User_Roles($dbConn);
    $all_actions = Action::getAllFromDb([], $dbConn);
    global $ACTIONS;
    foreach ($all_actions as $a) {
        $ACTIONS[$a->name] = $a;
    }
}
开发者ID:cwarren,项目名称:digitalfieldnotebooks,代码行数:22,代码来源:dataForTesting.php

示例4: request

require_once '../lang.cfg.php';
require_once '../classes/ALL_CLASS_INCLUDES.php';
require_once '../auth.cfg.php';
require_once '../util.php';
# TODO: validate the request (user logged in, fingerprint checks out)
if (!array_key_exists('isAuthenticated', $_SESSION) || !$_SESSION['isAuthenticated']) {
    echo 'not authenticated';
    exit;
}
$FINGERPRINT = util_generateRequestFingerprint();
// used to prevent/complicate session hijacking ands XSS attacks
if ($_SESSION['fingerprint'] != $FINGERPRINT) {
    echo 'bad fingerprint';
    exit;
}
# Create database connection object
$DB = util_createDbConnection();
$all_actions = Action::getAllFromDb(['flag_delete' => false], $DB);
$ACTIONS = array();
foreach ($all_actions as $a) {
    $ACTIONS[$a->name] = $a;
}
$USER = User::getOneFromDb(['username' => $_SESSION['userdata']['username']], $DB);
if (!$USER->matchesDb) {
    echo 'user did not load correctly';
    exit;
}
#------------------------------------------------#
# Set default return value
#------------------------------------------------#
$results = ['status' => 'failure', 'note' => 'unknown reason', 'html_output' => ''];
开发者ID:cwarren,项目名称:digitalfieldnotebooks,代码行数:31,代码来源:head_ajax.php


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