diff options
| author | Christian Fowler <spider@viovio.com> | 2009-09-02 16:42:32 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2009-09-02 16:42:32 +0000 |
| commit | fbca59a4aedbed10a4eb81fd6d2f0e838137be9d (patch) | |
| tree | 1dedf42bef7a3a4574a23b18ed801efc35ef8c76 | |
| parent | e907dd7fc0ba3fb72931fc2377b54b78f6b21e63 (diff) | |
| download | feed-fbca59a4aedbed10a4eb81fd6d2f0e838137be9d.tar.gz feed-fbca59a4aedbed10a4eb81fd6d2f0e838137be9d.tar.bz2 feed-fbca59a4aedbed10a4eb81fd6d2f0e838137be9d.zip | |
fix up editing and add feed icon
| -rw-r--r-- | admin/admin_feed_inc.php | 18 | ||||
| -rw-r--r-- | templates/admin_feed.tpl | 40 |
2 files changed, 27 insertions, 31 deletions
diff --git a/admin/admin_feed_inc.php b/admin/admin_feed_inc.php index 530671f..8328177 100644 --- a/admin/admin_feed_inc.php +++ b/admin/admin_feed_inc.php @@ -5,25 +5,29 @@ global $gBitSmarty; $contentTypes = get_content_types(); -$deleteSql = "DELETE FROM feed_conjugation"; -$gBitDb->query($deleteSql); +if( !empty( $_REQUEST['store_feed'] ) ) { -foreach ( $contentTypes as $type ){ + $deleteSql = "DELETE FROM feed_conjugation"; + $gBitDb->query($deleteSql); + + foreach ( array_keys( $contentTypes ) as $type ){ + if( !empty( $_REQUEST[$type]['conjugation_phrase'] ) || !empty( $_REQUEST[$type]['is_target_linked'] ) ) { $insertSql = "INSERT INTO feed_conjugation (content_type_guid, conjugation_phrase, is_target_linked) VALUES ( ?, ?, ?)"; - $gBitDb->query($insertSql, array( $type['content_type_guid'], $_REQUEST[$type['content_type_guid']], empty($_REQUEST[$type['content_type_guid'].'_target'])?'t':'f' ) ); + $gBitDb->query($insertSql, array( $type, $_REQUEST[$type]['conjugation_phrase'], empty($_REQUEST[$type]['is_target_linked'])?'y' : NULL ) ); } + } + +} $contentTypes = get_content_types(); $gBitSmarty->assign_by_ref('contentTypes',$contentTypes); - - function get_content_types(){ global $gBitDb; $selectSql = "SELECT lct.content_type_guid,conjugation_phrase, is_target_linked FROM liberty_content_types lct LEFT JOIN feed_conjugation fc ON (fc.content_type_guid = lct.content_type_guid)"; - $contentTypes = $gBitDb->getAll($selectSql); + $contentTypes = $gBitDb->getAssoc($selectSql); return $contentTypes; } diff --git a/templates/admin_feed.tpl b/templates/admin_feed.tpl index 8b47a3e..61d6c82 100644 --- a/templates/admin_feed.tpl +++ b/templates/admin_feed.tpl @@ -1,33 +1,25 @@ -<div class="span-24"> + <form action="{$smarty.const.KERNEL_PKG_URI}admin/index.php?page=feed" method="POST"> + + <input type="hidden" name="page" value="{$smarty.request.page}" /> <div class="row"> + <div class="span-4"> <h2>Content Description</h2> </div> + <div class="span-4"> <h2>Feed Verb</h2> </div> + <div class="span-4"> <h2>Remove Target Link</h2> </div> + </div> +{foreach from=$contentTypes item='type' key=contentTypeGuid} + <div class="row clear"> <div class="span-4"> - <h2>Content Description</h2> + {$contentTypeGuid} </div> - <div class="span-4"> - <h2>Feed Verb</h2> + <input type="text" name="{$contentTypeGuid|lower}[conjugation_phrase]" value="{$type.conjugation_phrase}"/>{*replace and lower to comply with BW url param standards*} </div> <div class="span-4"> - <h2>Remove Target Link</h2> + <input type="checkbox" name="{$contentTypeGuid|lower}[is_target_linked]" {if $type.is_target_linked == 'f'}checked='true'{/if} /> </div> </div> - <form action="{$smarty.const.KERNEL_PKG_URI}admin/index.php?page=feed" method="POST"> - - <input type="hidden" name="page" value="{$smarty.request.page}" /> - {foreach from=$contentTypes item='type'} - - <div class="row"> - <div class="span-4"> - {$type.content_type_guid} - </div> - <div class="span-4"> - <input type="text" name="{$type.content_type_guid|lower}" value="{$type.conjugation_phrase}"/>{*replace and lower to comply with BW url param standards*} - </div> - <div class="span-4"> - <input type="checkbox" name="{$type.content_type_guid|lower}_target" {if $type.is_target_linked == 'f'}checked='true'{/if} /> - </div> - </div> - {/foreach} - <input type="submit" value="Submit" /> +{/foreach} + <div class="row submit clear"> + <input type="submit" name="store_feed" value="Submit" /> + </div> </form> -</div> |
