本文整理汇总了PHP中Tree::generate_header方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::generate_header方法的具体用法?PHP Tree::generate_header怎么用?PHP Tree::generate_header使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::generate_header方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
$catalogtree = new Tree('productcatalog');
$catalogtree->set_param('module', 'ProductTemplates');
$nodes = get_categories_and_products(null);
foreach ($nodes as $node) {
$catalogtree->add_node($node);
}
$this->override_popup['template_data']['treeheader'] = $catalogtree->generate_header();
$this->override_popup['template_data']['treeinstance'] = '{literal}' . $catalogtree->generate_nodes_array() . '{/literal}';
parent::display();
}
示例2: XTemplate
/**
*
*/
function process_page()
{
global $theme;
global $mod_strings;
global $app_strings;
global $currentModule;
global $sugar_version, $sugar_config;
global $app_list_strings;
global $sugar_config;
$b_from_documents = false;
if (isset($_REQUEST['caller']) && $_REQUEST['caller'] == 'Documents') {
$b_from_documents = true;
}
//initalize template
$form = new XTemplate('modules/Documents/Popup_picker.html');
$form->assign('MOD', $mod_strings);
$form->assign('APP', $app_strings);
$form->assign('THEME', $theme);
$form->assign('MODULE_NAME', $currentModule);
//tree header.
$doctree = new Tree('doctree');
$doctree->set_param('module', 'Documents');
if ($b_from_documents) {
$doctree->set_param('caller', 'Documents');
$href_string = "javascript:populate_parent_search('doctree')";
} else {
$href_string = "javascript:populate_search('doctree')";
}
$nodes = get_category_nodes($href_string);
foreach ($nodes as $node) {
$doctree->add_node($node);
}
$form->assign("TREEHEADER", $doctree->generate_header());
$form->assign("TREEINSTANCE", $doctree->generate_nodes_array());
$site_data = "<script> var site_url= {\"site_url\":\"" . getJavascriptSiteURL() . "\"};</script>\n";
$form->assign("SITEURL", $site_data);
$form->parse('main.SearchHeader.TreeView');
$treehtml = $form->text('main.SearchHeader.TreeView');
$form->reset('main.SearchHeader.TreeView');
//end tree
if (isset($_REQUEST['caller']) && $_REQUEST['caller'] == 'Documents') {
///process treeview and return.
return insert_popup_header($theme) . $treehtml . insert_popup_footer();
}
////////////////////////process full search form and list view.//////////////////////////////
$output_html = '';
$where = '';
$where = $this->_get_where_clause();
$name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
$document_name = empty($_REQUEST['document_name']) ? '' : $_REQUEST['document_name'];
$category_id = empty($_REQUEST['category_id']) ? '' : $_REQUEST['category_id'];
$subcategory_id = empty($_REQUEST['subcategory_id']) ? '' : $_REQUEST['subcategory_id'];
$template_type = empty($_REQUEST['template_type']) ? '' : $_REQUEST['template_type'];
$is_template = empty($_REQUEST['is_template']) ? '' : $_REQUEST['is_template'];
$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
$hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
if (!$hide_clear_button) {
$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n";
}
$button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n";
$button .= "</form>\n";
$form->assign('NAME', $name);
$form->assign('DOCUMENT_NAME', $document_name);
$form->assign('request_data', $request_data);
$form->assign("CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_category_dom'], $category_id));
$form->assign("SUB_CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_subcategory_dom'], $subcategory_id));
$form->assign("IS_TEMPLATE_OPTIONS", get_select_options_with_id($app_list_strings['checkbox_dom'], $is_template));
$form->assign("TEMPLATE_TYPE_OPTIONS", get_select_options_with_id($app_list_strings['document_template_type_dom'], $template_type));
ob_start();
insert_popup_header($theme);
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
$form->parse('main.SearchHeader');
$output_html .= $form->text('main.SearchHeader');
// Reset the sections that are already in the page so that they do not print again later.
$form->reset('main.SearchHeader');
//add tree view to output_html.
$output_html .= $treehtml;
// create the listview
$seed_bean = new Document();
$ListView = new ListView();
$ListView->show_select_menu = false;
$ListView->show_delete_button = false;
$ListView->show_export_button = false;
$ListView->process_for_popups = true;
$ListView->setXTemplate($form);
$ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
$ListView->setHeaderText($button);
$ListView->setQuery($where, '', 'document_name', 'DOCUMENT');
$ListView->setModStrings($mod_strings);
ob_start();
$ListView->processListView($seed_bean, 'main', 'DOCUMENT');
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= insert_popup_footer();
//.........这里部分代码省略.........
示例3: return_browse_tab
function return_browse_tab()
{
global $theme, $image_path, $app_list_strings, $mod_strings, $app_strings;
$ss_brws = new Sugar_Smarty();
$ss_brws->assign("MOD", $mod_strings);
$ss_brws->assign("APP", $app_strings);
require_once 'vendor/ytree/Tree.php';
require_once 'vendor/ytree/Node.php';
require_once 'modules/KBTags/TreeData.php';
$tagstree = new Tree('kb_browse_tags');
$tagstree->set_param('module', 'KBTags');
$tagstree->set_param('moduleview', 'browse');
$nodes = get_tag_nodes_for_browsing();
foreach ($nodes as $node) {
$tagstree->add_node($node);
}
if (empty($tagstree->_nodes)) {
$notag_node = new Node('foo', 'There are no tags to browse');
$tagstree->add_node($notag_node);
}
$ss_brws->assign("TREEHEADER", $tagstree->generate_header());
$ss_brws->assign("TREEINSTANCE", $tagstree->generate_nodes_array());
$ss_brws->assign("TREE_WIDTH", "15%");
$ss_brws->assign("BORDER", 1);
//set the site_url variable.
global $sugar_config;
$sugar_config['site_url'] = preg_replace('/^http(s)?\\:\\/\\/[^\\/]+/', "http\$1://" . $_SERVER['HTTP_HOST'], $sugar_config['site_url']);
if (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
$sugar_config['site_url'] = preg_replace('/^http\\:/', 'https:', $sugar_config['site_url']);
}
$site_data = "<script> var site_url= {\"site_url\":\"" . $sugar_config['site_url'] . "\"};</script>\n";
$ss_brws->assign("SITEURL", $site_data);
return $ss_brws->fetch("modules/KBDocuments/tpls/browseTab.tpl");
}
示例4: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings;
$ss = new Sugar_Smarty();
$ss->assign("MOD", $GLOBALS['mod_strings']);
$ss->assign("INSTRUCTION", "<h1>{$mod_strings['LNK_BROWSER']}</h1>");
//tree header.
$doctree = new Tree('doctree');
$doctree->tree_style = 'include/ytree/TreeView/css/default/tree.css';
$doctree->set_param('module', 'xeBayCategories');
$nodes = get_node_data(array('TREE' => array('depth' => 0)), true);
// $nodes = get_category_nodes($href_string);
// $nodes = $this->get_test_nodes($href_string);
foreach ($nodes as $node) {
$doctree->add_node($node);
}
$ss->assign("TREEHEADER", $doctree->generate_header());
$ss->assign("TREEINSTANCE", $doctree->generate_nodes_array());
$site_data = "<script> var site_url= {\"site_url\":\"" . getJavascriptSiteURL() . "\"};</script>\n";
$ss->assign("SITEURL", $site_data);
$javascript = <<<EOQ
EOQ;
$ss->assign("JAVASCRIPT", $javascript);
echo $ss->fetch("modules/xeBayCategories/tpls/browser.tpl");
}
示例5: XTemplate
function process_page()
{
global $mod_strings, $app_strings, $currentModule, $seed_object, $sugar_version, $sugar_config;
$focus = BeanFactory::getBean('ProductCategories');
if (!isset($_REQUEST['html'])) {
$xtpl = new XTemplate('modules/ProductCategories/Popup_picker.html');
$GLOBALS['log']->debug("using file modules/ProductCategories/Popup_picker1.html");
} else {
$_REQUEST['html'] = preg_replace("/[^a-zA-Z0-9_]/", "", $_REQUEST['html']);
$GLOBALS['log']->debug("_REQUEST['html'] is " . $_REQUEST['html']);
$xtpl = new XTemplate('modules/ProductCategories/' . $_REQUEST['html'] . '.html');
$GLOBALS['log']->debug("using file modules/ProductCategories/" . $_REQUEST['html'] . '.html');
}
insert_popup_header();
//tree header.
$prodcattree = new Tree('productcategories');
$prodcattree->set_param('module', 'ProductCategories');
$parents = array();
if (!empty($_REQUEST['parent_category_id'])) {
$parents = $this->find_parents($_REQUEST['parent_category_id']);
}
$nodes = get_product_categories(null, $parents);
foreach ($nodes as $node) {
$prodcattree->add_node($node);
}
$xtpl->assign("TREEHEADER", $prodcattree->generate_header());
$xtpl->assign("TREEINSTANCE", $prodcattree->generate_nodes_array());
$xtpl->assign("MODULE_NAME", $currentModule);
global $sugar_config;
$site_data = "<script> var site_url= {\"site_url\":\"" . getJavascriptSiteURL() . "\"};</script>\n";
$xtpl->assign("SITEURL", $site_data);
if (!empty($_REQUEST['form']) && $_REQUEST['form'] == 'EditView') {
$the_javascript = "<script type='text/javascript' language='JavaScript'>\n";
$the_javascript .= "function set_return(treeid) { \n";
$the_javascript .= " node=YAHOO.namespace(treeid).selectednode;";
$the_javascript .= " window.opener.document.EditView.parent_id.value = node.data.id;\n";
$the_javascript .= " window.opener.document.EditView.parent_name.value = node.label;\n";
$the_javascript .= " window.close();\n";
$the_javascript .= "}\n";
$the_javascript .= "</script>\n";
$clear_button = "<input title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' class='button' LANGUAGE=javascript onclick=\"window.opener.document.EditView.parent_id.value = '';window.opener.document.EditView.parent_name.value = ''; window.close()\" type='submit' name='button' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " '>\n";
$cancel_button = "<input title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accessKey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' class='button' LANGUAGE=javascript onclick=\"window.close()\" type='submit' name='button' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " '>\n";
}
if (empty($_REQUEST['form']) || $_REQUEST['form'] == 'EditView' && $_REQUEST['tree'] == 'ProdCat') {
$seed_object->show_products = FALSE;
$the_javascript = <<<END
<script type='text/javascript' language='JavaScript'>
var field_id = null;
var field_name = null;
function set_return(treeid) {
if(typeof treeid != 'undefined') {
node=YAHOO.namespace(treeid).selectednode;
} else {
node = {'data': {'id': ''}, 'label': ''};
}
if (typeof window.opener.document.forms.search_form != 'undefined' || window.opener.document.forms.popup_query_form != 'undefined') { // Search
var form = (typeof window.opener.document.forms.search_form != 'undefined') ? window.opener.document.forms.search_form : window.opener.document.forms.popup_query_form;
var searchType = (typeof form.searchFormTab != 'undefined' && form.searchFormTab.value == 'basic_search') ? 'basic' : 'advanced';
field_id = form['category_id_' + searchType];
field_name = form['category_name_' + searchType];
} else if(typeof window.opener.document.ReportsWizardForm != 'undefined') { // reports
field_id = window.opener.document.ReportsWizardForm['ProductCategories:name:id:1'];
field_name = window.opener.document.ReportsWizardForm['ProductCategories:name:name:1'];
} else if(typeof window.opener.document.EditView != 'undefined') {
field_id = window.opener.document.EditView.category_id;
field_name = window.opener.document.EditView.category_name;
}
if(field_id != null && field_name != null) {
field_id.value = node.data.id;
field_name.value = node.label;
}
window.close();
}
</script>
END;
$clear_button = "<input title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' class='button' LANGUAGE=javascript onclick=\"set_return()\" type='submit' name='button' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " '>\n";
$cancel_button = "<input title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' class='button' LANGUAGE=javascript onclick=\"window.close()\" type='submit' name='button' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " '>\n";
}
$xtpl->assign("SET_RETURN_JS", $the_javascript);
$xtpl->assign("CLEAR_BUTTON", $clear_button);
$xtpl->assign("CANCEL_BUTTON", $cancel_button);
$xtpl->parse('main');
$xtpl->out('main');
}