本文整理汇总了PHP中Node::set_property方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::set_property方法的具体用法?PHP Node::set_property怎么用?PHP Node::set_property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::set_property方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_categories_and_products
function get_categories_and_products($parent_id)
{
$href_string = "javascript:set_return('productcatalog')";
$nodes = array();
if ($parent_id == '' or empty($parent_id)) {
$query = "select id, name , 'category' type from product_categories where (parent_id is null or parent_id='') and deleted=0";
$query .= " union select id, name , 'product' type from product_templates where (category_id is null or category_id='') and deleted=0";
} else {
$query = "select id, name , 'category' type from product_categories where parent_id ='{$parent_id}' and deleted=0";
$query .= " union select id, name , 'product' type from product_templates where category_id ='{$parent_id}' and deleted=0";
}
$result = $GLOBALS['db']->query($query);
// fetchByAssoc has been changed in version 7 and it does encoding of the string data.
// for the treeview we do not encoding as it messes up the display of the folder labels,
// hence we pass false as an additional parameter
while (($row = $GLOBALS['db']->fetchByAssoc($result, false)) != null) {
$node = new Node($row['id'], $row['name']);
$node->set_property("href", $href_string);
$node->set_property("type", $row['type']);
if ($row['type'] == 'product') {
$node->expanded = false;
$node->dynamic_load = false;
} else {
$node->expanded = false;
$node->dynamic_load = true;
}
$nodes[] = $node;
}
return $nodes;
}
示例2: 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;
}
示例3: populateTree
function populateTree($nodes, &$parent)
{
foreach ($nodes as $node) {
if (empty($node['label'])) {
$node['label'] = $node['name'];
}
$yn = new Node($parent->id . '/' . $node['name'], $node['label']);
if (!empty($node['action'])) {
$yn->set_property('action', $node['action']);
}
$yn->set_property('href', 'javascript:void(0);');
$yn->id = $parent->id . '/' . $node['name'];
if (!empty($node['children'])) {
$this->populateTree($node['children'], $yn);
}
$parent->add_node($yn);
}
}
示例4: populateTree
public function populateTree($nodes, &$parent)
{
foreach ($nodes as $node) {
if (empty($node['label'])) {
$node['label'] = $node['name'];
}
$yn = new Node($parent->id . '/' . $node['name'], $node['label']);
if (!empty($node['action'])) {
$yn->set_property('action', $node['action']);
}
$yn->set_property('href', 'javascript:void(0);');
$yn->id = $parent->id . '/' . $node['name'];
if (!empty($node['children'])) {
$this->populateTree($node['children'], $yn);
}
// Sets backward compatibility flag into the node defs for use on the
// client if needed
if (!empty($node['bwc'])) {
$yn->set_property('bwc', $node['bwc']);
}
$parent->add_node($yn);
}
}
示例5: 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;
}
示例6: buildTreeView
/**
* A Static method used to build the initial treeview when the page is first displayed
*
* @param String div_id - this div in which to display the tree
* @return Tree - the tree that is built
*/
function buildTreeView($div_id, $isAlive = true)
{
$tree = new Tree($div_id);
$nodes = array();
if ($isAlive) {
$nodes = PackageManager::getCategories('');
}
foreach ($nodes as $arr_node) {
$node = new Node($arr_node['id'], $arr_node['label']);
$node->dynamicloadfunction = 'PackageManager.loadDataForNodeForPackage';
$node->expanded = false;
$node->dynamic_load = true;
$node->set_property('href', "javascript:PackageManager.catClick('treeview');");
$tree->add_node($node);
$node->set_property('description', $arr_node['description']);
}
return $tree;
}
示例7: get_documents
function get_documents($cat_id, $subcat_id, $href = true)
{
$nodes = array();
$href_string = "javascript:select_document('doctree')";
$query = "select * from documents where deleted=0";
if ($cat_id != 'null') {
$query .= " and category_id='{$cat_id}'";
} else {
$query .= " and category_id is null";
}
if ($subcat_id != 'null') {
$query .= " and subcategory_id='{$subcat_id}'";
} else {
$query .= " and subcategory_id is null";
}
$result = $GLOBALS['db']->query($query);
$current_cat_id = null;
while (($row = $GLOBALS['db']->fetchByAssoc($result)) != null) {
$node = new Node($row['id'], $row['document_name']);
if ($href) {
$node->set_property("href", $href_string);
}
$node->expanded = true;
$node->dynamic_load = false;
$nodes[] = $node;
}
return $nodes;
}
示例8: 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;
//$json = getJSONobj();
//print $json->encode($response);
//return the parameters
}
示例9: 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");
}
示例10: create_node
/** create a new node for the tree widget
* @param string user_id, primary key value of a valid sugar user.
* @param string href script for the node.
* @param boolean dynamic: allow dynamic loading of child node, defult is true
* @param boolean force_direct: force direct forecast for the node default false.
* @param boolean top_level: is this the top level node, if yes add forecast type of node label, default false
* @param boolean commit: commit of forecast is allowed from this node.
*/
function create_node($user_id, $href = true, $dynamic = true, $force_direct = false, $top_level = false, $commit = false)
{
global $href_string;
global $mod_strings;
$user = new Common();
$user->set_current_user($user_id);
$user->setup();
$rollup = true;
$node_name = $user->my_name;
if ($force_direct or count($user->my_direct_reports) == 0) {
$rollup = false;
}
if ($top_level) {
if ($rollup) {
$node_name .= ' ' . $mod_strings['LBL_FMT_ROLLUP_FORECAST'];
} else {
$node_name .= ' ' . $mod_strings['LBL_FMT_DIRECT_FORECAST'];
}
}
$node = new Node($user_id, $node_name);
if ($href) {
$node->set_property("href", $href_string);
}
$node->expanded = !$dynamic;
$node->dynamic_load = $dynamic;
//if user has downline set the forecast type property.
if (!$rollup) {
$node->set_property('forecasttype', 'Direct', true);
$node->dynamic_load = false;
} else {
$node->set_property('forecasttype', 'Rollup', true);
}
$node->set_property('commit', $commit, true);
return $node;
}
示例11: create_browse_node
function create_browse_node($id, $node_name, $tag_count = 0, $doc_count = 0)
{
global $sugar_config, $currentModule, $current_language;
$mod_strings = get_kbtag_strings();
//_pp($mod_strings);
//create the title to display when hovering over link
$tag_LBL = $mod_strings['LBL_CHILD_TAGS_IN_TREE_HOVER'];
$doc_LBL = $mod_strings['LBL_ARTICLES_IN_TREE_HOVER'];
if ($tag_count == 1) {
//use singular
$tag_LBL = $mod_strings['LBL_CHILD_TAG_IN_TREE_HOVER'];
}
if ($doc_count == 1) {
//use singular
$doc_LBL = $mod_strings['LBL_ARTICLE_IN_TREE_HOVER'];
}
$title = $mod_strings['LBL_THIS_TAG_CONTAINS_TREE_HOVER'] . " {$tag_count} {$tag_LBL}, {$doc_count} {$doc_LBL}";
$node_name = "<span title='{$title}'>{$node_name}</span>";
$href = "javascript:node_click('kb_browse_tags','selected_directory_children', 'div', 'get_browse_documents')";
//create node
$node = new Node($id, $node_name);
$node->set_property("href", $href);
$node->expanded = false;
//decide if the folder icon should display by sepcifying whether the node is dynamic or not.
if ($tag_count == 0) {
$node->dynamic_load = false;
} else {
$node->dynamic_load = true;
}
return $node;
}