Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
ce88de35
Commit
ce88de35
authored
Mar 20, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix print_scholar_directory when scholar has no keywords
parent
245218c3
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
49 deletions
+84
-49
comex_library.php
php_library/comex_library.php
+10
-0
directory_content.php
php_library/directory_content.php
+33
-28
js_elements.php
php_library/js_elements.php
+7
-5
print_scholar_directory.php
print_scholar_directory.php
+34
-15
bootstrap.min.css
static/css/bootstrap.min.css
+0
-1
No files found.
php_library/comex_library.php
View file @
ce88de35
...
...
@@ -4,6 +4,16 @@
* Common utility functions
*/
// canonical person name label
function
name_string
(
$title
,
$first_name
,
$mid_name
,
$last_name
)
{
$mid_initial
=
(
strlen
(
$mid_name
)
?
substr
(
$mid_name
,
0
,
1
)
.
"."
:
""
);
return
implode
(
' '
,
array_filter
(
array
(
$title
,
$first_name
,
$mid_initial
,
$last_name
)
));
}
function
clean_exp
(
$string
)
{
// enlève les comma trainantes
if
(
strcmp
(
substr
(
trim
(
$string
),
-
1
),
','
)
==
0
){
...
...
php_library/directory_content.php
View file @
ce88de35
...
...
@@ -355,11 +355,14 @@ $insts_ids = array_unique($insts_ids);
// all institutions with infos to retrieve
$institutions
=
array
();
$ids_str
=
implode
(
','
,
$insts_ids
);
$sql
=
"SELECT * FROM orgs WHERE orgid IN ("
.
$ids_str
.
") ORDER BY label"
;
foreach
(
$base
->
query
(
$sql
)
as
$row
)
{
if
(
count
(
$insts_ids
))
{
$ids_str
=
implode
(
','
,
$insts_ids
);
$sql
=
"SELECT * FROM orgs WHERE orgid IN ("
.
$ids_str
.
") ORDER BY label"
;
foreach
(
$base
->
query
(
$sql
)
as
$row
)
{
if
(
$row
[
'name'
]
==
"_NULL"
)
continue
;
$info
=
array
();
...
...
@@ -384,8 +387,10 @@ foreach ($base->query($sql) as $row) {
}
$institutions
[
$row
[
'orgid'
]]
=
$info
;
}
}
// debug
// $content .= var_dump($institutions) ;
...
...
php_library/js_elements.php
View file @
ce88de35
...
...
@@ -9,12 +9,14 @@
// to autoselect current whoswho filters
// NB: uses global value $data
$auto_popfilters_snippet
=
'<script type="text/javascript">'
;
foreach
(
$data
as
$filter
=>
$array_vals
)
{
if
(
isset
(
$data
)
&&
$data
)
{
foreach
(
$data
as
$filter
=>
$array_vals
)
{
foreach
(
$array_vals
as
$val
)
{
$auto_popfilters_snippet
.=
'
whoswho.popfilter("'
.
$filter
.
'", {"prefill":"'
.
$val
.
'"});
'
;
}
}
}
$auto_popfilters_snippet
.=
'</script>'
;
...
...
print_scholar_directory.php
View file @
ce88de35
...
...
@@ -14,6 +14,10 @@ $meta = $html_head_inner;
$userid
=
$_GET
[
'query'
];
// get param for current user (allows customize user menus w/o looking at cookie)
$logged
=
$_GET
[
'u'
];
// $base = new PDO("sqlite:" . $dbname);
$base
=
new
PDO
(
$dsn
,
$user
,
$pass
,
$opt
);
...
...
@@ -70,7 +74,6 @@ if ($userid) {
FROM
(
SELECT
scholars_and_labs
.*
,
--
GROUP_CONCAT
(
insts
.
orgid
SEPARATOR
','
)
AS
insts_ids
,
GROUP_CONCAT
(
insts
.
label
SEPARATOR
'%%%'
)
AS
insts_list
FROM
(
...
...
@@ -99,7 +102,6 @@ if ($userid) {
GROUP BY luid
) AS scholars_and_orgs
-- expansion (+kw info)
LEFT JOIN sch_kw AS second_level
ON second_level.uid = scholars_and_orgs.luid
JOIN sch_kw ON sch_kw.kwid = second_level.kwid
...
...
@@ -113,6 +115,10 @@ if ($userid) {
HERE_QUERY;
// print_r('
===
print_scholar_directory
query
===<
br
>
');
// print_r($sql);
foreach ($base->query($sql) as $row) {
$info = array();
$info['
unique_id
'] = $row['
luid
'];
...
...
@@ -197,16 +203,29 @@ HERE_QUERY;
}
}
// we keep the query-ed user'
s
details
$target_name_elements
=
array
(
// if no keywords matched, the previous select is empty
if (count($scholars)==0){
$sqlsingle = "SELECT hon_title, first_name, middle_name, last_name FROM scholars WHERE luid =".$userid ;
$target_name = "";
foreach ($base->query($sqlsingle) as $row) {
$target_name = name_string(
$row['
hon_title
'],
$row['
first_name
'],
$row['
middle_name
'],
$row['
last_name
']
);
}
}
// otherwise we keep the query-ed user'
s
details
else
{
$target_name
=
name_string
(
$scholars
[
$userid
][
'title'
],
$scholars
[
$userid
][
'first_name'
],
$scholars
[
$userid
][
'mid_initial'
],
$scholars
[
$userid
][
'last_name'
]
);
$target_name
=
implode
(
' '
,
array_filter
(
$target_name_elements
)
);
);
}
// both our stats have been filled
// var_dump($lab_counts) ;
...
...
@@ -275,7 +294,7 @@ Contributions and ideas are welcome to improve this directory.
if
(
count
(
$scholars
)
==
0
){
// TODO message in modal panel
echo
'<h2>Sorry, '
.
$target_name
.
' did not mention any keywords ... we cannot process its
network.</h2><br/>
echo
'<h2>Sorry, '
.
$target_name
.
' did not mention any keywords ... we cannot process the
network.</h2><br/>
If you are '
.
$target_name
.
', you can <a href="/services/user/profile" target="_BLANK">modify your profile</a> and see your
network in few minutes.'
;
}
else
{
...
...
static/css/bootstrap.min.css
View file @
ce88de35
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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