Ejemplo n.º 1
0
function notes_display()
{
    if (session_id() == "") {
        session_start();
    }
    logger($script_path . " index start:");
    validate_access_webnotes();
    //configuration parameters:
    $config_params = Config::getConfigParams();
    $hostname = $config_params['hostname'];
    $watch_demo = $config_params['watch_demo'];
    $docroot = $config_params['docroot'];
    $debug = $config_params['debug'];
    $header = header_html();
    //
    $footer = $config_params['footer'];
    $doctype = $config_params['doctype'];
    $html_attribute = $config_params['html_attribute'];
    $css = $config_params['css'];
    $google_analytics = $config_params['google_analytics'];
    $godaddy_analytics = $config_params['godaddy_analytics'];
    $cookie_name = $config_params['cookie_name'];
    $ep4 = $config_params['ep4'];
    $docroot = $_SERVER['DOCUMENT_ROOT'];
    $user = $_SESSION['user'];
    //??
    $user = '******';
    if ($_REQUEST['action'] == 'searchdisplay') {
        $tag = $_REQUEST['tag'];
        $model = new TwextraModel();
        $notes_all_array = $model->searchNote($user, $tag);
    } else {
        $model = new TwextraModel();
        $notes_all_array = $model->getNotesAll($user);
    }
    header("Pragma: no-cache");
    header("cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    print $doctype;
    print "<html {$html_attribute} >";
    $message = "\n\n<head>\n\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{$css}\" />\n\n<title>Twextra- When you NEED more than 140 characters</title>";
    echo $message;
    $scripts = '';
    $scripts .= "<script type='text/javascript' src='/scripts/jquery/jquery-1.2.6.js'></script>\n";
    echo $scripts;
    $message = "\n\n<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/favicon.ico\" />\n\n</head>\n\n<body>\n\n<div class='wrapper'>\n\n<div class='page'>";
    echo $message;
    $banner = banner($screen_name, 'banner_index');
    //(user, banner_class)
    echo $banner;
    $message = "<div style='clear:both;margin-left:auto;margin-right:auto;width:800px;'>\n\nYour webnotes are displayed below:";
    $message .= "<table class='w_display_table' >";
    $message .= "<tr class='w_display_tr' >\n\n<th class='w_display_th'>Note</th>\n\n<th class='w_display_th'>Tags</th>\n\n<th class='w_display_th'>Updated</th>\n\n<th class='w_display_th'>Actions</th></tr>";
    foreach ($notes_all_array as $entry) {
        $message .= "<tr class='w_display_tr' >\n\n    <td class='w_display_td'>{$entry['note']}</td>\n\n    <td class='w_display_td' >{$entry['tag']}</td>\n\n    <td class='w_display_td'>{$entry['created']}</td>\n\n    <td class='w_display_td'><a href={$hostname}/webnotes/wrouter.php?wid={$entry['wid']}&wroute=edit >Edit</a>\n\n        <span id='delete' style='color:blue;' onclick=_edit('{$hostname}',{$entry['wid']})>Delete</span>\n\n        <a href={$hostname}/webnotes/wrouter.php?wid={$entry['wid']}&wroute=share>Share</a>\n\n    </td></tr>";
    }
    $message .= "</table>";
    $message .= "</div>";
    echo $message;
    echo $footer;
    $message = "\n\n</div>\n\n</div>\n\n</body>\n\n</html>";
    echo $message;
}