function addPrepareActions($wp_admin_bar, $post_id) { // Prepare listing link $url = ''; $args = array('id' => 'wpla_prepare_listing', 'title' => __('Prepare listing', 'wpla'), 'href' => $url, 'parent' => 'wpla_top'); $wp_admin_bar->add_node($args); $pm = new WPLA_AmazonProfile(); $profiles = $pm->getAll(); foreach ($profiles as $profile) { // echo "<pre>";print_r($profile);echo"</pre>";#die(); $profile_id = $profile->profile_id; $url = admin_url('admin.php?page=wpla&action=wpla_prepare_single_listing&product_id=' . $post_id . '&profile_id=' . $profile_id); $args = array('id' => 'wpla_list_on_amazon_' . $profile->profile_id, 'title' => $profile->profile_name, 'href' => $url, 'parent' => 'wpla_prepare_listing'); $wp_admin_bar->add_node($args); } return $args; }
function extra_tablenav($which) { if ('top' != $which) { return; } $wpl_profiles = WPLA_AmazonProfile::getAll(); $wpl_accounts = WPLA_AmazonAccount::getAll(true); $profile_id = isset($_REQUEST['profile_id']) ? $_REQUEST['profile_id'] : false; $account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : false; // echo "<pre>";print_r($wpl_profiles);echo"</pre>";die(); ?> <div class="alignleft actions" style=""> <select name="profile_id"> <option value=""><?php _e('All profiles', 'wpla'); ?> </option> <option value="_NONE_" <?php if ($profile_id == '_NONE_') { echo 'selected'; } ?> ><?php _e('No profile', 'wpla'); ?> </option> <?php foreach ($wpl_profiles as $profile) { ?> <option value="<?php echo $profile->profile_id; ?> " <?php if ($profile_id == $profile->profile_id) { echo 'selected'; } ?> ><?php echo $profile->profile_name; ?> </option> <?php } ?> </select> <select name="account_id"> <option value=""><?php _e('All accounts', 'wpla'); ?> </option> <?php foreach ($wpl_accounts as $account) { ?> <option value="<?php echo $account->id; ?> " <?php if ($account_id == $account->id) { echo 'selected'; } ?> ><?php echo $account->title; ?> (<?php echo $account->market_code; ?> )</option> <?php } ?> </select> <input type="submit" name="" id="post-query-submit" class="button" value="Filter"> </div> <?php }
public function ajax_wpla_show_profile_selection() { // fetch profiles $profiles = WPLA_AmazonProfile::getAll(); // load template $tpldata = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'profiles' => $profiles, 'form_action' => 'admin.php?page=' . self::ParentMenuId); @WPLA_Page::display('profile/select_profile', $tpldata); exit; }
public function displayEditPage() { // get item $listingsModel = new WPLA_ListingsModel(); $item = $listingsModel->getItem($_REQUEST['listing']); // get other data $profiles = WPLA_AmazonProfile::getAll(); $aData = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'item' => $item, 'feed_profiles' => $profiles, 'form_action' => 'admin.php?page=' . self::ParentMenuId . (isset($_REQUEST['paged']) ? '&paged=' . $_REQUEST['paged'] : '')); $this->display('listings_edit_page', array_merge($aData, $item)); }