本文整理汇总了PHP中Datamodel::getTableNum方法的典型用法代码示例。如果您正苦于以下问题:PHP Datamodel::getTableNum方法的具体用法?PHP Datamodel::getTableNum怎么用?PHP Datamodel::getTableNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datamodel
的用法示例。
在下文中一共展示了Datamodel::getTableNum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
$o_dm = new Datamodel(true);
// PHPUnit seems to barf on the caching code if we don't instanciate a Datamodel instance
$o_dm->getTableNum("ca_objects");
// set up test role
$this->opt_role = new ca_user_roles();
$this->opt_role->setMode(ACCESS_WRITE);
$this->opt_role->set("name", "UnitTestRole");
$this->opt_role->set("code", "unit_test_role");
if (!$this->opt_role->insert()) {
print "ERROR inserting role: " . join(" ", $this->opt_role->getErrors()) . "\n";
}
$this->opt_role->setMode(ACCESS_READ);
// set up test user
$this->ops_username = "unit_test_user";
$this->ops_password = "topsecret";
$this->opt_user = new ca_users();
$this->opt_user->setMode(ACCESS_WRITE);
$this->opt_user->set(array('user_name' => $this->ops_username, 'password' => $this->ops_password, 'email' => 'foo@bar.com', 'active' => 1, 'userclass' => 0, 'fname' => 'Test', 'lname' => "User"));
if (!$this->opt_user->insert()) {
print "ERROR inserting user: " . join(" ", $this->opt_user->getErrors()) . "\n";
}
$this->opt_user->addRoles("unit_test_role");
$this->opt_user->setMode(ACCESS_READ);
global $req, $resp;
$resp = new ResponseHTTP();
$req = new RequestHTTP($resp, array("dont_create_new_session" => true));
$this->assertInstanceOf('ca_users', $this->opt_user);
$this->assertInstanceOf('ca_user_roles', $this->opt_role);
}
示例2: Datamodel
if (is_array($va_activity_stream) && sizeof($va_activity_stream)) {
?>
<h2><?php
print _t("activity stream");
?>
</h2>
<div class="activitystream">
<?php
$o_dm = new Datamodel();
$t_activity_set = new ca_sets();
$t_group = new ca_user_groups();
foreach ($va_activity_stream as $va_activity) {
print "<div><small>";
print $va_activity["fname"] . " " . $va_activity["lname"] . " ";
switch ($va_activity["logged_table_num"]) {
case $o_dm->getTableNum("ca_set_items"):
switch ($va_activity["changetype"]) {
case "I":
print _t("added an item to %1", caNavLink($this->request, $va_activity["name"], "", "", "Sets", "setDetail", array("set_id" => $va_activity["set_id"])));
break;
# ----------------------------------------
# ----------------------------------------
case "U":
print _t("changed an item in %1", caNavLink($this->request, $va_activity["name"], "", "", "Sets", "setDetail", array("set_id" => $va_activity["set_id"])));
break;
# ----------------------------------------
# ----------------------------------------
case "D":
print _t("removed and item from %1", caNavLink($this->request, $va_activity["name"], "", "", "Sets", "setDetail", array("set_id" => $va_activity["set_id"])));
break;
# ----------------------------------------