Jump to content
simpilot

ScreenshotCenter 2.0

Recommended Posts

It is possible as i use the same skin and its not too difficult to change things the way you want them, click my signature for a demo, i have also added a clickable url to the main screenshot page from the random image.

Nice addition Dave. Thanks for sharing.

Nice job! On a side note, I too think it is a nice addition for a VA and I do thank Dave as well. And I really like your pilots page. Well done. ;)

Share this post


Link to post
Share on other sites

Not quite sure where the "Boost Karma" button is. Maybe I need to sign in to see it. Anyways, there are a few bits of coding that can help you getting those pages looking a lot better, and might fix your problem as well...

If you are still having problems with it, PM me and I'll help you get it sorted ou.

Hey T,

I just wanted to let you know that it works like a charm!! Thanks for the help!

See the result @ http://www.serious-airlines.com

Lucas

Share this post


Link to post
Share on other sites

What do you go into for it to automatically resize an image while it is uploaded?

regards

There is nothing to resize the images at this time, it is all done in the template displays. If you want to add something in you would add it into the screenshots.php file in the save_upload function.

Share this post


Link to post
Share on other sites

Dave would you be so kind to share your Pagination code for the screenshots as the server load on that page loading all my images is killing the server :-( I see you have managed it on your site?

Thanks in advance.

Share this post


Link to post
Share on other sites

Looking through the class code i see there is already a $limit variable in place, i have tried external methods but failed miserable, how would i limit the results using your function?

Share this post


Link to post
Share on other sites

Dave,

I have been messing about with this but i just cant seem to get anything to work, this is what i have so far.

Pastbin.

I would be greatful if you have the time to have a look,

Thanks

OK so now i have a bit more progress. new pasetbin code updated

Share this post


Link to post
Share on other sites

OK so i have something very crude working here, just got to figure out how to put the pilot details next to the images.

For anyone who has a bit more experience here is the code below,

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/
?>

<table width="100%">
       <tr>
           <td width="50%"><h3>Screenshot Gallery</h3></td>
           <td width="50%" align="right">
               <?php
               if(Auth::LoggedIn())
                   {
                       if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN))
                       {
                           echo '<form method="link" action="'.SITE_URL.'/index.php/screenshots/approval_list">
                               <input class="mail" type="submit" value="Screenshot Approval List"></form><br />';
                       }
                       echo '<form method="link" action="'.SITE_URL.'/index.php/screenshots/upload">
                       <input class="mail" type="submit" value="Upload A New Screenshot"></form></td>';
                    }
                    else
                    {
                        echo 'Login to rate or upload screenshots.';
                    }
                    ?>
       </tr>
   </table>
   <hr />

<?php
//max displayed per page
$per_page = 12;

//get start variable
$start = $_GET['start'];

//count records
$record_count = mysql_num_rows(mysql_query("SELECT * FROM screenshots"));

//count max pages
$max_pages = $record_count / $per_page; //may come out as decimal

if (!$start)
  $start = 0;

//display data
$get = mysql_query("SELECT * FROM screenshots LIMIT $start, $per_page");
while ($row = mysql_fetch_assoc($get))
{
// get data
$image = $row['id'];
$pilot = $row['pilot_id'];

echo "<table width 400px>";
echo "<tr>";
 echo "<td><img src =\"../pics/" . $row['file_name']."\" width=\"400px\"></td>";
 echo "<td>This is where the pilot info will go</td>";
echo "</tr>";
echo "</table>";
}

//setup prev and next variables
$prev = $start - $per_page;
$next = $start + $per_page;

//show prev button
if (!($start<=0))
      echo "<a href='?start=$prev'>Prev</a> ";

//show page numbers

//set variable for first page
$i=1;

for ($x=0;$x<$record_count;$x=$x+$per_page)
{
if ($start!=$x)
   echo " <a href='?start=$x'>$i</a> ";
else
   echo " <a href='?start=$x'><b>$i</b></a> ";
$i++;
}

