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
6a0fa12f
Commit
6a0fa12f
authored
Dec 27, 2016
by
John Punzalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update news form
parent
c018e35d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
4 deletions
+53
-4
class-esi-management-admin.php
...ugins/esi-management/admin/class-esi-management-admin.php
+1
-1
class-esi-management-news-form.php
...ent/admin/modules/news/class-esi-management-news-form.php
+5
-1
functions-news.php
...gins/esi-management/admin/modules/news/functions-news.php
+35
-0
esi-management-news-form.php
.../admin/modules/news/partials/esi-management-news-form.php
+11
-2
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 @
6a0fa12f
...
...
@@ -215,7 +215,7 @@ class Esi_Management_Admin {
add_submenu_page
(
$this
->
plugin_name
,
__
(
'Media'
,
'esi'
),
__
(
'Media'
,
'esi'
),
'manage_options'
,
'esi-management-media'
,
array
(
$plugin_admin_media
,
'plugin_page'
)
);
$plugin_admin_company
=
new
Esi_Management_Entity
(
$this
->
plugin_name
,
$this
->
version
);
add_submenu_page
(
$this
->
plugin_name
,
__
(
'
entity'
,
'esi'
),
__
(
'e
ntity'
,
'esi'
),
'manage_options'
,
'esi-management-entity'
,
array
(
$plugin_admin_company
,
'plugin_page'
)
);
add_submenu_page
(
$this
->
plugin_name
,
__
(
'
Entity'
,
'esi'
),
__
(
'E
ntity'
,
'esi'
),
'manage_options'
,
'esi-management-entity'
,
array
(
$plugin_admin_company
,
'plugin_page'
)
);
$plugin_admin_investment
=
new
Esi_Management_Investment
(
$this
->
plugin_name
,
$this
->
version
);
add_submenu_page
(
$this
->
plugin_name
,
__
(
'Investment'
,
'esi'
),
__
(
'Investment'
,
'esi'
),
'manage_options'
,
'esi-management-investment'
,
array
(
$plugin_admin_investment
,
'plugin_page'
)
);
...
...
wp-content/plugins/esi-management/admin/modules/news/class-esi-management-news-form.php
View file @
6a0fa12f
...
...
@@ -35,7 +35,7 @@ class Esi_Management_News_Form {
}
$errors
=
array
();
$page_url
=
admin_url
(
'admin.php?page=esi-management-news
&action=new
'
);
$page_url
=
admin_url
(
'admin.php?page=esi-management-news'
);
$field_id
=
isset
(
$_POST
[
'field_id'
]
)
?
intval
(
$_POST
[
'field_id'
]
)
:
0
;
$title
=
isset
(
$_POST
[
'title'
]
)
?
sanitize_text_field
(
$_POST
[
'title'
]
)
:
''
;
...
...
@@ -51,6 +51,7 @@ class Esi_Management_News_Form {
$industry_id
=
isset
(
$_POST
[
'radar_industry'
]
)
?
$_POST
[
'radar_industry'
]
:
array
();
$function_id
=
isset
(
$_POST
[
'radar_function'
]
)
?
$_POST
[
'radar_function'
]
:
array
();
$technology_ids
=
isset
(
$_POST
[
'technology_sub_id'
]
)
?
$_POST
[
'technology_sub_id'
]
:
array
();
$post_id
=
isset
(
$_POST
[
'post_id'
]
)
?
intval
(
$_POST
[
'post_id'
]
)
:
''
;
...
...
@@ -118,6 +119,7 @@ class Esi_Management_News_Form {
'region_id'
=>
$region_id
,
'industry_id'
=>
$industry_id
,
'function_id'
=>
$function_id
,
'technology_ids'
=>
$technology_ids
,
'post_id'
=>
$post_id
);
...
...
@@ -128,6 +130,8 @@ class Esi_Management_News_Form {
$fields
[
'id'
]
=
$field_id
;
$insert_id
=
esi_insert_new
(
$fields
);
}
if
(
is_wp_error
(
$insert_id
)
)
{
$redirect_to
=
add_query_arg
(
array
(
'message'
=>
'error'
),
$page_url
);
...
...
wp-content/plugins/esi-management/admin/modules/news/functions-news.php
View file @
6a0fa12f
...
...
@@ -103,6 +103,8 @@ function esi_insert_new( $args = array() ) {
unset
(
$args
[
'industry_id'
]
);
$function_id
=
$args
[
'function_id'
];
unset
(
$args
[
'function_id'
]
);
$technology_ids
=
$args
[
'technology_ids'
];
unset
(
$args
[
'technology_ids'
]
);
$radar_industry_id
=
esi_get_radar_by_industry
(
$industry_id
);
$radar_function_id
=
esi_get_radar_by_function
(
$function_id
);
...
...
@@ -122,6 +124,7 @@ function esi_insert_new( $args = array() ) {
esi_save_news_radar
(
$row_id
,
$radar_id
);
esi_save_news_industry
(
$row_id
,
$industry_id
);
esi_save_news_function
(
$row_id
,
$function_id
);
esi_save_list_technology_news
(
$row_id
,
$technology_ids
);
return
$row_id
;
}
...
...
@@ -130,6 +133,7 @@ function esi_insert_new( $args = array() ) {
esi_save_news_radar
(
$row_id
,
$radar_id
);
esi_save_news_industry
(
$row_id
,
$industry_id
);
esi_save_news_function
(
$row_id
,
$function_id
);
esi_save_list_technology_news
(
$row_id
,
$technology_ids
);
// do update method here
if
(
$wpdb
->
update
(
$table_name
,
$args
,
array
(
'id'
=>
$row_id
)
)
)
{
...
...
@@ -306,3 +310,34 @@ function esi_get_list_technology( $id = 0 ) {
return
$arrSelectedTechnology
;
}
function
esi_save_list_technology_news
(
$newsid
=
0
,
$technologyids
=
array
()
)
{
global
$wpdb
;
// Delete all current join from liaison table
$wpdb
->
query
(
$wpdb
->
prepare
(
'DELETE FROM '
.
$wpdb
->
prefix
.
'esi_technology_news WHERE news_id = %d'
,
$newsid
));
// Insert new news_id technology_id relation
foreach
(
$technologyids
as
$technology_id
)
{
$wpdb
->
insert
(
$wpdb
->
prefix
.
"esi_technology_news"
,
array
(
'technology_id'
=>
$technology_id
,
'news_id'
=>
intval
(
$newsid
)
));
}
}
function
esi_get_list_technology_news
(
$newsid
=
0
)
{
global
$wpdb
;
$query
=
$wpdb
->
get_results
(
"
SELECT id, name
FROM "
.
$wpdb
->
prefix
.
"esi_technology
INNER JOIN "
.
$wpdb
->
prefix
.
"esi_technology_news
ON "
.
$wpdb
->
prefix
.
"esi_technology.id = "
.
$wpdb
->
prefix
.
"esi_technology_news.technology_id
WHERE news_id = "
.
$newsid
.
"
"
);
return
$query
;
}
wp-content/plugins/esi-management/admin/modules/news/partials/esi-management-news-form.php
View file @
6a0fa12f
...
...
@@ -43,6 +43,7 @@ $investorArray = esi_get_investor_array($item->investment_id);
$industries
=
array
();
$functions
=
array
();
$radars_news
=
array
();
$selectedTechnologies
=
array
();
$radars_news
[]
=
esi_get_radar_by_news
(
$id
);
if
(
$radars_news
)
{
...
...
@@ -55,6 +56,7 @@ $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
);
add_thickbox
();
?>
...
...
@@ -134,7 +136,7 @@ add_thickbox();
</tr>
<tr
class=
"row-entity-id"
>
<th
scope=
"row"
>
<label
for=
"entity_id"
>
<?php
_e
(
'
e
ntity'
,
'esi'
);
?>
</label>
<label
for=
"entity_id"
>
<?php
_e
(
'
E
ntity'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"entity_id"
name=
"entity_id"
style=
"float:left"
>
...
...
@@ -208,6 +210,9 @@ add_thickbox();
</th>
<td>
<select
id=
"technology_sub_id"
name=
"technology_sub_id[]"
class=
"join_sub_data_select"
multiple=
"multiple"
>
<?php
foreach
(
$selectedTechnologies
as
$activetechnology
)
:
?>
<option
value=
'
<?=
$activetechnology
->
id
?>
'
selected
>
<?=
$activetechnology
->
name
?>
</option>
<?
endforeach
;
?>
</select><br
/>
</td>
</tr>
...
...
@@ -252,7 +257,11 @@ add_thickbox();
<input
type=
"hidden"
name=
"post_id"
value=
"
<?php
echo
(
$item
)
?
$item
->
post_id
:
''
;
?>
"
>
<?php
wp_nonce_field
(
''
);
?>
<?php
submit_button
(
__
(
'Add new'
,
'esi'
),
'primary'
,
'submit new'
);
?>
<?php
if
(
$_GET
[
'action'
]
==
'edit'
)
:
?>
<?php
submit_button
(
__
(
'Update News'
,
'esi'
),
'primary'
,
'submit new'
);
?>
<?php
else
:
?>
<?php
submit_button
(
__
(
'Add News'
,
'esi'
),
'primary'
,
'submit new'
);
?>
<?php
endif
;
?>
</form>
</div>
...
...
wp-content/plugins/esi-management/includes/class-esi-management.php
View file @
6a0fa12f
...
...
@@ -218,6 +218,7 @@ class Esi_Management {
$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'
);
$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