<?
class TreeNode extends ListItem {
var $children = array ();
var $parent = NULL;
var $level = 0;
var $_first_child = NULL;
var $_first_child_loaded = FALSE;
function set_template_vars (&$tpl, $prefix, $form = FALSE) {
$tpl->set_var ($prefix.'id', $this->id);
$tpl->set_var ($prefix.'ord_index', $this->ord_index);
$tpl->set_var ($prefix.'parent_id', $this->parent_id);
$tpl->set_var ($prefix.'root_id', $this->root_id);
$tpl->set_var ($prefix.'publish', $this->publish);
$tpl->set_var ($prefix.'name', $this->name);
$tpl->set_var ($prefix.'publish_full', $this->publish ? "Да" : "Нет");
$tpl->set_var ($prefix.'publish_full_color', $this->publish ? "<font color=green>Да</font>" : "<font color=#990000>Нет</font>");
if ($form) {
$tpl->set_var ($prefix.'publish_checkbox', common_checkbox ($prefix.'publish', 1, $this->publish));
}
}
}
$factory_class = "CatalogTree";
class CatalogNode extends TreeNode {
var $active = FALSE;
var $_image = NULL;
var $_page_title = NULL;
var $_meta_keywords = NULL;
var $_meta_description = NULL;
var $no_request = FALSE;
function set_template_vars (&$tpl, $form = FALSE) {
parent::set_template_vars ($tpl, 'catalog_', $form);
parent::set_template_vars ($tpl, 'structure_', $form);
$tpl->set_var ('catalog_class', $this->class);
$tpl->set_var ('catalog_treetype', $this->treetype);
$tpl->set_var ('catalog_rewrite', $this->rewrite);
$tpl->set_var ('catalog_rewrite_id', $this->get_rewrite ());
$tpl->set_var ('catalog_from_root', $this->from_root);
$tpl->set_var ('catalog_art', $this->art);
$tpl->set_var ('catalog_opendown', $this->opendown);
$tpl->set_var ('catalog_dimensions', $this->dimensions);
$tpl->set_var ('catalog_material', $this->material);
$tpl->set_var ('catalog_price', $this->price);
$tpl->set_var ('catalog_announce', $this->announce);
$tpl->set_var ('catalog_content', $this->content);
$tpl->set_var ('catalog_content_right', $this->content_right);
$tpl->set_var ('catalog_viewtype', $this->viewtype);
$tpl->set_var ('catalog_page_h1', $this->page_h1);
$tpl->set_var ('catalog_page_title', $this->page_title);
$tpl->set_var ('catalog_meta_keywords', $this->meta_keywords);
$tpl->set_var ('catalog_meta_description', $this->meta_description);
$tpl->set_var ('catalog_show_children', $this->show_children);
$tpl->set_var ('catalog_treetype_full', $this->treetype ? $this->treetype : getArrayValue ($this->treetype, $this->factory->treetypes));
$tpl->set_var ('catalog_class_full', $this->class_full ? $this->class_full : getArrayValue ($this->class, $this->factory->class_names));
$tpl->set_var ('catalog_viewtype_full', getArrayValue ($this->viewtype, $this->factory->viewtypes));
$tpl->set_var ('catalog_opendown_full', $this->opendown ? 'Да' : 'Нет');
$tpl->set_var ('catalog_publish_prices_full', $this->publish_prices ? 'Да' : 'Нет');
$tpl->set_var ('catalog_publish_at_page_full', $this->publish_at_page ? 'Да' : 'Нет');
$tpl->set_var ('catalog_publish_at_page_full_color', $this->publish_at_page ? "<font color=green>Да</font>" : "<font color=#990000>Нет</font>");
$tpl->set_var ('catalog_show_children_full', $this->show_children == -1 ? '<img src="/img/p.gif" width="13" height="15" border="0">' : ($this->show_children ? '<img src="/img/minusg.gif" width="13" height="15" border="0">' : '<img src="/img/plusg.gif" width="13" height="15" border="0">'));
$tpl->set_var ('catalog_icon', "/".$this->icon->image);
$tpl->set_var ('catalog_image', "/".$this->image->image);
$tpl->set_var ('structure_icon_showbig_tag', $t = $this->icon->get_img_tag (0, 0, NULL, 0, "/", $this->getAlt(), ' class="grbrd"'));
// $tpl->set_var ('structure_icon_showbig_returnfalse', ($this->image->image ? 'showImage(\'/'.$this->image->image.'\');' : "alert('Нет большой картинки')") . "return false;");
$tpl->set_var ('structure_icon_showbig_returnfalse', ($this->image->image ? 'showImage(\'/'.$this->get_page_address(FALSE).'?show=window\');' : "alert('Нет большой картинки')") . "return false;");
$tpl->set_var ('catalog_icon_tag', $t = $this->icon->get_img_tag (0, 0, NULL, 0, "/", $this->getAlt(), ''));
$tpl->set_var ('structure_icon_tag', $t);
$tpl->set_var ('catalog_icon_tag_small', $this->icon->get_img_tag (0, 40, NULL, 0, "/", $this->name, ''));
$tpl->set_var ('catalog_image_tag', $this->image->get_img_tag (0, 0, NULL, 0, "/", $this->getAlt(), ''));
$tpl->set_var ('structure_image_tag', $t);
// $tpl->set_var ('catalog_image_tag', $this->image->get_img_tag (0, 0, NULL, 0, MY_HTTP_ROOT_PATH, '', ''));
$tpl->set_var ('catalog_page_address', $a = $this->id ? $this->get_page_address () : '');
$tpl->set_var ('structure_page_address', $a);
$tpl->set_var ('catalog_page_address_nohost', $this->id ? $this->get_page_address (FALSE) : '');
if ($form) {
$tpl->set_var ('catalog_class_select', common_select_button ('catalog_class', $this->factory->classes, $this->class));
$tpl->set_var ('catalog_treetype_select', common_select_button ('catalog_treetype', $this->factory->treetypes, $this->treetype, "", "", "", " disabled=1"));
$tpl->set_var ('catalog_viewtype_select', common_select_button ('catalog_viewtype', $this->factory->viewtypes, $this->viewtype));
$tpl->set_var ('catalog_opendown_checkbox', common_checkbox ('catalog_opendown', 1, $this->opendown));
$tpl->set_var ('catalog_from_root_checkbox', common_checkbox ('catalog_from_root', 1, $this->from_root));
$tpl->set_var ('catalog_publish_prices_checkbox', common_checkbox ('catalog_publish_prices', 1, $this->publish_prices));
$tpl->set_var ('catalog_publish_at_page_checkbox', common_checkbox ('catalog_publish_at_page', 1, $this->publish_at_page));
$tpl->set_var ('catalog_show_children_checkbox', common_checkbox ('catalog_publish_prices', 1, $this->publish_prices));
$tpl->set_var ('catalog_icon_ctl', $this->icon->control ('catalog_icon', FALSE, FALSE));
$tpl->set_var ('catalog_image_ctl', $this->image->control ('catalog_image', FALSE, FALSE));
}
}
?>