|
From: Jon O. <jon...@us...> - 2005-08-20 18:24:05
|
Update of /cvsroot/mxbb/mx_newssuite/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22901/modules/mx_newssuite/admin Added Files: mx_module_defs.php Log Message: compatibility with new core 2.8 - adding new core generic parameters --- NEW FILE: mx_module_defs.php --- <?php /** ------------------------------------------------------------------------ * subject : mx-portal, CMS & portal * begin : june, 2002 * copyright : (C) 2002-2005 MX-System * email : jon...@ho... * project site : www.mx-system.com * * description : * ------------------------------------------------------------------------- * * $Id: mx_module_defs.php,v 1.1 2005/08/20 18:23:54 jonohlsson Exp $ */ /** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ /********************************************************************************\ | Class: mx_blockcp_parameter | The mx_blockcp_parameter object provides extra module block parameters, added to the standard core parameters. | | Usage examples: | \********************************************************************************/ // // The following flags are class specific options // //define('MX_ALL_DATA' , -1); // Flag - write all data class mx_blockcp_parameter { // ------------------------------ // Private Methods // // // =================================================== // define module specific block parameters // =================================================== function get_parameters($type_row = '') { global $lang; if (empty($type_row)) { $type_row = array(); } $type_row['news_type_select'] = !empty($lang['ParType_news_type_select']) ? $lang['ParType_news_type_select'] : "NewsSuite phpBB/KB Source"; return $type_row; } // =================================================== // display parameter field and data in the add/edit page // =================================================== function display_edit( $parameter_data ) { global $template, $blockcptemplate, $mx_blockcp, $mx_root_path, $theme, $lang; switch ( $parameter_data['parameter_type'] ) { case 'news_type_select': $this->display_edit_News_type_select( $block_id, $parameter_data['parameter_id'], $parameter_data ); break; } } function display_edit_News_type_select( $block_id, $parameter_id, $parameter_data ) { global $template, $board_config, $db, $theme, $lang, $images, $mx_blockcp, $mx_root_path, $phpEx, $mx_table_prefix, $table_prefix; global $newssuite_config; $newssuite_config['news_source_switch'] = 'phpbb'; $module_root_path = $mx_root_path . $mx_blockcp->module_root_path; include_once( $module_root_path . 'includes/newssuite_constants.' . $phpEx ); include_once( $module_root_path . "includes/newssuite_defs.$phpEx" ); $template->set_filenames(array( 'parameter' => $mx_root_path . $mx_blockcp->module_root_path . 'templates/'. $theme['template_name'] . '/admin/mx_blockcp_parameter.tpl') ); // Get number of forums in db $sql = "SELECT * FROM " . $news_cat_table . " ORDER BY $cat_extract_order"; if ( !( $result = $db->sql_query( $sql ) ) ) { message_die( GENERAL_ERROR, "Couldn't obtain forums information.", "", __LINE__, __FILE__, $sql ); } $forums = $db->sql_fetchrowset( $result ); // Get array of categories from the database $categories = get_main_cats( $newssuite_config ); $news_type_select_data = array(); $news_type_select_temp = $mx_blockcp->block_parameters['news_type_select']['parameter_value']; $news_type_select_temp = stripslashes( $news_type_select_temp ); $news_type_select_data = eval( "return " . $news_type_select_temp . ";" ); // // Check that some categories exist // if ( $total_categories = count( $categories ) ) { // // Check that some forums exist (these were queried earlier) // if ( $total_forums = count( $forums ) ) { switch ( $newssuite_config['news_source_switch'] ) { case 'phpbb': $template->assign_block_vars( 'switch_forums_phpbb', array( 'COLSPAN' => count( $item_types_array ) + 2 ) ); break; case 'kb': $template->assign_block_vars( 'switch_forums_kb', array( 'COLSPAN' => count( $item_types_array ) + 2 ) ); for( $z = 0; $z < ( count( $item_types_array ) ); $z++ ) { $template->assign_block_vars( 'switch_forums_kb.types_name', array( 'TYPES_NAME' => $item_types_name_array[$z] ) ); } break; } for( $i = 0; $i < $total_categories; $i++ ) { $template->assign_block_vars( 'catrow', array( 'CAT_ID' => $categories[$i]['cat_id'], 'COLSPAN' => count( $item_types_array ) + 1, 'CAT_NAME' => $categories[$i]['cat_title'] ) ); for( $j = 0; $j < $total_forums; $j++ ) { if ( $forums[$j]['cat_id'] == $categories[$i]['cat_id'] || $forums[$j]['cat_id'] == '' ) { switch ( $newssuite_config['news_source_switch'] ) { case 'phpbb': $template->assign_block_vars( 'catrow.forumrow_phpbb', array( 'FORUM_ID' => $forums[$j][$catt_id], 'FORUM_NAME' => $forums[$j][$catt_name], 'FORUM_DESC' => $forums[$j][$catt_desc], 'CHECKED' => ( $news_type_select_data[$forums[$j]['forum_id']]['forum_news'] ? 'CHECKED' : '' ), 'ANNOUNCE_CHECKED' => ( $news_type_select_data[$forums[$j]['forum_id']]['forum_news_announce'] ? 'CHECKED' : '' ), 'STICKY_CHECKED' => ( $news_type_select_data[$forums[$j]['forum_id']]['forum_news_sticky'] ? 'CHECKED' : '' ), 'NORMAL_CHECKED' => ( $news_type_select_data[$forums[$j]['forum_id']]['forum_news_post'] ? 'CHECKED' : '' ) ) ); break; case 'kb': $template->assign_block_vars( 'catrow.forumrow_kb', array( 'FORUM_ID' => $forums[$j][$catt_id], 'FORUM_NAME' => $forums[$j][$catt_name], 'FORUM_DESC' => $forums[$j][$catt_desc], 'CHECKED' => ( $news_type_select_data[$forums[$j][$cool_array_category_id]]['forum_news'] ? 'CHECKED' : '' ), // 'ANNOUNCE_CHECKED' => ( $news_type_select_data[$forums[$j]['forum_id']]['forum_news_announce'] ? 'CHECKED' : '' ), // 'STICKY_CHECKED' => ( $news_type_select_data[$forums[$j]['forum_id']]['forum_news_sticky'] ? 'CHECKED' : '' ), // 'NORMAL_CHECKED' => ( $news_type_select_data[$forums[$j]['forum_id']]['forum_news_post'] ? 'CHECKED' : '' ) ) ); for( $z = 0; $z < ( count( $item_types_array ) ); $z++ ) { $template->assign_block_vars( 'catrow.forumrow_kb.types', array( 'CHECKED' => ( $news_type_select_data[$forums[$j][$cool_array_category_id]][$item_types_array[$z]] ? 'CHECKED' : '' ), 'TYPE' => $item_types_array[$z], 'VALUE' => $item_types_id_array[$z] ) ); } break; } } } } } } $template->assign_vars(array( 'NAME' => $lang[$parameter_data['parameter_name']], 'PARAMETER_TITLE' => ( !empty($lang[$parameter_data['parameter_name']]) ) ? $lang[$parameter_data['parameter_name']] : $parameter_data['parameter_name'], 'PARAMETER_TYPE' => ( !empty($lang["ParType_".$parameter_data['parameter_type']]) ) ? $lang["ParType_".$parameter_data['parameter_type']] : '', 'PARAMETER_TYPE_EXPLAIN' => ( !empty($lang["ParType_".$parameter_data['parameter_type'] . "_info"]) ) ? '<br />' . $lang["ParType_".$parameter_data['parameter_type'] . "_info"] : '', 'SCRIPT_PATH' => $module_root_path, 'I_ANNOUNCE' => PHPBB_URL . $images['folder_announce'], 'I_STICKY' => PHPBB_URL . $images['folder_sticky'], 'I_NORMAL' => PHPBB_URL . $images['folder'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_STICKY' => $lang['Post_Sticky'], 'L_NORMAL' => $lang['Posted'], )); } } ?> |