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
860a9c59
Commit
860a9c59
authored
Jan 03, 2017
by
John Punzalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Ability in Entity
parent
4469d04b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
0 deletions
+67
-0
class-esi-management-entity-form.php
...admin/modules/entity/class-esi-management-entity-form.php
+2
-0
functions-entity.php
.../esi-management/admin/modules/entity/functions-entity.php
+51
-0
esi-management-entity-form.php
...in/modules/entity/partials/esi-management-entity-form.php
+14
-0
No files found.
wp-content/plugins/esi-management/admin/modules/entity/class-esi-management-entity-form.php
View file @
860a9c59
...
...
@@ -55,6 +55,7 @@ class Esi_Management_Entity_Form {
$total_raised
=
isset
(
$_POST
[
'total-raised'
]
)
?
(
int
)
sanitize_text_field
(
$_POST
[
'total-raised'
]
)
:
''
;
$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'
]
)
:
''
;
if
(
$is_investor
==
"on"
)
{
$is_investor
=
1
;
...
...
@@ -113,6 +114,7 @@ class Esi_Management_Entity_Form {
}
esi_save_list_entity_technology
(
$fields
[
'id'
],
$technology_ids
);
esi_save_list_entity_ability
(
$fields
[
'id'
],
$ability_ids
);
if
(
$is_ajax
){
return
$fields
;
...
...
wp-content/plugins/esi-management/admin/modules/entity/functions-entity.php
View file @
860a9c59
...
...
@@ -298,4 +298,55 @@ function esi_save_list_entity_technology( $entityid = 0, $technologyids = array(
'entity_id'
=>
intval
(
$entityid
)
));
}
}
/**
* Fetch technologies array
*
* @param int $entity_id
* @param array $ability_ids
*
* @return array
*/
function
esi_save_list_entity_ability
(
$entity_id
=
0
,
$ability_ids
=
array
()
)
{
global
$wpdb
;
// Delete all current join from liaison table
$wpdb
->
query
(
$wpdb
->
prepare
(
'DELETE FROM '
.
$wpdb
->
prefix
.
'esi_ability_entity WHERE entity_id = %d'
,
$entityid
));
// Insert new news_id ability_id relation
foreach
(
$ability_ids
as
$ability_id
)
{
$wpdb
->
insert
(
$wpdb
->
prefix
.
"esi_ability_entity"
,
array
(
'ability_id'
=>
$ability_id
,
'entity_id'
=>
intval
(
$entity_id
)
));
}
}
/**
* Fetch technologies array
*
* @param int $id
*
* @return array
*/
function
esi_get_list_selected_entity_ability
(
$id
=
0
,
$output
=
'object'
)
{
global
$wpdb
;
// Get Selected technology mapping
$arrSelectedTechnology
=
$wpdb
->
get_results
(
"SELECT * FROM "
.
$wpdb
->
prefix
.
"esi_ability_entity WHERE entity_id = "
.
$id
,
OBJECT_K
);
if
(
$output
==
'array'
)
{
$array
=
array
();
foreach
(
$arrSelectedTechnology
as
$selected
)
{
$array
[]
=
$selected
->
ability_id
;
}
$arrSelectedTechnology
=
$array
;
}
return
$arrSelectedTechnology
;
}
\ No newline at end of file
wp-content/plugins/esi-management/admin/modules/entity/partials/esi-management-entity-form.php
View file @
860a9c59
...
...
@@ -22,6 +22,8 @@ $technologies = esi_get_all_list_technology();
$technologies_selected
=
esi_get_list_selected_entity_technology
(
$id
,
'array'
);
$investment_type
=
esi_get_all_investment_type
(
array
(
'number'
=>
10000
));
$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'
);
add_thickbox
();
?>
...
...
@@ -200,6 +202,18 @@ add_thickbox();
</select><br
/>
</td>
</tr>
<tr
class=
"row-ability-id"
>
<th
scope=
"row"
>
<label
for=
"ability_id"
>
<?php
_e
(
'Ability'
,
'esi'
);
?>
</label>
</th>
<td>
<select
id=
"ability_id"
class=
"chosen-select"
name=
"ability_id[]"
multiple=
"multiple"
>
<?php
foreach
(
$abilities
as
$ability
)
:
?>
<option
value=
"
<?=
$ability
->
id
?>
"
<?=
(
in_array
(
$ability
->
id
,
$abilities_selected
))
?
"selected='selected'"
:
""
?>
>
<?=
$ability
->
name
?>
</option>
<?php
endforeach
;
?>
</select><br
/>
</td>
</tr>
</tbody>
</table>
...
...
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