本文整理汇总了PHP中Datamodel::getInstanceByTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Datamodel::getInstanceByTableName方法的具体用法?PHP Datamodel::getInstanceByTableName怎么用?PHP Datamodel::getInstanceByTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datamodel
的用法示例。
在下文中一共展示了Datamodel::getInstanceByTableName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRolesAsDOM
public function getRolesAsDOM()
{
$t_role = new ca_user_roles();
$t_list = new ca_lists();
$t_ui_screens = new ca_editor_ui_screens();
$vo_roles = $this->opo_dom->createElement("roles");
$qr_roles = $this->opo_db->query("SELECT * FROM ca_user_roles");
while ($qr_roles->nextRow()) {
$t_role->load($qr_roles->get("role_id"));
$vo_role = $this->opo_dom->createElement("role");
$vo_role->setAttribute("code", $this->makeIDNO($t_role->get("code")));
$vo_role->appendChild($this->opo_dom->createElement("name", $t_role->get("name")));
$vo_role->appendChild($this->opo_dom->createElement("description", $t_role->get("description")));
if (is_array($va_actions = $t_role->getRoleActions())) {
$vo_actions = $this->opo_dom->createElement("actions");
foreach ($va_actions as $vs_action) {
$vo_actions->appendChild($this->opo_dom->createElement("action", $vs_action));
}
$vo_role->appendChild($vo_actions);
}
$va_vars = $t_role->get('vars');
// add bundle level ACL items
if (is_array($va_vars['bundle_access_settings'])) {
$vo_bundle_lvl_ac = $this->opo_dom->createElement("bundleLevelAccessControl");
foreach ($va_vars['bundle_access_settings'] as $vs_bundle => $vn_val) {
$va_tmp = explode('.', $vs_bundle);
$vs_table_name = $va_tmp[0];
$vs_bundle_name = $va_tmp[1];
if ($t_ui_screens->isAvailableBundle($vs_table_name, $vs_bundle_name)) {
// only add this entry to the export if it's actually a valid bundle
$vs_access = $this->_convertACLConstantToString(intval($vn_val));
$vo_permission = $this->opo_dom->createElement("permission");
$vo_bundle_lvl_ac->appendChild($vo_permission);
$vo_permission->setAttribute('table', $vs_table_name);
$vo_permission->setAttribute('bundle', $vs_bundle_name);
$vo_permission->setAttribute('access', $vs_access);
}
}
$vo_role->appendChild($vo_bundle_lvl_ac);
}
// add type level ACL items
if (is_array($va_vars['type_access_settings'])) {
$vo_type_lvl_ac = $this->opo_dom->createElement("typeLevelAccessControl");
foreach ($va_vars['type_access_settings'] as $vs_id => $vn_val) {
$va_tmp = explode('.', $vs_id);
$vs_table_name = $va_tmp[0];
$vn_type_id = $va_tmp[1];
$vs_access = $this->_convertACLConstantToString(intval($vn_val));
/** @var BaseModelWithAttributes $t_instance */
$t_instance = $this->opo_dm->getInstanceByTableName($vs_table_name, true);
if (!($vs_list_code = $t_instance->getTypeListCode())) {
continue;
}
$va_item = $t_list->getItemFromListByItemID($vs_list_code, $vn_type_id);
if (!isset($va_item['idno'])) {
continue;
}
$vo_permission = $this->opo_dom->createElement("permission");
$vo_type_lvl_ac->appendChild($vo_permission);
$vo_permission->setAttribute('table', $vs_table_name);
$vo_permission->setAttribute('type', $va_item['idno']);
$vo_permission->setAttribute('access', $vs_access);
}
$vo_role->appendChild($vo_type_lvl_ac);
}
$vo_roles->appendChild($vo_role);
}
return $vo_roles;
}