Esempio n. 1
0
    //view templates list
    if($act == "view")
    {
        $xtpl->assign("ADD_TEMPLATE", "<a href=\"templates.php?act=add\">Add template</a>");
        $xtpl->assign("DELETE_TEMPLATE", "<a href=\"\" onclick=\"return false;\" onmouseup=\"if(window.confirm('Are you sure?')) document.getElementById('form1').submit()\">Delete selected</a>");
        $cfg_sort_fields = array("#"=>array("field"=>"","sort"=>"","def_sort_type"=>"","sort_order"=>"","url_name"=>""),
                                 "<a href=\"#\" onclick=\"return false\" onmouseup=\"select_all_checkboxs('select[]','form1')\" class=\"table_header_text\">Select</a>"=>array("field"=>"","sort"=>"","def_sort_type"=>"","sort_order"=>"","url_name"=>""),
                                 "Template name"=>array("field"=>"name","sort"=>"sort","def_sort_type"=>"","sort_order"=>"","url_name"=>"name"),
                                 "Web site"=>array("field"=>"template_website","sort"=>"sort","def_sort_type"=>"","sort_order"=>"","url_name"=>"t_website"),
                                 "Action"=>array("field"=>"","sort"=>"","def_sort_type"=>"","sort_order"=>"","url_name"=>""));
        $query = "SELECT id, name, template_website
                    FROM " . T_TEMPLATES;
        $href = MAIN_HOST . "templates.php";
        $pg_sel = new Page_Selector($query, $href, $pages, $sort, $cfg_sort_fields);
        $xtpl->assign("SELECTOR_LINKS", $pg_sel->display_selector());
        $xtpl->assign("SELECTOR_NUMROWS", $pg_sel->display_selector_num_rows(array(), $href));
        $xtpl->assign("TABLE_HEADER", $pg_sel->get_table_header());
        if(count($pg_sel->data) > 0)
        {
            foreach($pg_sel->data as $i=>$row)
            {
                $xtpl->assign("NUM", $i);
                $xtpl->assign("_ID", $i);
                $xtpl->assign("SELECT", "<input type=\"checkbox\" id=\"" . $i . "\" name=\"select[]\" value=\"" . $row["id"] . "\" onclick=\"change_tr_class(this)\">");
                $xtpl->assign("TEMPLATE_NAME", StripSlashes(htmlspecialchars($row["name"])));
                $xtpl->assign("TEMPLATE_WEBSITE", $row["template_website"]);
                $xtpl->assign("ACTION", "<a href=\"templates.php?act=edit&id=" . $row["id"] . "\" class=\"actions\">Edit</a>");
                $xtpl->parse("main.templates.view.list");
            }
        }