Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
b0e3d82e
Commit
b0e3d82e
authored
2 years ago
by
David Siegfried
Committed by
Jan-Hendrik Willms
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
move code to controller, closes
#806
Closes
#806
Merge request
!1243
parent
9ee941ec
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/oer/market.php
+40
-1
40 additions, 1 deletion
app/controllers/oer/market.php
app/views/oer/market/index.php
+12
-46
12 additions, 46 deletions
app/views/oer/market/index.php
with
52 additions
and
47 deletions
app/controllers/oer/market.php
+
40
−
1
View file @
b0e3d82e
...
@@ -25,7 +25,13 @@ class Oer_MarketController extends StudipController
...
@@ -25,7 +25,13 @@ class Oer_MarketController extends StudipController
}
}
$tag_matrix_entries_number
=
9
;
$tag_matrix_entries_number
=
9
;
$this
->
best_nine_tags
=
OERTag
::
findBest
(
$tag_matrix_entries_number
);
$this
->
best_nine_tags
=
OERTag
::
findBest
(
$tag_matrix_entries_number
);
$this
->
tags
=
[];
foreach
(
$this
->
best_nine_tags
as
$tag
)
{
$this
->
tags
[]
=
[
'tag_hash'
=>
$tag
->
tag_hash
,
'name'
=>
$tag
->
name
,
];
}
if
(
Request
::
get
(
"tag"
))
{
if
(
Request
::
get
(
"tag"
))
{
$this
->
materialien
=
OERMaterial
::
findByTag
(
Request
::
get
(
"tag"
));
$this
->
materialien
=
OERMaterial
::
findByTag
(
Request
::
get
(
"tag"
));
}
}
...
@@ -35,6 +41,22 @@ class Oer_MarketController extends StudipController
...
@@ -35,6 +41,22 @@ class Oer_MarketController extends StudipController
if
(
Request
::
get
(
"get"
)
===
"all"
)
{
if
(
Request
::
get
(
"get"
)
===
"all"
)
{
$this
->
materialien
=
OERMaterial
::
findBySQL
(
"1 ORDER BY oer_material.mkdate DESC"
);
$this
->
materialien
=
OERMaterial
::
findBySQL
(
"1 ORDER BY oer_material.mkdate DESC"
);
}
}
$this
->
material_data
=
false
;
if
(
!
empty
(
$this
->
materialien
))
{
$this
->
material_data
=
[];
foreach
(
$this
->
materialien
as
$material
)
{
$data
=
$material
->
toRawArray
();
$data
[
'tags'
]
=
array_map
(
function
(
$tag
)
{
return
$tag
[
'name'
];
},
$material
->
getTopics
());
$data
[
'logo_url'
]
=
$material
->
getLogoURL
();
$data
[
'download_url'
]
=
$material
->
getDownloadUrl
();
$this
->
material_data
[]
=
$data
;
}
}
$this
->
new_ones
=
OERMaterial
::
findBySQL
(
"LEFT JOIN oer_hosts ON (oer_hosts.host_id = oer_material.host_id)
$this
->
new_ones
=
OERMaterial
::
findBySQL
(
"LEFT JOIN oer_hosts ON (oer_hosts.host_id = oer_material.host_id)
WHERE draft = '0'
WHERE draft = '0'
AND (oer_material.host_id IS NULL OR oer_hosts.`active` = '1')
AND (oer_material.host_id IS NULL OR oer_hosts.`active` = '1')
...
@@ -48,6 +70,23 @@ class Oer_MarketController extends StudipController
...
@@ -48,6 +70,23 @@ class Oer_MarketController extends StudipController
"
);
"
);
$statement
->
execute
([
$GLOBALS
[
'user'
]
->
id
]);
$statement
->
execute
([
$GLOBALS
[
'user'
]
->
id
]);
$this
->
abo
=
(
bool
)
$statement
->
fetch
(
PDO
::
FETCH_COLUMN
,
0
);
$this
->
abo
=
(
bool
)
$statement
->
fetch
(
PDO
::
FETCH_COLUMN
,
0
);
if
(
$GLOBALS
[
'perm'
]
->
have_perm
(
'autor'
))
{
$actions
=
new
ActionsWidget
();
$actions
->
addLink
(
_
(
'Neues Lernmaterial hochladen'
),
$this
->
url_for
(
'oer/mymaterial/edit'
),
Icon
::
create
(
'add'
),
[
'data-dialog'
=>
'size=auto'
]
);
$actions
->
addLink
(
$this
->
abo
?
_
(
'Neuigkeiten abbestellen'
)
:
_
(
'Neuigkeiten abonnieren'
),
$this
->
aboURL
(),
Icon
::
create
(
$this
->
abo
?
'decline'
:
'rss'
),
[
'data-dialog'
=>
'size=auto'
]
);
Sidebar
::
Get
()
->
addWidget
(
$actions
);
}
}
}
public
function
get_tags_action
()
public
function
get_tags_action
()
...
...
This diff is collapsed.
Click to expand it.
app/views/oer/market/index.php
+
12
−
46
View file @
b0e3d82e
<?
<?php
$tags
=
[];
/**
if
(
$best_nine_tags
&&
count
(
$best_nine_tags
)
>
0
)
{
* @var Oer_MarketController $controller
foreach
(
$best_nine_tags
as
$tag
)
{
* @var array $material_data
$tags
[]
=
[
* @var array $tags
'tag_hash'
=>
$tag
[
'tag_hash'
],
* @var OERMaterial[] $new_ones
'name'
=>
$tag
[
'name'
]
*/
];
}
}
$material_data
=
false
;
if
(
!
empty
(
$materialien
))
{
$material_data
=
[];
foreach
(
$materialien
as
$material
)
{
$data
=
$material
->
toRawArray
();
$data
[
'tags'
]
=
array_map
(
function
(
$tag
)
{
return
$tag
[
'name'
];
},
$material
->
getTopics
());
$data
[
'logo_url'
]
=
$material
->
getLogoURL
();
$data
[
'download_url'
]
=
$material
->
getDownloadUrl
();
$material_data
[]
=
$data
;
}
}
?>
?>
<form
class=
"oer_search"
<form
class=
"oer_search"
action=
"
<?=
$controller
->
link_for
(
"oer/market/
search
"
)
?>
"
action=
"
<?=
$controller
->
search
(
)
?>
"
method=
"GET"
aria-live=
"polite"
method=
"GET"
aria-live=
"polite"
data-searchresults=
"
<?=
htmlReady
(
json_encode
(
$material_data
))
?>
"
data-searchresults=
"
<?=
htmlReady
(
json_encode
(
$material_data
))
?>
"
data-filteredtag=
"
<?=
htmlReady
(
Request
::
get
(
"
tag
"
))
?>
"
data-filteredtag=
"
<?=
htmlReady
(
Request
::
get
(
'
tag
'
))
?>
"
data-filteredcategory=
"
<?=
htmlReady
(
Request
::
get
(
"
category
"
))
?>
"
data-filteredcategory=
"
<?=
htmlReady
(
Request
::
get
(
'
category
'
))
?>
"
data-tags=
"
<?=
htmlReady
(
json_encode
(
$tags
))
?>
"
data-tags=
"
<?=
htmlReady
(
json_encode
(
$tags
))
?>
"
data-material_select_url_template=
"
<?=
htmlReady
(
$controller
->
url_for
(
'oer/market/
details
/
__material_id__'
))
?>
"
>
data-material_select_url_template=
"
<?=
htmlReady
(
$controller
->
details
URL
(
'
__material_id__'
))
?>
"
>
<?=
$this
->
render_partial
(
"
oer/market/_searchform
"
)
?>
<?=
$this
->
render_partial
(
'
oer/market/_searchform
'
)
?>
</form>
</form>
...
@@ -51,19 +33,3 @@ if (!empty($materialien)) {
...
@@ -51,19 +33,3 @@ if (!empty($materialien)) {
<?
<?
if
(
$GLOBALS
[
'perm'
]
->
have_perm
(
"autor"
))
{
$actions
=
new
ActionsWidget
();
$actions
->
addLink
(
_
(
'Neues Lernmaterial hochladen'
),
$controller
->
url_for
(
"oer/mymaterial/edit"
),
Icon
::
create
(
"add"
,
Icon
::
ROLE_CLICKABLE
),
[
'data-dialog'
=>
"1"
]
);
$actions
->
addLink
(
$abo
?
_
(
'Neuigkeiten abbestellen'
)
:
_
(
'Neuigkeiten abonnieren'
),
$controller
->
url_for
(
"oer/market/abo"
),
$abo
?
Icon
::
create
(
"decline"
,
Icon
::
ROLE_CLICKABLE
)
:
Icon
::
create
(
"rss"
,
Icon
::
ROLE_CLICKABLE
),
[
'data-dialog'
=>
"size=small"
]
);
Sidebar
::
Get
()
->
addWidget
(
$actions
);
}
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