|
From: Jon O. <jon...@us...> - 2006-08-13 18:52:36
|
Update of /cvsroot/mxbb/mx_linkdb/admin In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28103/modules/mx_linkdb/admin Added Files: mx_module_defs.php Log Message: More module blocks - Mini block - Latest Item block --- NEW FILE: mx_module_defs.php --- <?php /** * * @package mxBB Portal Module - mx_pafiledb * @version $Id: mx_module_defs.php,v 1.1 2006/08/13 18:52:33 jonohlsson Exp $ * @copyright (c) 2002-2006 [Mohd Basri, PHP Arena, pafileDB, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } /********************************************************************************\ | Class: mx_module_defs | The mx_module_defs object provides additional module block parameters... \********************************************************************************/ // // The following flags are class specific options // // Flow control define('MX_PANEL_DEBUG', false); /** * Enter description here... * */ class mx_module_defs { var $is_panel = false; // ------------------------------ // Private Methods // // // =================================================== // define module specific block parameters // =================================================== function get_parameters($type_row = '') { global $lang; if (empty($type_row)) { $type_row = array(); } $type_row['link_quick_cat'] = !empty($lang['ParType_link_quick_cat']) ? $lang['ParType_link_quick_cat'] : "linkDb default category"; return $type_row; } // =================================================== // Submit custom parameter field and data // =================================================== function submit_module_parameters( $parameter_data, $block_id ) { global $HTTP_POST_VARS, $db, $board_config, $mx_blockcp, $mx_root_path, $phpEx; $parameter_value = $HTTP_POST_VARS[$parameter_data['parameter_id']]; $parameter_opt = ''; /* switch ( $parameter_data['parameter_type'] ) { case 'pa_quick_cat': $bbcode_on = $board_config['allow_bbcode'] ? true : false; $html_on = $board_config['allow_html'] ? true : false; $smilies_on = $board_config['allow_smilies'] ? true : false; if( $bbcode_on ) { $bbcode_uid = make_bbcode_uid(); } break; } $parameter_value = prepare_message(trim($parameter_value), $html_on, $bbcode_on, $smilies_on, $bbcode_uid); $parameter_opt = $bbcode_uid; */ return array('parameter_value' => $parameter_value, 'parameter_opt' => $parameter_opt); } // =================================================== // display parameter field and data in the add/edit page // =================================================== function display_module_parameters( $parameter_data, $block_id ) { global $template, $mx_blockcp, $mx_root_path, $theme, $lang; switch ( $parameter_data['parameter_type'] ) { case 'link_quick_cat': $this->display_edit_link_quick_cat( $block_id, $parameter_data['parameter_id'], $parameter_data ); break; } } function display_edit_link_quick_cat( $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; // // Includes // $module_root_path = $mx_root_path . $mx_blockcp->module_root_path; include_once( $module_root_path . 'linkdb/includes/linkdb_constants.' . $phpEx ); // // Get varaibles // $data = ( !empty( $parameter_data['parameter_value'] ) ) ? $parameter_data['parameter_value'] : ''; $parameter_datas = $this->generate_jumpbox( 0, 0, array( $data => 1 ), false ); // // Start page proper // $template->set_filenames(array( 'parameter' => 'admin/mx_module_parameters.tpl') ); $template->assign_block_vars( 'select', array( 'PARAMETER_TITLE' => ( !empty($lang[$parameter_data['parameter_name']]) ) ? $lang[$parameter_data['parameter_name']] : $parameter_data['parameter_name'], 'PARAMETER_TITLE_EXPLAIN' => ( !empty($lang[$parameter_data['parameter_name']. "_explain"]) ) ? '<br />' . $lang[$parameter_data['parameter_name']. "_explain"] : '', 'L_NONE' => $lang['None'], 'SELECT_LIST' => $parameter_datas, 'FIELD_NAME' => ( !empty($lang[$parameter_data['parameter_name']]) ) ? $lang[$parameter_data['parameter_name']] : $parameter_data['parameter_name'], 'FIELD_ID' => $parameter_data['parameter_id'], 'FIELD_DESCRIPTION' => ( !empty($lang["ParType_".$parameter_data['parameter_type']]) ) ? $lang["ParType_".$parameter_data['parameter_type']] : '' )); $template->pparse('parameter'); } // =================================================== // Jump menu function // $cat_id : to handle parent cat_id // $depth : related to function to generate tree // $default : the cat you wanted to be selected // $for_file: TRUE high category ids will be -1 // $check_upload: if true permission for upload will be checked // =================================================== function generate_jumpbox( $cat_id = 0, $depth = 0, $default = '', $for_file = false, $check_upload = false ) { global $db; static $cat_rowset = false; $sql = 'SELECT * FROM ' . LINK_CATEGORIES_TABLE . ' ORDER BY cat_order ASC'; if ( !( $result = $db->sql_query( $sql ) ) ) { mx_message_die( GENERAL_ERROR, 'Couldnt Query categories info', '', __LINE__, __FILE__, $sql ); } $cat_rowset_temp = $db->sql_fetchrowset( $result ); $db->sql_freeresult( $result ); $cat_rowset = array(); foreach( $cat_rowset_temp as $row ) { $cat_rowset[$row['cat_id']] = $row; } // // Generate list // $cat_list .= ''; $pre = str_repeat( ' ', $depth ); $temp_cat_rowset = $cat_rowset; if ( !empty( $temp_cat_rowset ) ) { foreach ( $temp_cat_rowset as $temp_cat_id => $cat ) { if ( $cat['cat_parent'] == $cat_id ) { if ( is_array( $default ) ) { if ( isset( $default[$cat['cat_id']] ) ) { $sel = ' selected="selected"'; } else { $sel = ''; } } $cat_pre = ( !$cat['cat_allow_file'] ) ? '+ ' : '- '; $sub_cat_id = ( $for_file ) ? ( ( !$cat['cat_allow_file'] ) ? -1 : $cat['cat_id'] ) : $cat['cat_id']; $cat_class = ( !$cat['cat_allow_file'] ) ? 'class="greyed"' : ''; $cat_list .= '<option value="' . $sub_cat_id . '"' . $sel . ' ' . $cat_class . ' />' . $pre . $cat_pre . $cat['cat_name'] . '</option>'; $cat_list .= $this->generate_jumpbox( $cat['cat_id'], $depth + 1, $default, $for_file, $check_upload ); } } return $cat_list; } else { return; } } } ?> |