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
3446a1ff
Commit
3446a1ff
authored
Jan 02, 2017
by
John Punzalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update News
parent
ba719dbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
15 deletions
+36
-15
functions-news.php
...gins/esi-management/admin/modules/news/functions-news.php
+32
-0
esi-management-news-form.php
.../admin/modules/news/partials/esi-management-news-form.php
+4
-15
No files found.
wp-content/plugins/esi-management/admin/modules/news/functions-news.php
View file @
3446a1ff
...
...
@@ -341,3 +341,35 @@ function esi_get_list_technology_news ( $newsid = 0 ) {
return
$query
;
}
/**
* Fetch technologies array
*
* @param int $id
*
* @return array
*/
function
esi_get_list_selected_news_technology
(
$id
=
0
,
$output
=
'object'
)
{
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 = "
.
$id
.
"
"
,
OBJECT_K
);
if
(
$output
==
'array'
)
{
$array
=
array
();
foreach
(
$query
as
$selected
)
{
$array
[]
=
$selected
->
id
;
}
$query
=
$array
;
}
return
$query
;
}
wp-content/plugins/esi-management/admin/modules/news/partials/esi-management-news-form.php
View file @
3446a1ff
...
...
@@ -57,6 +57,8 @@ $function_news = esi_get_function_by_news($id);
$technologies
=
esi_get_list_technology
();
$selectedTechnologies
=
esi_get_list_technology_news
(
$id
);
$technologies_selected
=
esi_get_list_selected_news_technology
(
$id
,
'array'
);
add_thickbox
();
?>
...
...
@@ -196,26 +198,13 @@ add_thickbox();
<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>
<select
id=
"technology_id"
class=
"chosen-select"
name=
"technology_sub_id[]"
multiple=
"multiple"
>
<?php
foreach
(
$technologies
as
$technology
)
:
?>
<option
value=
"
<?=
$technology
->
id
?>
"
>
<?=
$technology
->
name
?>
</option>
<option
value=
"
<?=
$technology
->
id
?>
"
<?=
(
in_array
(
$technology
->
id
,
$technologies_selected
))
?
"selected='selected'"
:
""
?>
>
<?=
$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"
>
<?php
foreach
(
$selectedTechnologies
as
$activetechnology
)
:
?>
<option
value=
'
<?=
$activetechnology
->
id
?>
'
selected
>
<?=
$activetechnology
->
name
?>
</option>
<?
endforeach
;
?>
</select><br
/>
</td>
</tr>
<tr
class=
"row-type-id"
>
<th
scope=
"row"
>
<label
for=
"type_id"
>
<?php
_e
(
'Type'
,
'esi'
);
?>
</label>
...
...
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