예제 #1
0
                $main_image = $building['main_image'];
                $building_images = Idp_Main::getBuildingImages($building_id);
                if (count($building_images) > 0) {
                    ?>
								<h3><?php 
                    echo __('Manage images', 'idp-theme');
                    ?>
</h3>
								<hr />
							<?php 
                }
                ?>

						
						<div id="category_warning" <?php 
                Idp_Main::categoriesSetAllImages($building_id) ? print "style=\"display:none;\"" : (print "");
                ?>
 >
							<div class="alert alert-warning" role="alert">
									<?php 
                echo __('You may not submit this building until a category has been assigned to every image ', 'idp-theme');
                ?>
							</div>
						</div>
						<div class="row">
							<?php 
                foreach ($building_images as $key => $image) {
                    $image_tags = Idp_Main::getImageTags($image);
                    $thumb = wp_get_attachment_image_src($image, array('800', '800'));
                    $full = wp_get_attachment_image_src($image, 'full');
                    $image_category = Idp_Main::getImageCategory($image);
예제 #2
0
 /**
  * Set the image category for the given image
  * Return false on error and count of updated rows otherwise (can be 0).
  * 
  * @author David Becher
  * @return result
  */
 public static function setImageCategory($building_id, $attachment_id, $category_id, $user_id)
 {
     global $wpdb;
     $result = $wpdb->update($wpdb->prefix . 'image', array('category' => $category_id), array('building' => $building_id, 'attachment_id' => $attachment_id), array('%d'), array('%d', '%d'));
     if ($result != false) {
         //set update user and current time in building
         $result = $wpdb->update($wpdb->prefix . 'building', array('update_user' => $user_id, 'update_date' => current_time('mysql')), array('id' => $building_id), array('%d', '%s'), array('%d'));
     }
     if (Idp_Main::categoriesSetAllImages($building_id)) {
         //all images of this building have been categorized. Update status
         $building = Idp_Main::getBuildingBasicInfos($building_id);
         switch ($building['status']) {
             case 'created':
                 $status = "draft";
                 break;
             case 'draft':
                 $status = "complete";
                 break;
             case 'complete':
                 $status = "complete";
                 break;
             case 'published':
                 $status = "published";
                 break;
             default:
                 $status = "draft";
                 break;
         }
         Idp_Main::updateBuildingStatus($building_id, $status);
     }
     return $result;
 }