Esempio n. 1
0
     if ($id_parent) {
         $arr_tmp = create_tree('content_tree');
         if ($arr_tmp) {
             print "\n\t\t\t\t\t\t<li class='has-dropdown'>\n\t\t\t\t\t\t\t<a href='?modul=content'>\n\t\t\t\t\t\t\t\t<i class='icon-content'></i><span class='toggle ";
             if ($next_modul == 'content') {
                 print 'active';
             }
             print "'>" . v('CMT_MODUL_CONTENT') . "</span>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t<ul class='dropdown sub-tree ";
             if ($next_modul == 'content') {
                 print 'active';
             }
             print "'>";
             if (isset($id_tree)) {
                 tree_sidebar('content', $arr_tmp, tree_get_parents('content_tree', $id_tree));
             } else {
                 tree_sidebar('content', $arr_tmp, tree_get_parents('content_tree', NULL));
             }
             print "\n\t\t\t\t\t\t\t</ul><!-- /.dropdown -->\n\t\t\t\t\t\t</li><!-- /.has-dropdown -->";
         } else {
             print "\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href='?modul=content'>\n\t\t\t\t\t\t\t<i class='icon-content'></i><span>" . v('CMT_MODUL_CONTENT') . "</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li><!-- /.has-dropdown -->";
         }
     }
 } elseif ($arr_sb['modul'] == 'update') {
     $sql = "SELECT * FROM " . $_SESSION['TABLE_PREFIX'] . "cmt_settings WHERE title = 'update_core' AND c_active = '1' ";
     $result = db_mysql_query($sql, $conn);
     if (db_mysql_num_rows($result)) {
         print "\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href='?modul=update'>\n\t\t\t\t\t\t\t<i class='icon-update'></i><span>" . v('CMT_MODUL_UPDATE') . "</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>";
     }
 } else {
     if ($arr_sb['modul_string']) {
         $modul_string = $arr_sb['modul'] . "_" . $arr_sb['modul_string'];
Esempio n. 2
0
function tbody($params)
{
    global $conn, $modul, $sub_page, $pages;
    if (!isset($sub_page) or $sub_page == 0) {
        $sub_page = 1;
    }
    if ($modul == 'content_tree') {
        if (isset($params['FILTER'])) {
            $arr_tmp = create_tree('content_tree', 0, $params['FILTER']);
        } else {
            $arr_tmp = create_tree('content_tree', 0);
        }
        if ($arr_tmp) {
            $tbody = "<div class='table-body tree'>";
            $tbody .= tree_nav_table($params, 'content', $arr_tmp, tree_get_parents('content_tree', NULL));
            $tbody .= "</div><!-- /.table-body -->";
        }
    } else {
        if (!isset($params['FILTER'])) {
            $params['FILTER'] = NULL;
        } elseif (!isset($params['SORT'])) {
            $params['SORT'] = NULL;
        }
        if (!isset($params['GROUP'])) {
            $params['GROUP'] = NULL;
        }
        if (!isset($params['ADD'])) {
            $params['ADD'] = NULL;
        }
        $result = db_mysql_query(select_tbody($params['TABLE'], $params['SORT'], $params['FILTER'], $params['GROUP'], $params['ADD'], 100), $conn);
        if ($sub_page <= 1) {
            $sql_sub = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = '" . $_SESSION['TABLE_PREFIX'] . $modul . "' AND COLUMN_NAME = 'sort_order' ";
            $result_sub = db_mysql_query($sql_sub, $conn);
            if ($modul == 'content_tree') {
                $tbody = "<div class='table-body tree'>";
            } else {
                if (db_mysql_num_rows($result_sub)) {
                    $tbody = "<div class='table-body sortable'>";
                } else {
                    $tbody = "<div class='table-body " . $modul . "'>";
                }
            }
        }
        while ($arr = db_mysql_fetch_array($result)) {
            $tbody .= "<div class='table-row' id='" . $arr['id'] . "' >";
            foreach ($params['TABLE'] as $key => $value) {
                $data = init($arr[$key], $value, $key);
                if ($value == 'activate') {
                    $tbody .= "<div class='table-cell icon-only " . $key . "'>";
                    if ($arr[$key]) {
                        $tbody .= "<a href='#' class='icon-cell " . $key . "_de" . $value . "' data-content='" . $modul . "' id='" . $arr['id'] . "' ><i class='icon-" . $value . "-active'></i>";
                    } else {
                        $tbody .= "<a href='#' class='icon-cell " . $key . "_" . $value . "' data-content='" . $modul . "' id='" . $arr['id'] . "' ><i class='icon-" . $value . "'></i>";
                    }
                    $tbody .= "</div><!-- /.table-cell -->";
                } else {
                    $tbody .= "<div class='table-cell " . $key . "'>" . $data . "</div><!-- /.table-cell -->";
                }
            }
            if (count(array_filter($params['CONSTRUCT']))) {
                $width = 40 + 26 * count(array_filter($params['CONSTRUCT']));
                $tbody .= "<div class='table-cell tools' style='width: " . $width . "px;'>";
                foreach ($params['CONSTRUCT'] as $key => $value) {
                    if ($value === true) {
                        if ($key == 'activate') {
                            if (!isset($arr['c_default']) or $arr['c_default'] == 0) {
                                if ($arr['c_active']) {
                                    $tbody .= "<a href='#' class='icon-cell de" . $key . "' data-content='" . $modul . "' id='" . $arr['id'] . "' ><i class='icon-" . $key . "-active'></i>";
                                } else {
                                    $tbody .= "<a href='#' class='icon-cell " . $key . "' data-content='" . $modul . "' id='" . $arr['id'] . "' ><i class='icon-" . $key . "'></i>";
                                }
                                $tbody .= "</a>";
                            }
                        } elseif ($key == 'delete') {
                            if (!isset($arr['c_default']) or $arr['c_default'] == 0) {
                                $tbody .= "<a href='#' class='icon-cell " . $key . "' data-content='" . $modul . "' id='" . $arr['id'] . "' ><i class='icon-" . $key . "'></i></a>";
                            }
                        } else {
                            $tbody .= "<a href='#' class='icon-cell " . $key . "' data-content='" . $modul . "' id='" . $arr['id'] . "' ><i class='icon-" . $key . "'></i></a>";
                        }
                    }
                }
                $tbody .= "</div><!-- /.table-cell -->";
            }
            $tbody .= "</div><!-- /.table-row -->";
        }
        if (ceil($pages) != $sub_page) {
            $next_page = $sub_page + 1;
            $tbody .= "<form id='next_rows' method='POST'>";
            $tbody .= "<input type='hidden' name='modul' value='" . $modul . "'>";
            $tbody .= "<input type='hidden' name='params' value='" . serialize($params) . "'>";
            $tbody .= "<input type='hidden' name='sub_page' value='" . $next_page . "'>";
            $tbody .= "</form>";
        }
        $tbody .= "</div><!-- /.table-body -->";
    }
    if (isset($tbody)) {
        print $tbody;
    }
}
Esempio n. 3
0
function cross_table($title, $value = 0, $value_name = NULL, $value_label = NULL)
{
    global $conn, $formdata, $modul;
    preg_match("/(.*)_(.*)/i", $modul, $next_modul);
    if ($next_modul) {
        $next_modul = $next_modul[1];
    } else {
        $next_modul = $modul;
    }
    $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = '" . $_SESSION['TABLE_PREFIX'] . $formdata[$title]['settings']['data'] . "' AND COLUMN_NAME = 'id_parent' ";
    $result = db_mysql_query($sql, $conn);
    $id_parent = db_mysql_num_rows($result);
    if ($id_parent) {
        $arr_tmp = create_tree($formdata[$title]['settings']['data']);
        generate_tree_select($title, $arr_tmp, tree_get_parents($formdata[$title]['settings']['data'], $value));
        $formdata['levels'] = array('type' => 'hidden', 'value' => 1);
        unset($formdata[$title]);
    } else {
        if ($title == 'language') {
            $next_modul = 'content';
        }
        $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = '" . $_SESSION['TABLE_PREFIX'] . $next_modul . "_fields' AND COLUMN_NAME = 'id' ";
        $result = db_mysql_query($sql, $conn);
        if (db_mysql_num_rows($result)) {
            $sql = "SELECT value, label FROM " . $_SESSION['TABLE_PREFIX'] . $next_modul . "_fields WHERE source_table = '" . $formdata[$title]['settings']['data'] . "' ";
            $result = db_mysql_query($sql, $conn);
            if (db_mysql_num_rows($result)) {
                $arr = db_mysql_fetch_array($result);
            }
        }
        if (!isset($arr['value']) or !$arr['value']) {
            $arr['value'] = 'id';
        }
        if (!isset($arr['label']) or !$arr['label']) {
            $arr['label'] = 'title';
        }
        if (isset($value_name) && $value_name) {
            $arr['value'] = $value_name;
        }
        if (isset($value_label) && $value_label) {
            $arr['value'] = $value_label;
        }
        $sql_tmp = "SELECT " . $arr['value'] . ", " . $arr['label'] . ", sort_order FROM " . $formdata[$title]['settings']['data'] . " WHERE c_active = '1' ";
        if ($formdata[$title]['settings']['data'] == 'content_templates') {
            $sql_tmp .= "GROUP BY id_template ";
        }
        $sql_tmp .= "ORDER BY sort_order ASC ";
        $result_tmp = db_mysql_query($sql_tmp, $conn);
        if ($formdata[$title]['settings']['data'] == 'cmt_accounts') {
            $formdata[$title]['value'] = CMT_USER_ID;
        }
        unset($formdata[$title]['settings']['data']);
        if ($formdata[$title]['type'] != 'radio') {
            $formdata[$title]['settings']['data'][0] = "...";
        }
        while ($arr_tmp = db_mysql_fetch_array($result_tmp)) {
            if ($arr['label'] == 'label') {
                $formdata[$title]['settings']['data'][$arr_tmp[$arr['value']]] = v("CMT_" . $arr_tmp[$arr['label']]);
            } else {
                $formdata[$title]['settings']['data'][$arr_tmp[$arr['value']]] = $arr_tmp[$arr['label']];
            }
        }
    }
}