function fld_trans($s) { $parts = explode("||", $s); if (count($parts) == 1) { $parts = explode("english=", $s); } if (count($parts) == 1) { $parts = explode("inenglish:", $s); } if (eng()) { if (isset($parts[1])) { return $parts[1]; } else { return $parts[0]; } } else { return $parts[0]; } }
function make_comp_progs_menu() { if (eng()) { $links_names5 = array('COMPETITION PROGRAMME I', 'COMPETITION PROGRAMME II', 'COMPETITION PROGRAMME III', 'COMPETITION PROGRAMME IV'); $ids = array(69, 70, 71, 72); } else { $links_names5 = array('VÕISTLUSPROGRAMM I', 'VÕISTLUSPROGRAMM II', 'VÕISTLUSPROGRAMM III', 'VÕISTLUSPROGRAMM IV'); $ids = array(74, 75, 76, 77); } $links = array(); foreach ($ids as $id) { $lang = eng() ? "&l=eng" : ""; array_push($links, "?b=pr&dyn={$id}{$lang}"); } global $T; global $CELL_IDS; $widths = array(0, 200, 40); $count = 1; while ($item = array_shift($links_names5)) { // break; // TODO - to enable/disable programs // if (eng()) break; if ($count != 1 and $count != 4 and $count != 7) { $cells .= $T->get('sub_menu_cell_separator', array()); } $id = 's6'; $id .= $count - 1; $CELL_IDS[] = '"' . $id . '"'; $cells .= $T->get('sub_menu_cell', array($id, $item, $links[$count - 1])); if (!($count % 3)) { $pre = '<td width="' . array_shift($widths) . '"> </td>'; $rows .= '<table height="25" style="top: 235px; position: relative;margin-bottom:1px" border=0 cellspacing=0 cellpadding=0><tr>' . $pre . $cells . "</tr></table>\n"; $cells = ''; } $count++; } $pre = '<td width="' . array_shift($widths) . '"> </td>'; $rows .= '<table height="25" style="top: 235px; position: relative" border=0 cellspacing=0 cellpadding=0><tr>' . $pre . $cells . "</tr></table>\n"; return $T->get('comp_programm', array($rows)); }
function page_catalog($folder = "", $subfolder = "") { $o = ""; global $CatalogPageTitle; if ($folder) { $items = catalog_items(0); foreach ($items as $item) { if (to_url(fld_trans($item->title, "eng")) == $folder) { $CatalogPageTitle = fld_trans($item->title); if (!$subfolder) { $subfolders = catalog_items($item->id); foreach ($subfolders as $subfolder) { $o .= "<div id=subfolder>"; $subfolder->url = to_url(fld_trans($subfolder->title, "eng")); $subfolder->title = fld_trans($subfolder->title); $o .= "<div id=title><a href=catalog/{$folder}/{$subfolder->url}>{$subfolder->title}</a></div>"; $o .= "<div id=items>"; $subfolder_items = catalog_items($subfolder->id); $count = 0; foreach ($subfolder_items as $item) { if ($count >= 3) { break; } $img = catalog_images($item->id); if (count($img)) { $img = $img[0]->image_file; } else { $img = ""; } $GLOBALS['item_url'] = to_url(eng($item->title)); $o .= template("catalog_item", "title", fld_trans($item->title), "img", $img, "item_id", $item->id); $count++; } $o .= "</div>"; $o .= "</div>"; } } else { $search = $subfolder; $subfolders = catalog_items($item->id); foreach ($subfolders as $subfolder) { if (to_url(fld_trans($subfolder->title, "eng")) == $search) { $CatalogPageTitle = fld_trans($subfolder->title) . " - " . $CatalogPageTitle; $o .= "<div id=subfolder>"; $subfolder->title = fld_trans($subfolder->title); $o .= "<div id=title>{$subfolder->title}</div>"; $o .= "<div id=items>"; $subfolder_items = catalog_items($subfolder->id); $count = 0; foreach ($subfolder_items as $item) { $img = catalog_images($item->id); if (count($img)) { $img = $img[0]->image_file; } else { $img = ""; } $GLOBALS['item_url'] = to_url(eng($item->title)); $o .= template("catalog_item", "title", fld_trans($item->title), "img", $img, "item_id", $item->id); $count++; } $o .= "</div>"; $o .= "</div>"; } } } } } } if (!$CatalogPageTitle) { $CatalogPageTitle = fld_trans(db_result(db_query("SELECT title FROM menu WHERE link='catalog' LIMIT 1"))); } return template("catalog", "items", $o); }