Yii Framework Forum: [Module] Reportico Report Writer - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Module] Reportico Report Writer Integrates Reportico Open Source Report Designer into Yii Rate Topic: -----

#1 User is offline   Reportico 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 07-September 13

Posted 12 September 2013 - 03:57 PM

Hi there


I do much of the development on Reportico (open source php report writer) at reportico.org


I recently needed to incorporate this into a Yii application I have been involved with, so I thought I'd write a module for it. I have developed a first cut of this, and i'd appreciate any comments.

I have added a Yii page to the Reportico web site where you can download this module. It also provides getting started information and examples. It is here:-

http://www.reportico...rtico/index.php

I hope this is useful .. Please let me know what you think.

Peter Deed
0

#2 User is offline   enotirab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 14-January 11

Posted 19 September 2013 - 11:38 AM

View PostReportico, on 12 September 2013 - 03:57 PM, said:

Hi there


I do much of the development on Reportico (open source php report writer) at reportico.org


I recently needed to incorporate this into a Yii application I have been involved with, so I thought I'd write a module for it. I have developed a first cut of this, and i'd appreciate any comments.

I have added a Yii page to the Reportico web site where you can download this module. It also provides getting started information and examples.

As this is my first post on this forum im not allowed to post a link to it, but if you go to the reportico.org home page you can find a link to this yii demo site on the right hand side (under the reference to the joomla plugin )

I hope this is useful .. Please let me know what you think.

Peter Deed


First of let me say I REALLY love reportico! It is well written and extremely useful. I was trying to just the regular version of reportico and ran into some issues with relative URLS to my project when I tried to embed it into a page. It looked great inside the project suite, however all the images where gone and I had to manually add the css links when I embeded a report in a page. Once I saw that you had a Yii module I was very excited because I figured that these issues would be addressed in said module.

So I installed the module and started through the steps to update the admin password when I discovered an issue that I'm not exactly sure how to resolve. My site uses the 'path' style of URL instead of the 'get' style. That is to say that URLS come in the flavor of "index.php/controller/action" instead of "index.php?r=controller/action". Many of the URL components are hard-coded into the module and in their current state it seems they are incompatible with path style urls.
0

#3 User is offline   Reportico 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 07-September 13

Posted 19 September 2013 - 02:52 PM

Thanks very much for the information...

i must admit im not the most experienced with yii and wasnt really too aware of the path method

