Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-23-2012, 03:21 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 112,612
SilverDragonTears is on a distinguished road
Default

K Here is my sort script. I have it separate from the my adopts
Code:
<?php

include("functions/functions.php");
include("functions/functions_users.php");
include("functions/functions_adopts.php");
include("classes/class_pagination.php");
include("css/pagination.css");
include("inc/lang.php");

//***************//
//  START SCRIPT //
//***************//
$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
$page = $_GET["page"];




if($isloggedin == "yes")
{
$article_content = "<p id='activate_sort'>
                                 Click here to sort your adoptables
                            </p>
                            <table>
                                <tr>
                                    <th></th><th>Name and Type</th><th>Image</th><th>Clicks</th>
                                </tr>
                            </table>
                            <table id='sortable_adoptables'>";

		// We need to get all of the user's adoptables from the database and display them...
 		$query = "SELECT *  
                    FROM {$prefix}owned_adoptables  
                    LEFT JOIN {$prefix}sort_adoptables  
                        ON {$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id 
                    INNER JOIN {$prefix}levels  
                        ON {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel 
                    INNER JOIN {$prefix}adoptables 
                        ON {$prefix}owned_adoptables.type = {$prefix}adoptables.type 
                    WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}'  
                    AND {$prefix}levels.adoptiename = {$prefix}adoptables.type 
                    ORDER BY {$prefix}sort_adoptables.sorting_id";
		$stmt = $adopts->query($query);
        

		while($row = $stmt->fetchObject()){
			if($row->usealternates == 'yes') $image = $row->alternateimage; 
			else $image = $row->primaryimage; 
			if($row->currentlevel == 0) $image = $row->eggimage; 
			if($image=='') $image = $row->primaryimage; 
                         
            $article_content .= "<tr id='orderaid_{$row->aid}'><td><img src='{$image}' width='20px' height='20px'></td>
                           </tr> ";   
        }
        $article_content .= "</table>"; 
         
      }  
        
//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title, $article_content, $date);

?>
and this one?
Code:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        
        $('body').undelegate('click').delegate('p#activate_sort', 'click', function(){
            var realBg = $('table#sortable_adoptables').css('background-color');
            var submitForm = '<form name="submit_order" id="submit_order" action="" method="post"><fieldset><label for="submit">Submit Changes</label><input type="submit" id="submit" value="Submit"></fieldset></form>';
            $('table#sortable_adoptables').css('background-color', '#FFFF66').animate({ backgroundColor: realBg },  'slow' ).find('tbody').sortable({ cursor: 'pointer' });
            $(submitForm).insertAfter('p#activate_sort').hide().slideDown();
            $('p#activate_sort').attr('id', 'deactivate_sort');
        });
        
        $('body').undelegate('submit').delegate('form#submit_order', 'submit', function(event){
            event.preventDefault();
            var data = $('table#sortable_adoptables tbody').sortable('serialize');
            $.post('ajax_sort.php', data, function(result){
                $('form#submit_order').html(result).delay(5000).fadeOut('slow', function(){
                    $(this).remove();                    
                });
            });
            $('table#sortable_adoptables tbody').sortable('destroy');
            $('p#deactivate_sort').attr('id', 'activate_sort');
        });
});
</script>
__________________

Check out SilvaTales
Reply With Quote
  #2  
Old 03-23-2012, 04:41 PM
!Alive !Alive is offline
Member
 
Join Date: Feb 2012
Posts: 39
Gender: Male
Credits: 1,749
!Alive is on a distinguished road
Default

I made the chages to your php and the javascript. This should work. You might also want to change or remove the table that has the text for name, type, ect.
Let me know how it goes. ;3

PHP Code:
<?php

include("functions/functions.php");
include(
"functions/functions_users.php");
include(
"functions/functions_adopts.php");
include(
"classes/class_pagination.php");
include(
"css/pagination.css");
include(
"inc/lang.php");

//***************//
//  START SCRIPT //
//***************//
$id $_GET["id"];
$act $_GET["act"];
$more $_GET["more"];
$page $_GET["page"];




