|
From: Jon O. <jon...@us...> - 2006-07-08 10:21:41
|
Update of /cvsroot/mxbb/mx_kb/kb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26309/modules/mx_kb/kb/includes Modified Files: functions_admin.php functions_kb.php Log Message: making all admincp an object :-) Index: functions_admin.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/includes/functions_admin.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** functions_admin.php 17 Jun 2006 20:11:23 -0000 1.6 --- functions_admin.php 8 Jul 2006 10:21:36 -0000 1.7 *************** *** 15,159 **** /** ! * Enter description here... * - * @param unknown_type $cat_parent - * @param unknown_type $depth */ ! function admin_cat_main( $cat_parent = 0, $depth = 0 ) { ! global $mx_kb, $phpbb_root_path, $template, $phpEx, $lang, $images, $module_root_path, $theme; ! $pre = str_repeat( ' ', $depth ); ! if ( isset( $mx_kb->subcat_rowset[$cat_parent] ) ) { ! foreach( $mx_kb->subcat_rowset[$cat_parent] as $category_id => $category ) { ! $category_details = $category['category_details']; ! $category_id = $category['category_id']; ! $category_name = $category['category_name']; ! $temp_url = append_sid( $module_root_path . "kb.$phpEx?mode=cat&cat=$category_id" ); ! $category_link = '<a href="' . $temp_url . '" class="gen">' . $category_name . '</a>'; ! $temp_url = append_sid( $module_root_path . "admin/admin_kb_cat.$phpEx?mode=edit&cat=$category_id" ); ! $edit = '<a href="' . $temp_url . '"><img src="' . $images['kb_icon_edit'] . '" border="0" alt="' . $lang['Edit'] . '"></a>'; ! $temp_url = append_sid( $module_root_path . "admin/admin_kb_cat.$phpEx?mode=delete&cat=$category_id" ); ! $delete = '<a href="' . $temp_url . '" class="gen"><img src="' . $images['kb_icon_delpost'] . '" border="0" alt="' . $lang['Delete'] . '"></a>'; ! $temp_url = append_sid( $module_root_path . "admin/admin_kb_cat.$phpEx?mode=up&cat=$category_id" ); ! $up = '<a href="' . $temp_url . '" class="gen">' . $lang['Move_up'] . '</a>'; ! $temp_url = append_sid( $module_root_path . "admin/admin_kb_cat.$phpEx?mode=down&cat=$category_id" ); ! $down = '<a href="' . $temp_url . '" class="gen">' . $lang['Move_down'] . '</a>'; ! $row_class = ( !( $ss % 2 ) ) ? $theme['td_class1'] : $theme['td_class2']; ! $template->assign_block_vars( 'catrow', array( ! 'CATEGORY' => $category_link, ! 'CAT_DESCRIPTION' => $category_details, ! 'U_EDIT' => $edit, ! 'U_DELETE' => $delete, ! 'U_UP' => $up, ! 'U_DOWN' => $down, ! 'ROW_CLASS' => $row_class, ! 'PRE' => $pre ! )); ! admin_cat_main( $category_id, $depth + 1 ); } return; } - return; - } ! /** ! * Enter description here... ! * ! * @param unknown_type $sel_id ! * @param unknown_type $use_default_option ! * @param unknown_type $select_name ! * @return unknown ! */ ! function get_forums( $sel_id = 0, $use_default_option = false, $select_name = 'forum_id' ) ! { ! global $db, $lang; ! ! $sql = "SELECT forum_id, forum_name ! FROM " . FORUMS_TABLE; ! ! if ( !$result = $db->sql_query( $sql ) ) { ! mx_message_die( GENERAL_ERROR, "Couldn't get list of forums", "", __LINE__, __FILE__, $sql ); ! } ! $forumlist = '<select name="'.$select_name.'">'; ! if ( $sel_id == 0 ) ! { ! $forumlist .= '<option value="0" selected >'.$lang['Select_topic_id'].'</option>'; ! } ! if ( $use_default_option ) ! { ! $status = $sel_id == "-1" ? "selected" : ""; ! $forumlist .= '<option value="-1" '.$status.' >::'.$lang['Use_default'].'::</option>'; ! } ! while ( $row = $db->sql_fetchrow( $result ) ) ! { ! if ( $sel_id == $row['forum_id'] ) { ! $status = "selected"; } ! else { ! $status = ''; } - $forumlist .= '<option value="' . $row['forum_id'] . '" ' . $status . '>' . $row['forum_name'] . '</option>'; - } ! $forumlist .= '</select>'; ! return $forumlist; ! } ! /** ! * Enter description here... ! * ! * @param unknown_type $id ! * @param unknown_type $select ! * @return unknown ! */ ! function get_list_kb( $id, $select ) ! { ! global $db; ! $idfield = 'id'; ! $namefield = 'type'; ! $sql = "SELECT * ! FROM " . KB_TYPES_TABLE; ! if ( $select == 0 ) ! { ! $sql .= " WHERE $idfield <> $id"; ! } ! if ( !$result = $db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, "Couldn't get list of types", "", __LINE__, __FILE__, $sql ); ! } ! $typelist = ""; ! while ( $row = $db->sql_fetchrow( $result ) ) ! { ! $typelist .= "<option value=\"$row[$idfield]\"$s>" . $row[$namefield] . "</option>\n"; ! } ! return( $typelist ); } ?> \ No newline at end of file --- 15,189 ---- /** ! * Public mx_kb class. * */ ! class mx_kb_admin extends mx_kb_public { ! /** ! * load admin module ! * ! * @param unknown_type $module_name send module name to load it ! */ ! function adminmodule( $module_name ) ! { ! if ( !class_exists( 'kb_' . $module_name ) ) ! { ! global $module_root_path, $phpEx; ! $this->module_name = $module_name; ! ! require_once( $module_root_path . 'kb/admin/admin_' . $module_name . '.' . $phpEx ); ! eval( '$this->modules[' . $module_name . '] = new mx_kb_' . $module_name . '();' ); ! ! if ( method_exists( $this->modules[$module_name], 'init' ) ) ! { ! $this->modules[$module_name]->init(); ! } ! } ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $cat_parent ! * @param unknown_type $depth ! */ ! function admin_cat_main( $cat_parent = 0, $depth = 0 ) { ! global $phpbb_root_path, $template, $phpEx, $lang, $images, $module_root_path, $theme; ! ! $pre = str_repeat( ' ', $depth ); ! if ( isset( $this->subcat_rowset[$cat_parent] ) ) { ! foreach( $this->subcat_rowset[$cat_parent] as $category_id => $category ) ! { ! $category_details = '<span class="gensmall">' . $category['category_details'] . '</span>'; ! $category_id = $category['category_id']; ! $category_name = $category['category_name']; ! $temp_url = append_sid( $module_root_path . "kb.$phpEx?mode=cat&cat=$category_id" ); ! $category_link = '<a href="' . $temp_url . '" class="nav" target="_blank">' . $category_name . '</a>'; ! $temp_url = append_sid( $module_root_path . "admin/admin_kb.$phpEx?action=cat_manage&mode=edit&cat=$category_id" ); ! $edit = '<a href="' . $temp_url . '"><img src="' . $images['kb_icon_edit'] . '" border="0" alt="' . $lang['Edit'] . '"></a>'; ! $temp_url = append_sid( $module_root_path . "admin/admin_kb.$phpEx?action=cat_manage&mode=delete&cat=$category_id" ); ! $delete = '<a href="' . $temp_url . '" class="gen"><img src="' . $images['kb_icon_delpost'] . '" border="0" alt="' . $lang['Delete'] . '"></a>'; ! $temp_url = append_sid( $module_root_path . "admin/admin_kb.$phpEx?action=cat_manage&mode=up&cat=$category_id" ); ! $up = '<a href="' . $temp_url . '" class="gen">' . $lang['Move_up'] . '</a>'; ! $temp_url = append_sid( $module_root_path . "admin/admin_kb.$phpEx?action=cat_manage&mode=down&cat=$category_id" ); ! $down = '<a href="' . $temp_url . '" class="gen">' . $lang['Move_down'] . '</a>'; ! $row_class = ( !( $ss % 2 ) ) ? $theme['td_class1'] : $theme['td_class2']; ! $template->assign_block_vars( 'catrow', array( ! 'CATEGORY' => $category_link, ! 'CAT_DESCRIPTION' => $category_details, ! 'U_EDIT' => $edit, ! 'U_DELETE' => $delete, ! 'U_UP' => $up, ! 'U_DOWN' => $down, ! 'ROW_CLASS' => $row_class, ! 'PRE' => $pre ! )); ! $this->admin_cat_main( $category_id, $depth + 1 ); ! } ! return; } return; } ! /** ! * Enter description here... ! * ! * @param unknown_type $sel_id ! * @param unknown_type $use_default_option ! * @param unknown_type $select_name ! * @return unknown ! */ ! function get_forums( $sel_id = 0, $use_default_option = false, $select_name = 'forum_id' ) { ! global $db, $lang; ! $sql = "SELECT forum_id, forum_name ! FROM " . FORUMS_TABLE; ! if ( !$result = $db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, "Couldn't get list of forums", "", __LINE__, __FILE__, $sql ); ! } ! $forumlist = '<select name="'.$select_name.'">'; ! if ( $sel_id == 0 ) { ! $forumlist .= '<option value="0" selected >'.$lang['Select_topic_id'].'</option>'; } ! ! if ( $use_default_option ) { ! $status = $sel_id == "-1" ? "selected" : ""; ! $forumlist .= '<option value="-1" '.$status.' >::'.$lang['Use_default'].'::</option>'; } ! while ( $row = $db->sql_fetchrow( $result ) ) ! { ! if ( $sel_id == $row['forum_id'] ) ! { ! $status = "selected"; ! } ! else ! { ! $status = ''; ! } ! $forumlist .= '<option value="' . $row['forum_id'] . '" ' . $status . '>' . $row['forum_name'] . '</option>'; ! } ! $forumlist .= '</select>'; ! return $forumlist; ! } ! /** ! * Enter description here... ! * ! * @param unknown_type $id ! * @param unknown_type $select ! * @return unknown ! */ ! function get_list_kb( $id, $select ) ! { ! global $db; ! $idfield = 'id'; ! $namefield = 'type'; ! $sql = "SELECT * ! FROM " . KB_TYPES_TABLE; ! if ( $select == 0 ) ! { ! $sql .= " WHERE $idfield <> $id"; ! } ! if ( !$result = $db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, "Couldn't get list of types", "", __LINE__, __FILE__, $sql ); ! } ! $typelist = ""; ! while ( $row = $db->sql_fetchrow( $result ) ) ! { ! $typelist .= "<option value=\"$row[$idfield]\"$s>" . $row[$namefield] . "</option>\n"; ! } ! ! return( $typelist ); ! } } ?> \ No newline at end of file Index: functions_kb.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/includes/functions_kb.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** functions_kb.php 5 Jul 2006 22:48:26 -0000 1.13 --- functions_kb.php 8 Jul 2006 10:21:36 -0000 1.14 *************** *** 24,50 **** /** - * load admin module - * - * @param unknown_type $module_name send module name to load it - */ - function adminmodule( $module_name ) - { - if ( !class_exists( 'kb_' . $module_name ) ) - { - global $module_root_path, $phpEx; - - $this->module_name = $module_name; - - require_once( $module_root_path . 'kb/admin/admin_' . $module_name . '.' . $phpEx ); - eval( '$this->modules[' . $module_name . '] = new mx_kb_' . $module_name . '();' ); - - if ( method_exists( $this->modules[$module_name], 'init' ) ) - { - $this->modules[$module_name]->init(); - } - } - } - - /** * load module * --- 24,27 ---- |