|
From: Jon O. <jon...@us...> - 2005-08-20 18:22:48
|
Update of /cvsroot/mxbb/mx_forum/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22664/modules/mx_forum/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:22:39 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['phpbb_type_select'] = !empty($lang['ParType_phpbb_type_select']) ? $lang['ParType_phpbb_type_select'] : "phpBB 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 'phpbb_type_select': $this->display_edit_Phpbb_type_select( $block_id, $parameter_data['parameter_id'], $parameter_data ); break; } } function display_edit_Phpbb_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; $module_root_path = $mx_root_path . $mx_blockcp->module_root_path; include_once( $module_root_path . "includes/phpbb_constants.$phpEx" ); include_once( $module_root_path . "includes/phpbb_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 $sql = "SELECT cat_id, cat_title FROM " . CATEGORIES_TABLE . " ORDER BY cat_order"; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql ); } $categories = $db->sql_fetchrowset( $result ); $phpbb_type_select_data = array(); $phpbb_type_select_temp = $mx_blockcp->block_parameters['phpbb_type_select']['parameter_value']; $phpbb_type_select_temp = stripslashes( $phpbb_type_select_temp ); $phpbb_type_select_data = eval( "return " . $phpbb_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 ) ) { $template->assign_block_vars( 'switch_forums_phpbb', array( 'COLSPAN' => count( $item_types_array ) + 2 ) ); 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'] == '' ) { $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' => ( $phpbb_type_select_data[$forums[$j]['forum_id']]['forum_news'] ? 'CHECKED' : '' ), 'ANNOUNCE_CHECKED' => ( $phpbb_type_select_data[$forums[$j]['forum_id']]['forum_news_announce'] ? 'CHECKED' : '' ), 'STICKY_CHECKED' => ( $phpbb_type_select_data[$forums[$j]['forum_id']]['forum_news_sticky'] ? 'CHECKED' : '' ), 'NORMAL_CHECKED' => ( $phpbb_type_select_data[$forums[$j]['forum_id']]['forum_news_post'] ? 'CHECKED' : '' ) ) ); } } } } } $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'], )); } } ?> |