Jump to content

Recommended Posts

Posted

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. ;)

Posted

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

  • Administrators
Posted

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.

  • Moderators
Posted

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.

  • Moderators
Posted

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?

  • Moderators
Posted

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

  • Moderators
Posted

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 />

Posted

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. :(

  • Moderators
Posted

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.....

  • 2 weeks later...
Posted

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

  • 1 month later...
Posted

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.

  • Administrators
Posted

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.

  • Moderators
Posted

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.

  • Administrators
Posted

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.

  • Moderators
Posted

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

  • Moderators
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...