Example #1
0
 public static function getFlatPhotosEdit(Flat $flat)
 {
     $photos = $flat->getPhotos();
     if (!$photos) {
         $photos = array();
     }
     $photo_flat_path = $flat->getPhotoWebPath();
     $html = '';
     $photo_types = $flat->getPhotoTypes();
     foreach ($photos as $photo) {
         $photo_type_html = '';
         foreach ($photo_types as $i => $photo_type) {
             $selected = $i == $photo['tag'] ? 'selected' : '';
             $photo_type_html .= "<option value='{$i}' {$selected}>{$photo_type}</option>";
         }
         $id = $photo['name'];
         $html .= "<table class='base_text' style='float:left' id='table" . $id . "'>\n\t\t\t<tr><td rowspan=3><img src='" . $photo_flat_path . $photo['name'] . "_prev'></td>\n\t\t\t<td><label for='photo_type_" . $id . "'>На фото показано:</label><select name='photo_type_" . $id . "' id='photo_type_" . $id . "'>\n\t\t\t{$photo_type_html}\t\t\t\n\t\t\t</select></td></tr> \n\t\t\t<td><label for='photo_title_" . $id . "'>Название фото:</label><input type='text' id='photo_title_" . $id . "' name='photo_title_" . $id . "' value='{$photo['title']}'></td></tr>\n\t\t\t<tr><td><label for='photo_desc_" . $id . "'>Описание:</label><textarea id='photo_desc' name='photo_desc_" . $id . "' style='width:200px; height: 50px;'>{$photo['description']}</textarea></td></tr>\n\t\t\t<tr><td colspan=2><a onclick='delPhoto(\"" . $id . "\")' href='#'>Удалить</a></td></tr>\n\t\t\t</table>\t\t\n\t\t\t<input type=hidden name=photo_flat_exist[] value='" . $id . "'>";
     }
     return $html;
 }