/** * Returns whether a user is authorized to edit an inventory item * * @param int $inventory_id * * @return bool */ protected static function user_can_edit($inventory_id = NULL) { return WPIMAdmin::check_permission('edit_item', $inventory_id); }
public static function manage_add_ons() { self::$self_url = 'admin.php?page=' . __FUNCTION__; self::admin_heading(self::__('WP Inventory Add Ons')); $force = isset($_GET['force_update']) ? TRUE : FALSE; $add_ons = self::get_add_ons(FALSE, $force); if ($add_ons) { foreach ($add_ons as $add_on) { $installed = !empty($add_on->installed) ? '<span>' . self::__('Installed') . '</span>' : FALSE; $installed_class = $installed ? ' add_on_installed' : ''; echo '<div class="add_on' . $installed_class . '">'; echo '<h3>' . $add_on->title . $installed . '</h3>'; if (!empty($add_on->image)) { echo '<div class="image"><img src="' . $add_on->image . '"></div>'; } echo '<div class="description">' . $add_on->description . '</div>'; echo '<p class="learn_more">'; if (!empty($add_on->learn_more_url)) { echo '<a href="' . $add_on->learn_more_url . '">' . self::__('Learn More') . '</a></p>'; } if (!empty($add_on->download_url)) { echo '<a class="download" href="' . $add_on->download_url . '">' . self::__('Download') . '</a>'; } echo '</p>'; echo '</div>'; } } else { echo '<p>' . self::__('No add ons found. Please check back soon!') . '</p>'; } // echo '<p>' . self::__( 'Is your add-on not appearing in the menu? Click the button below to force the system to check for license changes.' ) . '</p>'; // echo '<p><a class="button" href="' . self::$self_url . '&force_update=true">' . self::__( 'Update License Info' ) . '</a></p>'; self::admin_footer(); }
public static function admin_call($method) { self::$admin = WPIMAdmin::getInstance(); self::$admin->{$method}(); }