Пример #1
0
function wikiplugin_report($data, $params)
{
    global $prefs, $page, $tiki_p_edit;
    $headerlib = TikiLib::lib('header');
    $tikilib = TikiLib::lib('tiki');
    static $reportI = 0;
    ++$reportI;
    $params = array_merge(array("view" => "sheet", "name" => ""), $params);
    extract($params, EXTR_SKIP);
    if (!empty($data)) {
        $result = "";
        $report = Report_Builder::loadFromWikiSyntax($data);
        $values = Report_Builder::fromWikiSyntax($data);
        $values = json_encode($values);
        $type = $report->type;
        switch ($view) {
            case 'sheet':
                TikiLib::lib("sheet")->setup_jquery_sheet();
                $headerlib->add_jq_onready("\n\t\t\t\t\tvar me = \$('#reportPlugin{$reportI}');\n   \t\t\t\tme\n\t\t\t\t\t\t.show()\n\t\t\t\t\t\t.visible(function() {\n\t\t\t\t\t\t\tme\n\n\t\t\t\t\t\t\t\t.sheet({\n\t\t\t\t\t\t\t\t\teditable: false,\n\t\t\t\t\t\t\t\t\tbuildSheet: true\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});");
                $result .= "\n\t\t\t\t\t<style>\n\t\t\t\t\t\t#reportPlugin{$reportI} {\n\t\t\t\t\t\t\tdisplay: none;\n\t\t\t\t\t\t\twidth: inherit ! important;\n\t\t\t\t\t\t}\n\t\t\t\t\t</style>\n\n\t\t\t\t\t<div id='reportPlugin{$reportI}'>" . $report->outputSheet($name) . "</div>";
                break;
        }
    }
    if ($tiki_p_edit == 'y') {
        $headerlib->add_jsfile("lib/core/Report/Builder.js")->add_js("\n\t\t\tfunction editReport{$reportI}(me) {\n\t\t\t\tvar me = \$(me).removeAttr('href');\n\t\t\t\tme.serviceDialog({\n\t\t\t\t\ttitle: me.attr('title'),\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tcontroller: 'report',\n\t\t\t\t\t\taction: 'edit',\n\t\t\t\t\t\tindex: {$reportI}\n\t\t\t\t\t},\n\t\t\t\t\tload: function() {\n\t\t\t\t\t\t\$.reportInit();\n\t\t\t\t\t\tvar values = \$.parseJSON('{$values}');\n\n\t\t\t\t\t\tif (values) {\n\t\t\t\t\t\t\t\$('#reportType')\n\t\t\t\t\t\t\t\t.val('{$type}')\n\t\t\t\t\t\t\t\t.change();\n\n\t\t\t\t\t\t\tvalues['type'] = null;\n\n\t\t\t\t\t\t\t\$('#reportEditor').one('reportReady', function(){\n\t\t\t\t\t\t\t\t\$('#reportEditor').reportBuilderImport(values);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t");
        $result .= "\n\t\t\t<form class='reportWikiPlugin' data-index='{$reportI}' method='post' action='tiki-wikiplugin_edit.php'>\n\t\t\t\t<input type='hidden' name='page' value='{$page}'/>\n\t\t\t\t<input type='hidden' name='content' value=''/>\n\t\t\t\t<input type='hidden' name='index' value='{$reportI}'/>\n\t\t\t\t<input type='hidden' name='type' value='report' />\n\t\t\t\t<input type='hidden' name='params[name]' value='{$name}' />\n\t\t\t\t<input type='hidden' name='params[view]' value='{$view}' />\n\t\t\t</form>\n\t\t\t<span title='" . tr('Edit Report') . "' style='cursor: pointer;' onclick='return editReport{$reportI}(this);'>\n\t\t\t\t<img src='img/icons/page_edit.png' alt='{$label}' width='16' height='16' title='{$label}' class='icon' />\n\t\t\t</span>";
    }
    return "~np~" . $result . "~/np~";
}
Пример #2
0
 static function loadFromWikiSyntax($data = "")
 {
     $values = Report_Builder::fromWikiSyntax($data);
     $me = Report_Builder::load($values['type']);
     return $me->setValues($values);
 }
