Arrow Home arrow Forums
larger font smaller font default font Fixed screen resolution Auto adjust screen size

Joomlapolis Forums  


Help! Plugin Nametags Joomgallery
Date: 2008/08/10 20:52 By: xhattr Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 1
graphgraph
Hi, i'm working on a plugin to display on your profile page on how many pictures your nametag is on, and wich pictures. I want to display a list with thumbs and the categorie (thumb must be linked with the original picture in joomgallery)

i already have this:
Code:

 <?php class getGalleryTagsTab extends cbTabHandler {     function getGalleryTagsTab() {         $this->cbTabHandler();     } /**  * Creates and returns the header of the Gallery tab  * conatining No. of images, and upload-link if configured   **/   function getHeader($user$total$Itemid$gallery){       $return "<p><strong>$user->username</strong>";              if (intval($total) == 0){           $return.=" staat op geen enkele foto.";     }     else {           $return.= " staat op <strong>"$total ."</strong> foto\'s.";     }         $return.= "</p>";         return $return;   }   /**    * Helper function from Ponygallery, creates the path for categories    **/   function ShowCategoryPath ($cat,$db_catg){     global $database;     $cat=intval$cat );     $parent_id=1000;     while ( $parent_id ){         // read name and parent_id         $query="select * from $db_catg where cid=$cat";         $database->setQuery$query );         $result=$database->query();         $parent_id=@mysql_result$result0'parent' );         $name=@mysql_result$result0'name' );         // write path         if ( empty( $path ) ) {         $path=$name;         }         else {         $path=$name ' > ' $path;         }         // next looping         $cat=$parent_id;         }     return $path " ";   }         /**    * Helper function, loads the right language    **/   function includeLang($gallery_absolute_path$mosConfig_lang){     if (file_exists($gallery_absolute_path."/language/".$mosConfig_lang.".php"))          include_once($gallery_absolute_path."/language/".$mosConfig_lang.".php");     else          include_once($gallery_absolute_path."/language/english.php");            }       /**  * Main function, displays the Gallery-Tab in Community Builder  **/       function getDisplayTab($tab,$user,$ui) {     global $database,$mosConfig_live_site$mosConfig_absolute_path$my,            $ag_paththumbs$mosConfig_lang$ag_showdetail$ag_perpage$ag_showrating$ag_showcomment;                 $pony_config_path =$mosConfig_absolute_path "/administrator/components/com_joomgallery/joomgallery.config.php";      //$ponyml_javascript = $mosConfig_absolute_path . "/administrator/components/com_ponygallery/ config.ponygallery.php";           define'_PONY_PARENT_MODULE'"1" );     $gallery_absolute_path $mosConfig_absolute_path."/components/com_joomgallery/";     require($pony_config_path); // config and language before Javascript needed     $this->includeLang($gallery_absolute_path$mosConfig_lang);     require_once($mosConfig_absolute_path."/components/com_joomgallery/includes/joom.javascript.php");     require_once($mosConfig_absolute_path."/administrator/components/com_joomgallery/common.joomgallery.php");     require_once($mosConfig_absolute_path "/administrator/components/com_joomgallery/joomgallery.class.php" );              $thumbnailpath=$mosConfig_live_site $ag_paththumbs "/";          $showdetail $ag_showdetail;     $showrating $ag_showrating;     $showcomment $ag_showcomment;     $picsNumber $ag_perpage;          $db_name "#__joomgallery";     $db_cmt_name "#__joomgallery_comments";     $db_catg_name "#__joomgallery_catg";                  $uid=intvalmosGetParam$_REQUEST"uid") );     $params $this->params;          // ItemId for Ponygallery-Links          $database->setQuery("select id from #__menu where link like '%com_joomgallery%'");     $Itemid=$database->loadResult();     if ($Itemid == '' || $Itemid == NULL)         $Itemid "";     else         $Itemid "&amp;Itemid=$Itemid";          $return="";  //String to return for output     if($tab->description != null)          $return .= "\t\t<div class=\"tab_Description\">".unHtmlspecialchars(getLangDefinition($tab->description))."</div>\n";              // Determine # of pics for pagination         $database->setQuery("SELECT count(id) FROM $db_name as a, #__joomgallery_nameshields as b "                  "\n  WHERE a.published = '1'"         "\n AND b.nuserid = '$user->user_id'"         "\n AND a.id = b.npicid"         "\n AND a.approved = 1");     $total=$database->loadResult();          // Hide tab if no pics and it is configured to hide:     if (($total==0) && ($params->get('showEmptyTab','0')==0))         return null;              // Pagination:     $startpage=1;     $picsperpage $params->get('picsperpage','0');     if ($picsperpage)         $picsNumber $picsperpage;              $pagingParams $this->_getPaging(array(),array("gallerytagstab_"));     if ($pagingParams["gallerytagstab_limitstart"] === null)          $pagingParams["gallerytagstab_limitstart"] = "0";     if ($picsNumber $total)          $pagingParams["gallerytagstab_limitstart"] = "0";                      // Include Header (Information) on first page:     if ($pagingParams["gallerytagstab_limitstart"] == "0")         $return .= $this->getHeader($user$total$Itemid$gallery_version);          // Start of pics table:         $return.= "<table class=\"gallerytabs_table\" width='100%' border='0' cellspacing='1' cellpadding='4'>";          // Order images by:     $sortby=$database->getEscaped($params->get('sortBy','catid ASC'));          $query "SELECT *";     if ($sortby =="rating")         $query .= ", ROUND(a.imgvotesum/a.imgvotes, 2) as rating";          $query .= " FROM $db_name as a, #__joomgallery_nameshields as b "              "\n  WHERE a.published = '1' " " AND a.approved = 1"             "\n AND b.nuserid = '$user->user_id'"             "\n AND a.id = b.npicid";     if ($sortby =="rating")         $query .= "\n ORDER BY rating DESC";     else         $query .= "\n ORDER BY ".$sortby;          $query .= "\n LIMIT ".($pagingParams["gallerytagstab_limitstart"]?$pagingParams["gallerytagstab_limitstart"]:"0").",".$picsNumber;          $database->setQuery($query);     if (! $rows=$database->loadObjectList());         $database->stderr();              $return.= "<tr>";     $rowcounter=0;               foreach ( $rows as $row1 ){         if ( ($rowcounter == 0) AND ($rowcounter <> 0) )             $return.="</tr><tr>";                            $link "openimage($ag_detailpic_open, $row1->id, $row1->imgfilename, $row1->imgtitle,$row1->imgtext)";              $return.= "<td width='34%' align='center' valign='bottom'>";     $return.= "<a href=\"$link\">"             ."<img src='$thumbnailpath$row1->imgthumbname' border='0' title='$row1->imgtext'>"             ."</a><br />";         $return .= "<b>$row1->imgtitle</b>";              // Display Category path:     if ($params->get('showCategory','1')==1){         $Category $this->ShowCategoryPath($row1->catid$db_catg_name);         $return .= "<br /> $Category";     }                  // Display Details and rating:         if ($showdetail )             $return.= "<br />".(($gallery_version =="joom")? _JOOMGALLERY_HITS_JOOMGALLERY_HITS).": $row1->imgcounter";         if ( $showrating ){             if ( $row1->imgvotes ){                     $fimgvotesum=number_format$row1->imgvotesum $row1->imgvotes2",""." );                     $frating="$fimgvotesum ($row1->imgvotes Votes)";             }          else {                 $frating_JOOMGALLERY_NO_VOTES;      }          $return.="<br />".( _JOOMGALLERY_RATING).": $frating";     }                  // Comments:         if ( $showcomment ){                          // Check how many comments exist             $database->setQuery"SELECT cmtid FROM $db_cmt_name WHERE cmtpic='$row1->id'" );             $comments_result=$database->query();             $comments=mysql_num_rows$comments_result );             $return.= "<br />".( _JOOMGALLERY_COMMENT) .": $comments";         }         $return.= "</td>";         $rowcounter++;     }         if ( $rowcounter <> ){         for ( $i=1$i <= (- ($rowcounter 3)); $i++ ) {             $return.= "<td width='34%' valign='top'> </td>";         }     }         $return.= "</tr></table>";          // Pagination, if configured to show:     $showPagination = ($params->get('pagination','1')=='1');     if ($showPagination &&($picsNumber $total)) {         $return .= "<div style='width:95%;text-align:center;'>"         .$this->_writePaging($pagingParams,"gallerytagstab_",$picsNumber,$total)         ."</div>";     }     return $return;         } } ?>



The problem is, i have the category, but i cant get the thumbnail work... Does somebody can help me?
Click here to see the profile of this user The administrator has disabled public write access.

Documentation

Documentation Subscription Service
(updated for CB 1.2 RC2)

What?

Why?

Where?

Just click here for answers!

Click here for a yearly subscription: subscribe now

Download Latest Release

The latest stable Community Builder Release is version 1.1 for Joomla 1.0 and Mambo.
You need to be a registered member of Joomlapolis to download.

The latest release candidate of Community Builder is version 1.2 RC3, native for Joomla 1.0, 1.5 and Mambo.
It is available as "thank you" to all CB documentation subscribers at this time.

CB Login