本文整理汇总了PHP中Acl::get_entity_childs方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::get_entity_childs方法的具体用法?PHP Acl::get_entity_childs怎么用?PHP Acl::get_entity_childs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::get_entity_childs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: echochildrens
function echochildrens($entities, $parent_id, $entities_admin)
{
/* Connect to db */
$db = new ossim_db();
$conn = $db->connect();
$users_by_entity = Acl::get_users_by_entity($conn, $parent_id);
$me = Session::get_session_user();
$entities_types = Acl::get_entities_types($conn);
$length_name = !empty($_GET['length_name']) ? GET('length_name') : 30;
echo ",children:[";
$is_editable = $parent_id != "" && (!empty($users_by_entity[$me]) || Session::am_i_admin() || !empty($entities_admin[$me]));
if ($is_editable) {
echo "{title:'<font style=\"font-weight:normal\">" . _("All Assets") . "</font>', url:'AllAssets', key:'e_" . $parent_id . "_allassets', icon:'../../pixmaps/menu/assets.gif', isFolder:false, expand:true,";
echo "children:[ ";
echo "{ key:'e_" . $parent_id . "_net', isFolder:true, isLazy:true, icon:'../../pixmaps/theme/net.png', title:'" . _("Networks") . "'},";
echo "{ key:'e_" . $parent_id . "_sensor', isFolder:true, isLazy:true, icon:'../../pixmaps/theme/server.png', title:'" . _("Sensors") . "'}";
echo "]}";
}
$children = Acl::get_entity_childs($conn, $parent_id);
if (!empty($children)) {
$flag = false;
foreach ($children as $index => $child_id) {
$icon = "../../pixmaps/theme/any.png";
$child = $entities[0][$child_id];
$entity_allowed = Acl::entityAllowed($child_id);
$child_key = "e_" . $child_id;
$child_sn = strlen($child['name']) > $length_name ? substr($child['name'], 0, $length_name) . "..." : $child['name'];
$child_name = Util::htmlentities($child['name']);
$chil_ent_admin = $entities_admin;
$chil_ent_admin[$child['admin_user']] = $child_id;
if ($child['parent_id'] == $parent_id) {
$title = "<font style=\"font-weight:bold;\">" . Util::htmlentities($child_sn) . "</font> <font style=\"color:gray\">[" . $entities_types[$child['type']]['name'] . "]</font>";
$tooltip = Util::htmlentities($child['name']) . " [" . $entities_types[$child['type']]['name'] . "]";
if ($flag || $is_editable) {
echo ",";
}
$flag = true;
echo "{title:'" . $title . "', tooltip:'{$tooltip}', noLink: true, url:'" . $child_url . "', key:'" . $child_key . "', icon:'{$icon}', expand:true, name:'{$child_name}'";
echochildrens($entities, $child_id, $withusers, $entities_admin, $length_name);
echo "}";
}
}
}
echo "]";
}
示例2: echochildrens
function echochildrens($entities, $parent_id, $withusers, $entities_admin)
{
$length_name = 50;
echo ",children:[";
/* Connect to db */
$db = new ossim_db();
$conn = $db->connect();
$users_by_entity = Acl::get_users_by_entity($conn, $parent_id);
$me = Session::get_session_user();
$entities_types = Acl::get_entities_types($conn);
$is_editable = $parent_id != "" && (!empty($users_by_entity[$me]) || Session::am_i_admin() || !empty($entities_admin[$me]));
if ($is_editable) {
echo "{title:'<font style=\"font-weight:normal\">" . _("All Assets") . "</font>', key:'ae_" . $parent_id . "', icon:'../../pixmaps/menu/assets.gif', isFolder:true, isLazy:true}";
if ($withusers) {
echo ",{title:'<font style=\"font-weight:normal\">" . _("Assets by user") . "</font>', key:'ue_" . $parent_id . "', icon:'../../pixmaps/menu/assets.gif', isFolder:true, isLazy:true}";
}
}
$children = Acl::get_entity_childs($conn, $parent_id);
if (!empty($children)) {
$flag = false;
foreach ($children as $index => $child_id) {
$icon = "../../pixmaps/theme/any.png";
$child = $entities[0][$child_id];
$entity_allowed = Acl::entityAllowed($child_id);
if ($entity_allowed == 2) {
$child_link = "noLink: false";
$child_url = "../acl/entities_edit.php?id=" . $child_id;
} else {
$child_link = "noLink: true";
$child_url = "";
}
$child_key = "e_" . $child_id;
$child_sn = strlen($child['name']) > $length_name ? substr($child['name'], 0, $length_name) . "..." : $child['name'];
$child_name = Util::htmlentities($child['name']);
$chil_ent_admin = $entities_admin;
$chil_ent_admin[$child['admin_user']] = $child_id;
if ($child['parent_id'] == $parent_id) {
$title = "<font style=\"font-weight:bold;\">" . Util::htmlentities($child_sn) . "</font> <font style=\"color:gray\">[" . $entities_types[$child['type']]['name'] . "]</font>";
$tooltip = Util::htmlentities($child['name']) . " [" . $entities_types[$child['type']]['name'] . "]";
if ($flag || $is_editable) {
echo ",";
}
$flag = true;
$h = "400";
echo "{title:'" . $title . "', h:'{$h}', " . $child_link . ", url:'" . $child_url . "', tooltip:'{$tooltip}', key:'" . $child_key . "', icon:'{$icon}', expand:true, name:'{$child_name}'";
echochildrens($entities, $child_id, $withusers, $entities_admin);
echo "}";
}
}
}
echo "]";
}