Пример #3
0
<?php

// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
require_once 'tiki-setup.php';
global $reportFullscreen, $index, $values;
$headerlib = TikiLib::lib('header');
$smarty = TikiLib::lib('smarty');
$access = TikiLib::lib('access');
$access->check_feature('feature_reports');
TikiLib::lib("sheet")->setup_jquery_sheet();
$headerlib->add_jsfile('lib/core/Report/Builder.js')->add_jq_onready('$.reportInit();');
$smarty->assign('definitions', Report_Builder::listDefinitions());
if (!empty($reportFullscreen)) {
    $smarty->assign('index', $index);
    $smarty->assign('values', $values);
    $smarty->assign('reportFullscreen', 'true');
    $smarty->display('tiki-edit_report.tpl');
} else {
    $smarty->assign('mid', 'tiki-edit_report.tpl');
    $smarty->display("tiki.tpl");
}
Пример #4
0
function wikiplugin_report( $data, $params )
{
	global $tikilib,$headerlib,$prefs,$page,$tiki_p_edit;
	static $reportI = 0;
	++$reportI;
	
	$params = array_merge(array("view"=> "sheet","name"=> ""), $params);
	
	extract($params, EXTR_SKIP);
	
	if (!empty($data)) {
		$result = "";
		$report = Report_Builder::loadFromWikiSyntax($data);
		$values = Report_Builder::fromWikiSyntax($data);
		$values = json_encode($values);
		$type = $report->type;
		
		switch($view) {
			case 'sheet':
				TikiLib::lib("sheet")->setup_jquery_sheet();
				
				$headerlib->add_jq_onready(
								"
					var me = $('#reportPlugin$reportI');
   				me
						.show()
						.visible(function() {
							me
								
								.sheet({
									editable: false,
									buildSheet: true
								});
						});"
				);
				
				$result .= "
					<style>
						#reportPlugin$reportI {
							display: none;
							width: inherit ! important;
						}
					</style>
					
					<div id='reportPlugin$reportI'>" 
						. $report->outputSheet($name) . 
					"</div>";
    			break;
				
		}
	}
	
	if ($tiki_p_edit == 'y') {
		$headerlib
			->add_jsfile("lib/core/Report/Builder.js")
			->add_js(
							"
			function editReport$reportI(me) {
				var me = $(me).removeAttr('href');
				me.serviceDialog({
					title: me.attr('title'),
					data: {
						controller: 'report',
						action: 'edit',
						index: $reportI
					},
					load: function() {
						$.reportInit();
						var values = $.parseJSON('$values');
						
						if (values) {
							$('#reportType')
								.val('$type')
								.change();
							
							values['type'] = null;
							
							$('#reportEditor').one('reportReady', function(){
								$('#reportEditor').reportBuilderImport(values);
							});
						}
					}
				});
				return false;
			}
		"
			);
		
		$result .= "
			<form class='reportWikiPlugin' data-index='$reportI' method='post' action='tiki-wikiplugin_edit.php'>
				<input type='hidden' name='page' value='$page'/>
				<input type='hidden' name='content' value=''/>
				<input type='hidden' name='index' value='$reportI'/>
				<input type='hidden' name='type' value='report' />
				<input type='hidden' name='params[name]' value='$name' />
				<input type='hidden' name='params[view]' value='$view' />
			</form>
			<span title='".tr('Edit Report')."' style='cursor: pointer;' onclick='return editReport$reportI(this);'>
				<img src='img/icons/page_edit.png' alt='$label' width='16' height='16' title='$label' class='icon' />
			</span>";
	}
	return "~np~" . $result . "~/np~"; 
}
Пример #5
0
 function action_wikidata($input)
 {
     echo Report_Builder::load($input->type->string())->setValuesFromRequest($input->value->string())->outputWikiData();
     die;
 }