fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9874] Frontpage pictures of buildings are also shown


From: Alexander Stevenson
Subject: [Fmsystem-commits] [9874] Frontpage pictures of buildings are also shown on the search page now
Date: Mon, 20 Aug 2012 06:56:23 +0000

Revision: 9874
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9874
Author:   andvare
Date:     2012-08-20 06:56:22 +0000 (Mon, 20 Aug 2012)
Log Message:
-----------
Frontpage pictures of buildings are also shown on the search page now

Modified Paths:
--------------
    branches/dev-thomasez/bookingfrontend/inc/class.uisearch.inc.php
    branches/dev-thomasez/bookingfrontend/templates/base/search.xsl

Modified: branches/dev-thomasez/bookingfrontend/inc/class.uisearch.inc.php
===================================================================
--- branches/dev-thomasez/bookingfrontend/inc/class.uisearch.inc.php    
2012-08-17 08:53:17 UTC (rev 9873)
+++ branches/dev-thomasez/bookingfrontend/inc/class.uisearch.inc.php    
2012-08-20 06:56:22 UTC (rev 9874)
@@ -106,16 +106,33 @@
                                        'layout' => $layout,
                                        'resource' => $resource,
                                );
+                               
+                               // Get frontpage picture documents - Resources
+                               $sodocres = 
CreateObject('booking.sodocument_resource');
+                               $resource_documents = $sodocres->read( array( 
"filters" => array( "category" => 
booking_sodocument::CATEGORY_FRONTPAGE_PICTURE ) ) );
+                               
+                               // Insert into $params if there are pictures - 
Resources
+                               if( $resource_documents['total_records'] > 0 ) {
+                                       // Convert nl2br on description
+                                       foreach( $resource_documents['results'] 
as $key => $data ) {
+                                               
$resource_documents['results'][$key]['description'] = nl2br( 
$resource_documents['results'][$key]['description'] );
+                                               
$resource_documents['results'][$key]['type'] = "resource";
+                                       }
+                                       $params['frontimages'] = 
$resource_documents['results'];
+                               }
+                       
+                               // Get frontpage picture documents - Buildings
+                               $sodocbuild = 
CreateObject('booking.sodocument_building');
+                               $building_documents = $sodocbuild->read( array( 
"filters" => array( "category" => 
booking_sodocument::CATEGORY_FRONTPAGE_PICTURE ) ) );
 
-                               // Get frontpage picture documents
-                               $sodoc = 
CreateObject('booking.sodocument_resource');
-                               $documents = $sodoc->read( array( "filters" => 
array( "category" => booking_sodocument::CATEGORY_FRONTPAGE_PICTURE ) ) );
-
-                               // Insert into $params if there are pictures
-                               if( $documents['total_records'] > 0 ) {
+                               // Insert into $params if there are pictures - 
Buildings
+                               if( $building_documents['total_records'] > 0 ) {
                                        // Convert nl2br on description
-                                       foreach( $documents['results'] as $key 
=> $data ) { $documents['results'][$key]['description'] = nl2br( 
$documents['results'][$key]['description'] ); }
-                                       $params['frontimages'] = 
$documents['results'];
+                                       foreach( $building_documents['results'] 
as $key => $data ) {
+                                               
$building_documents['results'][$key]['description'] = nl2br( 
$building_documents['results'][$key]['description'] );
+                                               
$building_documents['results'][$key]['type'] = "building";
+                                       }
+                                       $params['frontimages'] = array_merge( 
$params['frontimages'], $building_documents['results'] );
                                }
                        }
 //                     echo "<pre>";print_r($resource);exit;

Modified: branches/dev-thomasez/bookingfrontend/templates/base/search.xsl
===================================================================
--- branches/dev-thomasez/bookingfrontend/templates/base/search.xsl     
2012-08-17 08:53:17 UTC (rev 9873)
+++ branches/dev-thomasez/bookingfrontend/templates/base/search.xsl     
2012-08-20 06:56:22 UTC (rev 9874)
@@ -104,17 +104,32 @@
                                <xsl:when test="frontimages">
                                        <div id="frontimagesbox">
                                                <xsl:for-each 
select="frontimages">
-                                                       <a>
-                                                               <xsl:attribute 
name="href">index.php?menuaction=bookingfrontend.uiresource.show&amp;id=<xsl:value-of
 select="owner_id"/></xsl:attribute>
-                                                               <div 
class="frontimagebox">
-                                                                       <div 
class="frontimage">
-                                                                               
<xsl:attribute name="style">
-                                                                               
        background-image: url( 
'index.php?menuaction=bookingfrontend.uidocument_resource.download&amp;id=<xsl:value-of
 select="id"/>' );
-                                                                               
</xsl:attribute>
+                                                       <xsl:if 
test="type='resource'">
+                                                               <a>
+                                                                       
<xsl:attribute 
name="href">index.php?menuaction=bookingfrontend.uiresource.show&amp;id=<xsl:value-of
 select="owner_id"/></xsl:attribute>
+                                                                       <div 
class="frontimagebox">
+                                                                               
<div class="frontimage">
+                                                                               
        <xsl:attribute name="style">
+                                                                               
                background-image: url( 
'index.php?menuaction=bookingfrontend.uidocument_resource.download&amp;id=<xsl:value-of
 select="id"/>' );
+                                                                               
        </xsl:attribute>
+                                                                               
</div>
+                                                                               
<xsl:value-of disable-output-escaping="yes" select="description"/>
                                                                        </div>
-                                                                       
<xsl:value-of disable-output-escaping="yes" select="description"/>
-                                                               </div>
-                                                       </a>
+                                                               </a>
+                                                       </xsl:if>
+                                                       <xsl:if 
test="type='building'">
+                                                               <a>
+                                                                       
<xsl:attribute 
name="href">index.php?menuaction=bookingfrontend.uibuilding.show&amp;id=<xsl:value-of
 select="owner_id"/></xsl:attribute>
+                                                                       <div 
class="frontimagebox">
+                                                                               
<div class="frontimage">
+                                                                               
        <xsl:attribute name="style">
+                                                                               
                background-image: url( 
'index.php?menuaction=bookingfrontend.uidocument_building.download&amp;id=<xsl:value-of
 select="id"/>' );
+                                                                               
        </xsl:attribute>
+                                                                               
</div>
+                                                                               
<xsl:value-of disable-output-escaping="yes" select="description"/>
+                                                                       </div>
+                                                               </a>
+                                                       </xsl:if>
                                                </xsl:for-each>
                                                <div class="clr"></div>
                                        </div>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]