function handle_get($conversation) { $fresh = $_GET['fresh'] == 'true'; $max_timestamp = NULL; $board_list = array(); $connection = get_connection($fresh); try { $boards = get_boards($connection); if (!is_null($boards)) { foreach ($boards as $board) { $board_list[] = $board['id']; $timestamp = $board['timestamp']; if (is_null($max_timestamp) || $timestamp > $max_timestamp) { $max_timestamp = $timestamp; } } } else { $connection->close(); return null; } $notes = get_notes($connection); } catch (Exception $x) { $connection->close(); throw $x; } $connection->close(); if (!is_null($max_timestamp)) { $conversation->modificationTimestamp = $max_timestamp; } return json_encode(array('boards' => $board_list, 'notes' => $notes)); }
function query_statements($q) { extract($q); list($resource_ids, $rule_values) = query_result($q); for ($i = 0; $i < count($resource_ids); $i++) { $items[] = array('item_id' => $resource_ids[$i], 'notes' => get_notes($resource_ids[$i], $db)); } return $items; }
function show($id) { $this->load->helper('note'); $this->load->helper('format'); $this->load->helper('form'); $user = get_user($id); if (!$user) { show_error('User not found', 404); } $notes = get_notes($user->id); $fields = json_decode(file_get_contents(dirname(__FILE__) . '/fields.json')); $data = json_decode($user->data, TRUE); foreach ($user as $key => $value) { $data[$key] = $value; } $this->load->view('admin/header', array('title' => "Volunteer - {$user->firstname} {$user->lastname}")); $this->load->view('admin/volunteers/show', array('fields' => $fields, 'data' => $data, 'notes' => $notes, 'user' => $user, 'admin_id' => $this->admin->id())); $this->load->view('admin/footer'); }
echo 'Remainder'.$round%2 .'<br>'; $string = "i like to program in PHP".'<br>'; $a = strtoupper($string); $b = strtolower($string); $c = ucfirst($string); $d = ucwords($string); $e = ucwords(strtolower($string)); echo "Str to upr ".$a.'<br>'; echo "Str to lower ".$b.'<br>'; echo "ucfirst ".$c.'<br>'; echo "ucwords ".$d.'<br>'; echo "ucwords to str to lower ".$e.'<br>'; echo "Trim ".trim($string); */ $notes = array(); function notes_func() { $notes = array("0" => array("Name" => "ram", "Age" => 12, "Add" => "125 coll ave"), "1" => array("Name" => "rama", "Age" => 12, "Add" => "125 coll ave")); return $notes; } function get_notes() { $no = notes_func(); echo '<pre>' . $no; foreach ($no as $not) { //echo "Name ".$not['Name']."<br>"; echo $not['Name']; } } get_notes();
function get_all() { $result = get_notes(); echo json_encode($result); }
$hits = json_decode($result)->hits->total; log_msg("hits: " . json_encode($hits) . "\n"); // if no instances exist, add to ES if ($hits == 0) { log_msg("writing bug to ES: " . json_encode($dat) . "\n"); $result = do_http_request($url, $dat); log_msg("result: " . $result . "\n"); } } $es_comment_url = $elastic_search_server . $elastic_search_comment_index . "/" . $elastic_search_comment_doctype . "/"; $es_bug_url = $elastic_search_server . $elastic_search_bug_index . "/" . $elastic_search_bug_doctype . "/"; if ($log_filename) { $log_fp = fopen($log_filename, 'a'); } if (isset($_GET['dates'])) { get_notes($es_comment_url, $_GET); } else { try { // the comment arrives as the data in the $_POST array $dat = $_POST; // send the comment to ES, as-is log_msg("writing comment to ES: " . json_encode($dat) . "\n"); log_msg("response: " . do_http_request($es_comment_url, $dat) . "\n"); // search the comment string and see if any bug numbers are referenced $hits = preg_match_all('/Bug\\s*(?P<bug>\\d+)/i', $dat['comment'], $matches); // for each bug referenced, push the bug data to the 'bugs' doctype separately if ($hits) { foreach ($matches['bug'] as $bug) { log_msg("bug found: " . $bug . "\n"); send_bug($es_bug_url, $dat, $bug); }
<a href="logout.php">Logout</a> </div> </div> <div class="row"> <div class="span6"> <form class="well" action="add_note.php" method="post"> <label>Note Text</label> <input class="span5" type="text" name="note" placeholder="Create a note..."> <button class="btn" type="submit">create note</button> </form> </div> </div> <div class="row"> <div class="span4"> <?php $notes = get_notes($_SESSION['user_id']); ?> <?php if (count($notes) > 0) { ?> <ol> <?php foreach ($notes as $note) { ?> <li><?php echo $note['note']; ?> </li> <?php } ?>
<script src="../lib/js/jquery-1.3.2.min.js"> </script> <script src="../lib/js/jquery-ui-1.7.2.custom.min.js"> </script> <script src="../lib/js/json2.js"> </script> <script src="js/user.js"> </script> <script src="js/action_bar.js"> </script> <? echo '<script>'; echo "NOTAS.prefs="; getUserPrefs($_SESSION['userId']); echo ";NOTAS.preloadedNotas="; get_notes($_SESSION['userId']); echo '</script>'; ?> <title> <?php echo $_SESSION['userScreenName'] . "@Notas"; ?> </title> </head> <body> <div id="topContainer"> <div id="actionBar"> <!--<span id="ajaxInProgress" style="float:right">ajax in progress...</span>--><span id="ajaxIcon" style="float:right"> </span> </div> <div id="notasContainer" style="float: left;">
<?php require_once 'model.php'; if (isset($_POST['data'])) { //note: remove 'data' from equation $reply = array(); $request = json_decode($_POST['data'], true); //note: clean up post before use //echo 'request > ', var_dump($request); if (isset($request['action'])) { $userId = $_SESSION['userId']; switch ($request['action']) { case 'get_notes': get_notes($userId); break; case 'save_notes': save_notes($userId, $request['notas']); break; case 'delete_notes': delete_notes($userId, $request['ids']); break; case 'getUserPrefs': getUserPrefs($userId); break; case 'setUserPrefs': setUserPrefs($userId, $request['arg']); break; case 'logout': logoutUser(); break; default: