Ejemplo n.º 1
0
 function view_graph()
 {
     $out = ccf_graph_display(1);
     $vars = array('show_div' => true, 'user' => $this->user, 'num_months' => $this->last_x_months, 'this_month' => $this->month);
     $out .= ccf_show_graph_swf('flashcontent', $vars, $this->width, $this->height);
     return $out;
 }
Ejemplo n.º 2
0
        function display_graph($instance)
        {
            ### Networth Graph ###
            # Main Title
            $pw_main_title = get_user_option('pw_main_title');
            $pw_main_title_font_name = get_user_option('pw_main_title_font_name');
            $pw_main_title_font_color = get_user_option('pw_main_title_font_color');
            $pw_main_title_font_size = get_user_option('pw_main_title_font_size');
            $pw_main_title_bg_color = get_user_option('pw_main_title_bg_color');
            # Vertical
            $pw_vert_line_color = get_user_option('pw_vert_line_color');
            $pw_vert_font_name = get_user_option('pw_vert_font_name');
            $pw_vert_font_color = get_user_option('pw_vert_font_color');
            $pw_vert_font_size = 8;
            # Horizontal
            $pw_horiz_line_color = get_user_option('pw_horiz_line_color');
            $pw_horiz_font_name = get_user_option('pw_horiz_font_name');
            $pw_horiz_font_color = get_user_option('pw_horiz_font_color');
            $pw_horiz_font_size = 10;
            # Graph
            $pw_graph_do_not_fill = get_user_option('pw_graph_do_not_fill');
            $pw_graph_gradient_color_1 = get_user_option('pw_graph_gradient_color_1');
            $pw_graph_gradient_color_2 = get_user_option('pw_graph_gradient_color_2');
            $pw_graph_no_line = get_user_option('pw_graph_no_line');
            $pw_graph_line_color = get_user_option('pw_graph_line_color');
            $pw_graph_line_width = get_user_option('pw_graph_line_width');
            # Data Points
            $pw_graph_no_data_points = $instance['show_data_points'];
            $pw_data_point_color = get_user_option('pw_data_point_color');
            # User selected settings
            $width = $instance['width'];
            $height = $instance['height'];
            $last_x_months = $instance['last_x_months'];
            $bgcolor = $instance['bgcolor'];
            $out = '<script type="text/javascript" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/net-worth-calculator/js/swfobject.js"></script>
			<script type="text/javascript">

			var flashvars = {
				csv_file: "' . get_bloginfo('wpurl') . '/wp-content/plugins/net-worth-calculator/generate_csv.php?last=' . $last_x_months . '",

				main_title: "' . $pw_main_title . '",
				main_title_font_name: "' . $pw_main_title_font_name . '",
				main_title_font_color: "' . $pw_main_title_font_color . '",
				main_title_font_size: "' . $pw_main_title_font_size . '",
				main_title_bg_color: "' . $pw_main_title_bg_color . '",

				vert_line_color: "' . $pw_vert_line_color . '",
				vert_font_name: "' . $pw_vert_font_name . '",
				vert_font_color: "' . $pw_vert_font_color . '",
				vert_font_size: "' . $pw_vert_font_size . '",

				horiz_line_color: "' . $pw_horiz_line_color . '",
				horiz_font_name: "' . $pw_horiz_font_name . '",
				horiz_font_color: "' . $pw_horiz_font_color . '",
				horiz_font_size: "' . $pw_horiz_font_size . '",

				graph_gradient_color_1: "' . $pw_graph_gradient_color_1 . '",
				graph_gradient_color_2: "' . $pw_graph_gradient_color_2 . '",
				graph_line_color: "' . $pw_graph_line_color . '",
				graph_line_width: "' . $pw_graph_line_width . '",

				data_point_color: "' . $pw_data_point_color . '",
				' . ($pw_graph_do_not_fill != 'true' ? 'graph_do_not_fill: true,' : '') . '
				' . ($pw_graph_no_line != 'true' ? 'graph_no_line: true,' : '') . '
				' . ($pw_graph_no_data_points != 'true' ? 'graph_no_data_points: true,' : '') . '
			};
			</script>';
            $out .= ccf_show_graph_swf('widget_flashcontent', $vars = array('show_div' => true), $width, $height, $hex_bg = $bgcolor);
            return $out;
        }