if(
$isloggedin == "yes")
{
$article_content "<p id='activate_sort'>
                                 Click here to sort your adoptables
                            </p>
                            <table>
                                <tr>
                                    <th></th><th>Name and Type</th><th>Image</th><th>Clicks</th>
                                </tr>
                            </table>
                            <table>"
;

        
// We need to get all of the user's adoptables from the database and display them...
         
$query "SELECT *  
                    FROM 
{$prefix}owned_adoptables  
                    LEFT JOIN 
{$prefix}sort_adoptables  
                        ON 
{$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id 
                    INNER JOIN 
{$prefix}levels  
                        ON 
{$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel 
                    INNER JOIN 
{$prefix}adoptables 
                        ON 
{$prefix}owned_adoptables.type = {$prefix}adoptables.type 
                    WHERE 
{$prefix}owned_adoptables.owner = '{$loggedinname}'  
                    AND 
{$prefix}levels.adoptiename = {$prefix}adoptables.type 
                    ORDER BY 
{$prefix}sort_adoptables.sorting_id";
        
$stmt $adopts->query($query);
        

$cols 3//the number of columns

        
do{
        
$article_content .= "<tr>";
        for(
$i=1;$i<=$cols;$i++){ 
        

        while(
$row $stmt->fetchObject()){
            if(
$row->usealternates == 'yes'$image $row->alternateimage
            else 
$image $row->primaryimage
            if(
$row->currentlevel == 0$image $row->eggimage
            if(
$image==''$image $row->primaryimage
                         
            
$article_content .= "tent .= "
                        
<td class='sortable_adoptables'>
                        <
table id='orderaid_{$row['aid']}'><tr>
<
td><img src='{$image}' width='20px' height='20px'></td>
<
td width=50%>&nbsp;</td>    <!-- Create gap between columns -->
                           </
tr> </table></td>";   
        }
else{
            
$article_content .= "<td>&nbsp;</td>";    //If there are no more records at the end, add a blank column
            }
        }
    } while(
$row);
        
$article_content .= "</table>"; 
         
      }  
        
//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage(
$article_title$article_content$date);

?>
HTML Code:
<script type="text/javascript">
        $(document).ready(function(){
            $('body').undelegate('click').delegate('p#activate_sort', 'click', function(){
                var realBg = $('table#sortable_adoptables').css('background-color');
                var submitForm = '<form name="submit_order" id="submit_order" action="" method="post"><fieldset><label for="submit">Click and drag a Pokemon to switch it with  another Pokemon.</br></br></label><input type="submit" id="submit" value="Save Changes"></fieldset></form>';
		$('.sortable_adoptables')
                    .css('background-color', '#FFFF66')
                    .animate({ backgroundColor: realBg },  'slow' )
                    .sortable({ 
                        cursor: 'pointer', connectWith: ".sortable_adoptables", receive: function(event, ui) {
                            var $this = $(this);
                            if ($this.children('table').length > 1) {
     				$this.children('table').not(ui.item).appendTo(ui.sender);
				}
                        }
                    });
                $(submitForm).insertAfter('p#activate_sort').hide().slideDown();
                $('p#activate_sort').attr('id', 'deactivate_sort');
            });
            
            $('body').undelegate('submit').delegate('form#submit_order', 'submit', function(event){
                event.preventDefault();
                var data = $.map($('.sortable_adoptables'), function(v, i){
                           return $(v).sortable('serialize');
                });
                data = data.join("&");
                $.post('ajax_sort.php', data, function(result){
                    $('form#submit_order').html(result).delay(5000).fadeOut('slow', function(){
                        $(this).remove();                    
                    });
                });
                $('.sortable_adoptables').sortable('destroy');
                $('p#deactivate_sort').attr('id', 'activate_sort');
            });
        });
    </script>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Silly bots. --" how can I make a clickery? kitty08 Questions and Supports 6 10-24-2011 07:26 AM


All times are GMT -5. The time now is 02:05 PM.

Currently Active Users: 2237 (0 members and 2237 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636