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:-
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.
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.
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.
If user parameters are conditionally added based upon them being set, like criteria is.
Manually pass in criteria on the page the embeds the report.
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?
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.
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?
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?
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!
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:
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 “[size=2]Main Query - Error: User parameter fid, specified but not provided to reportico.[/size][size=2]” 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.[/size]
[size=2]
[/size]
[size=2]sorry for the frustration but i’ve spend several hours on this over the weekend and this really should be a no brainer.[/size]
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 :-