function cledit_theme($contents) { global $global_config, $module_name, $module_file, $module_info; $xtpl = new XTemplate("cledit.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); foreach ($contents['rows'] as $row) { $xtpl->clear_autoreset(); $xtpl->assign('LT_NAME', $row[0]); $xtpl->assign('LT_ID', $row[1]); $xtpl->assign('LT_VALUE', $row[2]); $xtpl->assign('LT_MAXLENGTH', $row[3]); $xtpl->set_autoreset(); $xtpl->parse('cledit.lt'); } foreach ($contents['npass'] as $row) { $xtpl->clear_autoreset(); $xtpl->assign('NPASS_NAME', $row[0]); $xtpl->assign('NPASS_ID', $row[1]); $xtpl->assign('NPASS_MAXLENGTH', $row[2]); $xtpl->set_autoreset(); $xtpl->parse('cledit.npass'); } $xtpl->assign('EDIT_NAME', $contents['edit_name']); $xtpl->assign('EDIT_ONCLICK', $contents['edit_onclick']); $xtpl->assign('EDIT_ID', $contents['edit_id']); $xtpl->assign('CANCEL_NAME', $contents['cancel_name']); $xtpl->assign('CANCEL_ONCLICK', $contents['cancel_onclick']); $xtpl->parse('cledit'); return $xtpl->text('cledit'); }
function viewcat_page_new($array_catpage, $array_cat_other, $generate_page) { global $global_array_cat, $module_name, $module_file, $module_upload, $lang_module, $module_config, $module_info, $global_array_cat, $catid, $page; $xtpl = new XTemplate('viewcat_page.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('IMGWIDTH1', $module_config[$module_name]['homewidth']); if ($global_array_cat[$catid]['viewdescription'] and $page == 1 or $global_array_cat[$catid]['viewdescription'] == 2) { $xtpl->assign('CONTENT', $global_array_cat[$catid]); if ($global_array_cat[$catid]['image']) { $xtpl->assign('HOMEIMG1', NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/img/' . $global_array_cat[$catid]['image']); $xtpl->parse('main.viewdescription.image'); } $xtpl->parse('main.viewdescription'); } foreach ($array_catpage as $array_row_i) { $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday']; $array_row_i['publtime'] = humanTiming($array_row_i['publtime']); $array_row_i['listcatid'] = explode(',', $array_row_i['listcatid']); $num_cat = sizeof($array_row_i['listcatid']); $array_row_i['title_cut'] = nv_clean60($array_row_i['title'], $module_config[$module_name]['titlecut'], true); $n = 1; foreach ($array_row_i['listcatid'] as $listcatid) { $listcat = array('title' => $global_array_cat[$listcatid]['title'], "link" => $global_array_cat[$listcatid]['link']); $xtpl->assign('CAT', $listcat); $n < $num_cat ? $xtpl->parse('main.viewcatloop.cat.comma') : ''; $xtpl->parse('main.viewcatloop.cat'); ++$n; } $xtpl->clear_autoreset(); $xtpl->assign('CONTENT', $array_row_i); if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id'])); $xtpl->parse('main.viewcatloop.news.adminlink'); } if ($array_row_i['imghome'] != '') { $xtpl->assign('HOMEIMG1', $array_row_i['imghome']); $xtpl->assign('HOMEIMGALT1', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']); $xtpl->parse('main.viewcatloop.news.image'); } if ($newday >= NV_CURRENTTIME) { $xtpl->parse('main.viewcatloop.news.newday'); } if (isset($array_row_i['uploader_link']) and !empty($array_row_i['uploader_link'])) { $xtpl->parse('main.viewcatloop.news.uploader_link'); } else { $xtpl->parse('main.viewcatloop.news.uploader'); } if ($array_row_i['hitstotal'] > 0) { $xtpl->parse('main.viewcatloop.news.hitstotal'); } $xtpl->set_autoreset(); $xtpl->parse('main.viewcatloop.news'); } $xtpl->parse('main.viewcatloop'); if (!empty($array_cat_other)) { $xtpl->assign('ORTHERNEWS', $lang_module['other']); foreach ($array_cat_other as $array_row_i) { $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday']; $array_row_i['publtime'] = nv_date("d/m/Y", $array_row_i['publtime']); $xtpl->assign('RELATED', $array_row_i); if ($newday >= NV_CURRENTTIME) { $xtpl->parse('main.related.loop.newday'); } $xtpl->parse('main.related.loop'); } $xtpl->parse('main.related'); } if (!empty($generate_page)) { $xtpl->assign('GENERATE_PAGE', $generate_page); $xtpl->parse('main.generate_page'); } $xtpl->parse('main'); return $xtpl->text('main'); }
function viewfam_page_new($array_fampage, $array_fam_other, $generate_page) { global $global_array_fam, $module_name, $module_file, $module_upload, $lang_module, $module_config, $module_info, $global_array_fam, $fid, $page; $xtpl = new XTemplate('viewfam_page.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('IMGWIDTH1', $module_config[$module_name]['homewidth']); if ($global_array_fam[$fid]['viewdescription'] and $page == 1 or $global_array_fam[$fid]['viewdescription'] == 2) { $xtpl->assign('CONTENT', $global_array_fam[$fid]); if ($global_array_fam[$fid]['image']) { $xtpl->assign('HOMEIMG1', NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $global_array_fam[$fid]['image']); $xtpl->parse('main.viewdescription.image'); } $xtpl->parse('main.viewdescription'); } $a = 0; foreach ($array_fampage as $array_row_i) { $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday']; $array_row_i['publtime'] = nv_date('d/m/Y h:i:s A', $array_row_i['publtime']); $array_row_i['listfid'] = explode(',', $array_row_i['listfid']); $num_fam = sizeof($array_row_i['listfid']); $n = 1; foreach ($array_row_i['listfid'] as $listfid) { $listfam = array('title' => $global_array_fam[$listfid]['title'], "link" => $global_array_fam[$listfid]['link']); $xtpl->assign('fam', $listfam); $n < $num_fam ? $xtpl->parse('main.viewfamloop.fam.comma') : ''; $xtpl->parse('main.viewfamloop.fam'); ++$n; } if ($a == 0) { $xtpl->clear_autoreset(); $xtpl->assign('CONTENT', $array_row_i); if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id'])); $xtpl->parse('main.viewfamloop.featured.adminlink'); } if ($array_row_i['imghome'] != '') { $xtpl->assign('HOMEIMG1', $array_row_i['imghome']); $xtpl->assign('HOMEIMGALT1', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']); $xtpl->parse('main.viewfamloop.featured.image'); } if ($newday >= NV_CURRENTTIME) { $xtpl->parse('main.viewfamloop.featured.newday'); } $xtpl->parse('main.viewfamloop.featured'); } else { $xtpl->clear_autoreset(); $xtpl->assign('CONTENT', $array_row_i); if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id'])); $xtpl->parse('main.viewfamloop.news.adminlink'); } if ($array_row_i['imghome'] != '') { $xtpl->assign('HOMEIMG1', $array_row_i['imghome']); $xtpl->assign('HOMEIMGALT1', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']); $xtpl->parse('main.viewfamloop.news.image'); } if ($newday >= NV_CURRENTTIME) { $xtpl->parse('main.viewfamloop.news.newday'); } $xtpl->set_autoreset(); $xtpl->parse('main.viewfamloop.news'); } ++$a; } $xtpl->parse('main.viewfamloop'); if (!empty($array_fam_other)) { $xtpl->assign('ORTHERNEWS', $lang_module['other']); foreach ($array_fam_other as $array_row_i) { $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday']; $array_row_i['publtime'] = nv_date("d/m/Y", $array_row_i['publtime']); $xtpl->assign('RELATED', $array_row_i); if ($newday >= NV_CURRENTTIME) { $xtpl->parse('main.related.loop.newday'); } $xtpl->parse('main.related.loop'); } $xtpl->parse('main.related'); } if (!empty($generate_page)) { $xtpl->assign('GENERATE_PAGE', $generate_page); $xtpl->parse('main.generate_page'); } $xtpl->parse('main'); return $xtpl->text('main'); }
function viewsubcat_main($viewcat, $array_cat) { global $global_config, $module_name, $module_file, $global_array_cat, $lang_module, $module_config, $module_info; $xtpl = new XTemplate("viewcat_main_bottom.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $xtpl->assign('LANG', $lang_module); // Hien thi cac chu de con foreach ($array_cat as $key => $array_row_i) { if (isset($array_cat[$key]['content'])) { $xtpl->assign('CAT', $array_row_i); $catid = intval($array_row_i['catid']); if ($array_row_i['subcatid'] != "") { $exl = 0; $arrsubcat_s = explode(",", $array_row_i['subcatid']); foreach ($arrsubcat_s as $subcatid_i) { if ($global_array_cat[$subcatid_i]['inhome'] == 1) { $xtpl->clear_autoreset(); if ($exl < 3) { $xtpl->assign('SUBCAT', $global_array_cat[$subcatid_i]); $xtpl->parse('main.listcat.subcatloop'); $xtpl->set_autoreset(); } else { $more = array('title' => $lang_module['more'], 'link' => $global_array_cat[$catid]['link']); $xtpl->assign('MORE', $more); $xtpl->parse('main.listcat.subcatmore'); $xtpl->set_autoreset(); break; } ++$exl; } } } $a = 0; $xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']); foreach ($array_cat[$key]['content'] as $array_row_i) { $array_row_i['publtime'] = nv_date('d-m-Y h:i:s A', $array_row_i['publtime']); ++$a; if ($a == 1) { $xtpl->assign('CONTENT', $array_row_i); if ($array_row_i['imghome'] != "") { $xtpl->assign('HOMEIMG', $array_row_i['imghome']); $xtpl->assign('HOMEIMGALT', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']); $xtpl->parse('main.listcat.image'); } if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " - " . nv_link_delete_page($array_row_i['id'])); $xtpl->parse('main.listcat.adminlink'); } } else { $xtpl->assign('OTHER', $array_row_i); $xtpl->parse('main.listcat.related.loop'); } if ($a > 1) { if ($viewcat == "viewcat_main_right") { $xtpl->assign('BORDER', 'border_r '); } elseif ($viewcat == "viewcat_main_left") { $xtpl->assign('BORDER', 'border_l '); } else { $xtpl->assign('BORDER', 'border_b '); } $xtpl->assign('WCT', 'fixedwidth '); } else { $xtpl->assign('WCT', 'fullwidth noborder '); } $xtpl->set_autoreset(); } if ($a > 1) { $xtpl->parse('main.listcat.related'); } $xtpl->parse('main.listcat'); } } // het Hien thi cac chu de con $xtpl->parse('main'); return $xtpl->text('main'); }
$xtpl->assign('DATA', $rows[$i]); $xtpl->assign('ROW_NR', $i); // parse a row $xtpl->parse('main.table.row'); } // parse the table (Table 1) $xtpl->parse('main.table'); /** * now, if you wanted to parse the table once again with the old rows, * and put one more $xtpl->parse('main.table') line, it wouldn't do it * becuase the sub-blocks were resetted (normal operation) * to parse the same block two or more times without having the sub-blocks resetted, * you should use clear_autoreset(); * to switch back call set_autoreset(); */ $xtpl->clear_autoreset(); for ($i = 1; $i <= $rowsize; $i++) { // assign array data $xtpl->assign('DATA', $rows[$i]); $xtpl->assign('ROW_NR', $i); // parse a row $xtpl->parse('main.table.row'); } // parse the table (Table 2) $xtpl->parse('main.table'); // Turn the autoreset back on - the sub-block will be reset after the next table parse $xtpl->set_autoreset(); // parse it one more time.. the rows are still there from the last parse of table (2) // the set_autoreset on the previous line means the rows are cleared during this parse (sub-block reset) (Table 3) $xtpl->parse('main.table'); // re-parse the table block (Table 4)
function viewcat_new_head($array_catpage, $array_cat_other) { global $global_config, $module_name, $module_file, $lang_module, $module_config, $module_info; $xtpl = new XTemplate("viewcat_new_head.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $xtpl->assign('LANG', $lang_module); $a = 0; foreach ($array_catpage as $array_row_i) { $array_row_i['publtime'] = nv_date('d/m/Y H:i', $array_row_i['publtime']); $xtpl->clear_autoreset(); if ($a == 0) { $xtpl->assign("HEAD", $array_row_i); if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " - " . nv_link_delete_page($array_row_i['id'])); $xtpl->parse('main.head_new.adminlink'); } if ($array_row_i['imghome'] != "") { if (file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['imghome'])) { $size = @getimagesize(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['imghome']); if ($size[0] > 0) { $homewidth = $module_config[$module_name]['homewidth'] * 2; $size[1] = round($homewidth / $size[0] * $size[1]); $size[0] = $homewidth; $xtpl->assign('IMGWIDTH1', $size[0]); $xtpl->assign('IMGHEIGHT1', $size[1]); $xtpl->assign('HOMEIMG1', NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_row_i['imghome']); $xtpl->assign('HOMEIMGALT1', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']); $xtpl->parse('main.head_new.image'); } } } $xtpl->set_autoreset(); $xtpl->parse("main.head_new"); } else { $xtpl->assign('CONTENT', $array_row_i); if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " - " . nv_link_delete_page($array_row_i['id'])); $xtpl->parse('main.viewcatloop.adminlink'); } if ($array_row_i['imghome'] != "") { if (file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['imghome'])) { $size = @getimagesize(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['imghome']); if ($size[0] > 0) { $homewidth = $module_config[$module_name]['homewidth']; $size[1] = round($homewidth / $size[0] * $size[1]); $size[0] = $homewidth; $xtpl->assign('IMGWIDTH1', $size[0]); $xtpl->assign('IMGHEIGHT1', $size[1]); $xtpl->assign('HOMEIMG1', NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_row_i['imghome']); $xtpl->assign('HOMEIMGALT1', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']); $xtpl->parse('main.viewcatloop.image'); } } } $xtpl->set_autoreset(); $xtpl->parse('main.viewcatloop'); } $a++; } if (!empty($array_cat_other)) { $xtpl->assign('ORTHERNEWS', $lang_module['other']); foreach ($array_cat_other as $array_row_i) { $array_row_i['publtime'] = nv_date("d/m/Y", $array_row_i['publtime']); $xtpl->assign('RELATED', $array_row_i); $xtpl->parse('main.related.loop'); } $xtpl->parse('main.related'); } $xtpl->parse('main'); return $xtpl->text('main'); }
function viewsubcat_main($viewcat, $array_cat) { global $module_name, $module_file, $global_array_cat, $lang_module, $module_config, $module_info, $global_config; $xtpl = new XTemplate($viewcat . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('TEMPLATE', $global_config['module_theme']); // Hien thi cac chu de con foreach ($array_cat as $key => $array_row_i) { if (isset($array_cat[$key]['content'])) { $array_row_i['rss'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $module_info['alias']['rss'] . "/" . $array_row_i['alias']; $xtpl->assign('CAT', $array_row_i); $catid = intval($array_row_i['catid']); if ($array_row_i['subcatid'] != '') { $exl = 0; $arrsubcat_s = explode(',', $array_row_i['subcatid']); foreach ($arrsubcat_s as $subcatid_i) { if ($global_array_cat[$subcatid_i]['inhome'] == 1) { $xtpl->clear_autoreset(); if ($exl < 3) { $xtpl->assign('SUBCAT', $global_array_cat[$subcatid_i]); $xtpl->parse('main.listcat.subcatloop'); $xtpl->set_autoreset(); } else { $more = array('title' => $lang_module['more'], 'link' => $global_array_cat[$catid]['link']); $xtpl->assign('MORE', $more); $xtpl->parse('main.listcat.subcatmore'); $xtpl->set_autoreset(); break; } ++$exl; } } } $a = 0; $xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']); foreach ($array_cat[$key]['content'] as $array_row_i) { $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday']; $array_row_i['publtime'] = nv_date('d/m/Y h:i:s A', $array_row_i['publtime']); $array_row_i['hometext'] = nv_clean60($array_row_i['hometext'], 90); $array_row_i['title0'] = nv_clean60($array_row_i['title'], 40); ++$a; if ($a == 1) { $image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['homeimgfile']; if ($array_row_i['homeimgfile'] != '' and file_exists($image)) { $width = 370; $height = 200; $array_row_i['imghome'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_row_i['homeimgfile']; $imginfo = nv_is_image($image); $basename = basename($image); if ($imginfo['width'] > $width or $imginfo['height'] > $height) { $basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $array_row_i['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename); if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) { $array_row_i['imghome'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename; } else { require_once NV_ROOTDIR . '/includes/class/image.class.php'; $_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT); $_image->cropFromCenter($width, $height); $_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename); if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) { $array_row_i['imghome'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename; } } } } if ($newday >= NV_CURRENTTIME) { $xtpl->parse('main.listcat.newday'); } $xtpl->assign('CONTENT', $array_row_i); if ($array_row_i['imghome'] != "") { $xtpl->assign('HOMEIMG', $array_row_i['imghome']); $xtpl->assign('HOMEIMGALT', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']); $xtpl->parse('main.listcat.image'); } if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id'])); $xtpl->parse('main.listcat.adminlink'); } } else { if ($newday >= NV_CURRENTTIME) { $xtpl->assign('CLASS', 'icon_new_small'); } else { $xtpl->assign('CLASS', 'icon_list'); } $array_row_i['title0'] = nv_clean60($array_row_i['title'], 35); $array_row_i['hometext'] = nv_clean60($array_row_i['hometext'], 90); $xtpl->assign('OTHER', $array_row_i); $xtpl->parse('main.listcat.related.loop'); } if ($a > 1) { $xtpl->assign('WCT', 'col-md-8 '); } else { $xtpl->assign('WCT', ''); } $xtpl->set_autoreset(); } if ($a > 1) { $xtpl->parse('main.listcat.related'); } $xtpl->parse('main.listcat'); } } if ($module_config[$module_name]['showtooltip']) { $xtpl->assign('TOOLTIP_POSITION', $module_config[$module_name]['tooltip_position']); $xtpl->parse('main.tooltip'); } $xtpl->parse('main'); return $xtpl->text('main'); }