4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Rembrandt on August 11, 2009, 06:58:02 PM

Title: [MOD]Last User Upload
Post by: Rembrandt on August 11, 2009, 06:58:02 PM
Hi!

mit diesen mod ist es möglich anzuzeigen, welcher user die letzten uploads gemacht hat.

angezeigt werden: datum, user, bildname, bild beschreibung, kategorie.

demo: demo.vienna-pictures (http://www.demo.vienna-pictures.com)

1.)search in  index.php

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
 
add before:

//###################################### Start Mod Last Upload #################################################

 $last_upload_num ="5"; // number e.g. 1,2,3,10,15,20,50,100... e.t.c
 
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
LIMIT $last_upload_num";
$result = $site_db->query($sql);

  $last_upload = "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"summary=\"new thumbs\">";
                $last_upload .= "<tr class=\"imagerow2\">\n";
$last_upload .= "<td  style=\"width:8%;text-align:center; \"><b>".$lang['date']."</b></td>\n";
$last_upload .= "<td  style=\"width:12%;text-align:center; \"><b>".$lang['added_by']."</b></td>\n";
$last_upload .= "<td  style=\"width:25%;text-align:center; \"><b>".$lang['image_name']."</b></td>\n";
$last_upload .= "<td  style=\"width:40%;text-align:center; \"><b>".$lang['description']."</b></td>\n";
$last_upload .= "<td  style=\"width:15%;text-align:center; \"><b>".$lang['category']."</b></td>\n";
$last_upload .= "</tr>\n";
$count = 0;
  $bgcounter = 0;
  while ($image_row2 = $site_db->fetch_array($result)){
    $img_date =  strftime ( '%d.%m.%Y',$image_row2['image_date']);
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

                $last_upload .= "<tr class=\"imagerow".$row_bg_number."\">\n";
                $last_upload .= "<td  style=\"width:8%;text-align:center; \">".$img_date."</td>\n";
$last_upload .= "<td  style=\"width:12%; \"><a href=\"./member.php?action=showprofile&amp;user_id=$image_row2[user_id]\">".$image_row2[user_name]."</a></td>\n";;
$last_upload .= "<td style=\"width:25%; \"><a href=\"./details.php?image_id=$image_row2[image_id]\">".$image_row2[image_name]."</a></td>\n";
$last_upload .= "<td  style=\"width:40%; \">".un_htmlspecialchars(format_text($image_row2['image_description']))."</td>\n";
$last_upload .= "<td  style=\"width:15%; \"><a href=\"./categories.php?cat_id=$image_row2[cat_id]\">".$image_row2[cat_name]."</a></td>\n";
  
$count++;
    if ($count == $last_upload_num) {
      $last_upload .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($last_upload_num - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $last_upload .= "<td style=\"width:".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $last_upload .= "</tr>\n";
    }
  }
  $last_upload .= "</table>\n";

$site_template->register_vars("last_upload", $last_upload);
unset($last_upload);
//###################################### End Mod Last Upload #################################################


in  home.html write wherever you want:  {last_upload}
or for default_full templates:
Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td class="head1" valign="top">Last Upload</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    <tr>
                      <td class="head1">{last_upload}</td>
                    </tr>
                  </table>
<br />

mfg Andi
Title: Re: [MOD]Last User Upload
Post by: mawenzi on August 11, 2009, 07:47:31 PM
... gefällt mir, wie immer auch deine Umsetzung und Präsentation, kann ich so direkt nach "Mods & Plugins (Releases & Support)" verschieben ...
... doch warum dieser Sprachsprung ... ;)
Title: Re: [MOD]Last User Upload
Post by: rinaldos on August 11, 2009, 11:48:55 PM
Schaut super aus und der Einbau klappt easy. Wer den Kategorie Namen angezeigt haben will sollte nur eine Zeile ändern.

$last_upload .= "<td  style=\"width:8%;text-align:center; \"><a href=\"./categories.php?cat_id=$image_row2[cat_id]\">".$image_row2[cat_id]."</td>\n";


durch diese ersetzen

$last_upload .= "<td  style=\"width:8%;text-align:center; \"><a href=\"./categories.php?cat_id=$image_row2[cat_id]\">".$image_row2[cat_name]."</td>\n";


Ich habe aber in Erinnerung das es soetwas ähnliches schonmal gab. Finde es nur auf Anhieb nicht.

LG
Ingo
Title: Re: [MOD]Last User Upload
Post by: Rembrandt on August 12, 2009, 05:30:55 AM
Hi!
@rinaldos, das wollte ich eigentlich machen, habe es aber dann vergessen.
ist wahrscheinlich das Nitro, denn im moment habe ich die maler hinter mir :)

