SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    Nov 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to have my guid saved for the dialog?

    I am using the following code to populate date in my page.

    Code:
    <table align="center" cellpadding="5" cellspacing="0" style="width:100%;">
        <?php
            $mysql_command = "CALL sp_populate_my_companies(:param_member_guid)"; 
            $mysql_query = $mysql_connection->prepare($mysql_command);
            $mysql_query->bindParam(':param_member_guid', $_SESSION["xoompage_member_guid"], PDO::PARAM_STR);
            $mysql_query->execute();
    
            while($mysql_row = $mysql_query->fetch())
            {
        ?>
        <tr>
            <td valign="top" style="width: 200px;"><a href="<?php echo $_SESSION["domain_name"]; ?>biz/company?id=<?php echo $mysql_row['company_guid']; ?>" target="_blank"><img src="<?php echo $_SESSION["domain_name"]; ?>gallery/companies/<?php echo $mysql_row['company_guid']; ?>/<?php echo $mysql_row['company_guid']; ?>_logo.png" alt="<?php echo $mysql_row['company_name']; ?>" width="200" height="80"></a></td>
            <td valign="top" style="width: 100%; padding: 10px;">
                <a href="<?php echo $_SESSION["domain_name"]; ?>biz/company?id=<?php echo $mysql_row['company_guid']; ?>" target="_blank"><?php echo $mysql_row['company_name']; ?></a><br>
                <?php echo $mysql_row['country_name']; ?><br><hr>
                <?php if ($mysql_row['allow_publish_news']) { ?><a href='<?php echo $_SESSION["domain_name"]; ?>biz/publishnews?id=<?php echo $mysql_row['company_guid']; ?>'>Publish News</a><br><?php } ?>
                <?php if ($mysql_row['allow_post_jobs']) { ?><a href='<?php echo $_SESSION["domain_name"]; ?>biz/jobdetails?company=<?php echo $mysql_row['company_guid']; ?>'>Post a Job</a><br><?php } ?>
                <?php if ($mysql_row['allow_edit_company']) { ?><a href='<?php echo $_SESSION["domain_name"]; ?>biz/companydetails?id=<?php echo $mysql_row['company_guid']; ?>'>Edit Company</a><br><?php } ?>
                <?php if ($mysql_row['allow_change_logo']) { ?><a href='<?php echo $_SESSION["domain_name"]; ?>biz/companylogo?id=<?php echo $mysql_row['company_guid']; ?>'>Company Logo</a><br><?php } ?>
                <?php if ($mysql_row['allow_change_cover']) { ?><a href='<?php echo $_SESSION["domain_name"]; ?>biz/companycover?id=<?php echo $mysql_row['company_guid']; ?>'>Company Cover</a><br><?php } ?>
                <?php if ($mysql_row['allow_delete_company']) { ?><a href="#" id="linkDelete">Delete Company</a><br><?php } ?>
            </td>
        </tr>
        <tr><td><br></td></tr>
        <?php } ?>
    </table>
    for the delete button (linkDelete), I am showing a confirmation dialog and delete the company like this:

    Code:
    $(document).ready(function()
    {
        $('div#dialogXoomPage').dialog({ position : ['center', 'middle'], autoOpen: false, modal: true, resizable: false, draggable: false,
        buttons:
        [{
            id: "btnDeleteCompany",
            text: "Delete",
            click: function()
            {
                //console.log(pid + " made it to dialog"); // make sure our id makes it this far
                delete_cmpany(company_id); // run delete photo function
                $( this ).dialog( "close" );
            }},
        {
            id: "btnCancelDeleteCompany",
            text: "Cancel",
            click: function()
            { $( this ).dialog( "close" ); }
        }],
        open: function ()
        { $("#btnCancelDeleteCompany").focus(); }
        });
    
        function delete_cmpany(company_id)
        {
            //console.log(pid + " made it to function"); // make sure our id makes it this far
            $.ajax({
            type: "POST",
            url: "delete_company.php",
            data: { id: company_id }
            }).done(function( msg ) {
            //no message bc we did a fadeOut
            //var msg would show any errors from our php file
            });
        };
    
        $('#linkDelete').click(function()
        {  
            company_id = "5d3c4f60-77b5-11e3-b1ac-74de2b9a31a4"; // the id of the photo i want to delete
            console.log(company_id);
            $('div#dialogXoomPage').dialog('open');
        });
        
        $(function() { $( "#btnNewCompany" ).button(); });
        $(function() { $( "#btnJoinCompany" ).button(); });
        $('#btnNewCompany').click(function(){ window.location = '<?php echo $_SESSION["domain_name"]; ?>biz/companydetails';});
        $('#btnJoinCompany').click(function(){ window.location = '<?php echo $_SESSION["domain_name"]; ?>biz/joincompany';});
    });
    I want to know how can I pass the company_guid to the dialog to use it in the company_id variable?


    Thanks,
    <snip/>
    Last edited by Mittineague; Jan 11, 2014 at 16:46.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •