/**
 *
 * Function list users projects
 * This function is used to display all the unrestricted templates (Access to whom = *)
 * @version 1.0
 * @author Patrick Lockley
 */
function list_blank_templates()
{
    /*
     * note the access rights to discern what templates this user can see
     */
    global $xerte_toolkits_site;
    $query_for_blank_templates = "select * from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails where access_rights=\"*\" and active=true order by date_uploaded DESC";
    $query_for_blank_templates_response = mysql_query($query_for_blank_templates);
    while ($row = mysql_fetch_array($query_for_blank_templates_response)) {
        echo "<div class=\"template\" onmouseover=\"this.style.backgroundColor='#ebedf3'\" onmouseout=\"this.style.backgroundColor='#fff'\"><div class=\"template_icon\"></div><div class=\"template_desc\"><p class=\"template_name\">";
        echo $row['display_name'];
        echo "</p><p class=\"template_desc_p\">";
        echo $row['description'];
        /*
         * If no example don't display the link
         */
        if ($row['display_id'] != 0) {
            echo "</p><a href=\"javascript:example_window('" . $row['display_id'] . "' )\">" . DISPLAY_EXAMPLE . "</a> | ";
        } else {
            echo "<br>";
        }
        echo "<button type=\"button\" class=\"xerte_button\" onclick=\"javascript:template_toggle('" . $row['template_name'] . "')\">" . DISPLAY_CREATE . "</button></div><div id=\"" . $row['template_name'] . "\" class=\"rename\">";
        echo "<span>" . DISPLAY_NAME . "</span><form action=\"javascript:create_tutorial('" . $row['template_name'] . "')\" method=\"post\" enctype=\"text/plain\"><input type=\"text\" width=\"200\" id=\"filename\" name=\"filename\" /><br /><button type=\"submit\" class=\"xerte_button\" >" . DISPLAY_BUTTON_PROJECT_CREATE . "</button></form></div></div>";
    }
    /*
     * once done listing the blank templates, list if any the specific templates available for this user
     */
    list_specific_templates();
}
/**
 *
 * Function list users projects
 * This function is used to display all the unrestricted templates (Access to whom = *)
 * @version 1.0
 * @author Patrick Lockley
 */
function list_blank_templates()
{
    /*
     * note the access rights to discern what templates this user can see
     */
    global $xerte_toolkits_site;
    $prefix = $xerte_toolkits_site->database_table_prefix;
    $query_for_blank_templates = "select * from {$prefix}originaltemplatesdetails where " . "access_rights=? and active= ? order by date_uploaded DESC";
    $rows = db_query($query_for_blank_templates, array('*', 1));
    foreach ($rows as $row) {
        echo "<div class=\"template\" onmouseover=\"this.style.backgroundColor='#ebedf3'\" " . "onmouseout=\"this.style.backgroundColor='#fff'\">" . "<div class=\"template_icon " . strtolower($row['template_name']) . "\">" . "</div><div class=\"template_desc\"><p class=\"template_name\">";
        echo $row['display_name'];
        echo "</p><p class=\"template_desc_p\">";
        echo $row['description'];
        /*
         * If no example don't display the link
         */
        if ($row['display_id'] != 0) {
            echo "</p><a href=\"javascript:example_window('" . $row['display_id'] . "' )\">" . DISPLAY_EXAMPLE . "</a> | ";
        } else {
            echo "<br>";
        }
        echo "<button id=\"" . $row['template_name'] . "_button\" type=\"button\" class=\"xerte_button_c_no_width\" onclick=\"javascript:template_toggle('" . $row['template_name'] . "')\"><i class=\"fa  icon-plus-sign xerte-icon\"></i> " . DISPLAY_CREATE . "&nbsp;</button></div><div id=\"" . $row['template_name'] . "\" class=\"rename\">";
        echo "<span>" . DISPLAY_NAME . "</span><form action=\"javascript:create_tutorial('" . $row['template_name'] . "')\" method=\"post\" enctype=\"text/plain\"><input type=\"text\" width=\"200\" id=\"filename\" name=\"filename\" /> <button type=\"submit\" class=\"xerte_button_c\" ><i class=\"fa  icon-plus-sign xerte-icon\"></i>" . DISPLAY_CREATE . "</button></form></div></div>";
    }
    /*
     * once done listing the blank templates, list if any the specific templates available for this user
     */
    list_specific_templates();
}