Ejemplo n.º 3
0
function grid_edit_months($json_url)
{
    ?>
<script>
jQuery("#months").jqGrid({
	caption: 'My Net Worth',
	height: 'auto',
	url: '<?php 
    echo $json_url;
    ?>
?view&months',
	datatype: 'json',
	colNames: ['ID', 'Month', 'Net Worth'],
	colModel: [
		{
			name: 'id',
			index: 'id',
			width: 50,
			hidden: true,
			sortable: false,
			editable: false
		},
		{
			name: 'month',
			index: 'month',
			width: 150,
			sortable: false,
			editable: false
		},
		{
			name: 'networth',
			index: 'networth',
			width: 150,
			sortable: false,
			editable: false,
			formatter: 'currency',
			formatoptions: {prefix:"$"}
		},
	],
	viewrecords: true,
	forceFit: true,
	editurl: '<?php 
    echo $json_url;
    ?>
?modify&months',
	afterSubmit: function(args) {
		alert('test');
	},
	onSelectRow: function(monthid) {
		if(monthid == null) {
			monthid = 0;
			if(jQuery('#assets').jqGrid('getGridParam','records') > 0) {
				jQuery("#assets").jqGrid('setGridParam',{url:"<?php 
    echo $json_url;
    ?>
?view&assets&month="+monthid,page:1,cellurl:"<?php 
    echo $json_url;
    ?>
?modify&assets&month="+monthid,editurl:"<?php 
    echo $json_url;
    ?>
?modify&assets&month="+monthid}).trigger('reloadGrid');
			}
			if(jQuery('#liabilities').jqGrid('getGridParam','records') > 0) {
				jQuery("#liabilities").jqGrid('setGridParam',{url:"<?php 
    echo $json_url;
    ?>
?view&liabilities&month="+monthid,page:1,cellurl:"<?php 
    echo $json_url;
    ?>
?modify&liabilities&month="+monthid,editurl:"<?php 
    echo $json_url;
    ?>
?modify&liabilities&month="+monthid}).trigger('reloadGrid');
			}
		} else if(monthid == '_empty') {
			jQuery("#months").jqGrid('addNewMonth', monthid, false, function(rowid, response) {
				var json = eval('(' + response.responseText + ')');
				jQuery("#months").trigger('reloadGrid');
				//jQuery("#months").setSelection(json.monthid, false);
				jQuery("#assets").jqGrid('setGridParam',{url:"<?php 
    echo $json_url;
    ?>
?view&assets&month="+json.monthid,page:1,cellurl:"<?php 
    echo $json_url;
    ?>
?modify&assets&month="+json.monthid,editurl:"<?php 
    echo $json_url;
    ?>
?modify&assets&month="+json.monthid}).trigger('reloadGrid');
				jQuery("#liabilities").jqGrid('setGridParam',{url:"<?php 
    echo $json_url;
    ?>
?view&liabilities&month="+json.monthid,page:1,cellurl:"<?php 
    echo $json_url;
    ?>
?modify&liabilities&month="+json.monthid,editurl:"<?php 
    echo $json_url;
    ?>
?modify&liabilities&month="+json.monthid}).trigger('reloadGrid');
			});
		} else {
			jQuery("#assets").jqGrid('setGridParam',{url:"<?php 
    echo $json_url;
    ?>
?view&assets&month="+monthid,page:1,cellurl:"<?php 
    echo $json_url;
    ?>
?modify&assets&month="+monthid,editurl:"<?php 
    echo $json_url;
    ?>
?modify&assets&month="+monthid}).trigger('reloadGrid');
			jQuery("#liabilities").jqGrid('setGridParam',{url:"<?php 
    echo $json_url;
    ?>
?view&liabilities&month="+monthid,page:1,cellurl:"<?php 
    echo $json_url;
    ?>
?modify&liabilities&month="+monthid,editurl:"<?php 
    echo $json_url;
    ?>
?modify&liabilities&month="+monthid}).trigger('reloadGrid');
		}
	},
	gridComplete: function() {
		var ids = jQuery("#months").jqGrid('getDataIDs');
		for(var i = 0; i < ids.length; i++) {
			if(ids[i] == '_empty') {
				jQuery("#months").setCell(ids[i], 1, '', {'color': '#aaaaaa'});
				jQuery("#months").setCell(ids[i], 2, '', {'color': '#aaaaaa'});
			} else {
				var value = jQuery("#months").getCell(ids[i], 2);
				if(value > 0) {
					jQuery("#months").setCell(ids[i], 2, '', {'color': 'green'});
					jQuery("#months").setCell(ids[i], 1, '', {'font-weight': 'bold'});
					jQuery("#months").setCell(ids[i], 2, '', {'font-weight': 'bold'});
				} else if(value < 0) {
					jQuery("#months").setCell(ids[i], 2, '', {'color': 'red'});
					jQuery("#months").setCell(ids[i], 1, '', {'font-weight': 'bold'});
					jQuery("#months").setCell(ids[i], 2, '', {'font-weight': 'bold'});
				}
				
			}
		}
		<?php 
    echo ccf_show_graph_swf('managedata', $vars = array('no_tags' => 1), $width = 300, $height = 300);
    ?>
	}
});
</script>
<?php 
}
Ejemplo n.º 4
0
				var copy = prompt("Copy and paste this code into your post:", '[networth view="graph"]');
				window.clipboardData.setData('Text', copy);
			}
			</script>
			<span class="copy-link" style="margin-right: 20px"><a id="copy-link-graph" href="#">Get embed code for this graph</a></span>
		</div>
		<div id="right-box" style="float: left; width: 400px;">
			<table id="assets"></table>
			<br/>
			<table id="liabilities"></table>
			<script type="text/javascript">
			function copy_link_data(month) {
				var copy = prompt("Copy and paste this code into your post:", '[networth month="'+month+'" view="data"]');
				window.clipboardData.setData('Text', copy);
			}
			</script>
			<span class="copy-link"><a id="copy-link-data" href="#">Get embed code for this data table</a></span>
			<br/>
		</div>
	</div>


	<?php 
print ccf_show_graph_swf('managedata', $vars = array(), $width = 300, $height = 300);
$json_url = get_bloginfo('wpurl') . '/wp-content/plugins/net-worth-calculator/json.php';
grid_edit_months($json_url);
grid_edit_items($json_url, 'liability', 'liabilities');
grid_edit_items($json_url, 'asset', 'assets');
?>
</div>