Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
E
esi-management
Project
Project
Details
Activity
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
John
esi-management
Commits
459d627a
Commit
459d627a
authored
Feb 23, 2017
by
John Punzalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update News with Radar Industry Functions
parent
d74d17ef
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
35 deletions
+89
-35
esi-management-admin.css
...plugins/esi-management/admin/css/esi-management-admin.css
+14
-1
spinner.gif
wp-content/plugins/esi-management/admin/img/spinner.gif
+0
-0
esi-management-admin.js
...t/plugins/esi-management/admin/js/esi-management-admin.js
+26
-17
esi-management-news-form.php
.../admin/modules/news/partials/esi-management-news-form.php
+33
-17
functions-radar.php
...ns/esi-management/admin/modules/radar/functions-radar.php
+16
-0
No files found.
wp-content/plugins/esi-management/admin/css/esi-management-admin.css
View file @
459d627a
...
...
@@ -5,4 +5,17 @@
.chosen-container-single
{
height
:
33px
;
}
\ No newline at end of file
}
.radar-hide
{
display
:
none
;
}
.esi-loader.active
{
display
:
inline-block
;
width
:
20px
;
height
:
20px
;
background-image
:
url(../img/spinner.gif)
;
background-repeat
:
no-repeat
;
vertical-align
:
middle
;
}
wp-content/plugins/esi-management/admin/img/spinner.gif
0 → 100644
View file @
459d627a
4.06 KB
wp-content/plugins/esi-management/admin/js/esi-management-admin.js
View file @
459d627a
...
...
@@ -30,13 +30,17 @@
*/
$
(
function
()
{
$
(
'#radar_industry'
).
multiSelect
();
$
(
'#radar_function'
).
multiSelect
();
$
(
"#radar_industry"
).
chosen
({
disable_search_threshold
:
10
,
width
:
"350px"
});
$
(
"#radar_function"
).
chosen
({
disable_search_threshold
:
10
,
width
:
"350px"
});
$
(
'#industry_sub_id'
).
multiSelect
();
$
(
'.join_sub_data_select'
).
multiSelect
();
$
(
'.js-multiselect'
).
multiSelect
();
$
(
"#radar_id"
).
live
(
'change'
,
function
(
el
){
$
(
".esi-loader"
).
addClass
(
"active"
);
$
.
ajax
({
url
:
ajaxurl
,
type
:
'POST'
,
...
...
@@ -47,25 +51,33 @@
success
:
function
(
response
)
{
var
data
=
JSON
.
parse
(
response
);
$
(
"#radar_industry"
).
find
(
"option:gt(0)"
).
remove
();
$
(
"#radar_industry"
).
find
(
"option"
).
remove
();
$
.
each
(
data
.
industry
,
function
(
i
,
d
){
// $("#radar_industry").append($('<option>', {
// value: d.id,
// text: d.name
// }));
$
(
'#radar_industry'
).
multiSelect
(
'addOption'
,
{
value
:
d
.
id
,
text
:
d
.
name
,
index
:
i
});
$
(
"#radar_industry"
).
append
(
$
(
'<option>'
,
{
value
:
d
.
id
,
text
:
d
.
name
}));
});
$
(
"#radar_industry"
).
trigger
(
"chosen:updated"
);
$
(
"#radar_function"
).
find
(
"option:gt(0)"
).
remove
();
$
(
"#radar_function"
).
find
(
"option"
).
remove
();
$
.
each
(
data
.
function
,
function
(
i
,
d
){
// $("#radar_function").append($('<option>', {
// value: d.id,
// text: d.name
// }));
$
(
'#radar_function'
).
multiSelect
(
'addOption'
,
{
value
:
d
.
id
,
text
:
d
.
name
,
index
:
i
});
$
(
"#radar_function"
).
append
(
$
(
'<option>'
,
{
value
:
d
.
id
,
text
:
d
.
name
}));
});
$
(
"#radar_function"
).
trigger
(
"chosen:updated"
);
$
(
'.radar_ind_func'
).
removeClass
((
"radar-hide"
));
$
(
".esi-loader"
).
removeClass
(
"active"
);
},
error
:
function
(
errorThrown
){
console
.
log
(
errorThrown
);
...
...
@@ -73,9 +85,6 @@
});
});
$
(
'#radar_industry'
).
multiSelect
();
$
(
'#radar_function'
).
multiSelect
();
$
(
'#industry_sub_id'
).
multiSelect
();
if
(
$
(
".chosen-select"
)){
...
...
wp-content/plugins/esi-management/admin/modules/news/partials/esi-management-news-form.php
View file @
459d627a
...
...
@@ -36,22 +36,25 @@ $regions = esi_get_all_region(array('number' => 10000));
$countries
=
esi_get_all_countries
();
$selected
=
array
();
$selected
[
'industry'
]
=
esi_get_industry_by_news
(
$id
);
$selected
[
'function'
]
=
esi_get_function_by_news
(
$id
);
$industries
=
array
();
$functions
=
array
();
$industries
=
esi_get_all_industry
();
$functions
=
esi_get_function
();
$radars_news
=
array
();
$selectedTechnologies
=
array
();
$radars_news
=
esi_get_radar_by_news
(
$id
);
if
(
$radars_news
)
{
foreach
(
$radars_news
as
$key
=>
$value
)
{
$industries
=
array_merge
(
esi_get_radar_industry
(
$value
),
$industries
);
$functions
=
array_merge
(
esi_get_radar_function
(
$value
),
$functions
);
}
}
$industry_news
=
esi_get_industry_by_news
(
$id
);
$function_news
=
esi_get_function_by_news
(
$id
);
$technologies
=
esi_get_list_technology
();
$selectedTechnologies
=
esi_get_list_technology_news
(
$id
);
$technologies_selected
=
esi_get_list_selected_news_technology
(
$id
,
'array'
);
...
...
@@ -117,22 +120,35 @@ add_thickbox();
<label
for=
"radar_id"
>
<?php
_e
(
'Radar'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"radar_id"
name=
"radar_id
"
>
<select
id=
"radar_id"
class=
"chosen-select"
name=
"radar_id"
multiple=
"multiple"
data-placeholder=
"Choose a Radar Industry
"
>
<option
value=
"0"
>
Select Radar
</option>
<?php
foreach
(
$radars
as
$radar
)
:
?>
<option
value=
"
<?=
$radar
->
id
?>
"
<?=
(
in_array
(
$radar
->
id
,
$radars_news
))
?
'selected="selected"'
:
''
?>
>
<?=
$radar
->
name
?>
</option>
<?php
endforeach
;
?>
</select><br
/><br
/>
<label
for=
"radar_industry"
>
Select industry
</label>
<select
id=
"radar_industry"
name=
"radar_industry[]"
multiple=
"multiple"
>
</select>
<span
class=
"esi-loader"
></span>
</td>
</tr>
<tr
class=
"row-industry-id"
>
<th
scope=
"row"
>
<label
for=
"radar_industry"
>
<?php
_e
(
'Industry'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"radar_industry"
name=
"radar_industry[]"
multiple=
"multiple"
data-placeholder=
"Choose a Radar Industry"
>
<?php
foreach
(
$industries
as
$industry
)
:
?>
<option
value=
"
<?=
$industry
->
id
?>
"
<?=
(
in_array
(
$industry
->
id
,
$
industry_news
))
?
'selected="selected"'
:
''
?>
>
<?=
$industry
->
name
?>
</option>
<option
value=
"
<?=
$industry
->
id
?>
"
<?=
(
in_array
(
$industry
->
id
,
$
selected
[
'industry'
]
))
?
'selected="selected"'
:
''
?>
>
<?=
$industry
->
name
?>
</option>
<?php
endforeach
;
?>
</select><br
/>
<label
for=
"radar_function"
>
Select function
</label>
<select
id=
"radar_function"
name=
"radar_function[]"
multiple=
"multiple"
>
</select>
</td>
</tr>
<tr
class=
"row-function-id"
>
<th
scope=
"row"
>
<label
for=
"radar_function"
>
<?php
_e
(
'Function'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"radar_function"
name=
"radar_function[]"
multiple=
"multiple"
data-placeholder=
"Choose a Radar Function"
>
<?php
foreach
(
$functions
as
$function
)
:
?>
<option
value=
"
<?=
$function
->
id
?>
"
<?=
(
in_array
(
$function
->
id
,
$
function_news
))
?
'selected="selected"'
:
''
?>
>
<?=
$function
->
name
?>
</option>
<option
value=
"
<?=
$function
->
id
?>
"
<?=
(
in_array
(
$function
->
id
,
$
selected
[
'function'
]
))
?
'selected="selected"'
:
''
?>
>
<?=
$function
->
name
?>
</option>
<?php
endforeach
;
?>
</select>
</td>
...
...
wp-content/plugins/esi-management/admin/modules/radar/functions-radar.php
View file @
459d627a
...
...
@@ -66,6 +66,7 @@ function esi_get_radar_industry( $id = 0 ) {
// Get Selected industry mapping
$arrSelectedIndustry
=
$wpdb
->
get_results
(
"SELECT industry_id FROM "
.
$wpdb
->
prefix
.
"esi_radar_industry WHERE radar_id="
.
$id
);
var_dump
(
$arrSelectedIndustry
);
die
;
if
(
$arrSelectedIndustry
){
$arrSelectedIndustry
=
array_map
(
function
(
$val
)
{
return
intval
(
$val
->
industry_id
);
...
...
@@ -248,3 +249,18 @@ function esi_delete_radar( $id = 0 ) {
global
$wpdb
;
$wpdb
->
query
(
$wpdb
->
prepare
(
'DELETE FROM '
.
$wpdb
->
prefix
.
'esi_radar WHERE id = %d'
,
$id
)
);
}
function
esi_get_function
()
{
global
$wpdb
;
return
$wpdb
->
get_results
(
"SELECT * FROM "
.
$wpdb
->
prefix
.
"esi_function ORDER BY name ASC"
);
}
function
esi_get_all_industry
()
{
global
$wpdb
;
return
$wpdb
->
get_results
(
"SELECT * FROM "
.
$wpdb
->
prefix
.
"esi_industry "
);
}
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