function phpblock_switchlanguage() { //languagename sample $languagenameary['ja']['ja'] = "日本語"; $languagenameary['ja']['en'] = "英語"; $languagenameary['ja']['de'] = "独語"; // global $_CONF; $languageid = COM_getLanguageId(); $url = $_CONF['site_url'] . "/switchlang.php?lang="; $html = ""; if (is_array($_CONF['languages'])) { $ary = $_CONF['languages']; foreach ($ary as $fid => $fvalue) { if ($html != "") { $html .= "|"; } if ($_CONF['language_files'][$fid] != "") { if ($languagenameary[$languageid][$fid]) { $languagename = $languagenameary[$languageid][$fid]; } else { $languagename = $fvalue; } if ($fid == $languageid) { $html .= $languagename . LB; } else { $html .= '<a href=' . $url . $fid . '">' . $languagename . '</a>' . LB; } } } } return $html; }
function parse($p1, $p2, $fulltag) { global $_CONF; $retval = ''; $p1 .= empty($p2) ? '' : ' ' . $p2; if (!empty($p1)) { $lang = COM_getLanguageId(); $lang = empty($lang) ? 'en' : $lang; // default to en $attr['target'] = '_blank'; $attr['style'] = "cursor:help;text-decoration:none;')"; $url = "http://www.glfusion.org/wiki/doku.php/?do=search&id=" . trim(str_replace(' ', '_', $p1)); $retval = COM_createLink($p1, $url, $attr); } return $retval; }
function phpmenuitem_news() { global $_CONF, $LANG01; $url = $_CONF['site_url'] . '/index.php?topic=General_' . COM_getLanguageId(); switch (COM_getLanguageId()) { case en: $label = "NEWS"; break; case sc: $label = "NOTICIAS"; break; case ja: $label = "お知らせ"; break; } $menuitems = array('url' => $url, 'label' => $label, 'icon_url' => '', 'id_name' => '', 'class_name' => '', 'submenu_entries' => array()); return $menuitems; }
function CUSTOM_switchlang() { global $_CONF; global $_USER; global $argv; $page = $argv[1]; if ($_CONF['allow_user_language'] == 1) { $oldlang = COM_getLanguageId(); $lang_len = strlen($oldlang); $newlang = substr($page, -$lang_len); if (!array_key_exists($newlang, $_CONF['language_files'])) { $newlang = $oldlang; } if ($newlang != $oldlang) { $_CONF['language'] = $_CONF['language_files'][$newlang]; $_USER['language'] = $_CONF['language']; } } }
<?php // Configulation for Mycaljp switch (COM_getLanguageId()) { case 'ja': // Japanese $_MYCALJP2_CONF['headertitleyear'] = 'Y年'; $_MYCALJP2_CONF['headertitlemonth'] = 'm月'; $_MYCALJP2_CONF['titleorder'] = true; $_MYCALJP2_CONF['sunday'] = '日'; $_MYCALJP2_CONF['monday'] = '月'; $_MYCALJP2_CONF['tuesday'] = '火'; $_MYCALJP2_CONF['wednesday'] = '水'; $_MYCALJP2_CONF['thursday'] = '木'; $_MYCALJP2_CONF['friday'] = '金'; $_MYCALJP2_CONF['saturday'] = '土'; break; case 'en': // English $_MYCALJP2_CONF['headertitleyear'] = 'Y'; $_MYCALJP2_CONF['headertitlemonth'] = 'F'; $_MYCALJP2_CONF['titleorder'] = false; $_MYCALJP2_CONF['sunday'] = 'S'; $_MYCALJP2_CONF['monday'] = 'M'; $_MYCALJP2_CONF['tuesday'] = 'T'; $_MYCALJP2_CONF['wednesday'] = 'W'; $_MYCALJP2_CONF['thursday'] = 'T'; $_MYCALJP2_CONF['friday'] = 'F'; $_MYCALJP2_CONF['saturday'] = 'S'; break; }
/** * Set the {lang_id} and {lang_attribute} variables for a template * * NOTE: {lang_attribute} is only set in multi-language environments. * * @param ref &$template template to use * @return void * */ function COM_setLangIdAndAttribute(&$template) { global $_CONF; $langAttr = ''; $langId = ''; if (!empty($_CONF['languages']) && !empty($_CONF['language_files'])) { $langId = COM_getLanguageId(); } else { // try to derive the language id from the locale $l = explode('.', $_CONF['locale']); // get rid of character set $langId = $l[0]; $l = explode('@', $langId); // get rid of '@euro', etc. $langId = $l[0]; } if (!empty($langId)) { $l = explode('-', str_replace('_', '-', $langId)); if (count($l) == 1 && strlen($langId) == 2) { $langAttr = 'lang="' . $langId . '"'; } else { if (count($l) == 2) { if ($l[0] == 'i' || $l[0] == 'x') { $langId = implode('-', $l); $langAttr = 'lang="' . $langId . '"'; } else { if (strlen($l[0]) == 2) { $langId = implode('-', $l); $langAttr = 'lang="' . $langId . '"'; } else { $langId = $l[0]; // this isn't a valid lang attribute, so don't set $langAttr } } } } } $template->set_var('lang_id', $langId); if (!empty($_CONF['languages']) && !empty($_CONF['language_files'])) { $template->set_var('lang_attribute', ' ' . $langAttr); } else { $template->set_var('lang_attribute', ''); } }
/** * This function creates html options for Topics, for a single or multi select box * * @param string/array $selected_ids Topics Ids to mark as selected * @param int $include_root_all Include Nothing (0) or Root (1) or All (2) or None (4) in list. * @param boolean $language_specific If false include all topics for every language * @param string $remove_id Id of topic to not include (includes any children) (used for selection of parent id) * @param boolean $remove_archive Remove archive topic from list if any * @param int $uid User id or 0 = current user * @return HTML string * */ function TOPIC_getTopicListSelect($selected_ids = array(), $include_root_all = 1, $language_specific = false, $remove_id = '', $remove_archive = false, $uid = 0) { global $_TOPICS, $_TABLES, $LANG21; $retval = ''; if (!is_array($selected_ids)) { $selected_ids = array($selected_ids); } if ($include_root_all > 0) { $start_topic = 1; } else { $start_topic = 2; } $total_topic = count($_TOPICS); $branch_level_skip = 0; $lang_id = ''; if ($language_specific) { $lang_id = COM_getLanguageId(); } // Retrieve Archive Topic if any $archive_tid = ''; if ($remove_archive) { $archive_tid = DB_getItem($_TABLES['topics'], 'tid', 'archive_flag = 1'); } for ($count_topic = $start_topic; $count_topic <= $total_topic; $count_topic++) { if ($count_topic == 1) { // Deal with Root or All and None if ($include_root_all == 1) { $id = $_TOPICS[$count_topic]['id']; $title = $_TOPICS[$count_topic]['title']; $retval .= '<option value="' . $id . '"'; $retval .= ' title="' . $title . '"'; if (in_array($id, $selected_ids)) { $retval .= ' selected="selected"'; } $retval .= '>' . $title . '</option>'; } else { // Check for None if ($include_root_all == 4 || $include_root_all == 6) { $id = TOPIC_NONE_OPTION; $title = $LANG21[47]; $retval .= '<option value="' . $id . '"'; $retval .= ' title="' . $title . '"'; if (in_array($id, $selected_ids)) { $retval .= ' selected="selected"'; } $retval .= '>' . $title . '</option>'; } // Check for All if ($include_root_all == 2 || $include_root_all == 6) { $id = TOPIC_ALL_OPTION; $title = $LANG21[7]; $retval .= '<option value="' . $id . '"'; $retval .= ' title="' . $title . '"'; if (in_array($id, $selected_ids)) { $retval .= ' selected="selected"'; } $retval .= '>' . $title . '</option>'; } } } else { // Check to see if we need to include id (this is done for stuff like topic edits that cannot include themselves or child as parent if ($branch_level_skip >= $_TOPICS[$count_topic]['branch_level']) { $branch_level_skip = 0; } if ($branch_level_skip == 0) { $id = $_TOPICS[$count_topic]['id']; if ($uid == 0) { // Current User $specified_user_access = $_TOPICS[$count_topic]['access']; } else { $specified_user_access = SEC_hasAccess($_TOPICS[$count_topic]['owner_id'], $_TOPICS[$count_topic]['group_id'], $_TOPICS[$count_topic]['perm_owner'], $_TOPICS[$count_topic]['perm_group'], $_TOPICS[$count_topic]['perm_members'], $_TOPICS[$count_topic]['perm_anon'], $uid); } // Make sure to show topics for proper language and access level only if ($archive_tid != $id && $specified_user_access > 0 && $id != $remove_id && ($lang_id == '' || $lang_id != '' && ($_TOPICS[$count_topic]['language_id'] == $lang_id || $_TOPICS[$count_topic]['language_id'] == ''))) { $title = $_TOPICS[$count_topic]['title']; $branch_spaces = ""; for ($branch_count = $start_topic; $branch_count <= $_TOPICS[$count_topic]['branch_level']; $branch_count++) { $branch_spaces .= " "; } $retval .= '<option value="' . $id . '"'; $retval .= ' title="' . $title . '"'; if (in_array($id, $selected_ids)) { $retval .= ' selected="selected"'; } $retval .= '>' . $branch_spaces . $title . '</option>'; } else { // Cannot pick child as parent so skip $branch_level_skip = $_TOPICS[$count_topic]['branch_level']; } } } } return $retval; }
* * @license GNU General Public License version 2 or later * http://www.opensource.org/licenses/gpl-license.php * * Copyright (C) 2010-2015 by the following authors: * Mark R. Evans mark AT glfusion DOT org * */ // this file can't be used on its own if (!defined('GVERSION')) { die('This file can not be used on its own!'); } $themeAPI = 2; $_SYSTEM['disable_mootools'] = true; $_IMAGE_TYPE = 'png'; $lang = COM_getLanguageId(); if (empty($lang)) { $result = DB_query("SELECT onleft,name FROM {$_TABLES['blocks']} WHERE is_enabled = 1"); } else { $result = DB_query("SELECT onleft,name FROM {$_TABLES['blocks']}"); } $nrows = DB_numRows($result); for ($i = 0; $i < $nrows; $i++) { $A = DB_fetchArray($result); if ($A['onleft'] == 1) { $_BLOCK_TEMPLATE[$A['name']] = 'blockheader-left.thtml,blockfooter-left.thtml'; } else { $_BLOCK_TEMPLATE[$A['name']] = 'blockheader-right.thtml,blockfooter-right.thtml'; } } $_BLOCK_TEMPLATE['_msg_block'] = 'blockheader-message.thtml,blockfooter-message.thtml';
function assembleMenu($name, $skipCache = false) { $menuData = NULL; $lang = COM_getLanguageId(); if (!empty($lang)) { $menuName = $name . '_' . $lang; } else { $menuName = $name; } $cacheInstance = 'menudata_' . $menuName . '_' . CACHE_security_hash() . '__data'; if ($skipCache == false) { $cacheCheck = CACHE_check_instance($cacheInstance, 0); if ($cacheCheck) { $menuData = unserialize($cacheCheck); return $menuData; } } $menuObject = initMenu($menuName, $skipCache); if ($menuObject != NULL) { $menuData = $menuObject->_parseMenu(); $menuData['type'] = $menuObject->type; $cacheMenu = serialize($menuData); CACHE_create_instance($cacheInstance, $cacheMenu, 0); } return $menuData; }
/** * Provides a drop-down menu (or simple link, if you only have two languages) * to switch languages. This can be used as a PHP block or called from within * your theme's header.thtml: <?php print phpblock_switch_language(); ?> * * @return string HTML for drop-down or link to switch languages * */ function phpblock_switch_language() { global $_CONF; $retval = ''; if (empty($_CONF['languages']) || empty($_CONF['language_files']) || count($_CONF['languages']) != count($_CONF['language_files'])) { return $retval; } $lang = COM_getLanguage(); $langId = COM_getLanguageId($lang); if (count($_CONF['languages']) == 2) { foreach ($_CONF['languages'] as $key => $value) { if ($key != $langId) { $newLang = $value; $newLangId = $key; break; } } $switchUrl = COM_buildUrl($_CONF['site_url'] . '/switchlang.php?lang=' . $newLangId); $retval .= COM_createLink($newLang, $switchUrl); } else { $retval .= '<form name="change" action="' . $_CONF['site_url'] . '/switchlang.php" method="get">' . LB; $retval .= '<input type="hidden" name="oldlang" value="' . $langId . '"/>' . LB; $retval .= '<select onchange="change.submit()" name="lang">'; foreach ($_CONF['languages'] as $key => $value) { if ($lang == $_CONF['language_files'][$key]) { $selected = ' selected="selected"'; } else { $selected = ''; } $retval .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>' . LB; } $retval .= '</select>' . LB; $retval .= '</form>' . LB; } return $retval; }
function fnclist($pi_name, $template, $group_id, $perpage, $page, $order, $gcode) { global $_CONF; global $_TABLES; global $_DATABOX_CONF; global $perpage; global $LANG_DATABOX; global $LANG_DATABOX_ADMIN; if ($group_id === "") { if ($gcode != "") { $group_id = DATABOX_codetoid($gcode, 'DATABOX_def_group', "group_id"); } } //----- if ($page == 0) { $page = 1; } //----- $tbl1 = $_TABLES['DATABOX_category']; $tbl2 = $_TABLES['DATABOX_base']; $tbl3 = $_TABLES['DATABOX_def_category']; $tbl4 = $_TABLES['DATABOX_def_group']; //@@@@@ //----- $sql = "SELECT " . LB; $sql .= " t1.category_id " . LB; $sql .= " ,t3.name " . LB; $sql .= " ,t3.code " . LB; $sql .= " ,t3.description " . LB; $sql .= " ,Count(t1.id) AS count" . LB; $sql .= " ,t4.name AS group_name " . LB; $sql .= " ,t4.group_id " . LB; $sql .= " ,t4.code AS group_code " . LB; $sql .= " FROM " . LB; $sql .= " {$tbl1} AS t1 " . LB; $sql .= " ,{$tbl2} AS t2 " . LB; $sql .= " ,{$tbl3} AS t3 " . LB; $sql .= " ,{$tbl4} AS t4 " . LB; $sql .= " WHERE " . LB; $sql .= " t1.id = t2.id " . LB; $sql .= " AND t1.category_id = t3.category_id " . LB; if ($group_id != "") { $sql .= " AND t3.categorygroup_id = " . $group_id . LB; } $sql .= " AND t3.categorygroup_id = t4.group_id " . LB; //管理者の時,下書データも含む //if ( SEC_hasRights('databox.admin')) { //}else{ $sql .= " AND t2.draft_flag=0" . LB; //} //アクセス権のないデータ はのぞく $sql .= COM_getPermSql('AND', 0, 2, "t2") . LB; //公開日以前のデータはのぞく $sql .= " AND (released <= NOW())" . LB; //公開終了日を過ぎたデータはのぞく $sql .= " AND (expired=0 OR expired > NOW())" . LB; $sql .= " GROUP BY " . LB; $sql .= " t1.category_id" . LB; $sql .= " ORDER BY " . LB; $sql .= " t4.orderno,t3.orderno" . LB; $result = DB_query($sql); $cnt = DB_numRows($result); $pages = 0; if ($perpage > 0) { $pages = ceil($cnt / $perpage); } //ヘッダ、左ブロック if ($page > 1) { $page_title = sprintf('%s (%d)', $LANG_DATABOX['category_top'], $page); } else { $page_title = sprintf('%s ', $LANG_DATABOX['category_top']); } $headercode = "<title>" . $_CONF['site_name'] . " - " . $page_title . "</title>"; // Meta Tags $headercode .= DATABOX_getheadercode("category", $template, $pi_name, 0, $_CONF['site_name'], $_CONF['meta_description'], $_CONF['smeta_keywords'], $_CONF['meta_description']); $retval .= DATABOX_siteHeader($pi_name, '', $page_title, $headercode); // $tmplfld = DATABOX_templatePath('category', $template, $pi_name); $templates = new Template($tmplfld); $templates->set_file(array('list' => 'list.thtml', 'nav' => 'navigation.thtml', 'row' => 'row.thtml', 'col' => "col.thtml", 'grp' => "grp.thtml", 'pagenav' => 'pagenavigation.thtml')); $languageid = COM_getLanguageId(); $language = COM_getLanguage(); $templates->set_var('languageid', $languageid); $templates->set_var('language', $language); if ($languageid != "") { $templates->set_var('_languageid', "_" . $languageid); } else { $templates->set_var('_languageid', ""); } // $templates->set_var('site_url', $_CONF['site_url']); $templates->set_var('this_script', THIS_SCRIPT); $templates->set_var('home', $LANG_DATABOX['home']); if ($group_id != "") { $group_name = DB_getItem($tbl4, 'name', "group_id = " . $group_id); $templates->set_var('lang_category_list_h2', $group_name . $LANG_DATABOX['category_top']); } else { $templates->set_var('lang_category_list_h2', $LANG_DATABOX['category_top']); } //page $offset = ($page - 1) * $perpage; $sql .= " LIMIT {$offset}, {$perpage}"; $lin1 = $offset + 1; $lin2 = $lin1 + $perpage - 1; if ($lin2 > $cnt) { $lin2 = $cnt; } $templates->set_var('lang_view', $LANG_DATABOX['view']); $templates->set_var('lin', $lin1 . "-" . $lin2); $templates->set_var('cnt', $cnt); $templates->set_var('lang_name', $LANG_DATABOX_ADMIN['name']); $templates->set_var('lang_count', $LANG_DATABOX['count']); $result = DB_query($sql); $numrows = DB_numRows($result); $old_group_name = ""; if ($numrows > 0) { for ($i = 0; $i < $numrows; $i++) { $A = DB_fetchArray($result); $A = array_map('stripslashes', $A); $group_name = COM_applyFilter($A['group_name']); $name = COM_applyFilter($A['name']); $description = COM_applyFilter($A['description']); $url = $_CONF['site_url'] . "/" . THIS_SCRIPT; $url .= "?"; //コード使用の時 if ($_DATABOX_CONF['categorycode']) { $url .= "code=" . $A['code']; $url .= "&m=code"; } else { $url .= "id=" . $A['category_id']; $url .= "&m=id"; } $url = COM_buildUrl($url); $link = COM_createLink($name, $url); $templates->set_var('category_link', $link); $templates->set_var('category_name', $name); $templates->set_var('category_description', $description); $templates->set_var('category_url', $url); $templates->set_var('count', $A['count']); $templates->set_var('category_id', $A['category_id']); $templates->set_var('category_code', $A['code']); //===== if ($old_group_name != $group_name) { $url = $_CONF['site_url'] . "/" . THIS_SCRIPT; $url .= "?"; //コード使用の時 if ($_DATABOX_CONF['groupcode']) { $url .= "gcode=" . $A['group_code']; //@@@@@ $url .= "&m=gcode"; } else { $url .= "gid=" . $A['group_id']; //@@@@@ $url .= "&m=gid"; } $url = COM_buildUrl($url); $link = COM_createLink($group_name, $url); $templates->set_var('group_link', $link); $templates->set_var('group_name', $group_name); $templates->parse('grp_var', 'grp', true); $old_group_name = $group_name; } $templates->parse('col_var', 'col', true); $templates->parse('row_var', 'row', true); $templates->set_var('grp_var', ''); $templates->set_var('col_var', ''); } // Call to plugins to set template variables in the databox PLG_templateSetVars('databox', $templates); //ページなび //$url = $_CONF['site_url'] . '/'.THIS_SCRIPT."?m=".$m;//."?order=$order"; $url = $_CONF['site_url'] . '/' . THIS_SCRIPT; $templates->set_var('page_navigation', COM_printPageNavigation($url, $page, $pages)); //------------ $templates->parse('nav_var', 'nav', true); $templates->set_var('blockfooter', COM_endBlock()); $templates->set_var('msg', ""); $templates->parse('output', 'list'); $school_content = $templates->finish($templates->get_var('output')); $retval .= $school_content; } else { $templates->set_var('msg', $LANG_DATABOX["nohit"]); $templates->parse('output', 'list'); $content = $templates->finish($templates->get_var('output')); $retval .= $content; } $retval = PLG_replacetags($retval); return $retval; }
/** * Set the {lang_id} and {lang_attribute} variables for a template * * @param Template $template template to use * @return void */ function COM_setLangIdAndAttribute($template) { global $_CONF, $LANG_ISO639_1; $langAttr = ''; if (!empty($_CONF['languages']) && !empty($_CONF['language_files'])) { $langId = COM_getLanguageId(); } else { $langId = $LANG_ISO639_1; } if (!empty($langId)) { $l = explode('-', str_replace('_', '-', $langId)); if (count($l) === 1 && strlen($langId) === 2) { $langAttr = 'lang="' . $langId . '"'; } elseif (count($l) == 2) { if ($l[0] === 'i' || $l[0] === 'x') { $langId = implode('-', $l); $langAttr = 'lang="' . $langId . '"'; } elseif (strlen($l[0]) === 2) { $langId = implode('-', $l); $langAttr = 'lang="' . $langId . '"'; } else { $langId = $l[0]; // this isn't a valid lang attribute, so don't set $langAttr } } } $template->set_var('lang_id', $langId); if (!empty($_CONF['languages']) && !empty($_CONF['language_files'])) { $template->set_var('lang_attribute', ' ' . $langAttr); } else { $template->set_var('lang_attribute', ' lang="' . $LANG_ISO639_1 . '"'); } }
function fnclist($id, $template) { global $_CONF; global $_TABLES; global $_USER_CONF; global $perpage; global $LANG_USERBOX; global $LANG_USERBOX_ADMIN; global $LANG_USERBOX_NOYES; //----- $page = COM_applyFilter($_REQUEST['page'], true); if (!isset($page) or $page == 0) { $page = 1; } $pi_name = "userbox"; $field_def = DATABOX_getadditiondef($pi_name); //----- $tbl1 = $_TABLES['USERBOX_addition']; $tbl2 = $_TABLES['USERBOX_base']; $tbl3 = $_TABLES['USERBOX_def_field']; $tbl5 = $_TABLES['users']; //----- $sql = "SELECT " . LB; $sql .= " t1.field_id " . LB; $sql .= " ,t1.value " . LB; $sql .= " ,t3.name " . LB; $sql .= " ,t3.templatesetvar" . LB; $sql .= " ,t3.description " . LB; $sql .= " ,Count(t1.id) AS count" . LB; $sql .= " FROM " . LB; $sql .= " {$tbl1} AS t1 " . LB; $sql .= " ,{$tbl2} AS t2 " . LB; $sql .= " ,{$tbl3} AS t3 " . LB; $sql .= " ,{$tbl5} AS t5 " . LB; $sql .= " WHERE " . LB; $sql .= " t1.value <>''" . LB; $sql .= " AND t1.id = t2.id " . LB; $sql .= " AND t1.id = t5.uid " . LB; $sql .= " AND t1.field_id = t3.field_id " . LB; //TYPE[0] = '一行テキストフィールド'; //TYPE[2] = 'いいえ/はい'; //TYPE[3] = '日付 (date picker対応)'; //TYPE[7] = 'オプションリスト'; //TYPE[8] = 'ラジオボタンリスト'; //TYPE[9] = 'オプションリスト(マスタ) (既定リスト)'; $sql .= " AND t3.type IN (0,2,3,4,7,8,9,16) " . LB; //ALLOW_DISPLAY[0] ='表示する(orderに指定可能)'; //ALLOW_DISPLAY[1] ='ログインユーザのみ表示する'; if (COM_isAnonUser()) { $sql .= " AND t3.allow_display=0 " . LB; } else { $sql .= " AND t3.allow_display IN (0,1) " . LB; } if ($id != 0) { $sql .= " AND t1.field_id = " . $id . LB; } //管理者の時,下書データも含む //if ( SEC_hasRights('userbox.admin')) { //}else{ $sql .= " AND t2.draft_flag=0" . LB; //} //アクセス権のないデータ はのぞく $sql .= COM_getPermSql('AND', 0, 2, "t2") . LB; //公開日以前のデータはのぞく $sql .= " AND (released <= NOW())" . LB; //公開終了日を過ぎたデータはのぞく $sql .= " AND (expired=0 OR expired > NOW())" . LB; $sql .= " GROUP BY " . LB; $sql .= " t1.field_id , t1.value" . LB; $sql .= " ORDER BY " . LB; $sql .= " t1.field_id,t1.value" . LB; $result = DB_query($sql); $cnt = DB_numRows($result); $pages = 0; if ($perpage > 0) { $pages = ceil($cnt / $perpage); } //ヘッダ、左ブロック //@@@@@@ 修正要 if ($id == 0) { $w = $LANG_USERBOX['attribute_top']; $attribute_top = $w; $field_top = ""; $col = "col.thtml"; } else { $url = $_CONF['site_url'] . "/userbox/attribute.php"; $attribute_top = ":<a href='" . $url . "'>" . $LANG_USERBOX['attribute_top'] . "</a>"; $w = $field_def[$id]['name'] . $LANG_USERBOX['countlist']; $field_top = $w; $col = "col2.thtml"; } if ($page > 1) { $page_title = sprintf('%s (%d)', $w, $page); } else { $page_title = sprintf('%s ', $w); } $headercode .= DATABOX_getheadercode("attribute", $template, $pi_name, 0, $_CONF['site_name'], $_CONF['meta_description'], $_CONF['meta_keywords'], $_CONF['meta_description']); $retval .= DATABOX_siteHeader($pi_name, '', $page_title, $headercode); // $tmplfld = DATABOX_templatePath('attribute', $template, $pi_name); $templates = new Template($tmplfld); $templates->set_file(array('list' => 'list.thtml', 'nav' => 'navigation.thtml', 'row' => 'row.thtml', 'col' => $col, 'pagenav' => 'pagenavigation.thtml')); $languageid = COM_getLanguageId(); $language = COM_getLanguage(); $templates->set_var('languageid', $languageid); $templates->set_var('language', $language); if ($languageid != "") { $templates->set_var('_languageid', "_" . $languageid); } else { $templates->set_var('_languageid', ""); } // $templates->set_var('site_url', $_CONF['site_url']); $templates->set_var('this_script', THIS_SCRIPT); $templates->set_var('home', $LANG_USERBOX['home']); $templates->set_var('attribute_top', $attribute_top); $templates->set_var('field_top', $field_top); //page $offset = ($page - 1) * $perpage; $lin1 = $offset + 1; $lin2 = $lin1 + $perpage - 1; if ($lin2 > $cnt) { $lin2 = $cnt; } $templates->set_var('lang_view', $LANG_USERBOX['view']); $templates->set_var('lin', $lin1 . "-" . $lin2); $templates->set_var('cnt', $cnt); // $templates->set_var('lang_name', $LANG_USERBOX_ADMIN['name']); $templates->set_var('lang_count', $LANG_USERBOX['count']); $sql .= " LIMIT {$offset}, {$perpage}"; $result = DB_query($sql); $numrows = DB_numRows($result); if ($numrows > 0) { for ($i = 0; $i < $numrows; $i++) { $A = DB_fetchArray($result); $name = COM_applyFilter($A['name']); $description = COM_applyFilter($A['description']); $fid = $A["field_id"]; $value = $A["value"]; $fieldvalue = DATABOX_getfieldvalue($value, $field_def[$fid]['type'], $field_def[$fid]['selectionary'], $LANG_USERBOX_NOYES, $field_def[$fid]['selectlist'], $pi_name); $url = $_CONF['site_url'] . "/" . THIS_SCRIPT; $url .= "?"; $url .= "id=" . $A['field_id']; $url .= "&m=id"; $url2 = $url . "&value=" . $A['value']; $url = COM_buildUrl($url); $link = COM_createLink($name, $url); $url2 = COM_buildUrl($url2); $link2 = COM_createLink($fieldvalue, $url2); $templates->set_var('field_link', $link); $templates->set_var('value_link', $link2); $templates->set_var('field_description', $description); $templates->set_var('field_name', $name); $templates->set_var('field_url', $url); $templates->set_var('value_url', $url2); $templates->set_var('value', $fieldvalue); $templates->set_var('count', $A['count']); //===== $templates->parse('col_var', 'col', true); $templates->parse('row_var', 'row', true); $templates->set_var('col_var', ''); } // Call to plugins to set template variables in the databox PLG_templateSetVars('userbox', $templates); //ページなび //$url = $_CONF['site_url'] . '/'.THIS_SCRIPT."?m=".$m;//."?order=$order"; $url = $_CONF['site_url'] . '/' . THIS_SCRIPT; $templates->set_var('page_navigation', COM_printPageNavigation($url, $page, $pages)); //------------ $templates->parse('nav_var', 'nav', true); $templates->set_var('blockfooter', COM_endBlock()); $templates->set_var('msg', ""); $templates->parse('output', 'list'); $school_content = $templates->finish($templates->get_var('output')); $retval .= $school_content; } else { $templates->set_var('msg', $LANG_USERBOX["nohit"]); $templates->parse('output', 'list'); $content = $templates->finish($templates->get_var('output')); $retval .= $content; } $retval = PLG_replacetags($retval); return $retval; }