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
9ba6e2b2
Commit
9ba6e2b2
authored
Dec 26, 2016
by
John Punzalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update entity add industry select
parent
20b02be8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
0 deletions
+81
-0
class-esi-management-admin.php
...ugins/esi-management/admin/class-esi-management-admin.php
+11
-0
esi-management-admin.js
...t/plugins/esi-management/admin/js/esi-management-admin.js
+28
-0
functions-entity.php
.../esi-management/admin/modules/entity/functions-entity.php
+17
-0
esi-management-entity-form.php
...in/modules/entity/partials/esi-management-entity-form.php
+24
-0
class-esi-management.php
.../plugins/esi-management/includes/class-esi-management.php
+1
-0
No files found.
wp-content/plugins/esi-management/admin/class-esi-management-admin.php
View file @
9ba6e2b2
...
...
@@ -316,6 +316,17 @@ class Esi_Management_Admin {
}
public
function
esi_industries_ajax_callback
(){
$data
=
$_POST
;
if
(
!
empty
(
$data
))
{
$response
=
array
(
'industry'
=>
esi_get_list_industry
(
$data
[
'radar_id'
]));
echo
json_encode
(
$response
);
wp_die
();
}
}
/**
* Show custom user profile fields
* @param obj $user The user object.
...
...
wp-content/plugins/esi-management/admin/js/esi-management-admin.js
View file @
9ba6e2b2
...
...
@@ -32,6 +32,7 @@
$
(
'#radar_industry'
).
multiSelect
();
$
(
'#radar_function'
).
multiSelect
();
$
(
'#industry_sub_id'
).
multiSelect
();
$
(
"#radar_id"
).
live
(
'change'
,
function
(
el
){
$
.
ajax
({
url
:
ajaxurl
,
...
...
@@ -72,6 +73,7 @@
$
(
'#radar_industry'
).
multiSelect
();
$
(
'#radar_function'
).
multiSelect
();
$
(
'#industry_sub_id'
).
multiSelect
();
if
(
$
(
".chosen-select"
)){
$
(
".chosen-select"
).
chosen
({
disable_search_threshold
:
10
,
width
:
"350px"
});
...
...
@@ -220,4 +222,30 @@
$
(
"select#esi_function_table"
).
treeMultiselect
({
startCollapsed
:
false
});
});
$
(
"#industry_id"
).
live
(
'change'
,
function
(
el
){
$
.
ajax
({
url
:
ajaxurl
,
type
:
'POST'
,
data
:
{
'action'
:
'esi_industries_ajax_action'
,
'radar_id'
:
$
(
this
).
val
()
},
success
:
function
(
response
)
{
var
data
=
JSON
.
parse
(
response
);
$
(
"#industry_sub_id"
).
find
(
"option:gt(0)"
).
remove
();
$
.
each
(
data
.
industry
,
function
(
i
,
d
){
$
(
'#industry_sub_id'
).
multiSelect
(
'addOption'
,
{
value
:
d
.
id
,
text
:
d
.
name
,
index
:
i
});
});
},
error
:
function
(
errorThrown
){
console
.
log
(
errorThrown
);
}
});
});
$
(
'#industry_sub_id'
).
multiSelect
();
})(
jQuery
);
wp-content/plugins/esi-management/admin/modules/entity/functions-entity.php
View file @
9ba6e2b2
...
...
@@ -172,4 +172,21 @@ function sample_admin_notice_success() {
<p>
<?php
_e
(
'Done!'
,
'sample-text-domain'
);
?>
</p>
</div>
<?php
}
/**
* Fetch industry array
*
* @param int $id
*
* @return array
*/
function
esi_get_list_industry
(
$id
=
0
)
{
global
$wpdb
;
// Get Selected industry mapping
$arrSelectedIndustry
=
$wpdb
->
get_results
(
"SELECT * FROM "
.
$wpdb
->
prefix
.
"esi_industry WHERE parent = "
.
$id
.
" ORDER BY name ASC"
);
return
$arrSelectedIndustry
;
}
\ No newline at end of file
wp-content/plugins/esi-management/admin/modules/entity/partials/esi-management-entity-form.php
View file @
9ba6e2b2
...
...
@@ -16,6 +16,8 @@ global $wpdb;
$item
=
esi_get_entity
(
$id
);
$countries
=
esi_get_all_countries
();
$entity_types
=
esi_get_all_entity_type_id
();
$industries
=
array
();
$industries
=
array_merge
(
esi_get_list_industry
(),
$industries
);
add_thickbox
();
?>
...
...
@@ -151,6 +153,28 @@ add_thickbox();
<input
type=
"text"
name=
"latest-round-type"
id=
"latest-round-type"
class=
"regular-text"
placeholder=
"
<?php
echo
esc_attr
(
'Latest Round Type'
,
'esi'
);
?>
"
value=
"
<?php
echo
(
$item
)
?
esc_attr
(
$item
->
latest_round_type
)
:
''
;
?>
"
/>
</td>
</tr>
<hr
/>
<tr
class=
"row-entity-industry"
>
<th
scope=
"row"
>
<label
for=
"industry_id"
>
<?php
_e
(
'Industry'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"industry_id"
name=
"industry_id[]"
>
<option
value=
"0"
>
Select an industry
</option>
<?php
foreach
(
$industries
as
$industry
)
:
?>
<option
value=
"
<?=
$industry
->
id
?>
"
>
<?=
$industry
->
name
?>
</option>
<?php
endforeach
;
?>
</select><br
/>
</td>
</tr>
<tr
class=
"row-entity-sub-industry"
>
<th
scope=
"row"
>
</th>
<td>
<select
id=
"industry_sub_id"
name=
"industry_sub_id[]"
multiple=
"multiple"
>
</select><br
/>
</td>
</tr>
</tbody>
</table>
...
...
wp-content/plugins/esi-management/includes/class-esi-management.php
View file @
9ba6e2b2
...
...
@@ -216,6 +216,7 @@ class Esi_Management {
$this
->
loader
->
add_action
(
'wp_ajax_esi_media_ajax_action'
,
$plugin_admin
,
'esi_media_ajax_callback'
);
$this
->
loader
->
add_action
(
'wp_ajax_esi_investment_ajax_action'
,
$plugin_admin
,
'esi_investment_ajax_callback'
);
$this
->
loader
->
add_action
(
'wp_ajax_esi_radar_ajax_action'
,
$plugin_admin
,
'esi_radar_ajax_callback'
);
$this
->
loader
->
add_action
(
'wp_ajax_esi_industries_ajax_action'
,
$plugin_admin
,
'esi_industries_ajax_callback'
);
// Add radars field to user form
// $this->loader->add_action('show_user_profile', $plugin_admin, 'esi_custom_user_profile_fields');
...
...
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