help to better help you:

Please: add always Joomla / JEM version and details to your posts, so we can try to reproduce your issue!

[SOLVED] Myplanning works but not the menu link

[SOLVED] Myplanning works but not the menu link

4 years 11 months ago
#26858
Beginner in the knowledge of JEM.
There is a calendar by category or by location, but I don't know if it is possible to display a calendar showing all the events of a single joomla user.
There is a list of his own events, but not in the form of a calendar.
Thank you
The following user(s) said Thank You: jojo12

Please Log in or Create an account to join the conversation.

Re: [SOLVED] Myplanning works but not the menu link

4 years 11 months ago
#26859
Interesting idea. Try and share if you succeed!

Please Log in or Create an account to join the conversation.

Re: [SOLVED] Myplanning works but not the menu link

4 years 11 months ago
#26878
Hello,
I just added myplanning to the com_jem component by copying and pasting other parts of code.
I then applied some modifications.
It is therefore not an optimized solution.
Then see the description.

After a few tests, it seems to work for my joomla and jem environment.
I then created the menu link under the joomla administrator.
in URL link :
index.php?option=com_jem& view=myplanning

BUT I can create this link automatically by myself without any modification
the selection in Menu Item type by the JEM component by selecting Calendar (Shows a Calendar) !!!!!
Obviously it is practical but I lose the real Calendar which is replaced by myplanning ....

I can't figure out how to change this error.
How jem allows joomla to make menu links?

Anyone have an idea?
Thank you


description to do Myplanning-

Myplanning


1) com_jem/controller.php (edit)

switch ($viewName) {
case 'attendees':
case 'calendar':
case 'myplanning':




2) views/myplanning (new)

a) Copy all View calendar

b) change  in view.html.php:
class JemViewMyplanning extends JviewLegacy

c) change  in view.html.php:
$url_base = 'index.php?option=com_jem&view=myplanning' . $partItemid;


3) models/myplanning.php (new)

a) Copy Model calendar and change
class JemModelMyplanning extends JemModelEventslist

b) change
getListQuery() by protected function getListQuery() from eventlist.php

[strike]$query->join('LEFT', '#__jem_countries AS ct ON ct.iso2 = l.country');[/strike]

[strike]$query->join('LEFT', '#__users AS u on u.id = a.created_by');[/strike]

after ordering

# Get the WHERE clause for the query
$where = $this->_buildWhere();

[strike]$query->select('DATEDIFF(a.enddates, a.dates) AS datesdiff, DAYOFMONTH(a.dates) AS start_day, YEAR(a.dates) AS start_year, MONTH(a.dates) AS start_month');[/strike]

$query->where( $where);

c) add
protected function _buildWhere() from myevents.php

[strike]a.access[/strike]
[strike]a.published[/strike]

Attachments:

The following user(s) said Thank You: jojo12

Please Log in or Create an account to join the conversation.

Re: [SOLVED] Myplanning works but not the menu link

4 years 11 months ago - 4 years 11 months ago
#26881
Hi, I tried to reproduce this myplanning part to understand how it works and where the problems are. But I did not understand all in the models part.
Are you working with JEM 2.2.3?
Last edit: 4 years 11 months ago by jojo12. Reason: typos

Please Log in or Create an account to join the conversation.

Re: [SOLVED] Myplanning works but not the menu link

4 years 11 months ago
#26882
Hi,

Sorry my explanations on the model are not well formulated.

yes i am using 2.2.3:
Package: 2.2.3 February 2018
Component: 2.2.3 February 2018
Module-Basic: 2.2.3 August 2017
Calendar module: 2.2.3 December 2017
Module-Banner: 2.2.3 February 2018
Module-Jubilee: 2.2.3 February 2018
Module-Teaser: 2.2.3 February 2018
Module-Wide: 2.2.3 August 2017
Plugin-Content: 2.2.3 December 2014
Plugin-Content List Events: 2.2.3 December 2017
Plugin-Finder: 2.2.3 January 2015 deactivated
Plugin-Search: 2.2.3 June 2015 deactivated
Plugin-Comments: 2.2.3 December 2014 disabled
Mailer Plugin: 2.2.3 September 2017 disabled
PHP: 7.3.11-1 ~ deb10u1
GD: 2.2.5
the principle is as follows:
myplanning comes from:
a) calendar.php
I use the calendar model and I modify the calendar getListQuery by replacing it with the getListQuery from myevents.php.
But I don't need the information about country (ct) and author (u) either I delete:
$ query-> join ('LEFT', '#__jem_countries AS ct ON ct.iso2 = l.country');
$ query-> join ('LEFT', '#__users AS u on u.id = a.created_by');

b) then I need to retrieve the where clause from controllers / myevents.php or protected function buildwhere () where is:
// then if the user is the owner of the event
$ where [] = 'a.created_by ='. $ this -> _ db-> Quote ($ user-> id);
I delete the
$ where [] = 'a.access IN ('. implode (',', $ levels). ')';
$ where [] = 'c.access IN ('. implode (',', $ levels). ')';
because already covered in the model calendar.

c) I copy protected function _buildWhere () modified in myplanning.php
and I add in protected function getListQuery () of myplanning.php after
# ordering
$ orderby = $ this-> getState ('filter.orderby');
if ($ orderby) {$ query-> order ($ orderby);}
this
// after
# Get the WHERE clause for the query
$ where = $ this -> _ buildWhere ();

and invalid
// here we can extend the query of the Eventslist model
//$query->select('DATEDIFF(a.enddates, a.dates) AS datesdiff, DAYOFMONTH (a.dates) AS start_day, YEAR (a.dates) AS start_year, MONTH (a.dates) AS start_month ') ;

Thanks

Attachments:

The following user(s) said Thank You: jojo12

Please Log in or Create an account to join the conversation.

Re: [SOLVED] Myplanning works but not the menu link

4 years 11 months ago
#26883
you should change in line 3 and 5 of views/myplanning/tmp/default.xml from
COM_JEM_CALENDAR_VIEW_DEFAULT_TITLE to "COM_JEM_MYPLANNING_VIEW_DEFAULT_TITLE"
then you get a menu which links there.
You're great!
It would be awesome to add a menu which shows all the attendings of a user corrresponding to MYATTENDANCES!

Please Log in or Create an account to join the conversation.

Time to create page: 0.626 seconds