Advertisement:

Author Topic: Customizing Admin Menu  (Read 2963 times)

sanam

  • Newbie
  • *
  • Posts: 8
Customizing Admin Menu
« on: June 14, 2014, 02:54:35 pm »
Hiii,
I am new to osclass.
I want to add some more functionality to admin like user approval,payment status etc... In which page i can do that.
And also i cannot find any code for db connection in the file... I just want to change some fields in db where can be this applied.
Please someone help me :-[

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: Customizing Admin Menu
« Reply #1 on: June 15, 2014, 12:56:09 am »
script is not that advanced. there are plugins you can use for most of those requests except for db connection. (config.php)

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: Customizing Admin Menu
« Reply #2 on: June 15, 2014, 02:01:34 am »
Download 10-12 simple plugins from here :
Code: [Select]
http://forums.osclass.org/plugins/plugins-user-contributed-plugins/ search inside  each one..I'm sure  there is  a lot of  ways where and how you can solve your problems.

sanam

  • Newbie
  • *
  • Posts: 8
Re: Customizing Admin Menu
« Reply #3 on: June 15, 2014, 08:17:29 am »
Thank you for the answer. But still i cannot find any plugin to change the admin menu. Can you please tell me the file where admin menu is connected.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Customizing Admin Menu
« Reply #4 on: June 15, 2014, 04:54:03 pm »
Hi,

As has been pointed, things are more complex than that, there is not such thing as "one file to control them all" here :D

But i can give you some hints and tips:

- Use hooks and filters to add new rows to Listing views

This I'm using to add a new column "Premium type" (for a site with several types, a new DB table storing premiums and their data has been created)

Code: [Select]
function premiumType_header($table) {
    $table->addColumn('premium_type', '<span>' . __('Premium type' . '</span>'));

}

function premiumType_data($row, $aRow) {
    $conn = getConnection();
    $premium = $conn->osc_dbFetchResult("SELECT premium_type FROM krw_premium_ads WHERE premium_id = '%d'", $aRow['pk_i_id'] );

    $row['premium_type'] = $premium['premium_type'] ;
    return $row ;
}

osc_add_hook('admin_items_table', 'premiumType_header');
osc_add_filter("items_processing_row", "premiumType_data" );

There you can see a quick method to make your own queries to the database:

Code: [Select]
    $conn = getConnection();
    $premium = $conn->osc_dbFetchResult("SELECT premium_type FROM krw_premium_ads WHERE premium_id = '%d'", $aRow['pk_i_id'] );

a.- osc_dbFetchResult is for a single result expected, osc_dbFetchResults for several rows, etc. See oc-includes/osclass/db.php for functions to UPDATE, INSERT, etc.

b.- They use same model as PHP core function sprintf

Another filter to add options to "See more..." link for each item in the Listings view:

Code: [Select]
osc_add_filter('more_actions_manage_items', 'ptm_admin_premium_options');
Dig into oc-includes/osclass/classes/datatables/ItemsDataTable.php for examples of filtering and available filters.

For other features you want, study existent plugins providing features similar of those you want to have. ???

Regards

Web-Media

  • Sr. Member
  • ****
  • Posts: 453
  • Web
Re: Customizing Admin Menu
« Reply #5 on: June 17, 2014, 01:22:53 pm »
Teseo pointed towards customizing admin tables.
for admin menu :
Code: [Select]
function event_admin_menu(){
     osc_add_admin_menu_page('My text', osc_admin_render_plugin_url(osc_plugin_path(dirname(__FILE__)) . '/my_file_inside_plugin.php'), 'my_file');
  osc_add_admin_submenu_page('My text 2','Options ' , osc_admin_render_plugin_url(osc_plugin_path(dirname(__FILE__)) . '/my_file_inside_plugin.php'), 'my_file_options');
 }

   osc_add_hook('admin_menu_init', 'event_admin_menu')
..  each and every plugin (newer ones ) . has  something like that  inside .
check oficials osclass plugin to .
Code: [Select]
http://market.osclass.org/plugins .
here is  example menu plugin  (from oficial osclass blog. last year ) (dont know if updated  but do exactly what you need)
« Last Edit: June 18, 2014, 04:41:10 pm by Web-Media »

sanam

  • Newbie
  • *
  • Posts: 8
Re: Customizing Admin Menu
« Reply #6 on: June 18, 2014, 01:41:15 pm »
ThankYou for your replies. I ll try this out :)