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
72beaa9b
Commit
72beaa9b
authored
Jan 10, 2017
by
John Punzalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Entity
parent
3417eb92
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
17 deletions
+74
-17
class-esi-management-entity-form.php
...admin/modules/entity/class-esi-management-entity-form.php
+5
-0
functions-entity.php
.../esi-management/admin/modules/entity/functions-entity.php
+60
-15
esi-management-entity-form.php
...in/modules/entity/partials/esi-management-entity-form.php
+8
-1
esi-management-news-form.php
.../admin/modules/news/partials/esi-management-news-form.php
+1
-1
No files found.
wp-content/plugins/esi-management/admin/modules/entity/class-esi-management-entity-form.php
View file @
72beaa9b
...
...
@@ -56,6 +56,8 @@ class Esi_Management_Entity_Form {
$latest_round_type
=
isset
(
$_POST
[
'latest-round-type'
]
)
?
(
int
)
sanitize_text_field
(
$_POST
[
'latest-round-type'
]
)
:
''
;
$technology_ids
=
isset
(
$_POST
[
'technology_id'
]
)
?
(
$_POST
[
'technology_id'
]
)
:
''
;
$ability_ids
=
isset
(
$_POST
[
'ability_id'
]
)
?
(
$_POST
[
'ability_id'
]
)
:
''
;
$industry_ids
=
isset
(
$_POST
[
'industry_id'
]
)
?
(
$_POST
[
'industry_id'
]
)
:
''
;
$industry_sub_ids
=
isset
(
$_POST
[
'industry_sub_id'
]
)
?
(
$_POST
[
'industry_sub_id'
]
)
:
''
;
if
(
$is_investor
==
"on"
)
{
$is_investor
=
1
;
...
...
@@ -113,8 +115,11 @@ class Esi_Management_Entity_Form {
$insert_id
=
esi_insert_entity
(
$fields
);
}
$industry_ids
=
array_merge
(
$industry_ids
,
$industry_sub_ids
);
esi_save_list_entity_technology
(
$fields
[
'id'
],
$technology_ids
);
esi_save_list_entity_ability
(
$fields
[
'id'
],
$ability_ids
);
esi_save_list_entity_industry
(
$fields
[
'id'
],
$industry_ids
);
if
(
$is_ajax
){
return
$fields
;
...
...
wp-content/plugins/esi-management/admin/modules/entity/functions-entity.php
View file @
72beaa9b
...
...
@@ -191,32 +191,25 @@ function esi_get_list_industry( $id = 0 ) {
return
$arrSelectedIndustry
;
}
/**
* Fetch
technologies array
* Fetch
industry
*
* @param int $id
*
* @return array
*/
function
esi_get_
list_selected_entity_industry
(
$id
=
0
,
$output
=
'object'
)
{
function
esi_get_
industry
(
$id
=
0
)
{
global
$wpdb
;
// Get Selected technology mapping
$arrSelectedTechnology
=
$wpdb
->
get_results
(
"SELECT * FROM "
.
$wpdb
->
prefix
.
"esi_technology_entity WHERE entity_id = "
.
$id
,
OBJECT_K
);
if
(
$output
==
'array'
)
{
$array
=
array
();
foreach
(
$arrSelectedTechnology
as
$selected
)
{
$array
[]
=
$selected
->
technology_id
;
}
$arrSelectedTechnology
=
$array
;
}
// Get Selected industry mapping
$item
=
$wpdb
->
get_results
(
"SELECT * FROM "
.
$wpdb
->
prefix
.
"esi_industry WHERE id = "
.
$id
.
" ORDER BY name ASC"
);
return
$
arrSelectedTechnology
;
return
$
item
;
}
/**
* Fetch technologies array
*
...
...
@@ -349,4 +342,56 @@ function esi_get_list_selected_entity_ability( $id = 0, $output = 'object' ) {
}
return
$arrSelectedTechnology
;
}
\ No newline at end of file
}
/**
* Fetch technologies array
*
* @param int $id
*
* @return array
*/
function
esi_get_list_selected_entity_industry
(
$id
=
0
,
$output
=
'object'
)
{
global
$wpdb
;
// Get Selected technology mapping
$arrSelectedIndustry
=
$wpdb
->
get_results
(
"SELECT * FROM "
.
$wpdb
->
prefix
.
"esi_entity_industry WHERE entity_id = "
.
$id
,
ARRAY_A
);
if
(
$output
==
'array'
)
{
$array
=
array
();
foreach
(
$arrSelectedIndustry
as
$selected
)
{
$array
[]
=
$selected
[
'industry_id'
];
}
$arrSelectedIndustry
=
$array
;
}
return
$arrSelectedIndustry
;
}
/**
* Save industries array
*
* @param int $entity_id
* @param array $industry_ids
*
* @return array
*/
function
esi_save_list_entity_industry
(
$entity_id
=
0
,
$industry_ids
=
array
())
{
global
$wpdb
;
// Delete all current join from liaison table
$wpdb
->
query
(
$wpdb
->
prepare
(
'DELETE FROM '
.
$wpdb
->
prefix
.
'esi_entity_industry WHERE entity_id = %d'
,
$entity_id
));
// Insert new news_id ability_id relation
foreach
(
$industry_ids
as
$industry_id
)
{
$wpdb
->
insert
(
$wpdb
->
prefix
.
"esi_entity_industry"
,
array
(
'industry_id'
=>
$industry_id
,
'entity_id'
=>
intval
(
$entity_id
)
));
}
}
wp-content/plugins/esi-management/admin/modules/entity/partials/esi-management-entity-form.php
View file @
72beaa9b
...
...
@@ -25,6 +25,9 @@ $entities = esi_get_all_entity(array('number' => 10000));
$abilities
=
esi_get_all_ability
(
array
(
'number'
=>
10000
));
$abilities_selected
=
esi_get_list_selected_entity_ability
(
$id
,
'array'
);
$industries_selected
=
esi_get_list_selected_entity_industry
(
$id
,
'array'
);
add_thickbox
();
?>
...
...
@@ -177,7 +180,7 @@ add_thickbox();
<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>
<option
value=
"
<?=
$industry
->
id
?>
"
<?=
(
in_array
(
$industry
->
id
,
$industries_selected
)
?
'selected="selected"'
:
''
)
?>
>
<?=
$industry
->
name
?>
</option>
<?php
endforeach
;
?>
</select><br
/>
</td>
...
...
@@ -187,6 +190,10 @@ add_thickbox();
</th>
<td>
<select
id=
"industry_sub_id"
name=
"industry_sub_id[]"
multiple=
"multiple"
>
<?php
foreach
(
$industries_selected
as
$industry_selected
)
:
?>
<?php
$current_industry
=
esi_get_industry
(
$industry_selected
);
?>
<option
value=
"
<?=
$industry_selected
?>
"
selected=
"selected"
>
<?=
$current_industry
[
0
]
->
name
;
?>
</option>
<?php
endforeach
;
?>
esi_get_industry
</select><br
/>
</td>
</tr>
...
...
wp-content/plugins/esi-management/admin/modules/news/partials/esi-management-news-form.php
View file @
72beaa9b
...
...
@@ -306,7 +306,7 @@ add_thickbox();
<label
for=
"investor"
>
<?php
_e
(
'Investor'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"investor"
name=
"investor[]"
data-placeholder=
"Choose a entity..."
multiple=
""
class=
"chosen-select"
>
<select
id=
"investor"
name=
"investor[]"
data-placeholder=
"Choose a entity..."
multiple=
""
class=
"chosen-select"
required=
"required"
>
<?php
foreach
(
$companies
as
$entity
)
:
?>
<option
value=
"
<?=
$entity
->
id
?>
"
<?=
(
isset
(
$investorArray
)
&&
in_array
(
$entity
->
id
,
$investorArray
))
?
'selected="selected"'
:
''
?>
>
<?=
$entity
->
name
?>
</option>
<?php
endforeach
;
?>
...
...
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