Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
73c63993
Commit
73c63993
authored
Nov 01, 2006
by
Penny Leach
Browse files
added mixed_array_to_field_array function to convert (eg) array of user
objects to array of user ids
parent
015bef3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/mahara.php
View file @
73c63993
...
...
@@ -607,6 +607,20 @@ function hsc ($text) {
return
htmlspecialchars
(
$text
,
ENT_COMPAT
,
'UTF-8'
);
}
/**
* function to convert an array of objects to
* an array containing one field per place
*
* @param array $array input array
* @param mixed $field field to look for in each object
*/
function
mixed_array_to_field_array
(
$array
,
$field
)
{
$repl_fun
=
create_function
(
'$n, $field'
,
'$n = (object)$n; return $n->{$field};'
);
$fields
=
array_pad
(
array
(),
count
(
$array
),
$field
);
return
array_map
(
$repl_fun
,
$array
,
$fields
);
}
/**
* Used by XMLDB
*/
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment