/** * Returns error message or false. * @param GWF_Order $order * @param GWF_User $user * @return string | false */ public function canAffordB(GWF_Order $order, $user) { if ($user === false) { return false; } if ($user->isAdmin()) { return false; } $money = $user->getMoney(); $price = $order->getOrderPriceTotal(); $left = $money - $price; if ($left >= 0) { return false; } $lang = $this->loadLangGWF(); return GWF_HTML::error('Buy with GWF', $lang->lang('err_funds', array(Module_Payment::displayPrice($money), Module_Payment::displayPrice($price), Module_Payment::displayPrice(-$left)))); }
public function displayPrice() { return Module_Payment::displayPrice($this->getVar('dl_price')); }
echo sprintf('<td>%s</td>', $tLang->lang('th_order_date_ordered')); echo sprintf('<td class="gwf_date">%s</td>', GWF_Time::displayDate($order->getVar('order_date_ordered'))); echo GWF_Table::rowEnd(); echo GWF_Table::rowStart(); echo sprintf('<td>%s</td>', $tLang->lang('th_order_date_paid')); echo sprintf('<td class="gwf_date">%s</td>', GWF_Time::displayDate($order->getVar('order_date_paid'))); echo GWF_Table::rowEnd(); echo GWF_Table::rowStart(); echo sprintf('<td>%s</td>', $tLang->lang('th_order_site')); echo sprintf('<td>%s</td>', $order->getPaymentModule()->getSiteName()); echo GWF_Table::rowEnd(); echo GWF_Table::rowStart(); echo sprintf('<td>%s</td>', $tLang->lang('th_order_status')); echo sprintf('<td>%s</td>', $status_link); echo GWF_Table::rowEnd(); echo GWF_Table::rowStart(); echo sprintf('<td>%s</td>', $tLang->lang('th_order_price_total')); echo sprintf('<td>%s</td>', Module_Payment::displayPrice($order->getOrderPriceTotal())); echo GWF_Table::rowEnd(); echo GWF_Table::end(); echo $tVars['form_exec']; echo '<div>' . PHP_EOL; echo $tVars['display']; echo '</div>' . PHP_EOL; //echo $tVars['form_edit']; //echo sprintf('<div class="gwf_buttons">').PHP_EOL; //if ($order->isCreated()) //{ // echo GWF_Button::generic($tLang->lang('btn_mark_paid'), $tVars['href_paid']); //} //echo '</div>'.PHP_EOL;
echo sprintf('<td>%s</td>', GWF_Form::checkbox(sprintf('mod[%s]', $module->getName()), $checked)); echo sprintf('<td>%s</td>', $module->display('module_name')); echo sprintf('<td>%s</td>', Module_Payment::displayPrice($price)); echo sprintf('<td>%s</td>', implode(', ', array_keys($module->getDependencies()))); echo sprintf('<td>%s</td>', $strMethods); echo GWF_Table::rowEnd(); } echo GWF_Table::end(); // Design table $headers = array(array(), array($tLang->Lang('th_design_name')), array($tLang->Lang('th_design_price'))); echo GWF_Table::start(); echo GWF_Table::displayHeaders2($headers); foreach ($tVars['designs'] as $design => $price) { if ($client !== false) { $checked = $client->ownsDesign($design); } else { $checked = isset($_POST['purchase']) ? isset($_POST['design'][$design]) : $price == 0; } echo GWF_Table::rowStart(); echo sprintf('<td>%s</td>', GWF_Form::checkbox(sprintf('design[%s]', $design), $checked)); echo sprintf('<td>%s</td>', $design); echo sprintf('<td>%s</td>', Module_Payment::displayPrice($price)); echo GWF_Table::rowEnd(); } echo GWF_Table::end(); echo '<div class="gwf_buttons_outer">' . PHP_EOL; echo '<div class="gwf_buttons">' . PHP_EOL; echo GWF_Form::submit('purchase', $tLang->lang('btn_purchase')) . PHP_EOL; echo '</div>' . PHP_EOL; echo '</div>' . PHP_EOL; echo GWF_Form::end();