I have researched for this solution all month but I didn't get the right answer for my page. Please take a look and give me suggestions.
I have the admin page and the view is Dashboard.
I have tables are Staffs, Customers, Comments, Contacts....
I created these page to show data on view successfully for each of them.
NOW, I want to make the dashboard page to view each 5 top new Staffs, Customers, Comments....were being added to system. The summary page. My Dashboard page will be my main page (when access the domain, it will direct to dashboard page).
My question are:
Where should I create the Dashboard page in?
How can I take the data from Staff Controllers, Customers Controller....in the dashboard page. Dashboard page is not include in view of these above controllers.
I use cakephp 1.3
Please give me the best suggestion for this. Thank everyone much !
First of all it depends upon the way you wanna go ahead:
1) Where should I create the Dashboard page in?
Its totally upto you where you want to create the page, but it should ideally be the page to be redirected after the admin login.(BTW its a foolish question to be asked.)
2) How can I take the data from Staff Controllers, Customers Controller....in the dashboard page. Dashboard page is not include in view of these above controllers.
You can do that in 2 ways:
a) Create common functions for these in their respective model and just call those into your single function created for dashboard.
b) Create functions in their respective controller and import the controller and use these methods in the dashboard function(But avoid this approach as long as you can as it will load unnecessary controller class files).
Hope it helps you.
Related
I readed doku and search about middleware on october informations, but nothing find what me can help.
My Problem:
I created Plugin and use RainLab User Plugin for Frontend Editoring of Content.
Frontend Content spilt up on Section, Group and Article.
Single Users become different access: hiddem, show, edit and more for sections and articles.
The site works with one plugin on content load dynamic.
How i can load content for single user by access config?
My solution:
I added on backend some functions to give access for users.
rainlab user content access
All access configs saved and works.
My idee is to create middleware to load content but i find nothing what can help me.
Docu tell me you can create middleware but middleware load all time on frontend, backend, all pages on website. This is not good solution.
https://octobercms.com/docs/backend/controllers-ajax#controller-middleware
In addition comes if i debug on middleware, so rainlab user functions not working, no informations about url request.
Why add middleware when you must load and create all classes and functions by himself??
I need middleware only for frontend and only for plugin or component.
I hope somebody can me help to find another solution or idee to fix it.
I think there is nothing left but to implement the content access in respective component on onRun function. :( and problem by this solution is: return Redirect not working outside a class or function (only on onRun)
There is Problem with your approach, as you want middleware and also you want to make sure it run for specific plugins and component. middleware worked based on request and request may have information about URL etc. but not about plugin & component etc so it can not determine when to run based on plugin etc..`
So you may use Different approach. and it will work with Frontend also with ajax requests.
You can create component inside your plugin, It will assessment all the access for logged in user if user is logged in. if user is not logged in you can provide different assessment access.
Now you need to add this component to your layout and now all pages which are using this layout have this access information from the beginning.
Now this component inject access information to page, So your Page and plugin's components can have this information readily available. now from your component inside onRun you can handle redirect at very top.
Component is not to define access, its just inject predefined access information which is in database [ as you said you use users plugin so fetch it and inject it ] to the page
Component will be specifically just inject access information to page. And that Component will be on layout so. it will automatically trigger for that layout pages. so it will executed first and based on that you can decide how to use it. you can also render conditional component based on that. as you can have access information in markup part as well so
if you have any doubt or questions please comment.
I am new to Joomla component developement and currently fighting with certain basic design patterns!
Lets say, I am developing a component where users can enter simple notes into their personal notebooks.
On calling the view "index.php?option=com_notebook&view=notes" I simply show a list of all note entries of the user. No problem so far, this is working fine.
Now I want to extend my component with the following feature: on opening the view "index.php?option=com_notebook&view=notes", I want to check if the user has already created a notebook before. If yes, I show all note entries, if not, I want to load a different view which contains a form to create a new notebook with certain options.
But how can this be done in a clean way?
For sure, I just can implement the form within the view "notes", but this is not the clean way, isnt it?
I also tried to override the function "display()" of the main controller and set the view manually if no notebook exists. But if I do so, I have to handle all calls to other views of my component manually within the function "display()". To solve this, I created a copy the original implementation from the class "JControllerLegacy" and changed it to my needs - this is working - but is this really the best way to handle problems like this?
So I ask you, what is the best approach to solve this problem?
Thx a lot!
According to me the best solution of your problem is to provide "New" and "Edit" button to your notebook listing page and create edit view of notbook. Same as Joomla has articles and article views.
So, As you mentioned above if use dose not have any notebook then he/she can create a new notebook using that "New" button. when user clicked on "New" button he has blank form where he/she can create new notebook.
here is the example how to create listing and edit view in Joomla. Hope this will help you.
https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_backend_actions
I want to build a multi user website where my users register and their account is created.
After sign up the user gets a specific url to build his website. Like. Mysite.com/user1
Now the user can login to the control panel and publish his data. Eg he has created a faq page.
His faq page should be available like
Mysite.com/user1/faq
I've done everything but this faq page building does not work at all.
I check the user for existence in the DB and route to his page in the routes.php file
:any = home/loader/$1
And in loader.php I fetch the details and display his welcome page, for the faq page, I have created a function in the loader.php controller as
Faq()
And built a custom view for it but now when I try to access the page it only loads the welcome page.
I tried all methods but it does not work.
I suggest you have a look at the Tutplus
http://code.tutsplus.com/tutorials/basecamp-style-subdomains-with-codeigniter
It explains how to work with wildcard routing in codeigniter
So I have few articles in my menu which are for registered users only. I want them to be visible for everyone but if the user is not logged-in once he clicks on the menu I want him get redirected to the login page..
I saw this tutorial: Auto redirect guests to login but it seems outdated, in joomla 3.3 I can't find any "alias" menu item type.
Is there any alternative for that?
Iam using Joomla 3.3.1 with Community Builder.
-Thank you.
There are two ways you could do this really. One is through code and the other is through the administrators panel. I'm assuming based on the question you are interested in the back end solution.
This involves creating two unique menu items with the same name (alias' would need to be different). One which is only visible to logged in users, which points to the component view desired. The second menu is only visible to guests, and will point to the user log in component view with a redirect url set to component view you wish them to be redirected to.
I attached a link below to an article explaining how to only show menu items to guests and have them hide when users are logged in.
http://docs.joomla.org/How_do_you_hide_something_from_logged_in_users%3F
I developed an application with different MVCs using the Yii Framework
For example
I created a crud layer for Student Contact details and Student Courses etc.
All worked perfectly since each had its own menu, and when clicked eachs own view rendered.
Now my client wants everything on one page, and is quite persistent, we are talking about 7 MVC that need to be displayed on one page. Each MVC has it's own controller, model and view and own DB table. How can I render all of them on one page without re-writing the whole application? Is this possible.
If I understood your problem correctly, you simply want to merge all menu items and show the full navigation on each page.
By separating menus into standalone views and including each and one of them into a navigation view, you can have a well-structured non-repeating code.
$this->renderPartial('anotherView');
is pretty much everything you might need to know to get started. This is only callable in views as $this refers to the current controller object.
You can use views from other controllers:
$this->renderPartial('application.views.student_Contact.show',array('model'=>$model));
Hope this helps.