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
c018e35d
Commit
c018e35d
authored
Dec 26, 2016
by
John Punzalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Ajax calls for request JOIN News & Entity
parent
aca9f395
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
162 additions
and
82 deletions
+162
-82
class-esi-management-admin.php
...ugins/esi-management/admin/class-esi-management-admin.php
+12
-1
esi-management-admin.js
...t/plugins/esi-management/admin/js/esi-management-admin.js
+29
-1
functions-news.php
...gins/esi-management/admin/modules/news/functions-news.php
+16
-0
esi-management-news-form.php
.../admin/modules/news/partials/esi-management-news-form.php
+104
-80
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 @
c018e35d
...
...
@@ -320,7 +320,18 @@ class Esi_Management_Admin {
$data
=
$_POST
;
if
(
!
empty
(
$data
))
{
$response
=
array
(
'industry'
=>
esi_get_list_industry
(
$data
[
'radar_id'
]));
$response
=
array
(
'industry'
=>
esi_get_list_industry
(
$data
[
'industry_id'
]));
echo
json_encode
(
$response
);
wp_die
();
}
}
public
function
esi_technologies_ajax_callback
(){
$data
=
$_POST
;
if
(
!
empty
(
$data
))
{
$response
=
array
(
'returned_data'
=>
esi_get_list_technology
(
$data
[
'id'
]));
echo
json_encode
(
$response
);
wp_die
();
...
...
wp-content/plugins/esi-management/admin/js/esi-management-admin.js
View file @
c018e35d
...
...
@@ -33,6 +33,8 @@
$
(
'#radar_industry'
).
multiSelect
();
$
(
'#radar_function'
).
multiSelect
();
$
(
'#industry_sub_id'
).
multiSelect
();
$
(
'.join_sub_data_select'
).
multiSelect
();
$
(
"#radar_id"
).
live
(
'change'
,
function
(
el
){
$
.
ajax
({
url
:
ajaxurl
,
...
...
@@ -230,7 +232,7 @@
type
:
'POST'
,
data
:
{
'action'
:
'esi_industries_ajax_action'
,
'
radar
_id'
:
$
(
this
).
val
()
'
industry
_id'
:
$
(
this
).
val
()
},
success
:
function
(
response
)
{
var
data
=
JSON
.
parse
(
response
);
...
...
@@ -245,6 +247,32 @@
}
});
});
$
(
".join_data_select"
).
live
(
'change'
,
function
(
el
){
var
populate
=
$
(
this
).
data
(
'populate'
);
$
.
ajax
({
url
:
ajaxurl
,
type
:
'POST'
,
data
:
{
'action'
:
$
(
this
).
data
(
'action'
),
'id'
:
$
(
this
).
val
()
},
success
:
function
(
response
)
{
var
data
=
JSON
.
parse
(
response
);
$
(
populate
).
find
(
"option:gt(0)"
).
remove
();
$
.
each
(
data
.
returned_data
,
function
(
i
,
d
){
$
(
populate
).
multiSelect
(
'addOption'
,
{
value
:
d
.
id
,
text
:
d
.
name
,
index
:
i
});
});
},
error
:
function
(
errorThrown
){
console
.
log
(
errorThrown
);
}
});
});
$
(
'#industry_sub_id'
).
multiSelect
();
...
...
wp-content/plugins/esi-management/admin/modules/news/functions-news.php
View file @
c018e35d
...
...
@@ -290,3 +290,19 @@ function esi_delete_news( $id = 0 ) {
global
$wpdb
;
$wpdb
->
query
(
$wpdb
->
prepare
(
'DELETE FROM '
.
$wpdb
->
prefix
.
'esi_news WHERE id = %d'
,
$id
)
);
}
/**
* Fetch technologies array
*
* @param int $id
*
* @return array
*/
function
esi_get_list_technology
(
$id
=
0
)
{
global
$wpdb
;
// Get Selected technology mapping
$arrSelectedTechnology
=
$wpdb
->
get_results
(
"SELECT * FROM "
.
$wpdb
->
prefix
.
"esi_technology WHERE parent = "
.
$id
.
" ORDER BY name ASC"
);
return
$arrSelectedTechnology
;
}
wp-content/plugins/esi-management/admin/modules/news/partials/esi-management-news-form.php
View file @
c018e35d
...
...
@@ -54,6 +54,8 @@ if ($radars_news) {
$industry_news
[]
=
esi_get_industry_by_news
(
$id
);
$function_news
[]
=
esi_get_function_by_news
(
$id
);
$technologies
=
esi_get_list_technology
();
add_thickbox
();
?>
...
...
@@ -141,88 +143,110 @@ add_thickbox();
<option
value=
"
<?=
$entity
->
id
?>
"
<?=
(
$item
->
entity_id
==
$entity
->
id
)
?
'selected="selected"'
:
''
?>
>
<?=
$entity
->
name
?>
</option>
<?php
endforeach
;
?>
</select>
<a
href=
"
#TB_inline?width=600&height=450&inlineId=esi-add-entity
"
class=
"page-title-action
thickbox"
id=
"esi_add_entity"
style=
"float:left;margin-top:5px;"
onclick=
"self.parent.tb_remove();"
>
<a
href=
"
/wp-admin/admin.php?page=esi-management-entity&action=new"
target=
"_blank
"
class=
"page-title-action
"
style=
"float:left;margin-top:5px;"
>
Add entity
</a>
</td>
</tr>
<tr
class=
"row-investment-id"
>
<th
scope=
"row"
>
<label
for=
"investment_id"
>
<?php
_e
(
'Investment'
,
'esi'
);
?>
</label>
</th>
<td>
<input
type=
"hidden"
name=
"investment_id"
id=
"investment_id"
value=
"
<?=
(
isset
(
$investment
->
id
))
?
$investment
->
id
:
""
;
?>
"
/>
<p
class=
"investment-details"
>
<?php
if
(
!
isset
(
$investment
))
:
?>
<a
href=
"#TB_inline?width=600&height=450&inlineId=esi-add-investment"
class=
"page-title-action thickbox"
id=
"esi_add_investment"
style=
"float:left"
>
Add investment
</a>
<?php
else
:
$entity
=
esi_get_entity
(
$investment
->
entity_id
);
$investmentType
=
esi_get_investment_type
(
$investment
->
investment_type_id
);
?>
<b>
entity :
</b>
<?=
$entity
->
name
;
?>
<br
/>
<b>
Investment type :
</b>
<?=
$investmentType
->
name
;
?>
<br
/>
<b>
Investor :
</b>
<?php
$investors
=
array
();
foreach
(
$companies
as
$entity
)
:
?>
<?php
if
(
isset
(
$investorArray
)
&&
in_array
(
$entity
->
id
,
$investorArray
)){
$investors
[]
=
$entity
->
name
;
}
?>
<?php
endforeach
;
?>
<?=
implode
(
', '
,
$investors
);
?>
<br
/>
<b>
Amount :
</b>
<?=
$investment
->
amount
;
?>
<br
/>
<b>
Date :
</b>
<?=
$investment
->
investment_date
;
?>
<br
/><br
/>
</p>
<a
href=
"#TB_inline?width=600&height=450&inlineId=esi-add-investment"
class=
"page-title-action thickbox"
id=
"esi_industry"
>
Edit investment
</a>
<?php
endif
;
?>
</p>
</td>
</tr>
<tr
class=
"row-type-id"
>
<th
scope=
"row"
>
<label
for=
"type_id"
>
<?php
_e
(
'Type'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"type_id"
name=
"type_id"
>
<option
value=
"0"
>
Select a type
</option>
<?php
foreach
(
$types
as
$type
)
:
?>
<option
value=
"
<?=
$type
->
id
?>
"
<?=
(
$item
->
type_id
==
$type
->
id
)
?
'selected="selected"'
:
''
?>
>
<?=
$type
->
name
?>
</option>
<?php
endforeach
;
?>
</select>
</td>
</tr>
<tr
class=
"row-type-id"
>
<th
scope=
"row"
>
<label
for=
"region_id"
>
<?php
_e
(
'Region'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"region_id"
name=
"region_id"
>
<option
value=
"0"
>
Select a region
</option>
<?php
foreach
(
$regions
as
$region
)
:
?>
<option
value=
"
<?=
$region
->
id
?>
"
<?=
(
$item
->
region_id
==
$region
->
id
)
?
'selected="selected"'
:
''
?>
>
<?=
$region
->
name
?>
</option>
<?php
endforeach
;
?>
</select>
</td>
</tr>
<tr
class=
"row-publish-date"
>
<th
scope=
"row"
>
<label
for=
"publish_date"
>
<?php
_e
(
'Publish Date'
,
'esi'
);
?>
</label>
</th>
<td>
<input
type=
"date"
name=
"publish_date"
id=
"publish_date"
class=
"regular-text"
placeholder=
"
<?php
echo
esc_attr
(
''
,
'esi'
);
?>
"
value=
"
<?php
echo
(
$item
)
?
esc_attr
(
explode
(
' '
,
$item
->
publish_date
)[
0
]
)
:
''
;
?>
"
required=
"required"
/>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr
class=
"row-investment-id"
>
<th
scope=
"row"
>
<label
for=
"investment_id"
>
<?php
_e
(
'Investment'
,
'esi'
);
?>
</label>
</th>
<td>
<input
type=
"hidden"
name=
"investment_id"
id=
"investment_id"
value=
"
<?=
(
isset
(
$investment
->
id
))
?
$investment
->
id
:
""
;
?>
"
/>
<p
class=
"investment-details"
>
<?php
if
(
!
isset
(
$investment
))
:
?>
<a
href=
"#TB_inline?width=600&height=450&inlineId=esi-add-investment"
class=
"page-title-action thickbox"
id=
"esi_add_investment"
style=
"float:left"
>
Add investment
</a>
<?php
else
:
$entity
=
esi_get_entity
(
$investment
->
entity_id
);
$investmentType
=
esi_get_investment_type
(
$investment
->
investment_type_id
);
?>
<b>
entity :
</b>
<?=
$entity
->
name
;
?>
<br
/>
<b>
Investment type :
</b>
<?=
$investmentType
->
name
;
?>
<br
/>
<b>
Investor :
</b>
<?php
$investors
=
array
();
foreach
(
$companies
as
$entity
)
:
?>
<?php
if
(
isset
(
$investorArray
)
&&
in_array
(
$entity
->
id
,
$investorArray
)){
$investors
[]
=
$entity
->
name
;
}
?>
<?php
endforeach
;
?>
<?=
implode
(
', '
,
$investors
);
?>
<br
/>
<b>
Amount :
</b>
<?=
$investment
->
amount
;
?>
<br
/>
<b>
Date :
</b>
<?=
$investment
->
investment_date
;
?>
<br
/><br
/>
</p>
<a
href=
"#TB_inline?width=600&height=450&inlineId=esi-add-investment"
class=
"page-title-action thickbox"
id=
"esi_industry"
>
Edit investment
</a>
<?php
endif
;
?>
</p>
</td>
</tr>
<tr
class=
"row-technology-id"
>
<th
scope=
"row"
>
<label
for=
"technology_id"
>
<?php
_e
(
'Technology'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"technology_id"
name=
"technology_id"
class=
"join_data_select"
data-tablename=
"technology"
data-action=
"esi_technologies_ajax_action"
data-populate=
".join_sub_data_select"
>
<option
value=
"0"
>
Select a Technology
</option>
<?php
foreach
(
$technologies
as
$technology
)
:
?>
<option
value=
"
<?=
$technology
->
id
?>
"
>
<?=
$technology
->
name
?>
</option>
<?php
endforeach
;
?>
</select><br
/>
</td>
</tr>
<tr
class=
"row-entity-sub-industry"
>
<th
scope=
"row"
>
Select Sub Technology
<br/>
(If needed)
</th>
<td>
<select
id=
"technology_sub_id"
name=
"technology_sub_id[]"
class=
"join_sub_data_select"
multiple=
"multiple"
>
</select><br
/>
</td>
</tr>
<tr
class=
"row-type-id"
>
<th
scope=
"row"
>
<label
for=
"type_id"
>
<?php
_e
(
'Type'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"type_id"
name=
"type_id"
>
<option
value=
"0"
>
Select a type
</option>
<?php
foreach
(
$types
as
$type
)
:
?>
<option
value=
"
<?=
$type
->
id
?>
"
<?=
(
$item
->
type_id
==
$type
->
id
)
?
'selected="selected"'
:
''
?>
>
<?=
$type
->
name
?>
</option>
<?php
endforeach
;
?>
</select>
</td>
</tr>
<tr
class=
"row-type-id"
>
<th
scope=
"row"
>
<label
for=
"region_id"
>
<?php
_e
(
'Region'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"region_id"
name=
"region_id"
>
<option
value=
"0"
>
Select a region
</option>
<?php
foreach
(
$regions
as
$region
)
:
?>
<option
value=
"
<?=
$region
->
id
?>
"
<?=
(
$item
->
region_id
==
$region
->
id
)
?
'selected="selected"'
:
''
?>
>
<?=
$region
->
name
?>
</option>
<?php
endforeach
;
?>
</select>
</td>
</tr>
<tr
class=
"row-publish-date"
>
<th
scope=
"row"
>
<label
for=
"publish_date"
>
<?php
_e
(
'Publish Date'
,
'esi'
);
?>
</label>
</th>
<td>
<input
type=
"date"
name=
"publish_date"
id=
"publish_date"
class=
"regular-text"
placeholder=
"
<?php
echo
esc_attr
(
''
,
'esi'
);
?>
"
value=
"
<?php
echo
(
$item
)
?
esc_attr
(
explode
(
' '
,
$item
->
publish_date
)[
0
]
)
:
''
;
?>
"
required=
"required"
/>
</td>
</tr>
</tbody>
</table>
<input
type=
"hidden"
name=
"field_id"
value=
"
<?php
echo
(
$item
)
?
$item
->
id
:
0
;
?>
"
>
<input
type=
"hidden"
name=
"post_id"
value=
"
<?php
echo
(
$item
)
?
$item
->
post_id
:
''
;
?>
"
>
...
...
wp-content/plugins/esi-management/includes/class-esi-management.php
View file @
c018e35d
...
...
@@ -217,6 +217,7 @@ class Esi_Management {
$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'
);
$this
->
loader
->
add_action
(
'wp_ajax_esi_technologies_ajax_action'
,
$plugin_admin
,
'esi_technologies_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