get_html_for_blotter_editor($entries); $page->set_title("Blotter Editor"); $page->set_heading("Blotter Editor"); $page->add_block(new Block("Welcome to the Blotter Editor!", $html, "main", 10)); $page->add_block(new Block("Navigation", "Index", "left", 0)); } public function display_blotter_page($entries) { global $page; $html = $this->get_html_for_blotter_page($entries); $page->set_mode("data"); $page->set_data($html); } public function display_blotter($entries) { global $page, $config; $html = $this->get_html_for_blotter($entries); $position = $config->get_string("blotter_position", "subheading"); $page->add_block(new Block(null, $html, $position, 20)); } private function is_odd($number) { return $number & 1; // 0 = even, 1 = odd } private function get_html_for_blotter_editor($entries) { global $user; /** * Long function name, but at least I won't confuse it with something else ^_^ */ $html = ""; // Add_new stuff goes here. $table_header = " Date Message Important? Action "; $add_new = " ".make_form(make_link("blotter/add"))." "; // Now, time for entries list. $table_rows = ""; for ($i = 0 ; $i < count($entries) ; $i++) { /** * Add table rows */ $id = $entries[$i]['id']; $entry_date = $entries[$i]['entry_date']; $entry_text = $entries[$i]['entry_text']; if($entries[$i]['important'] == 'Y') { $important = 'Y'; } else { $important = 'N'; } if(!$this->is_odd($i)) {$tr_class = "odd";} if($this->is_odd($i)) {$tr_class = "even";} // Add the new table row(s) $table_rows .= " $entry_date $entry_text $important
".$user->get_auth_html()."
"; } $html = " $table_header$add_new$table_rows

Help:
Add entries to the blotter, and they will be displayed.
"; return $html; } private function get_html_for_blotter_page($entries) { /** * This one displays a list of all blotter entries. */ global $config; $i_color = $config->get_string("blotter_color","#FF0000"); $html = ""; $html .= "Blotter
";

		for ($i = 0 ; $i < count($entries) ; $i++)
		{
			/**
			 * Blotter entries
			 */
			// Reset variables:
			$i_open = "";
			$i_close = "";
			$id = $entries[$i]['id'];
			$messy_date = $entries[$i]['entry_date'];
			$clean_date = date("m/d/y",strtotime($messy_date));
			$entry_text = $entries[$i]['entry_text'];
			if($entries[$i]['important'] == 'Y') { $i_open = ""; $i_close=""; }
			$html .= "{$i_open}{$clean_date} - {$entry_text}{$i_close}

"; } $html .= "
"; return $html; } private function get_html_for_blotter($entries) { /** * Show the blotter widget * Although I am starting to learn PHP, I got no idea how to do javascript... to the tutorials! */ global $config; $i_color = $config->get_string("blotter_color","#FF0000"); $position = $config->get_string("blotter_position", "subheading"); $html = ""; $html .= ""; $entries_list = ""; for ($i = 0 ; $i < count($entries) ; $i++) { /** * Blotter entries */ // Reset variables: $i_open = ""; $i_close = ""; $id = $entries[$i]['id']; $messy_date = $entries[$i]['entry_date']; $clean_date = date("m/d/y",strtotime($messy_date)); $entry_text = $entries[$i]['entry_text']; if($entries[$i]['important'] == 'Y') { $i_open = ""; $i_close=""; } $entries_list .= "
  • {$i_open}{$clean_date} - {$entry_text}{$i_close}
  • "; } $out_text = ""; $in_text = ""; $pos_break = ""; $pos_align = "text-align: right; position: absolute; right: 0px;"; if($position == "left") { $pos_break = "
    "; $pos_align = ""; } if(count($entries) == 0) { $out_text = "No blotter entries yet."; $in_text = "Empty.";} else { $clean_date = date("m/d/y",strtotime($entries[0]['entry_date'])); $out_text = "Blotter updated: {$clean_date}"; $in_text = ""; } $html .= "
    $out_text{$pos_break}Show/Hide Show All
    "; $html .= "
    $in_text
    "; return $html; } } ?>