Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
fmido88 authored Jun 10, 2023
1 parent 84a80cf commit ee66de6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 48 deletions.
5 changes: 1 addition & 4 deletions block_wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function init() {
/**
* Getting the content of the block.
* The display differ according to user.
* If the user has capabilites to charge other user's wallet or
* If the user has capabilities to charge other user's wallet or
* a regular user.
*
* @return stdClass|null
Expand All @@ -60,9 +60,6 @@ public function get_content() {
$canviewcoupons = has_capability('enrol/wallet:viewcoupon', $context);
$cangeneratecoupon = has_capability('enrol/wallet:createcoupon', $context);

// Get the user balance.
$balance = transactions::get_user_balance($USER->id);
$norefund = transactions::get_nonrefund_balance($USER->id);
// Get the default currency.
$currency = get_config('enrol_wallet', 'currency');
// Get the default payment account.
Expand Down
44 changes: 1 addition & 43 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,9 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* wallet enrolment plugin.
* Wallet Balance Block lib.
*
* @package block_wallet
* @copyright 2023 Mo Farouk <phun.for.physics@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/


/**
* To add the category and node information into the my profile page.
*
* @param core_user\output\myprofile\tree $tree The myprofile tree to add categories and nodes to.
* @param stdClass $user The user object that the profile page belongs to.
* @param bool $iscurrentuser If the $user object is the current user.
* @param stdClass $course The course to determine if we are in a course context or system context.
* @return void
*/
function block_wallet_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
global $CFG, $OUTPUT;
require_once($CFG->dirroot.'/enrol/wallet/lib.php');
// Get the user balance.
$balance = enrol_wallet_plugin::get_user_balance($user->id);

// Get the default currency.
$currency = get_config('enrol_wallet', 'currency');

// Prepare transaction URL to display.
$transactionsurl = new moodle_url('/enrol/wallet/extra/transaction.php');
$transactions = html_writer::link($transactionsurl, get_string('transactions', 'enrol_wallet'));
$tempctx = new stdClass;
$tempctx->balance = $balance;
$tempctx->currency = $currency;
$tempctx->transactions = $transactions;

// Display the current user's balance in the wallet.
$render = $OUTPUT->render_from_template('enrol_wallet/display', $tempctx);

// Add the new category.
$wdcategory = new core_user\output\myprofile\category('walletcredit',
get_string('walletcredit', 'enrol_wallet'),
null);
$tree->add_category($wdcategory);

$credittitle = ''; // No need now for a title.
// Add the node.
$node = new core_user\output\myprofile\node('walletcredit', 'walletcredit', $credittitle, null, null, $render);
$tree->add_node($node);
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
$plugin->component = 'block_wallet';
$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array(
'enrol_wallet' => 2023060902
'enrol_wallet' => 2023061002
);

0 comments on commit ee66de6

Please sign in to comment.