function clean_up_event($event) { $event->title = trim(strip_tags($event->title)); // save space by passing timestamps instead of dictionary if ($event->start) { $event->start = mktime($event->start->hour, $event->start->minute, 0, $event->start->month, $event->start->day, $event->start->year); } if ($event->end) { $event->end = mktime($event->end->hour, $event->end->minute, 0, $event->end->month, $event->end->day, $event->end->year); } if (!$event->shortloc) { $event->shortloc = $event->location; } $event->shortloc = preg_replace('/ \(.+\)/', '', $event->shortloc); if ($latlon = Buildings::get_lat_lon($event->shortloc)) { $event->coordinate = $latlon; } $event->description = str_replace("\r\n", '<br />', $event->description); if (strlen($event->infophone) == 6) { switch (substr($event->infophone, 0, 1)) { case '3': case '8': $event->infophone = '617-25' . $event->infophone; break; case '4': $event->infophone = '617-32' . $event->infophone; break; case '2': $event->infophone = '617-45' . $event->infophone; break; default: break; } } if ($event->categories) { foreach ($event->categories as $category) { $category->name = ucwordswrapper($category->name); } } return $event; }
case 'buildings': case 'names': if (isset($_REQUEST['drilldown'])) { $title = $categories[$category]; $drilldown = $_REQUEST['drilldown']; $drilldown_title = $_REQUEST['desc']; $places = places_sublist($drilldown); require "$page->branch/drilldown.html"; } else { require "$page->branch/$category.html"; } break; default: $title = Buildings::category_title($category); $places = Buildings::category_items($category); require "$page->branch/places.html"; break; } } $page->output(); function places_sublist($listName) { $places = array(); if($_REQUEST['category'] == 'buildings') { $drill = new DrillNumeralAlpha($listName, "key"); $keys = array_keys(Buildings::$bldg_data); natsort($keys);
function planet_massmanage_set() { global $smarty, $sql, $data; if (!empty($_REQUEST['planet_ids']) && is_array($_REQUEST['planet_ids'])) { $planets = $_REQUEST['planet_ids']; require_once dirname(__FILE__) . '/buildings.php'; foreach (array_keys($planets) as $planet_id) { $_REQUEST['planet_id'] = $planet_id; if (empty($buildings)) { $buildings = new Buildings($data, $smarty); } else { $buildings->Buildings($data, $smarty); } $buildings->quiet = true; $buildings->build(); } } planet_massmanage(); }
} CacheIMS::init(); // set bbox extent //set the offset parameter define('MOVE_FACTOR', 0.40); $selectvalue = $_REQUEST['selectvalues']; $tabs = new Tabs(selfURL(), "tab", array("Map", "Photo", "What's Here")); if(!photoURL()) { $tabs->hide("Photo"); } $data = Buildings::bldg_info($selectvalue); $whats_here = whats_here($data); $anything_here = (count($whats_here) > 0); $snippets = snippets($data); if(!$anything_here) { $tabs->hide("What's Here"); } $tabs_html = $tabs->html($page->branch); $tab = $tabs->active(); $photoURL = photoURL(); $tab = tab(); switch ($page->branch) {
<? define("BLDG_DATA_XML", dirname(__FILE__) . "/../mobi-web/map/xml/bldg_data.xml"); Buildings::init(); class Buildings { public static $bldg_data = NULL; public static function category_titles() { $result = array(); foreach (self::$categories as $category => $catinfo) { $result[$category] = $catinfo['title']; } return $result; } public static function category_title($category) { return self::$categories[$category]['title']; } public static function category_items($category) { $finder = self::$categories[$category]['finder']; return call_user_func(array(self, $finder), $category); } public static $categories = array( 'room' => array('title' => 'Selected Rooms', 'finder' => 'find_contents'), 'food' => array('title' => 'Food Services', 'finder' => 'find_contents'), 'library' => array('title' => 'Libraries', 'finder' => 'find_contents'),
while ($row = $db->fetchByAssoc($r)) { echo "<option value='{$row['id']}'>{$row['name']}</option>"; } ?> </select> </div> <input type="button" value="Создать по шаблону" id="create_tpl_obj" onclick="create_obj($('#build_id_cht').val(), $('#floor_cht').val(), $('#popup_form_select').val(), $('#section_cht').val())"/> <input type="button" value="Создать" id="create_obj" onclick="location.href='index.php?module=Realty&action=EditView&floor='+$('#floor_cht').val()+'&building_name='+$('#b_name').text()+'&building_id='+$('#build_id_cht').val()+'&return_action=chess_table&return_id='+$('#build_id_cht').val()+'&return_module=Buildings'"/> </div> <!--[if lt IE 9]><div class="popup__valignfix"></div><![endif]--> </div> <h1>Шахматка <?php $building = new Buildings(); $building->retrieve($_REQUEST['record']); echo "<span id='b_name'>{$building->name}</span></h1>"; echo '<table border="1" class="chess_table" cellpadding=0>'; $sec = $building->get_linked_beans('buildings_sections', 'Sections'); if (count($sec) > 0) { $sections = $sec; $floors_quantity = $building->number_of_floors; echo "<tr>"; foreach ($sections as $section) { $colspan = $section->flats_quantity; echo "<td class='floor_class' align='center' width='50px' height='50px' padding='6px' ><b>Этаж<b></td>\n\t\t\t <td class='sections' align='center' height='50px' padding='6px' colspan='{$colspan}'><b>{$section->name}</b></td>"; } echo "</tr>"; $floor = $floors_quantity; for ($i = 0; $i < $floors_quantity; $i++) {
function get_category($category) { if (preg_match('/^[enmw]{1,2}$/', $category)) { return generate_building_numbers($category); } elseif (preg_match('/^\w_\w+$/', $category)) { return generate_building_names($category); } $places = Buildings::category_items($category); $result = array(); foreach ($places as $title => $building) { $bldg_info = Buildings::bldg_info($building); $bldg_info['displayName'] = $title; $result[] = $bldg_info; } return $result; }
public function destroy($badge_id) { $json_request = array('status' => FALSE, 'responseText' => '', 'redirect' => FALSE); if (Request::ajax()) { if ($gallery = Buildings::where('id', $badge_id)->first()->gallery) { $photos = $gallery->photos; foreach ($gallery->photos as $photo) { if (!empty($photo->name) && File::exists(Config::get('site.galleries_photo_dir') . '/' . $photo->name)) { File::delete(Config::get('site.galleries_photo_dir') . '/' . $photo->name); } if (!empty($photo->name) && File::exists(Config::get('site.galleries_thumb_dir') . '/' . $photo->name)) { File::delete(Config::get('site.galleries_thumb_dir') . '/' . $photo->name); } $photo->delete(); } $gallery->delete(); } if ($photo = Buildings::where('id', $badge_id)->first()->photo) { if (!empty($photo->name) && File::exists(Config::get('site.galleries_photo_dir') . '/' . $photo->name)) { File::delete(Config::get('site.galleries_photo_dir') . '/' . $photo->name); } if (!empty($photo->name) && File::exists(Config::get('site.galleries_thumb_dir') . '/' . $photo->name)) { File::delete(Config::get('site.galleries_thumb_dir') . '/' . $photo->name); } $photo->delete(); } Buildings::where('id', $badge_id)->delete(); $json_request['responseText'] = "Дом удален."; $json_request['status'] = TRUE; } else { return Redirect::back(); } return Response::json($json_request, 200); }