Ive just changed my setup to path method and it seems like you say to be very broken :-(..

Im hoping its not too difficult to fix .. ill see how i get on

Peter
0

#4 User is offline   enotirab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 14-January 11

Posted 19 September 2013 - 03:24 PM

View PostReportico, on 19 September 2013 - 02:52 PM, said:

Thanks very much for the information...

i must admit im not the most experienced with yii and wasnt really too aware of the path method

Ive just changed my setup to path method and it seems like you say to be very broken :-(..

Im hoping its not too difficult to fix .. ill see how i get on

Peter



Awesome, please let me know how it comes out. I'll let you know if I run into any other issues!
0

#5 User is offline   Reportico 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 07-September 13

Posted 26 September 2013 - 04:02 PM

Hi enotirab

Ive put a new version of the module up on the site at the same location :-
http://www.reportico...rtico/index.php


This now should work in both "path" and "get" modes .. fingers crossed!



Also ive fixed it up so it works better with yii-bootstrap if thats of any use.

Please let me know how you get on if you try it ..

Good Luck!
Peter
0

#6 User is offline   enotirab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 14-January 11

Posted 08 October 2013 - 05:20 PM

View PostReportico, on 26 September 2013 - 04:02 PM, said:

Hi enotirab

Ive put a new version of the module up on the site at the same location :-
http://www.reportico...rtico/index.php


This now should work in both "path" and "get" modes .. fingers crossed!



Also ive fixed it up so it works better with yii-bootstrap if thats of any use.

Please let me know how you get on if you try it ..

Good Luck!
Peter


Works exceptionally well! This module also got ride of some issues I was experience with regular version of Reportico and Yii sessions conflicting. Excellent work.
0

#7 User is offline   enotirab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 14-January 11

Posted 10 October 2013 - 06:35 PM

Okay, follow up question for you. Not sure if you want these here or on the reportico forums.

One thing I really like about your setup is that you can include criteria with an [] to have it conditionally added to a query if it is included; this is SUPER handy. I am in a situation where I need the exact same behavior on a PreSQL query, but with user parameters. I'm using an embedded report with a custom interface so I have need to pass criteria that the user enters into Reportico. User parameters serve this purpose but if I do something like have a PreSQL that looks like:

SELECT trans_id, amount, date FROM transactions WHERE
amount > 50
[AND date >= {USER_PARAM,sDate}]

ect I get an error if sDate is not set or is set to NULL. I'd like to be able pass sDate to Reportico in such a way that it will conditionally add the parameter to the query if it is set.

I can imagine doing this in one of three ways.

1. If user parameters are conditionally added based upon them being set, like criteria is.
2. Manually pass in criteria on the page the embeds the report.
3. Have access to the PreSql code on that page to problematically alter it based on user input.


Is there a way to already do this that I am missing?
0

#8 User is offline   Reportico 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 07-September 13

Posted 11 October 2013 - 01:15 AM

Ok thats an interesting one...
I think the ability to make the user_parameters conditional would be the best way as per your suggestion..

I just got it working by passing the whole Where clause in the parameter .. so

SELECT trans_id, amount, date FROM transactions WHERE
amount > 50
{USER_PARAM,sDate}

and pass in with

$q->user_parameters["sDate"] = "WHERE date > '2013-10-01'";

I know its not ideal but does that help?
0

#9 User is offline   enotirab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 14-January 11

Posted 11 October 2013 - 10:24 AM

View PostReportico, on 11 October 2013 - 01:15 AM, said:

Ok thats an interesting one...
I think the ability to make the user_parameters conditional would be the best way as per your suggestion..

I just got it working by passing the whole Where clause in the parameter .. so

SELECT trans_id, amount, date FROM transactions WHERE
amount > 50
{USER_PARAM,sDate}

and pass in with

$q->user_parameters["sDate"] = "WHERE date > '2013-10-01'";

I know its not ideal but does that help?


Well I'm a little embarrassed that I didn't even think of that. It also occurred to me that I could last night that I could just build the temp-table from the PreSql in the custom code and to the whole thing programmatically also.

Thanks for the provided solution. I realize I'm using Reportico slightly out of the scope it was probably designed for; your help if greatly appreciated.
0

#10 User is offline   enotirab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 14-January 11

Posted 11 October 2013 - 11:37 AM

Oh, one final issue. Since I'm embedding just the output for a report, if I enter criteria that returns no data set, it takes me back to the criteria entry section with a message displaying that there is no data returned, which would be fine if I wasn't using a custom interface. Is there a way to suppress this behavior and instead either just show the header columns with no data, or perhaps just get a message only without switching mode when in output only mode?
0

#11 User is offline   enotirab 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 14-January 11

Posted 11 October 2013 - 05:13 PM

Nevermind on that last one. Found your suggestion
here. Works fine.
0

#12 User is offline   Reportico 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 07-September 13

Posted 14 October 2013 - 06:13 PM

View Postenotirab, on 11 October 2013 - 05:13 PM, said:

Nevermind on that last one. Found your suggestion
here. Works fine.


wow amazed you found that... glad it solved your problem.
0

#13 User is offline   Just Informatics 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 16-October 13

Posted 16 October 2013 - 07:31 AM

Hi Reportico,

Firstly, thanks for your efforts to bring Reportico to Yii.

I'm trying to get reportico set up on my Yii application (as per your install instructions). When I try to navigate to <my application>/index.php/reportico I get an error: Call to undefined method reportico::getIsInitialized()

Is this something you've come across before? Any suggestions?
0

#14 User is offline   Just Informatics 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 16-October 13

Posted 16 October 2013 - 08:04 AM

View PostJust Informatics, on 16 October 2013 - 07:31 AM, said:

Hi Reportico,

Firstly, thanks for your efforts to bring Reportico to Yii.

I'm trying to get reportico set up on my Yii application (as per your install instructions). When I try to navigate to <my application>/index.php/reportico I get an error: Call to undefined method reportico::getIsInitialized()

Is this something you've come across before? Any suggestions?


I resolved my issue by adding:
function getIsInitialized(){
            return true;
        }

to class reportico (reportico.php)
0

#15 User is offline   Reportico 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 07-September 13

Posted 16 October 2013 - 02:52 PM

View PostJust Informatics, on 16 October 2013 - 08:04 AM, said:

I resolved my issue by adding:
function getIsInitialized(){
            return true;
        }

to class reportico (reportico.php)


Thanks for finding this... I havent seen that error come up in my tests, so im interested in what is causing it. I notice that the function is required if a component is derived from a CApplicationComponent or implements IApplicatonComponent, but reportico doesnt. So im guessing that some other yii configuration is causing the reportico component inside the reportico module to be treated as behaving like an Application Component?

Do you have any ideas?

On the basis that this can easily happen elsewhere, I have actually done what you said and uploaded a newer version with that method defined in the reportico class!
0

#16 User is offline   Bear L 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 28-March 14

Posted 15 April 2014 - 04:28 PM

I just installed YiiReportico, and am so far VERY impressed.

I do have a question: I have built a very robust user/group security model for my application. Is there a simple way to bypass the admin/project passwords so that I can pass in whether a user is authenticated and at what level? This would let my users have SSO access to do what they need without a shared project password.

In my application controllers I have code that looks something like this:
public function accessRules()
{
$_permissions=Controller::getModulePermissions('Users');
return array(
array('allow',
'actions'=>array('view'),
'expression'=>"${_permissions['canRead']} === 1",
),
array('allow',
'actions'=>array('update'),
'expression'=>"${_permissions['canUpdate']} === 1",
),
array('allow',
'actions'=>array('admin'),
'expression'=>"${_permissions['canAdmin']} === 1",
),
)
}
0

#17 User is offline   Peter Deed 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 27-April 11

Posted 15 April 2014 - 04:57 PM

If you modify protected/modules/reportico/ReporticoModule.php you can add some extra parameters which can be picked in reports...

so if you find the text ..

        $this->engine->embedded_report = true;
        $this->engine->allow_debug = true;
        $this->engine->framework_parent = "yii";
        $this->engine->external_user = Yii::app()->user->id;
        $this->engine->url_path_to_assets = $this->getAssetsUrl();


Add some more
        $this->engine->user_parameters = array();
        $this->engine->user_parameters["authenticated"] = isauthenticatedtest();
        $this->engine->user_parameters["authentication_level"] = isauthenticatedtest();


then you can pick this up in report SQL using something like
       
       SELECT x 
       FROM y
       WHERE 1 = 1
       AND {USER_PARAM,authenticated} = '1'
       AND {USER_PARAM,authentication_level} = 'admin'


You can pass in any value in using the user_parameter array.

When you press Ok to store the SQL it may report a syntax error but just ignore this .. it should work when you run it

Peter Deed
0

#18 User is offline   Todd Anstis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 01-July 12

Posted 14 July 2014 - 12:37 PM

i love just about everything about Reportico, but i am pulling my hair out trying to pass user parameters. i'm using identical syntax to what's used below, in an embedded yii report, and i am CONSTANTLY getting the "Main Query - Error: User parameter fid, specified but not provided to reportico." what on earth could i be doing wrong? i've even done a print_r of the reportico object and i can see that the value is being passed.


sorry for the frustration but i've spend several hours on this over the weekend and this really should be a no brainer.

View PostPeter Deed, on 15 April 2014 - 04:57 PM, said:

If you modify protected/modules/reportico/ReporticoModule.php you can add some extra parameters which can be picked in reports...

so if you find the text ..

        $this->engine->embedded_report = true;
        $this->engine->allow_debug = true;
        $this->engine->framework_parent = "yii";
        $this->engine->external_user = Yii::app()->user->id;
        $this->engine->url_path_to_assets = $this->getAssetsUrl();


Add some more
        $this->engine->user_parameters = array();
        $this->engine->user_parameters["authenticated"] = isauthenticatedtest();
        $this->engine->user_parameters["authentication_level"] = isauthenticatedtest();


then you can pick this up in report SQL using something like
   	
   	SELECT x 
   	FROM y
   	WHERE 1 = 1
   	AND {USER_PARAM,authenticated} = '1'
   	AND {USER_PARAM,authentication_level} = 'admin'


You can pass in any value in using the user_parameter array.

When you press Ok to store the SQL it may report a syntax error but just ignore this .. it should work when you run it

Peter Deed

0

#19 User is offline   Reportico 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 07-September 13

Posted 14 July 2014 - 03:56 PM

Hi there

Sorry you are having such a problem...

Im suspecting that although your values are being passed, they may not be saved properly in the session..

Do you know if you are using the version 3.2 from a few months ago ( where i know there is a problem )
or the version 4.1 i released about a week ago which should work?

If you are using the 3.2 version then you could try adding code to store the user_parameters through the session...

on around line 3427 of modules/reportico/components/reportico.php there is a line
$this->access_mode = session_item("access_mode", $this->access_mode );


if you after this
$this->user_parameters = session_item("user_parameters", $this->user_parameters );


If you are using new 4.1 it should work already, so let me know and i can debug it but at line modules/reportico/components/reportico.php there is a line :-

$this->user_parameters = register_session_param("user_parameters", $this->user_parameters);


you could put a check of print_r after this.

Anymay let me know some more and i can look further

Peter
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users