本文整理汇总了PHP中Node::add_node方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::add_node方法的具体用法?PHP Node::add_node怎么用?PHP Node::add_node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::add_node方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_product_categories
function get_product_categories($parent_id, $open_nodes_ids = array())
{
$href_string = "javascript:set_return('productcategories')";
reset($open_nodes_ids);
$nodes = array();
if ($parent_id == '') {
$query = "select * from product_categories where (parent_id is null or parent_id='') and deleted=0 order by list_order";
} else {
$query = "select * from product_categories where parent_id ='{$parent_id}' and deleted=0 order by list_order";
}
$result = $GLOBALS['db']->query($query);
while (($row = $GLOBALS['db']->fetchByAssoc($result)) != null) {
$node = new Node($row['id'], $row['name']);
$node->set_property("href", $href_string);
if (count($open_nodes_ids) > 0 and $row['id'] == current($open_nodes_ids)) {
$node->expanded = true;
$node->dynamic_load = false;
$current_id = current($open_nodes_ids);
array_shift($open_nodes_ids);
$child_nodes = get_product_categories($current_id, $open_nodes_ids);
//add all returned node to current node.
foreach ($child_nodes as $child_node) {
$node->add_node($child_node);
}
} else {
$node->expanded = false;
$node->dynamic_load = true;
}
$nodes[] = $node;
}
return $nodes;
}
示例2: get_category_nodes
function get_category_nodes($href_string)
{
$nodes = array();
global $mod_strings;
global $app_list_strings;
$query = "select distinct category_id, subcategory_id from documents where deleted=0 order by category_id, subcategory_id";
$result = $GLOBALS['db']->query($query);
$current_cat_id = null;
$cat_node = null;
while (($row = $GLOBALS['db']->fetchByAssoc($result)) != null) {
if (empty($row['category_id'])) {
$cat_id = 'null';
$cat_name = $mod_strings['LBL_CAT_OR_SUBCAT_UNSPEC'];
} else {
$cat_id = $row['category_id'];
$cat_name = $app_list_strings['document_category_dom'][$row['category_id']];
}
if (empty($current_cat_id) or $current_cat_id != $cat_id) {
$current_cat_id = $cat_id;
if (!empty($cat_node)) {
$nodes[] = $cat_node;
}
$cat_node = new Node($cat_id, $cat_name);
$cat_node->set_property("href", $href_string);
$cat_node->expanded = true;
$cat_node->dynamic_load = false;
}
if (empty($row['subcategory_id'])) {
$subcat_id = 'null';
$subcat_name = $mod_strings['LBL_CAT_OR_SUBCAT_UNSPEC'];
} else {
$subcat_id = $row['subcategory_id'];
$subcat_name = $app_list_strings['document_subcategory_dom'][$row['subcategory_id']];
}
$subcat_node = new Node($subcat_id, $subcat_name);
$subcat_node->set_property("href", $href_string);
$subcat_node->expanded = false;
$subcat_node->dynamic_load = true;
$cat_node->add_node($subcat_node);
}
if (!empty($cat_node)) {
$nodes[] = $cat_node;
}
return $nodes;
}
示例3: get_test_nodes
public function get_test_nodes($href_string)
{
$nodes = array();
$cat_node = new Node("1111", "1111");
$cat_node->set_property("href", $href_string);
// $cat_node->expanded = false;
$cat_node->dynamic_load = false;
$subcat_node = new Node("sub 1111", "sub 1111");
$cat_node->add_node($subcat_node);
$nodes[] = $cat_node;
$cat_node = new Node("2222", "2222");
$cat_node->set_property("href", $href_string);
$cat_node->dynamic_load = false;
$nodes[] = $cat_node;
$cat_node = new Node("3333", "3333");
$cat_node->set_property("href", $href_string);
$cat_node->dynamic_load = false;
$nodes[] = $cat_node;
$cat_node = new Node("4444", "4444");
$cat_node->set_property("href", $href_string);
$cat_node->dynamic_load = true;
$nodes[] = $cat_node;
return $nodes;
}
示例4: Node
$root_node->add_node($node);
}
$href_string = "javascript:handler:SUGAR.kb.adminClick()";
if ($root_node) {
$root_node->set_property("href", $href_string);
}
$root_node->expanded = true;
$tagstree->add_node($root_node);
} else {
$tagstree->set_param('moduleview', 'modal');
//$nodes = get_tags_nodes_cached(null);
//$nodes=get_tags_nodes(false,null);
$nodes = get_tags_nodes(false, false, null);
$root_node = new Node('All_Tags', $mod_strings['LBL_TAGS_ROOT_LABEL']);
foreach ($nodes as $node) {
$root_node->add_node($node);
}
$href_string = "javascript:handler:SUGAR.kb.modalClose('tagstree')";
if ($root_node) {
$root_node->set_property("href", $href_string);
}
$root_node->expanded = true;
$tagstree->add_node($root_node);
}
//$tagstree->add_node($root_node);
$response = $tagstree->generate_nodes_array();
} else {
$response = 1;
}
if (!empty($response)) {
echo $response;
示例5: return_advanced_tab
//.........这里部分代码省略.........
}
$a1_style = '';
$x1_style = '';
$a2_style = 'none';
$x2_style = 'none';
//set the expiration date filter if it exists. Also set the style properties
//that will determine whether to show or hide the supporting text boxes
if (isset($_POST['active_date_filter'])) {
$ss_adv->assign("ACTIVE_DATE_FILTER_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_date_filter_options'], $_POST['active_date_filter']));
if ($_POST['active_date_filter'] == 'on' || $_POST['active_date_filter'] == 'before' || $_POST['active_date_filter'] == 'after') {
$a1_style = '';
} else {
$a1_style = 'none';
}
if ($_POST['active_date_filter'] == 'between_dates') {
$a2_style = '';
}
} else {
$ss_adv->assign("ACTIVE_DATE_FILTER_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_date_filter_options'], ''));
}
//set the expiration date filter if it exists. Also set the style properties
//that will determine whether to show or hide the supporting text boxes
if (isset($_POST['exp_date_filter'])) {
$ss_adv->assign("EXP_DATE_FILTER_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_date_filter_options'], $_POST['exp_date_filter']));
if ($_POST['exp_date_filter'] == 'on' || $_POST['exp_date_filter'] == 'before' || $_POST['exp_date_filter'] == 'after') {
$x1_style = '';
} else {
$x1_style = 'none';
}
if ($_POST['exp_date_filter'] == 'between_dates') {
$x2_style = '';
}
} else {
$ss_adv->assign("EXP_DATE_FILTER_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_date_filter_options'], ''));
}
//set the style sheet properties for date filters
$ss_adv->assign("A_DATE1_STYLE", $a1_style);
$ss_adv->assign("X_DATE1_STYLE", $x1_style);
$ss_adv->assign("A_DATE2_STYLE", $a2_style);
$ss_adv->assign("X_DATE2_STYLE", $x2_style);
$attach_name_style = 'none';
$attach_mime_style = 'none';
if (isset($_POST['attachments'])) {
$ss_adv->assign("ATTACHMENT_SELECT_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_attachment_option_dom'], $_POST['attachments']));
if ($_POST['attachments'] == 'mime') {
$attach_mime_style = ' ';
} else {
if ($_POST['attachments'] == 'name') {
$attach_name_style = ' ';
}
}
} else {
$ss_adv->assign("ATTACHMENT_SELECT_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_attachment_option_dom'], ''));
}
$ss_adv->assign("ATTACHMENT_NAME_STYLE", $attach_name_style);
$ss_adv->assign("ATTACHMENT_MIME_STYLE", $attach_mime_style);
if (!empty($focus->kbdoc_approver_id)) {
$user = BeanFactory::getBean('Users', $focus->kbdoc_approver_id);
$ss_adv->assign("KBDOC_APPROVER_NAME", $user->name);
$ss_adv->assign("KBDOC_APPROVER_ID", $focus->kbdoc_approver_id);
}
global $timedate;
$ss_adv->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
$ss_adv->assign("USER_DATE_FORMAT", $timedate->get_user_date_format());
$ss_adv->assign('JSON_CONFIG_JAVASCRIPT', $json_config->get_static_json_server());
if (isset($_POST['frequency'])) {
$ss_adv->assign("FRQ_VIEW_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_viewing_frequency_dom'], $_POST['frequency']));
} else {
$ss_adv->assign("FRQ_VIEW_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_viewing_frequency_dom'], ''));
}
if (isset($_POST['is_external_article'])) {
if ($_POST['is_external_article']) {
$ss_adv->assign('is_external_id', '1');
$ss_adv->assign('is_external_checked', 'checked');
} else {
$ss_adv->assign('is_external_id', '0');
$ss_adv->assign('is_external_checked', '');
}
}
//create tree for tag selection modal
$tag = BeanFactory::getBean('KBTags');
$ss_adv->assign("TAG_NAME", $tag->tag_name);
//tree header.
$tagstree = new Tree('tagstree');
$tagstree->set_param('module', 'KBTags');
$tagstree->set_param('moduleview', 'modal');
$nodes = get_tags_nodes(false, false, null);
$root_node = new Node('All_Tags', $mod_strings['LBL_TAGS_ROOT_LABEL']);
foreach ($nodes as $node) {
$root_node->add_node($node);
}
$href_string = "javascript:handler:modalClose('tagstree')";
if ($root_node) {
$root_node->set_property("href", $href_string);
}
$root_node->expanded = true;
$tagstree->add_node($root_node);
$ss_adv->assign("TREEINSTANCE", $tagstree->generate_nodes_array());
return $ss_adv->fetch("modules/KBDocuments/tpls/advancedTab.tpl");
}
示例6: get_tags_nodes
function get_tags_nodes($create_root_node = false, $admin = false, $parent_id = null)
{
$nodes = array();
global $app_list_strings;
$mod_strings = get_kbtag_strings();
//$query="select id,tag_name from kbtags where parent_tag_id is null and deleted=0 order by tag_name";
$query = "select id,tag_name from kbtags where deleted = 0 and";
if (empty($parent_id)) {
$query .= " parent_tag_id is null order by tag_name";
} else {
$query .= " parent_tag_id = '{$parent_id}' order by tag_name";
}
$result = $GLOBALS['db']->query($query);
$current_cat_id = null;
$cat_node = null;
if ($create_root_node) {
$root_node = new Node('All_Tags', 'All Tags');
}
while (($row = $GLOBALS['db']->fetchByAssoc($result)) != null) {
if (!empty($row['id'])) {
$tag_id = $row['id'];
$doc_count = tagged_documents_count($tag_id);
$href_string = '';
if ($admin) {
//$tag_label =$row['tag_name'].'('.$doc_count.')';
$tag_name = '<input type="checkbox" onclick="javascript:handler:SUGAR.kb.checkTags();" id="selected_tags[]" name="selected_tags[]" value="' . $tag_id . '">';
$tag_name .= $row['tag_name'] . '(' . $doc_count . ')';
$href_string = "javascript:handler:SUGAR.kb.adminClick();javascript:handler:SUGAR.kb.moveToTag();javascript:node_click('tagstree','selected_directory_children', 'div', 'get_admin_browse_articles')";
} else {
$tag_name = $row['tag_name'] . '(' . $doc_count . ')';
$href_string = "javascript:handler:SUGAR.kb.modalClose('tagstree')";
if ($create_root_node) {
$root_node->set_property("href", $href_string);
}
}
$parent_tag_node = new Node($tag_id, $tag_name);
$parent_tag_node->set_property("href", $href_string);
$parent_tag_node->dynamic_load = true;
$parent_tag_node->expanded = false;
if ($create_root_node) {
$root_node->dynamic_load = true;
$root_node->expanded = false;
if (!empty($parent_tag_node)) {
$root_node->add_node($parent_tag_node);
}
$nodes[] = $root_node;
} else {
//$parent_tag_node->expanded = true;
if (!empty($parent_tag_node)) {
$nodes[] = $parent_tag_node;
}
}
//childNodes($parent_tag_node,$tag_id,$nodes,$admin);
}
}
return $nodes;
}