//show next button
if (!($start>=$record_count-$per_page))
      echo " <a href='?start=$next'>Next</a>";

?>

<center>
<br /><br />

Share this post


Link to post
Share on other sites

Just grabbed your pastebin Mark, sorry the last few days have been a blur. I will see what I can do with it here this evening.

Share this post


Link to post
Share on other sites

I am also digging the idea of some pagination. I think it would be great for the screenshot center.

On another note, Dave I am sorry to see what has happened over at your VA. It is a shame that a group of sim enthusiasts gets bullied around like that. It is a crying shame. :(

Share this post


Link to post
Share on other sites

Yeah, it's a shame. But if dave does another work of skin and he copyrights it and he'll able to sue or anything to someone who copy it.

Anyway back on the Page thingy topic.....

Share this post


Link to post
Share on other sites

ok was working on this as well but huge error it repeated everything multiple times so i wound up with 13 pages of the same images

<?php
//max displayed per page
$per_page = 12;

//get start variable
$start = $_GET['start'];

//count records
$record_count = mysql_num_rows(mysql_query("SELECT * FROM screenshots"));

//count max pages
$max_pages = $record_count / $per_page; //may come out as decimal

if (!$start)
  $start = 0;

//display data
$get = mysql_query("SELECT * FROM screenshots LIMIT $start, $per_page");
while ($row = mysql_fetch_assoc($get))
{

if (!$screenshots) {echo '<div id="error">There are no screenshots in the database!</div>'; }
else {
   echo '<table class="profiletop">';
   $tiles=0;
   foreach($screenshots as $screenshot) {
       $pilot = PilotData::getpilotdata($screenshot->pilot_id);
       if(!$screenshot->file_description)
       {$screenshot->file_description = 'Not Available';}
       if ($tiles == '0') { echo '<tr>'; }
       echo '<td width="25%" valign="top"><br />
                   Views: '.$screenshot->views.' - Rating: '.$screenshot->rating.'<br /><br />
                   <a href="'.SITE_URL.'/index.php/Screenshots/large_screenshot?id='.$screenshot->id.'">
                       <img src="'.SITE_URL.'/pics/'.$screenshot->file_name.'" border="0" width="200px" height="150px" alt="By: '.$pilot->firstname.' '.$pilot->lastname.'" /></a>
                           <br />
                   <u>Submited By:</u> '.$pilot->firstname.' '.$pilot->lastname.' - '.PilotData::getpilotcode($pilot->code, $pilot->pilotid).'<br />
                   <u>Date:</u> '.date('m/d/Y', strtotime($screenshot->date_uploaded)).'<br />
                   <u>Description:</u> '.$screenshot->file_description.'<br /><br />
               </td>';
       $tiles++;
       if ($tiles == '3') {  echo '</tr>'; $tiles=0; }
   }
   echo '</table>';
}
}

//setup prev and next variables
$prev = $start - $per_page;
$next = $start + $per_page;

//show prev button
if (!($start<=0))
      echo "<a href='?start=$prev'>Prev</a> ";

//show page numbers

//set variable for first page
$i=1;

for ($x=0;$x<$record_count;$x=$x+$per_page)
{
if ($start!=$x)
   echo " <a href='?start=$x'>$i</a> ";
else
   echo " <a href='?start=$x'><b>$i</b></a> ";
$i++;
}

//show next button
if (!($start>=$record_count-$per_page))
      echo " <a href='?start=$next'>Next</a>";

?>

this is the code not sure what i did wrong

Share this post


Link to post
Share on other sites

Would be sweet if we could figure out how to make it email or airmail a pilot and let him/her know their screenshots were approved. Like an auto send I guess. Not sure how difficult that would be to do.

Would this be hard to trigger for airlines that use your Airmail script? Like an auto NOTAM from the main site admin.

Nothing serious here, just curious.

Share this post


Link to post
Share on other sites

Attached is a stripped down version of what I have running at virtualACA (no individual pilot screenshot center or functions and no contest functions). It has pagination built in and also sends an airmail for both approvals and rejections of new screenshots. You MUST have AIRMail installed and running without modification to the core files for the airmail functions to work within the screenshot center module. Templates are generic and must be skined/adjusted to your va. You can adjust the pagination, look around the module file for the parameters.

Installation is the same as the original in the start of the thread.

EDIT: Removed download - corrupted. Newest version with pagination later in the thread.

Share this post


Link to post
Share on other sites

Cheers Dave your a star, just the one question in the pilots profile i have their latest screen shot displayed using,

<?php Screenshots::get_pilots_newscreenshot($userinfo->pilotid); ?>

Its now complaining about the get method undefined but its been so long since i have looked at this i cant remember.

exact error is,

Fatal error: Call to undefined method Screenshots::get_pilots_newscreenshot() in /file location/profile_main.tpl on line 68, which is that code above. Any pointers would be appreciated,

That file is,

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/

   if (!$screenshot)
       {echo 'You Have Not Submitted<br />Any Screenshots'; }
   else
       {
           echo '<b>Your Latest Submission</b><br />
           <img src="'.SITE_URL.'/pics/'.$screenshot->file_name.'" height="125px" width="180px" alt="Your Latest Screenshot" />
           <br />Submitted On - '.$date;
       }
?>

Cheers.

Share this post


Link to post
Share on other sites

Sorry, looks like I got overzealous when I was removing some of the functions used at virtalACA.

Need to add ->

public function get_pilots_newscreenshot($pilot_id)    {
       $screenshot = ScreenshotsData::get_pilots_newscreenshot($pilot_id);
       $this->set('screenshot', $screenshot);
       $this->set('date', date('m/d/Y', $screenshot->date));
       $this->show('Screenshots/screenshots_pilot.tpl');
   }

to screenshots.php

And add ->

public function get_pilots_newscreenshot($pilot_id) {
       $query = "SELECT id, file_name, file_description, pilot_id, UNIX_TIMESTAMP(date_uploaded) AS date FROM screenshots WHERE pilot_id='$pilot_id' AND file_approved='1' ORDER BY date_uploaded DESC LIMIT 1;";

       return DB::get_row($query);
   }

to ScreenshotsData.class.php

You will also need to add the screenshots_pilot.tpl file from the original version back to the template structure.

Share this post


Link to post
Share on other sites

working like a charm now with the pagnation

only question dave is where can i change it no i have this

.1

.2

next

but i would like

1,2,3,next

i looked at the pagnation but i can't seem to find it

thanks in advance joeri

Share this post


Link to post
Share on other sites

working like a charm now with the pagnation

only question dave is where can i change it no i have this

.1

.2

next

but i would like

1,2,3,next

i looked at the pagnation but i can't seem to find it

thanks in advance joeri

Its in the Pageination.class.php at the bottom where the url are created,

This si what i done from line 179 to 204,

$output .= sprintf('<a href="' . $link . '">«</a>', '1');
     }

     if ($currentPage > 1){
        $output .= sprintf('<a href="' . $link . '"> Previous </a>', $currentPage - 1);
     }

     for ($i = $loopStart; $i <= $loopEnd; $i++)
     {
        if ($i == $currentPage){
           $output .= '' . $i . ' ';
        } else {
           $output .= sprintf('<a href="' . $link . '">', $i) . $i . '</a> ';
        }
     }

     if ($currentPage < $totalPages){
        $output .= sprintf('<a href="' . $link . '"> Next </a>', $currentPage + 1);
     }

     if ($loopEnd != $totalPages){
        $output .= sprintf('<a href="' . $link . '">»</a>', $totalPages);
     }

     return ' ' . $output . ' ';
  }

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×