How to run sql query to return data from different joomla components - mysql

I am trying to customize the source files of a Joomla component.
Before the Joomla MVC model introduced, I was able to run SQL queries in a component, Kunena 1.0 to select data from another component. e.g Sobi2.
However, after Kunena 1.5 [MVC model] was introduced, I do not know how / where to add the SQL query to select data from Sobi2.
I believe I need to add some codes in the files of the /models/ or /func/ folder. But can someone provide more detailed assistance on how I can achieve this?

The data interaction is done by the model, you will find Kunena models in the model folder.
Querying the SOBI2 databse is the same as before, MVC wouldn't actually affect how you do this.
To get your head around MVC, have a look at:
http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
For examples of how to query the database in your model, look at:
http://docs.joomla.org/How_to_use_the_database_classes_in_your_script
In simple terms, the Controller directs to the appropriate view (view.html.php), this view then interacts with the model, and then directs to a template file (normally located in the view/tmpl folder.
Hope this helps.

Related

When to create a module in Yii2 Advanced template?

I am little confused before starting a new project in Yii2 advanced template. So, i am asking this question.
I have done some projects in "Yii2 basic" app in which we use modules for different parts of our application like for adminpanel, api we create different folders in 'modules folder'.
I had also done a project in Yii2 advanced template it was multiapp project so we used advanced template. As we already had 'backend' and 'frontend' separated in Yii2 advanced template so we didn't created any module in 'modules' folder.
Now, i want to ask what is right approach. like in my new project we have users and products in backend so is it appropriate to create different modules for them in 'modules' folder or will it be ok if i create there controllers and models directly in backend folder.
what are the advantages of using modules folder in advanced template?
Thanks for answers in advance.
The advantage of module's use is primarly the possibilities of a resue of this components in several diffferente project. you can easly separate you common repetative functionalities in several modules and use the same code in different prject indipendently of the "template" or scaffolding you use for the single applicazione or group of applications.
Do the fact the modules are self-contained software units that consist of models, views, controllers, and other supporting components
modules are, not only usable as a sort of mini-applications, but also as a easy way for code organization and reuse.
Modules are used to reduce our work.
Example:
In most of projects have user login function like login , signup ,
forget passsword ,password reset.
If you write code for these functions as module . You can use any
project
So there is know need to write one code again and again.

How to add manage temparory data in DotnetNuke?

I am beginner in DNN. I am creating a module which provides Login, Dashboard and Add-Update Form. I have data in JSON format. I want to store it temparory while user use the website. Data will be destroy as soon as user will close the website.
Currently I have created a folder in my Solution Explorer of project in Visual Basic and created 3 .json files which stores login_info.json, basic_info.json and auth_info.json. I write json data whenever user login and I make it blank when user logout.
Above method is working fine now but I afraid it will work when I will publish this module.
Also I may have situation where I need to store image some where. I don't know how I will manage.
Can anybody please guide me?
Is this proper way to store data temparory in DNN?
Is there any other better way?
After getting one of reply for Database Suggestion
Is there any table which same as User Meta in DotnetNuke?
You use the ConnectionString that is used by DNN and access the database as you would normally.
DotNetNuke.Common.Utilities.Config.GetConnectionString()
Or you can use the Data Access Layer that the DNN Framework supplies. For that take the Christoc Templates. In there is all you need to communicate with the DB.

How to merge multiple cucumber results into a single report?

I have a strong test suit built using Cucumber - WATIR. Also I am using pretty face reports to generate test execution report which gives a crispy dashboard. Along with that I also do create HTML and json reports too.
I set up all the reports to be generated in a folder with the day, and browser name. so today it would be like 11-15/IE9/ and 11-15/FIREFOX/ etc. So I need a way to prepare a report where I should get a report which should be a merge of all the reports. Any suggestion how to achieve will be highly appreciated.
How can I do this with generated json or html reports?
Also a thought in my mind is , any how I am having pretty face report, where I am getting a dashboard with name index.html inside 11-15/IE9/ and 11-15/FIREFOX/, I want to create a dynamic HTML page where it reads all the datefiles/browser creates links to the index.html on it.
Awaiting any new idea or any enhancement to my existing idea.

fluent nhibernate + how to create sql schema

I have a question about how to render the sql schema with fluent nhibernate.
I have searched alot and used a couple of things but i dont know how to render it. I´m only building the ground of my website, the core. And now i want to create the database from my mappings. How do i do that? Is it with testrunning or what?
If i build the solution i don´t get any sql file i have also tried export it to hbm files to use schema tool export but dont get it to work.
have tried
Fluent NHibernate (1.2.0.712) export mappings to HBM not working / not respecting conventions
and
https://stackoverflow.com/questions/5244257/build-schema-with-fluent-nhibernate
and alot other links.
What do i have to do to get the sql file? every site give almost the same code but they don´t tell how to render it. How to execute the process to retrieve the file..
can anyone tell me? i can build it by my self but i want to try this function!
best regards
You can create the database using the SchemaExport.Create method:
// this NHibernate tool takes a configuration (with mapping info)
// and exports a database schema from it
new SchemaExport(config)
.Create(true, true);
If you want to see the generated SQL, you can use the ShowSql method, but this is not required to create the database.
_sessionFactory = Fluently.Configure()
.Database(SQLiteConfiguration.Standard
.UsingFile(SqliteDatabaseFullPath())
// Display generated SQL in Output window
.ShowSql()
)
...
It's been my experience with NHibernate that it's almost always best to start with a working example, so I suggest you get the FirstAutomappedProject sample project that is part of the FNH source. This will give you all the pieces you need.
Probably easiest to download the zip file (button on the upper left) which includes all the FNH source code, and look in the "src" folder for the examples.

Error using Dynamic Data Filtering: missing datasource

I am trying to use the ASP.NET Dynamic Data Filtering project, but I'm running into a problem during the configuration.
I'm following the instructions on the author's blog, and everything works like described. Then it tells me to change the datasource using the designer view. I am told to select the "GridDataSource" in the "Configure data source" wizard. This option is not there though.
I get all of the classes in my project, including the DataContext that was generated by Linq. When I choose "Show only DataContext objects", the dropdown ("Choose your context object:") is completely empty.
When I turn of the checkbox and choose my DataContext class, I get asked which table I want and all that. But, as the whole purpose of a Dynamic Data site is NOT to use one single table, that's not much help.
So I've looked at the instructions again and copied the resulting datasource from the example:
<asp:DynamicLinqDataSource ID="GridDataSource" runat="server"
EnableDelete="True" EnableUpdate="True"></asp:DynamicLinqDataSource>
Which is exactly what I had, without the "WhereParameters" nodes in there.
Now, when I run the list page however, I get an exception about a missing datasource from the filtering component. Of course when I remove the DynamicFilterRepeater, it works again.
This is the meat of the exception:
[InvalidOperationException: Missing DataSource]
Catalyst.Web.DynamicData.DynamicFilterRepeater.GetTable() in D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs:74
Catalyst.Web.DynamicData.DynamicFilterRepeater.GetFilters() in D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs:81
Catalyst.Web.DynamicData.DynamicFilterRepeater.OnInit(EventArgs e) in D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs:106
How do I make the DynamicFilterRepeater recognize my datasource?
I'm using VS2010 Pro, on a Win7 machine.
have you looked at the sample project you get when you download the source code.
Have a look at my blog post here Dynamic Data Filtering – Installation