@mawenzi, ja ich bin mir selber noch nicht sicher wie ich für mich am einfachsten einen mod präsentiere,
b.z.w. das es die meisten verstehn,das ist bald mehr arbeit als der mod selber.

für den einbau und funktion ist die erklärung nicht so wichtig, glaube ich.
und 'add after' oder 'before' denke ich, verstehen auch die jenigen die nicht englisch können.

mfg Andi
Title: Re: [MOD]Last User Upload
Post by: Allround on May 30, 2012, 11:29:35 PM
Und das ganze statt mit Datum mit Thumb Image??
Title: Re: [MOD]Last User Upload
Post by: Rembrandt on May 31, 2012, 04:49:11 AM
Hi!

Und das ganze statt mit Datum mit Thumb Image??


//###################################### Start Mod Last Upload #################################################

 $last_upload_num ="6"; // number e.g. 1,2,3,10,15,20,50,100... e.t.c
 
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
       LIMIT $last_upload_num";
$result = $site_db->query($sql);

  $last_upload = "<table style=\"width:".$config['image_table_width']."; border-style:none;\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"summary=\"new thumbs\">";
  $last_upload .= "<tr class=\"imagerow2\">\n";
  $last_upload .= "<td  style=\"width:8%;text-align:center; \"><b>".$lang['date']."</b></td>\n";
  $last_upload .= "<td  style=\"width:8%;text-align:center; \"><b>".$lang['added_by']."</b></td>\n";
  $last_upload .= "<td  style=\"width:25%;text-align:center; \"><b>&nbsp;</b></td>\n";
  $last_upload .= "<td  style=\"width:15%;text-align:center; \"><b>".$lang['image_name']."</b></td>\n";
  $last_upload .= "<td  style=\"width:30%;text-align:center; \"><b>".$lang['description']."</b></td>\n";
  $last_upload .= "<td  style=\"width:15%;text-align:center; \"><b>".$lang['category']."</b></td>\n";
  $last_upload .= "</tr>\n";
 
  $count = 0;
  $bgcounter = 0;
  while ($image_row2 = $site_db->fetch_array($result)){
    $img_date =  strftime ( '%d.%m.%Y',$image_row2['image_date']);
     
      $row_bg_number = (++$bgcounter == 1) ? 1 : 2;
     
      if ($bgcounter  == 3){
        $row_bg_number = 3;
        $bgcounter = 0;
      }
     
  $last_upload .= "<tr class=\"imagerow".$row_bg_number."\">\n";
  $last_upload .= "<td  style=\"width:8%;text-align:center; \">".$img_date."</td>\n";
  $last_upload .= "<td  style=\"width:8%; \"><a href=\"./member.php?action=showprofile&amp;user_id=$image_row2[user_id]\">".$image_row2[user_name]."</a></td>\n";;
  $last_upload .= "<td  style=\"width:12%; \">".get_thumbnail_code($image_row2['image_media_file'], $image_row2['image_thumb_file'], $image_row2['image_id'], $image_row2['cat_id'], format_text(trim($image_row2['image_name']), 2), $mode, 1)."</td>\n";
  $last_upload .= "<td style=\"width:15%; \"><a href=\"./details.php?image_id=$image_row2[image_id]\">".$image_row2[image_name]."</a></td>\n";
  $last_upload .= "<td  style=\"width:30%; \">".un_htmlspecialchars(format_text($image_row2['image_description']))."</td>\n";
  $last_upload .= "<td  style=\"width:15%; \"><a href=\"./categories.php?cat_id=$image_row2[cat_id]\">".$image_row2[cat_name]."</a></td>\n";
   
    $count++;
    if ($count == $last_upload_num) {
      $last_upload .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($last_upload_num - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $last_upload .= "<td style=\"width:".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $last_upload .= "</tr>\n";
    }
  }
  $last_upload .= "</table>\n";

$site_template->register_vars("last_upload", $last_upload);
unset($last_upload);
//###################################### End Mod Last Upload #################################################

mit den weiten der einzelnen Spalten mußt du dich noch selber spielen.

mfg Andi
Title: Re: [MOD]Last User Upload
Post by: Allround on May 31, 2012, 10:36:29 AM
ging aber schnell...
Danke

Ich hab 200 px thumbnails, ich hätte noch gern gewußt wie ich in den Code durch Eingabe von width und height die thumbnails auf 100 px reduzieren kann.. oder noch besser.. die Thumbnail weg und in der Zeile "Bildname" eine Mouseover Vorschau des Bildes.. in der Größe von 100 px
Title: Re: [MOD]Last User Upload
Post by: Rembrandt on May 31, 2012, 05:14:02 PM
suche hilft:
http://www.4homepages.de/forum/index.php?topic=25017.0

mfg Andi
Title: Re: [MOD]Last User Upload
Post by: Allround on June 01, 2012, 12:29:20 AM
Danke