Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TandemPlugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Uni Osnabrück
Plugins
TandemPlugin
Commits
aae4ce90
Commit
aae4ce90
authored
7 years ago
by
Moritz Strohm
Browse files
Options
Downloads
Patches
Plain Diff
do not show "my tandems" page on other user's profiles, fixes #3
parent
5a354064
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
TandemPlugin.class.php
+55
-37
55 additions, 37 deletions
TandemPlugin.class.php
plugin.manifest
+1
-1
1 addition, 1 deletion
plugin.manifest
with
56 additions
and
38 deletions
TandemPlugin.class.php
+
55
−
37
View file @
aae4ce90
...
...
@@ -39,21 +39,23 @@ class TandemPlugin extends StudIPPlugin implements SystemPlugin, PortalPlugin
bindtextdomain
(
'TandemPlugin'
,
__DIR__
.
'/locale'
);
//add JavaScript file:
PageLayout
::
addHeadElement
(
'script'
,
PageLayout
::
addHeadElement
(
'script'
,
array
(
'src'
=>
$this
->
getPluginURL
()
.
'/assets/javascript/TandemPlugin.js'
,
'type'
=>
'text/javascript'
),
),
''
);
//add CSS file:
PageLayout
::
addHeadElement
(
'link'
,
PageLayout
::
addHeadElement
(
'link'
,
array
(
'href'
=>
$this
->
getPluginURL
()
.
'/assets/css/TandemPlugin.css'
,
'rel'
=>
'stylesheet'
,
'type'
=>
'text/css'
),
),
''
);
...
...
@@ -61,34 +63,50 @@ class TandemPlugin extends StudIPPlugin implements SystemPlugin, PortalPlugin
//navigation items:
if
(
Navigation
::
hasItem
(
'/profile'
))
{
//we're on the user's profile page: add the navigation item.
$navigation
=
new
Navigation
(
dgettext
(
'TandemPlugin'
,
'Meine Tandems'
),
PluginEngine
::
getURL
(
'tandemplugin/my_tandems/index'
)
);
/*
$sub_navigation = new Navigation(
dgettext('TandemPlugin', 'Übersicht'),
PluginEngine::getURL('tandemplugin/my_tandems/index')
);
$navigation->addSubNavigation('index',$sub_navigation);
$sub_navigation = new Navigation(
dgettext('TandemPlugin', 'Meine Tandem-Profile'),
PluginEngine::getURL('tandemplugin/my_tandems/profiles')
);
$navigation->addSubNavigation('profiles', $sub_navigation);
$sub_navigation = new Navigation(
dgettext('TandemPlugin', 'Meine Sprachtandems'),
PluginEngine::getURL('tandemplugin/my_tandems/pairs')
);
$navigation->addSubNavigation('pairs', $sub_navigation);
*/
$user
=
User
::
findCurrent
();
$show_navigation
=
false
;
//Check if we are on the profile page of the current user:
if
(
!
Request
::
get
(
'username'
))
{
//No username parameter set:
//We must be on the current user's profile page.
$show_navigation
=
true
;
}
else
{
if
(
Request
::
get
(
'username'
)
==
$user
->
username
)
{
$show_navigation
=
true
;
}
}
Navigation
::
addItem
(
'/profile/my_tandems'
,
$navigation
);
if
(
$show_navigation
)
{
//add the navigation item.
$navigation
=
new
Navigation
(
dgettext
(
'TandemPlugin'
,
'Meine Tandems'
),
PluginEngine
::
getURL
(
'tandemplugin/my_tandems/index'
)
);
/*
$sub_navigation = new Navigation(
dgettext('TandemPlugin', 'Übersicht'),
PluginEngine::getURL('tandemplugin/my_tandems/index')
);
$navigation->addSubNavigation('index',$sub_navigation);
$sub_navigation = new Navigation(
dgettext('TandemPlugin', 'Meine Tandem-Profile'),
PluginEngine::getURL('tandemplugin/my_tandems/profiles')
);
$navigation->addSubNavigation('profiles', $sub_navigation);
$sub_navigation = new Navigation(
dgettext('TandemPlugin', 'Meine Sprachtandems'),
PluginEngine::getURL('tandemplugin/my_tandems/pairs')
);
$navigation->addSubNavigation('pairs', $sub_navigation);
*/
Navigation
::
addItem
(
'/profile/my_tandems'
,
$navigation
);
}
}
if
(
RolePersistence
::
isAssignedRole
(
User
::
findCurrent
()
->
id
,
'TandemAdmin'
)
...
...
@@ -104,8 +122,8 @@ class TandemPlugin extends StudIPPlugin implements SystemPlugin, PortalPlugin
Icon
::
create
(
"roles"
,
"navigation"
)
);
Navigation
::
addItem
(
"/tandemplugin"
,
$top_navigation
);
$sub_navigation
=
new
Navigation
(
dgettext
(
'TandemPlugin'
,
'Etablierte Tandems'
),
PluginEngine
::
getURL
(
'tandemplugin/admin/pairs'
)
...
...
@@ -123,7 +141,7 @@ class TandemPlugin extends StudIPPlugin implements SystemPlugin, PortalPlugin
PluginEngine
::
getURL
(
'tandemplugin/admin/pairs'
,
[
'status'
=>
'-1'
])
);
$navigation
->
addSubNavigation
(
'rejected'
,
$sub_navigation
);
$sub_navigation
=
new
Navigation
(
dgettext
(
'TandemPlugin'
,
'Aufgelöste Tandems'
),
PluginEngine
::
getURL
(
'tandemplugin/admin/terminated_pairs'
)
...
...
@@ -159,7 +177,7 @@ class TandemPlugin extends StudIPPlugin implements SystemPlugin, PortalPlugin
$template
=
$factory
->
open
(
'start.php'
);
$user_id
=
User
::
findCurrent
()
->
id
;
$template
->
set_attribute
(
'current_user_id'
,
$user_id
);
$profiles
=
TandemProfile
::
findBySql
(
...
...
@@ -175,7 +193,7 @@ class TandemPlugin extends StudIPPlugin implements SystemPlugin, PortalPlugin
$pair_exist
=
[];
$match_count
=
[];
$matches_exist
=
false
;
foreach
(
$profiles
as
$profile
)
{
$pairs
[
$profile
->
id
]
=
TandemPair
::
findByProfileAndStatus
(
$profile
,
1
)[
0
];
$pair_requests
[
$profile
->
id
]
=
TandemPair
::
countByProfileAndStatus
(
$profile
,
0
);
...
...
@@ -187,7 +205,7 @@ class TandemPlugin extends StudIPPlugin implements SystemPlugin, PortalPlugin
}
}
}
$template
->
set_attribute
(
'pair_requests'
,
$pair_requests
);
$template
->
set_attribute
(
'pairs'
,
$pairs
);
$template
->
set_attribute
(
'matches_exist'
,
$matches_exist
);
...
...
This diff is collapsed.
Click to expand it.
plugin.manifest
+
1
−
1
View file @
aae4ce90
pluginname=TandemPlugin
pluginclassname=TandemPlugin
origin=data-quest
version=0.7
version=0.7
.1
description=Dieses Plugin ermöglicht es, Sprachtandems innerhalb der Stud.IP Platform zu bilden.
studipMinVersion=3.99
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment