diff options
| author | Christian Fowler <spider@viovio.com> | 2006-01-15 06:46:36 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2006-01-15 06:46:36 +0000 |
| commit | 86d050555536975ca942ea2aede2ef4cda59d1af (patch) | |
| tree | 27009f8d945cfe81e5613d76f86fa3ed8f3f9f5b /image_order.php | |
| parent | 7911b3404f7032dd79eb78b766c22375fcf2f8a7 (diff) | |
| download | fisheye-86d050555536975ca942ea2aede2ef4cda59d1af.tar.gz fisheye-86d050555536975ca942ea2aede2ef4cda59d1af.tar.bz2 fisheye-86d050555536975ca942ea2aede2ef4cda59d1af.zip | |
Woot! my first ReleaseTwo commit. Have added simple table to hold list of favorite user content_id's
Diffstat (limited to 'image_order.php')
| -rw-r--r-- | image_order.php | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/image_order.php b/image_order.php index 3911d43..4caae03 100644 --- a/image_order.php +++ b/image_order.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_fisheye/image_order.php,v 1.8 2005/11/22 07:25:47 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_fisheye/image_order.php,v 1.9 2006/01/15 06:46:36 spiderr Exp $ * @package fisheye * @subpackage functions */ @@ -35,12 +35,24 @@ if (!empty($_REQUEST['cancel'])) { if( !empty( $_REQUEST['batch'] ) ) { // flip so we can do instant hash lookup $batchCon = array_flip( $_REQUEST['batch'] ); - // increment the first element from 0 to 1 so any conditional tests will pass, particularly in the .tpl + // increment the first element from 0 to 1 (element 0 index before flip) so any conditional tests will pass, particularly in the .tpl $batchCon[key($batchCon)]++; $gBitSmarty->assign_by_ref( 'batchEdit', $batchCon ); } - if( !empty( $_REQUEST['reorder_gallery'] ) && $gContent->loadImages() ) { + if( !empty( $_REQUEST['is_favorite'] ) ) { + // flip so we can do instant hash lookup + $favoriteCon = array_flip( $_REQUEST['is_favorite'] ); + // increment the first element from 0 to 1 (element 0 index before flip) so any conditional tests will pass, particularly in the .tpl + $favoriteCon[key($favoriteCon)]++; + } + + if( !empty( $_REQUEST['reorder_gallery'] ) || !empty( $favoriteCon ) ) { + $gContent->loadImages(); + } + + + if( !empty( $_REQUEST['reorder_gallery'] ) ) { switch( $_REQUEST['reorder_gallery'] ){ case 'upload_date': foreach( array_keys( $gContent->mItems ) as $imageId ) { @@ -71,6 +83,16 @@ if (!empty($_REQUEST['cancel'])) { } } + if( !empty( $favoriteCon ) ) { + foreach( array_keys( $gContent->mItems ) as $itemConId ) { + if( $gContent->mItems[$itemConId]->getField( 'is_favorite' ) && empty( $favoriteCon[$itemConId] ) ) { + $gBitUser->expungeFavorite( $itemConId ); + } elseif( !$gContent->mItems[$itemConId]->getField('is_favorite') && !empty( $favoriteCon[$itemConId] ) ) { + $gBitUser->storeFavorite( $itemConId ); + } + } + } + foreach ($_REQUEST['imagePosition'] as $contentId=>$newPos) { if( $galleryItem = $gLibertySystem->getLibertyObject( $contentId ) ) { if( isset( $batchCon[$contentId] ) ) { @@ -152,7 +174,6 @@ $listHash = array( 'user_id' => $gBitUser->mUserId, 'max_records' => -1, 'no_thu $galleryList = $gContent->getList( $listHash ); $gBitSmarty->assign_by_ref( 'galleryList', $galleryList['data'] ); $gContent->loadImages(); -$gBitSmarty->assign_by_ref('galleryImages', $gContent->mItems); $gBitSmarty->assign_by_ref('formfeedback', $feedback); |
