Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
a73a2a99
Commit
a73a2a99
authored
Dec 09, 2014
by
Son Nguyen
Committed by
Gerrit Code Review
Dec 09, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Fixing up group homepage problem (Bug #1396565)"
parents
0999b8e9
7d6192f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
2 deletions
+66
-2
htdocs/blocktype/groupviews/lib.php
htdocs/blocktype/groupviews/lib.php
+1
-1
htdocs/lib/db/upgrade.php
htdocs/lib/db/upgrade.php
+64
-0
htdocs/lib/version.php
htdocs/lib/version.php
+1
-1
No files found.
htdocs/blocktype/groupviews/lib.php
View file @
a73a2a99
...
...
@@ -24,7 +24,7 @@ class PluginBlocktypeGroupViews extends SystemBlocktype {
}
public
static
function
single_only
()
{
return
fals
e
;
return
tru
e
;
}
public
static
function
get_categories
()
{
...
...
htdocs/lib/db/upgrade.php
View file @
a73a2a99
...
...
@@ -3773,5 +3773,69 @@ function xmldb_core_upgrade($oldversion=0) {
$todb
->
sort
=
'0'
;
insert_record
(
'blocktype_category'
,
$todb
);
}
if
(
$oldversion
<
2014112700
)
{
// Need to find the group homepages that have more than one groupview on them
// and merge their data into one groupview as we shouldn't allow more than one groupview block
// as it breaks pagination
// First get any pages that have more than one groupview on them
// and find the status of the groupview blocks
if
(
$records
=
get_records_sql_array
(
"SELECT v.id AS view, bi.id AS block FROM
{
view
}
v
INNER JOIN
{
block_instance
}
bi ON v.id = bi.view
WHERE v.id IN (
SELECT v.id FROM
{
view
}
v
INNER JOIN
{
block_instance
}
bi ON v.id = bi.view
WHERE bi.blocktype = 'groupviews'
AND v.type = 'grouphomepage'
GROUP BY v.id
HAVING COUNT(v.id) > 1
)
AND bi.blocktype='groupviews'
ORDER BY v.id, bi.id"
,
array
()))
{
require_once
(
get_config
(
'docroot'
)
.
'blocktype/lib.php'
);
$lastview
=
0
;
// set default
$info
=
array
();
$x
=
-
1
;
foreach
(
$records
as
$record
)
{
if
(
$lastview
!=
$record
->
view
)
{
$x
++
;
$info
[
$x
][
'in'
][
'showgroupviews'
]
=
0
;
$info
[
$x
][
'in'
][
'showsharedviews'
]
=
0
;
$info
[
$x
][
'in'
][
'view'
]
=
$record
->
view
;
$info
[
$x
][
'in'
][
'block'
]
=
$record
->
block
;
$lastview
=
$record
->
view
;
}
else
{
$info
[
$x
][
'out'
][]
=
$record
->
block
;
}
$bi
=
new
BlockInstance
(
$record
->
block
);
$configdata
=
$bi
->
get
(
'configdata'
);
if
(
!
empty
(
$configdata
[
'showgroupviews'
]))
{
$info
[
$x
][
'in'
][
'showgroupviews'
]
=
1
;
}
if
(
!
empty
(
$configdata
[
'showsharedviews'
]))
{
$info
[
$x
][
'in'
][
'showsharedviews'
]
=
1
;
}
}
// now that we have info on the state of play we need to save one of the blocks
// with correct data and delete the not needed blocks
foreach
(
$info
as
$item
)
{
$bi
=
new
BlockInstance
(
$item
[
'in'
][
'block'
]);
$configdata
=
$bi
->
get
(
'configdata'
);
$configdata
[
'showgroupviews'
]
=
$item
[
'in'
][
'showgroupviews'
];
$configdata
[
'showsharedviews'
]
=
$item
[
'in'
][
'showsharedviews'
];
$bi
->
set
(
'configdata'
,
$configdata
);
$bi
->
commit
();
foreach
(
$item
[
'out'
]
as
$old
)
{
$bi
=
new
BlockInstance
(
$old
);
$bi
->
delete
();
}
}
}
}
return
$status
;
}
htdocs/lib/version.php
View file @
a73a2a99
...
...
@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config
->
version
=
201411
0
700
;
$config
->
version
=
201411
2
700
;
$config
->
series
=
'15.04'
;
$config
->
release
=
'15.04dev'
;
$config
->
minupgradefrom
=
2009022600
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment