Ejemplo n.º 1
0
 /**
  * Get instance of the class itself
  *
  * @return noteDB
  */
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
<?php

/*
================================================================================
    REQUEST OF RETURN ALL NOTES
    -> GET VALUES WITH AJAX
    author : ELihu Alejandro Cruz Albores
    version : 1.0.4
================================================================================
*/
include "../NoteDB.php";
$id = $_GET['id'];
//Instance
$Conection = new NoteDB("WebProject", "localhost", "root", " ");
echo $Conection->getAllNotes($id);
Ejemplo n.º 3
0
                        <a href="https://github.com/stephenhu3" class="github-link" target="_blank"><img class="logo" src="../img/logo.png">GitHub | Stephen Hu</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>


    <div class="container body-content">

        <h2>Notes</h2>

        <div class="jumbotron" id="note-textarea">
            <?php 
require_once "../db.php";
$notes = NoteDB::getInstance()->get_notes_by_user_name('Stephen');
if (0 === $notes->count()) {
    echo '<div class="error">';
    echo 'The person ';
    echo 'Stephen';
    echo 'is not found. Please check the spelling and try again.';
    echo '</div>';
} else {
    while ($notes->valid()) {
        $row = $notes->current();
        echo '<div id="note">';
        echo 'Date Created: ';
        echo $row['DATE_CREATED'];
        echo '<br>';
        // Saved notes appear here
        echo $row['CONTENT'];
Ejemplo n.º 4
0
<?php

/*
================================================================================
    REQUEST OF ADD NOTES
    -> GET VALUES WITH AJAX
    author : ELihu Alejandro Cruz Albores
    version : 1.0.4
================================================================================
*/
include "../NoteDB.php";
$id = $_POST['id'];
$text = $_POST['text'];
$key_note = $_POST['key_note'];
//Instance
$Conection = new NoteDB("WebProject", "localhost", "root", " ");
$data = $Conection->addNote($id, $text, $key_note);
Ejemplo n.º 5
0
<?php

require_once "db.php";
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        case 'insert_note':
            $noteContent = $_POST["noteContent"];
            $userDate = $_POST["userDate"];
            echo $noteContent;
            NoteDB::getInstance()->insert_note(1, $noteContent, $userDate);
            break;
    }
}
Ejemplo n.º 6
0
<?php

/*
================================================================================
    REQUEST OF EDIT USERS
    -> GET VALUES WITH AJAX
    author : ELihu Alejandro Cruz Albores
    version : 1.0.4
================================================================================
*/
include "../NoteDB.php";
$id = $_POST['id'];
//Instance
$Conection = new NoteDB("WebProject", "localhost", "root", " ");
$data = $Conection->removeIdNote($id);
Ejemplo n.º 7
0
<?php

/*
================================================================================
    REQUEST OF UPDATE USERS
    -> GET VALUES WITH AJAX
    author : ELihu Alejandro Cruz Albores
    version : 1.0.4
================================================================================
*/
include "../NoteDB.php";
$id = $_POST['id'];
$text = $_POST['text'];
$key_note = $_POST['key_note'];
//Instance
$Conection = new NoteDB("WebProject", "localhost", "root", " ");
$data = $Conection->updateNotes($id, $text, $key_note);
Ejemplo n.º 8
0
<?php

/*
================================================================================
    REQUEST OF REMOVE USERS
    -> GET VALUES WITH AJAX
    author : ELihu Alejandro Cruz Albores
    version : 1.0.4
================================================================================
*/
include "../NoteDB.php";
$id = $_POST['id'];
$key_note = $_POST['key_note'];
//Instance
$Conection = new NoteDB("WebProject", "localhost", "root", " ");
$data = $Conection->removeNote($id, $key_note);