Example #1
0
 function _get_item_data(&$row, &$bars, &$_bars, &$c, &$count, &$loaded)
 {
     $c++;
     //$loaded = is_array($pids) && in_array($row['id'], $pids) ? 1 : 0;
     $suffix = $c == $count ? 'last' : 'whole';
     $_bars = $bars . ($c == $count ? 's' : 'l');
     $type_icon = isset($GLOBALS['cfg']['types'][$row['root_id']][$row['type']]['icon']) ? $GLOBALS['cfg']['types'][$row['root_id']][$row['type']]['icon'] : 'icon.tree.gif';
     $item_data = $row;
     // Если это рутовый узел, то название показываем так: "имя сайта - имя страницы"
     if ($item_data['id'] == $item_data['pid']) {
         $item_data['name'] = getSiteByRootID($item_data['root_id']) . " - " . $item_data['name'];
     }
     $item_data['icon'] = $type_icon;
     $item_data['_bars'] = $_bars;
     $item_data['loaded'] = $loaded;
     $item_data['suffix'] = $suffix;
     $item_data['target'] = 'tree_toc';
     $item_data['plus_onclick'] = 'event.cancelBubble = true;return expandNode(' . $row['id'] . ', true);';
     $item_data['onclick'] = 'event.cancelBubble = true;doSelect(' . $row['id'] . '); return expandNode(' . $row['id'] . ')';
     $item_data['ondblclick'] = 'selectID(' . $row['id'] . ')';
     $item_data['onactivate'] = 'itemActivate(this)';
     $item_data['onfocus'] = 'itemActivate(this)';
     $item_data['ondeactivate'] = 'itemDeactivate(this)';
     $item_data['ondragstart'] = '';
     $item_data['ondragenter'] = '';
     $item_data['ondragleave'] = '';
     $item_data['ondragover'] = '';
     $item_data['ondrop'] = '';
     $item_data['href'] = 'page.php?page=tree/node_id&do=getnode&id=' . $row['id'] . '&bars=' . $_bars . '&value=' . $this->value;
     $item_data['bars'] = preg_split('//', $bars, -1, PREG_SPLIT_NO_EMPTY);
     return $item_data;
 }
Example #2
0
File: tree.php Project: romlg/cms36
 /**
  * Формирование html-кода для input_treecheck
  */
 function showTreeLinksHtml()
 {
     $ids = get('ids', array(), 'p');
     $fld = get('fld', '', 'p');
     $path_id = get('path', '', 'p');
     $html = "";
     if (!$ids) {
     } else {
         global $site_domains;
         $rows = sql_getRows("SELECT * FROM tree WHERE id IN (" . $ids . ")", true);
         $ids = explode(",", $ids);
         foreach ($ids as $id) {
             $id = (int) trim($id);
             if (!$id) {
                 continue;
             }
             $path = '';
             if (count($site_domains) > 1) {
                 $path .= getSiteByRootID(@$rows[$id]['root_id']) . ' (' . getLangByRootID(@$rows[$id]['root_id']) . '): ';
             }
             $path .= $this->getPath($id, '', '', false);
             $html .= '<div class="textBox">';
             $html .= '<a href="javascript:void(0);" onclick="remove_from_treecheck(\'' . $id . '\', \'' . str_replace(array("[", "]"), array("\\\\[", "\\\\]"), $fld) . '\', this);"><img src="/admin/images/tree/ico_del.gif" style="float:left" alt="Удалить"></a>&nbsp;';
             $html .= $path;
             $html .= '&nbsp;<a href="' . (count($site_domains) > 1 ? 'http://' . getSiteByRootID(@$rows[$id]['root_id']) . '/' . getLangByRootID(@$rows[$id]['root_id']) . $rows[$id]['dir'] . $path_id : @$rows[$id]['dir'] . $path_id) . '" target="_blank"><img src="/admin/images/tree/ico_see.gif" alt="Просмотр"></a>';
             $html .= '</div>';
         }
     }
     echo json_encode(array('html' => iconv('windows-1251', 'utf-8', $html)));
     die;
 }
Example #3
0
File: cd.php Project: romlg/cms36
function draw_line($id, $line, $cd_table)
{
    global $ids;
    global $tree_result;
    global $site_domains;
    $ret = '';
    $result_id = $ids[$id];
    $snapped = result_id_by_snap($tree_result[$result_id]['id']);
    if ($tree_result[$result_id]['visible'] == 1) {
        $style = "color: #444444; text-decoration: none; font-weight: bold;";
    } else {
        $style = "color: #aaaaaa; text-decoration: none; font-weight: bold;";
    }
    $query_check = mysql_query("select * from `{$cd_table}` where id={$id}");
    if ($query_check && mysql_num_rows($query_check)) {
        $checkbox = " checked ";
    } else {
        $checkbox = " ";
    }
    switch ($tree_result[$result_id]['type']) {
        case "catalog":
            $img = "/admin/images/icons/icon.orders.gif";
            break;
        case "text":
            $img = "/admin/images/icons/folder.gif";
            break;
        case "module":
            $img = "/admin/images/icons/icon.module.gif";
            break;
        case "home":
            $img = "/admin/images/icons/icon.domik.gif";
            break;
    }
    if ($line) {
        echo "<div style='/*background: url(/admin/modules/cd/img/line.gif) no-repeat; */padding-left: 8px; height: 30px;'>\n";
    } else {
        echo "<div style='/*background: url(/admin/modules/cd/img/white.gif) no-repeat; */padding-left: 10px; height: 30px;'>\n";
    }
    if (sizeof($snapped) > 0) {
        echo "<a id='plus_minus_{$id}' style='/*background: url(/admin/images/icons/white.gif);*/ ' style='{$style}' href=\"javascript:toggle_visibility('container_{$id}');toggle_plus_minus('plus_minus_{$id}')\">";
        echo "+&nbsp;";
        echo "</a>";
    } else {
        echo "<span>&nbsp;&nbsp;&nbsp;</span>\n";
    }
    echo "<input type='checkbox' id='cb_node_" . $tree_result[$result_id]['id'] . "' name={$id} {$checkbox}>\n";
    if ($tree_result[$result_id]['id'] == $tree_result[$result_id]['pid']) {
        $tree_result[$result_id]['name'] = getSiteByRootID($tree_result[$result_id]['root_id']) . " - " . $tree_result[$result_id]['name'];
    }
    if (sizeof($snapped) > 0) {
        echo "<a style='{$style}' href=\"javascript:toggle_visibility('container_{$id}');toggle_plus_minus('plus_minus_{$id}')\"><img src='{$img}' border='0' />" . $tree_result[$result_id]['name'] . "</a>\n";
    } else {
        echo "<a style='{$style}' href=\"javascript:toggle_none()\"><img src='{$img}' border='0' />" . $tree_result[$result_id]['name'] . "</a>\n";
    }
    echo "</div>\n\n";
    if (sizeof($snapped) > 0) {
        echo "<div class='container' id='container_{$id}' style='display: none;'>\n";
        foreach ($snapped as $child) {
            draw_line($tree_result[$child]['id'], true, $cd_table);
        }
        echo "</div>\n\n";
    }
    //return $ret;
}