/** * Called to register */ public function register() { $this->load->spark('robot-helper/1.1'); $this->load->helper('robot'); $this->load->helper('form'); $this->load->library('form_validation'); $submit = $this->input->post('submit'); if ($submit) { if ($this->form_validation->run('registration')) { $this->load->model('contributor'); $insert = elements(array('username', 'email', 'real_name', 'password', 'website'), $_POST); if (Contributor::insert($insert)) { UserHelper::setNotice("Yay! Start contributing sparks!"); UserHelper::setLoggedIn(Contributor::findByUsername($insert['username'])); UtilityHelper::handleRedirectIfNeeded(); redirect(base_url() . 'contributors/' . $insert['username'] . '/profile'); } else { UserHelper::setNotice("Whoa. That didn't work. Sorry?", FALSE); } } else { UserHelper::setNotice('Whoops. There were some errors. Check below and re-submit!'); } } list($question, $answer) = get_spam_check(); $data['spam_question'] = $question; $data['spam_answer'] = $answer; $this->load->view('contributors/register', $data); }
public function actionView2() { //$client->soap_defencoding = 'UTF-8'; if (isset($_GET["txnref"])) { //$trans_pay_status = $pay->response_code; $trans = array(); $order = UtilityHelper::callGlobalPay($_GET["txnref"], $trans); if (!$order) { $this->render('view2', array('response' => "Error occured please try again later", 'error' => 1)); } else { Yii::app()->user->setState('user_cart', NULL); $this->render('view2', array('response' => $trans, 'error' => 0, 'order' => $order)); } } }
public function UploadImage() { if (Input::file()) { $images = Input::file('images'); foreach ($images as $image) { //$filename = time() . '.' . $image->getClientOriginalExtension(); $filename = UtilityHelper::guid() . '.' . $image->getClientOriginalExtension(); $path = public_path('uploads/' . $filename); Image::make($image->getRealPath())->save($path); $input = Input::all(); $banner = Banner::find($input['id']); $banner->url = 'uploads/' . $filename; $banner->save(); } } }
public function UploadImage() { if (Input::file()) { $images = Input::file('images'); foreach ($images as $image) { //$filename = time() . '.' . $image->getClientOriginalExtension(); $filename = UtilityHelper::guid() . '.' . $image->getClientOriginalExtension(); $path = public_path('uploads/' . $filename); Image::make($image->getRealPath())->save($path); $input = Input::all(); $product_id = $input['id']; $final_input['url'] = 'uploads/' . $filename; $final_input['product_id'] = $product_id; $this->image->create($final_input); } } }
public function actionActivateTheme() { $themes = Theme::model()->findAll(); $suc = Yii::t('info', 'Theme has been Activated'); $err = Yii::t('info', 'Theme was not Activated'); if (isset($_POST['Theme']['name'])) { $valid = Theme::model()->findByAttributes(array('name' => $_POST['Theme']['name'])); if (!empty($valid)) { file_put_contents(UtilityHelper::yiiparam('frontPath') . "/config/main-theme.php", $this->getConfigTemplate($_POST['Theme']['name'])); Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc); } else { Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err); } } else { //Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR,$err); } $this->render('activate', array('models' => $themes)); }
public function actionView($id) { $model = $this->loadModel($id, $this->modelName); //if($model->response_code == 'pending'){ $json = array(); if ($model->type == 'interswitch') { UtilityHelper::callInterswitch($model->reference_number, $json); } else { UtilityHelper::callGlobalPay($model->reference_number, $json); } //UtilityHelper::sendToLog($json); //} $model = $this->loadModel($id, $this->modelName); if (Yii::app()->getRequest()->getIsAjaxRequest()) { $this->renderPartial('_view', array('model' => $model), false, true); Yii::app()->end(); } $this->render('view', array('model' => $model)); }
public function actionContactUs() { $model = new ContactUsForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'contactus-form') { echo CActiveForm::validate($model); Yii::app()->end(); } if (isset($_POST['ContactUsForm'])) { $model->attributes = $_POST['ContactUsForm']; // validate user input and redirect to the previous page if valid if ($model->validate()) { UtilityHelper::sendMail($model->email, UtilityHelper::yiiparam('salesEmail'), 'Contact Us Request - ' . $model->subject, $model->comment); $this->render('thankyou', array('model' => $model)); } } // display the login form $this->render('contactus', array('model' => $model)); }
public function actionCreate() { $model = new CGroup(); $description = new CGroupDescription(); $this->performAjaxValidation(array($model, $description), 'cgroup-form'); if (isset($_POST['CGroupDescription'])) { //$model->setAttributes($_POST[$this->modelName]); $description->setAttributes($_POST[$this->modelName . 'Description']); $suc = Yii::t('info', 'CGroup was successfully created'); $err = Yii::t('info', 'Could not update CGroup'); $description->c_group_id = 0; $description->locale_code = Yii::app()->getLanguage(); if ($model->validate() && $description->validate()) { if ($model->save()) { $description->c_group_id = $model->id; $description->save(); Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc); if (Yii::app()->getRequest()->getIsAjaxRequest()) { $this->renderPartial('_view', array('model' => $model, 'description' => $description), false, true); Yii::app()->end(); } else { $this->redirect(array('view', 'id' => $model->id)); } } else { Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err); } } else { $description->validate(); } UtilityHelper::sendToLog($model->getErrors()); UtilityHelper::sendToLog($description->getErrors()); } if (Yii::app()->getRequest()->getIsAjaxRequest()) { $this->renderPartial('_form', array('model' => $model, 'description' => $description), false, true); Yii::app()->end(); } $this->render('create', array('model' => $model, 'description' => $description)); }
public function actionIndex() { $settings = Yii::app()->settings; $config = (require Yii::getPathOfAlias('backend.views.settings.settingsForm') . '.php'); //echo UtilityHelper::getSettings('messages','accountactivatedsubject'); //echo UtilityHelper::getSettings('messages','accountactivated'); if (isset($_POST['SettingsForm'])) { //print_r($_POST['SettingsForm']); //$model->setAttributes($_POST['SettingsForm']); $settings->deleteCache(); foreach ($_POST['SettingsForm'] as $category => $values) { $settings->set($category, $values); } file_put_contents(UtilityHelper::yiiparam('frontPath') . "/config/main-settings.php", $this->getConfigTemplate($settings->get('site', 'name'), $settings->get('site', 'siteRedirectUrl'), $settings->get('site', 'noreplyEmail'), $settings->get('site', 'salesEmail'), $settings->get('site', 'sitePhone'), $settings->get('site', 'currency'))); user()->setFlash('success', 'Site settings were updated.'); $this->refresh(); } foreach ($config['elements'] as $category => &$attributes) { foreach ($attributes['elements'] as &$attribute) { $attribute['value'] = $settings->get($category, $attribute['name']); } } $this->render('index', array('config' => $config)); }
public static function getPublishPath($path) { $rpath = realpath(UtilityHelper::yiiparam('frontPath') . '/www' . $path); if (!empty($rpath)) { $url = Yii::app()->assetManager->publish($rpath); return $url; } return null; }
?> <div class="checkout_head_general"> <span class="checkout_title">Where should we deliver</span> <?php $cid = strtolower((string) $this->id); if ($cid != 'specialorder') { ?> <div class="checkout_top"> <span class="in_your_cart">In your Cart</span> <?php echo CHtml::image(Yii::app()->request->baseUrl . '/img/checkout_arrow.png'); ?> <span class="badge"><?php echo $this->getCartCount(); ?> </span> <strong>@ <?php echo UtilityHelper::formatPrice($this->getCartTotal()); ?> </strong> <a href="<?php echo $this->createUrl('cart/cart'); ?> "><?php echo CHtml::image(Yii::app()->request->baseUrl . '/img/checkout_edit.png'); ?> </a> </div> <?php } ?> <div class="clear"></div> </div>
<div class="productoptionvalue"> <?php echo CHtml::$type("OrderOption[{$i}][product_option_value_id]", '', CHtml::listData($productoptionvalue, 'id', function ($data) { $sign = '+'; $soldout = ''; if ($data->quantity < 1) { $soldout = '-Sold Out'; } if ($data->subtract) { $sign = '-'; } $optionvalue = OptionValue::model()->findByPk($data->option_value_id); $dprice = ""; if ($data->price > 0) { $dprice = " ( {$sign} " . UtilityHelper::formatPrice($data->price) . ")"; } return $optionvalue->getName() . $dprice . "{$soldout}"; }), array('encode' => false)); ?> </div> <?php } else { if ($option->type == 'date') { ?> <div class="input-append"> <?php $this->widget('yiiwheels.widgets.datepicker.WhDatePicker', array('name' => "OrderOption[{$i}][value]", 'pluginOptions' => array('format' => 'mm/dd/yyyy'))); ?> <span class="add-on"><icon class="icon-calendar"></icon></span>
<?php $this->widget('bootstrap.widgets.TbAlert'); ?> <?php $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', 'product_name', 'product_quantity', 'product_colour', 'specification', 'comment', 'payment_code', 'firstname', 'lastname', 'email', 'telephone', array('name' => 'total', 'type' => 'raw', 'value' => UtilityHelper::formatPrice($model->total)), array('name' => 'order_status_id', 'type' => 'raw', 'value' => !empty($model->orderStatus) ? TbHtml::encode($model->orderStatus->getName()) : null), 'address_1', 'address_2', 'city', 'postal_code', array('name' => 'zone', 'label' => 'State', 'type' => 'raw', 'value' => $model->zone !== null ? TbHtml::encode($model->zone->name) : null), array('name' => 'country', 'type' => 'raw', 'value' => $model->country !== null ? TbHtml::encode($model->country->name) : null), 'ip', 'forwarded_ip', 'user_agent', 'date_added', 'date_modified'))); ?> <div class="hlinks hide"> <div class="uid"><?php echo $model->id; ?> </div> </div>
echo $form->labelEx($model, 'return_action'); ?> <?php echo UtilityHelper::enumDropDownList($model, 'return_action'); ?> <?php echo $form->error($model, 'return_action'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'return_status'); ?> <?php echo UtilityHelper::enumDropDownList($model, 'return_status'); ?> <?php echo $form->error($model, 'return_status'); ?> </div> <div class="row buttons"> <?php echo TbHtml::submitButton($model->isNewRecord ? Yii::t('label', 'Create') : Yii::t('label', 'Save'), array('color' => TbHtml::BUTTON_COLOR_SUCCESS)); ?> <?php echo TbHtml::linkButton(Yii::t('label', 'Cancel'), array('class' => 'cancelButton', 'color' => TbHtml::BUTTON_COLOR_DANGER, 'url' => Yii::app()->createUrl('returns/admin'))); ?> </div>
<thead> <tr> <th>Product</th><th></th><th>Price</th><th>Quantity</th><th>To Pay</th><th></th> </tr> </thead> <tbody> <?php foreach ($cart as $pos => $product) { ?> <tr> <td><?php echo CHtml::image(Yii::app()->request->baseUrl . $this->productImageThumb($product['product_id']), '', array('class' => 'thumb')); ?> </td> <td class="title"><span><a href="<?php echo Yii::app()->createUrl('product/view', UtilityHelper::productLink($product['product_id'])); ?> "><?php echo $product['name']; ?> </a></span> <span class="<?php if ($product['stock'] < 6) { echo 'red'; } else { echo 'green'; } ?> ">Only <strong><?php echo $product['stock']; ?>
<?php $this->widget('bootstrap.widgets.TbAlert'); ?> <?php $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array(array('name' => 'name', 'header' => 'Name', 'value' => $model->getName()), 'id', array('name' => 'store_id', 'type' => 'raw', 'value' => !empty($model->store) ? TbHtml::link(TbHtml::encode($model->store->name), array("store/view", "id" => $model->store_id)) : null), array('name' => 'image', 'type' => 'raw', 'value' => !empty($model->images) ? TbHtml::image(TbHtml::encode(UtilityHelper::getPublishPath($model->images[0]->source)), Yii::t('label', 'Image')) : null, 'cssClass' => 'gridimage'), array('name' => 'parent_id', 'type' => 'raw', 'value' => !empty($model->parent) ? TbHtml::link(TbHtml::encode($model->parent->getName()), array("category/view", "id" => $model->parent_id)) : null), array('name' => 'top', 'value' => $model->top === '0' ? 'No' : 'Yes', 'filter' => array('0' => 'No', '1' => 'Yes')), 'sort_order', array('name' => 'status', 'value' => $model->status === '0' ? 'No' : 'Yes', 'filter' => array('0' => 'No', '1' => 'Yes')), 'date_added', 'date_modified'))); ?> <div class="hlinks hide"> <div class="uid"><?php echo $model->id; ?> </div> </div>
public function actionPayment($id) { $cart = $this->getCart(); $add = CheckoutAddress::model()->findByPk($id); $link; $onlinePaymentMethodName; $extrapObj = array(); $orderArray = array(); $classArray = array(); if (!empty($add) && !empty($cart['items'])) { if (isset($_POST['Payment']['payment_method'])) { $pay_method = $_POST['Payment']['payment_method']; $cart['payment'] = $pay_method == 4 ? 2 : $pay_method; $paymentType = is_numeric($pay_method) ? 'others' : 'online'; $order = new Order(); $order->order_status_id = 1; $order->total = $this->getCartTotal(); $order->ip = Yii::app()->request->userHostAddress; $order->user_agent = Yii::app()->request->userAgent; $order->firstname = $add->firstname; $order->lastname = $add->lastname; $order->email = $add->email; $order->telephone = $add->telephone; $order->payment_firstname = $add->firstname; $order->payment_lastname = $add->lastname; $order->payment_company = ''; $order->payment_tax_id = 0; $order->payment_address_1 = $add->address_1; $order->payment_address_2 = $add->address_2; $order->payment_city = $add->city; $order->payment_postcode = $add->postal_code; $order->payment_country_id = $add->country_id; $order->payment_zone_id = $add->zone_id; $order->payment_method = $cart['payment']; $order->payment_code = uniqid() . rand(1, 9); $order->shipping_firstname = $add->firstname; $order->shipping_lastname = $add->lastname; $order->shipping_company = ''; $order->shipping_address_1 = $add->address_1; $order->shipping_address_2 = $add->address_2; $order->shipping_city = $add->city; $order->shipping_postcode = $add->postal_code; $order->shipping_country_id = $add->country_id; $order->shipping_zone_id = $add->zone_id; $order->shipping_method = 2; if ($add->zone_id == 2412) { $order->shipping_method = 1; } $storeid = UtilityHelper::yiiparam('storeID'); $store = Store::model()->findByPk($storeid); $order->store_id = $storeid; $order->store_name = $store->name; $order->store_url = $store->url; $order->payment_country = Country::model()->findByPk($order->payment_country_id)->name; $order->payment_zone = Zone::model()->findByPk($order->payment_zone_id)->name; $order->shipping_country = $order->payment_country; $order->shipping_zone = $order->payment_zone; if ($order->save()) { foreach ($cart['items'] as $product) { $orderproduct = new OrderProduct(); $orderproduct->order_id = $order->id; $orderproduct->product_id = $product['product_id']; $orderproduct->name = $product['name']; $orderproduct->model = $product['model']; $orderproduct->quantity = $product['quantity']; $orderproduct->price = $product['price']; $orderproduct->total = $product['total']; $orderproduct->tax = 0; if ($orderproduct->save()) { if (!empty($product['option'])) { foreach ($product['option'] as $orderoption) { $orderoption->order_id = $order->id; $orderoption->order_product_id = $orderproduct->id; $orderoption->save(); } } } else { Yii::log("CartPaymentOrderProductErrors: " . CVarDumper::dumpAsString($orderproduct->getErrors()), CLogger::LEVEL_ERROR, "cart.actions.payment"); } } //Yii::app()->user->setState('user_cart', NULL); $extrap = array(); // switch ($paymentType) { case 'others': // Will need to loop through the ids for non online payment to do this properly if ($pay_method == 1) { $link = '_cash'; $extrap = array('orderID' => $order->id, 'total' => $order->total); UtilityHelper::changeOrderStatus($order->id); } else { if ($pay_method == 3) { $link = '_bank'; $extrap = array('orderID' => $order->id, 'total' => $order->total); } } break; case 'online': $subClasses = new PaymentGatewayHelper(); $subClassesArray = $subClasses->getSubClasses(); foreach ($subClassesArray as $class => $payOption) { ${$class} = new $class(); $onlinePaymentMethodName = ${$class}->getPaymentName(); if ($pay_method == $onlinePaymentMethodName) { $link = ${$class}->getViewLink(); ${$class}->setOrderObj($order); $extrapObj = ${$class}->getOrderObj(); foreach ($extrapObj as $field => $value) { $orderArray[$field] = $value; } $link = ${$class}->getViewLink(); $extrap = array('orderID' => $orderArray['id'], 'total' => $orderArray['total']); ${$class}->regPaymentTransaction($order); $classArray['pay_method'] = $pay_method; } else { continue; } } break; default: break; } if (Yii::app()->getRequest()->getIsAjaxRequest()) { $this->renderPartial($link, array_merge(array('ref' => $order->payment_code), $extrap, $classArray), false, true); Yii::app()->end(); } $this->render($link, array_merge(array('ref' => $order->payment_code), $extrap, $classArray)); Yii::app()->end(); } else { Yii::log("CartPaymentErrors: " . CVarDumper::dumpAsString($order->getErrors()), CLogger::LEVEL_ERROR, "cart.actions.payment"); } } if (Yii::app()->getRequest()->getIsAjaxRequest()) { $this->renderPartial('_payment', array('app' => $add), false, true); Yii::app()->end(); } $this->render('payment', array('app' => $add)); Yii::app()->end(); } $this->redirect(array('cart')); }
<?php $i++; } } ?> </div> <div class="col-md-4 product_right" style="margin-top: -6%"> <div class="reg"><?php //echo CHtml::image(Yii::app()->request->baseUrl.'/img/product_price.png'); ?> <?php echo ' ' . Yii::t('label', 'Price'); ?> </div> <div class="product_price"><?php echo UtilityHelper::formatPrice($product->price); ?> </div> <div class="reg"><?php //echo CHtml::image(Yii::app()->request->baseUrl.'/img/product_stock.png'); echo ' ' . Yii::t('label', 'Stock'); ?> </div> <div class="product_stock">Only <?php echo $product->quantity; ?> items left</div> <!--<div class="product_free"><?php //echo CHtml::image(Yii::app()->request->baseUrl.'/img/delivery_icon.png'); ?> <div class="p_free"><?php
public static function callGlobalPay($txnref, &$trans) { //$txnref = $_GET["txnref"]; $client = new SoapClient('https://www.globalpay.com.ng/globalpaywebservice/service.asmx?wsdl', array('exceptions' => 0, 'encoding' => 'UTF-8')); $soapaction = "https://www.eazypaynigeria.com/globalpay/getTransactions"; $namespace = "https://www.eazypaynigeria.com/globalpay/"; $order = Order::model()->findByAttributes(array('payment_code' => $txnref)); $pay = PaymentTransaction::model()->findByAttributes(array('reference_number' => $txnref)); $merch_txnref = $txnref; $channel = ""; //change the merchantid to the one sent to you $merchantID = "174"; $start_date = ""; $end_date = ""; //change the uid and pwd to the one sent to you $uid = "yl_ws_user"; $pwd = "yl_ws_password"; $payment_status = ""; /* $err = $client->getError(); if ($err) { $this->render('view2',array('response'=>$err, 'error'=>1)); }*/ // Doc/lit parameters get wrapped $MethodToCall = "getTransactions"; //$MethodToCall= "Checkcenter"; $param = array('merch_txnref' => $merch_txnref, 'channel' => $channel, 'merchantID' => $merchantID, 'start_date' => $start_date, 'end_date' => $end_date, 'uid' => $uid, 'pwd' => $pwd, 'payment_status' => $payment_status); $result = $client->__soapCall($MethodToCall, array('parameters' => $param), array('uri' => $namespace, 'soapaction' => $soapaction)); // Check for a fault if (is_soap_fault($result)) { //"SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})"; return false; } else { //This gives getTransactionsResult $WebResult = $MethodToCall . "Result"; // Pass the result into XML if (is_object($result)) { $xresult = $result->{$WebResult}; } else { $xresult = $result[$WebResult]; } $xml = simplexml_load_string($xresult); //self::sendToLog($xml); //$trans = array(); $trans['amount'] = $xml->record->amount; $trans['txn_date'] = $xml->record->payment_date; $trans['pmt_method'] = $xml->record->channel; $trans['pmt_status'] = $xml->record->payment_status; $trans['pmt_txnref'] = $xml->record->txnref; $trans['currency'] = $xml->record->field_values->field_values->field[2]->currency; // $pnr = 'PNR'; $trans['trans_status'] = $xml->record->payment_status_description; $trans['merch_name'] = $pay->customer_name; $trans['merch_phoneno'] = $order->telephone; $trans['merch_amt'] = $pay->transaction_amount; //$pay = new PaymentTransaction; $pay->transaction_date = $trans['txn_date']; //$pay->reference_number = ; $pay->payment_reference = $trans['pmt_txnref']; if ($trans['amount'] != $trans['merch_amt']) { $trans['pmt_status'] .= " ( Amount does not match and no service will be rendered)"; $pay->response_code = $trans['pmt_status']; } else { $pay->response_code = $trans['pmt_status']; } $pay->response_description = $trans['trans_status']; $pay->approved_amount = $trans['amount']; //$pay->transaction_amount = $trans['merch_amt']; $pay->transaction_currency = $trans['currency']; //$pay->customer_name = $trans['merch_name']; $pay->save(); if (empty($order->check)) { $message = "Dear {$order->firstname} {$order->lastname},<br/><br/>You have just attempted making payment for order #{$order->id} on {$order->store_url}. Find the details below.<br/><br/>Name : {$order->firstname} {$order->lastname} <br/><br/>Phone number : {$order->telephone} <br/><br/>Amount : " . UtilityHelper::formatPrice($trans['amount']) . " <br/><br/>Transaction Date : {$trans['txn_date']} <br/><br/>Payment Method : {$trans['pmt_method']} <br/><br/>Payment Status : {$pay->response_code} <br/><br/>Transaction Reference Number : {$trans['pmt_txnref']} <br/><br/>Currency : {$trans['currency']} <br/><br/>Transaction Status : {$trans['trans_status']} <br/><br/>"; if ($trans['pmt_status'] == 'successful' && $trans['amount'] == $trans['merch_amt']) { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Successful Payment Notification', $message); //UtilityHelper::changeOrderStatus($order->id); $order->order_status_id = 2; $order->check = 1; $order->save(); UtilityHelper::subtractOrder($order->id); } else { if ($trans['pmt_status'] == 'pending') { } else { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Failed Payment Notification', $message); //UtilityHelper::changeOrderStatus($order->id,10); $order->order_status_id = 10; $order->check = 1; $order->save(); } } } return $order; } return false; }
function __construct() { parent::__construct(); # Page cache everything under the home controller for 5 minutes UtilityHelper::tryPageCache(); }
<?php $this->pageTitle = UtilityHelper::yiiparam('site_name'); ?> <h1>Welcome to <i><?php echo UtilityHelper::yiiparam('site_name'); ?> Admin Panel</i></h1> <?php Yii::app()->user->setFlash('success', '<strong> You may login by clicking login on the top right corner.</strong>'); $this->widget('bootstrap.widgets.TbAlert'); ?> <img style='margin-left:20%;' src='<?php echo Yii::app()->request->baseUrl . '/images/admin_icon.png'; ?> ' title='Admin' alt='Admin'/>
} ?> <!-- second secondary menu --> <?php if (Yii::app()->user->hasFlash('orderMessage')) { ?> <div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <?php echo Yii::app()->user->getFlash('orderMessage'); ?> </div> <?php } if (isset($orders)) { if (!empty($orders)) { $this->widget('bootstrap.widgets.TbGridView', array('id' => 'manufacturer-grid', 'type' => array(TbHtml::GRID_TYPE_STRIPED, TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_CONDENSED), 'dataProvider' => $orders->search(), 'filter' => $orders, 'rowCssClassExpression' => '"items[]_{$data->id}"', 'columns' => array('id', array('name' => 'total', 'type' => 'raw', 'value' => function () { return UtilityHelper::formatPrice($data->total); }), array('name' => 'order_status_id', 'type' => 'raw', 'value' => function () { $status = OrderStatus::model()->findByPk($data->order_status_id); return !empty($status) ? $status->name : null; }), 'payment_code', 'invoice_no'))); } else { echo "<h5>You have not placed an order with us yet.</h5>"; } } else { echo "<h3>Please <a href=" . $this->createUrl('/user/login') . ">Log in</a> to view your order history</h3>"; } ?> </div> </div>
<div class="related_inner"> <a href="<?php echo $link; ?> "><?php $tpath = Yii::app()->request->baseUrl . '/img/no-image.jpg'; if (!empty($related->thumbs)) { $tpath = Yii::app()->request->baseUrl . $related->thumbs[0]->source; } ?> <?php echo CHtml::image($tpath); ?> <span class="related_title"><?php echo $related->getName(); ?> </span> <span class="related_price"><?php echo UtilityHelper::formatPrice($related->price); ?> </span></a> </div> </div> <?php if ($i == 2) { break; } } ?>
?> <h5>Name : <?php echo $response['merch_name']; ?> </h5> <h5>Phone number : <?php echo $response['merch_phoneno']; ?> </h5> <h5>Transaction Amount : <?php echo UtilityHelper::formatPrice($response['merch_amt']); ?> </h5> <h5>Debited Amount : <?php echo UtilityHelper::formatPrice($response['amount']); ?> </h5> <h5>Transaction Date : <?php echo $response['txn_date']; ?> </h5> <h5>Payment Method : <?php echo $response['pmt_method']; ?> </h5> <h5>Payment Status : <?php echo $response['pmt_status']; ?> </h5> <h5>Transaction Reference Number : <?php
<tbody> <tr class="odd"> <td><strong>Sub Total</strong></td><td><?php echo UtilityHelper::formatPrice($subtotal); ?> </td> </tr> <tr class="even"> <td><strong>VAT</strong></td><td><?php echo UtilityHelper::formatPrice($vat); ?> </td> </tr> <tr class="odd"> <td><strong>Total</strong></td><td><?php echo UtilityHelper::formatPrice($total); ?> </td> </tr> </tbody> </table> <?php } ?> <div class="clear"></div> <?php $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', 'payment_code', 'invoice_no', array('name' => 'order_status_id', 'header' => Yii::t('label', 'Options'), 'value' => $this->getOrderStatus($model->order_status_id)), array('name' => 'comment', 'header' => 'Comment', 'value' => !empty($model->orderDescription) ? $model->orderDescription[0]->comment : ''), 'date_added', 'date_modified'))); ?> </div> </div> </div>
/** * The call for showing the package listing page. For type, handles * 'latest', 'featured' and 'official' * @param string $type */ function browse($type = false) { UtilityHelper::tryPageCache(1); $this->load->model('spark'); $this->load->model('rating'); $sparks = array(); $data['browse_type'] = ''; $data['description'] = ''; $data['browse_type_raw'] = $type; if ($type == 'latest') { $sparks = Spark::getTop(200); $data['browse_type'] = 'Browse Latest'; $data['description'] = 'These are the most recently registered sparks with at least one release.'; } elseif ($type == 'featured') { $sparks = Spark::getLatestOf(FALSE, TRUE); $data['browse_type'] = 'Browse Featured'; $data['description'] = 'These are sparks that the GetSparks team thinks are worth a spin'; } elseif ($type == 'official') { $sparks = Spark::getLatestOf(FALSE, NULL, TRUE); $data['browse_type'] = 'Browse Official'; $data['description'] = 'These are sparks written by GetSparks, the Reactor Team, or CodeIgntier gurus'; } else { # Ugly fix for now, not sure why we didn't have a 'browse all' # in the first place :P $sparks = Spark::getTop(1000); $data['browse_type'] = 'Browse All'; $data['description'] = 'These are all of GetSparks\' sparks'; } # Get a list of spark ids on this page $ids = array(); foreach ($sparks as $s) { $ids[] = $s->id; } # Wait until the views are donw $data['sparks'] = $sparks; $data['ratings'] = $this->rating->getRatingsFromList($ids); $this->load->view('packages/listing', $data); }
?> </a> - <?php echo $row->summary; ?> </li> <?php } ?> </ul> <?php } ?> <h2>Comments</h2> <?php UtilityHelper::loadDisqus(); ?> <script type="text/javascript"> function yank(version) { if(confirm('Are you sure you want to disable this version? You should only do this if the release is unusable. Developers may depend on it!')) { window.location = '<?php echo base_url(); ?> packages/<?php echo $contribution->name; ?> /versions/' + version + '/disable'; }
public static function callInterswitch($ref, &$json) { //$ref = $_POST['txnref']; $order = Order::model()->findByAttributes(array('payment_code' => $ref)); $pay = PaymentTransaction::model()->findByAttributes(array('reference_number' => $ref)); $url = UtilityHelper::yiiparam('interswitchGet') . '?productid=' . UtilityHelper::yiiparam('interswitchProductID') . '&transactionreference=' . $ref . '&amount=' . $order->total * 100; //self::sendToLog($url); try { $cURL = curl_init(); curl_setopt($cURL, CURLOPT_URL, $url); curl_setopt($cURL, CURLOPT_HTTPGET, true); curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1); curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Hash: ' . hash('sha512', UtilityHelper::yiiparam('interswitchProductID') . $ref . UtilityHelper::yiiparam('MAC_key')))); $result = curl_exec($cURL); if (FALSE === $result) { throw new Exception(curl_error($cURL), curl_errno($cURL)); } //self::sendToLog($result,"Json things!!!"); curl_close($cURL); } catch (Exception $e) { self::sendToLog(sprintf('Curl failed with error #%d: %s', $e->getCode(), $e->getMessage()), "CURL Interswitch Error"); return false; } $json = json_decode($result, true); //$pay->transaction_date = $json['TransactionDate']; //$pay->reference_number = $ref; $pay->payment_reference = $json['PaymentReference']; $pay->response_description = $json['ResponseDescription']; $pay->response_code = $json['ResponseCode']; $pay->approved_amount = $json['Amount'] / 100; //$pay->customer_name = ; $pay->save(); $json['CustomerName'] = $pay->customer_name; $total = UtilityHelper::formatPrice($order->total); $siteurl = UtilityHelper::yiiparam('siteUrl'); if (empty($order->check)) { $messg = "Dear {$order->firstname} {$order->lastname},<br/><br/>You have just attempted making payment for order #{$order->id} on {$order->store_url}. Find the details below.<br/><br/>Amount: {$total}<br/><br/>Response Description: {$json['ResponseDescription']}<br/><br/>Response Code: {$json['ResponseCode']}<br/><br/>Transaction Ref No: {$ref}<br/><br/>Payment Reference: {$json['PaymentReference']}<br/><br/>Transaction Date: {$json['TransactionDate']}<br/>"; if ($json['ResponseCode'] == '09') { } else { if ($json['ResponseCode'] == '00') { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Successful Payment Notification', $messg); //UtilityHelper::changeOrderStatus($order->id); $order->order_status_id = 2; $order->check = 1; $order->save(); UtilityHelper::subtractOrder($order->id); } else { UtilityHelper::sendMail(UtilityHelper::yiiparam('salesEmail'), $order->email, 'Failed Payment Notification', $messg); //UtilityHelper::changeOrderStatus($order->id,10); $order->order_status_id = 10; $order->check = 1; $order->save(); } } } //return $order; }
echo $order->email; ?> </h5> <h5>Phone: <?php echo $order->telephone; ?> </h5> <br/> <span>Please take note of your transaction id, you may be required to present it in future.</span> <?php echo CHtml::hiddenField('merch_txnref', $ref); echo CHtml::hiddenField('merchantid', "174"); echo CHtml::hiddenField('names', $order->firstname . ' ' . $order->lastname); //$orderID); echo CHtml::hiddenField('email_address', $order->email); echo CHtml::hiddenField('amount', "{$total}"); //echo CHtml::hiddenField('site_redirect_url', UtilityHelper::yiiparam('site_redirect_url')); echo CHtml::hiddenField('phone_number', $order->telephone); echo CHtml::hiddenField('currency', UtilityHelper::yiiparam('currencyText')); ?> <?php } ?> </div> </div> <div class="section_foot_general"> <input type="submit" class="f_right_checkout" value="" /> <div class="clear"></div> </div> <?php echo CHtml::endForm();
/** * Registration user */ public function actionRegistration() { Profile::$regMode = true; $model = new RegistrationForm(); $profile = new Profile(); // ajax validator if (isset($_POST['ajax']) && $_POST['ajax'] === 'registration-form') { echo UActiveForm::validate(array($model, $profile)); Yii::app()->end(); } if (Yii::app()->user->id) { $this->redirect(Yii::app()->controller->module->profileUrl); } else { if (isset($_POST['RegistrationForm'])) { $model->attributes = $_POST['RegistrationForm']; $profile->attributes = isset($_POST['Profile']) ? $_POST['Profile'] : array(); if ($model->validate() && $profile->validate()) { //$soucePassword = $model->password; //$realp = PasswordHelper::generateStrongPassword(); //$model->password = $realp; $model->activkey = UserModule::encrypting(microtime() . $model->password); $model->password = PasswordHelper::hashPassword($model->password); $model->verifyPassword = $model->password; $model->superuser = 0; $model->type = 1; $model->status = Yii::app()->controller->module->activeAfterRegister ? User::STATUS_ACTIVE : User::STATUS_NOACTIVE; if ($model->save()) { $profile->user_id = $model->id; $profile->save(); if (Yii::app()->controller->module->sendActivationMail) { $activation_url = $this->createAbsoluteUrl('/user/activation/activation', array("activkey" => $model->activkey, "email" => $model->email)); $name = $_POST['Profile']['first_name'] . ' ' . $_POST['Profile']['last_name']; UserModule::sendMail($model->email, UserModule::t("You registered from {site_name}", array('{site_name}' => Yii::app()->name)), UserModule::t("<div style='border: 1px solid #FCC32A;border-radius:5px;box-shadow:1px 5px 5px;background-color:#FFFFEE;'><div style='background-color:#333;border-radius:5px;padding:10px;'><img src='http://yorshop.com/img/main_logo.png' style='float:left'/><h2 style='color: #FFF;width:70%;margin-left:15%;'>Successful Registration</h2><hr/></div><div style='padding:10px;'><p><strong>Dear {name},</strong></p><p>Thank you for registering at <a href='{site_url}' target='blank'>{site_name}</a>.</p><p>Please activate your account by clicking: <a href='{activation_url}' target='blank'>{activation_url}</a> or copy and paste it in your browser.</p><p><a href='{site_url}' target='blank' ><img src='http://yorshop.com/img/form_submit.png'/></a></p></div><div style='padding:0px 10px 0px;'><p>If you need any assistance or have any inquiry or suggestion, feel free to contact our customer service team at <a href='mailto:info@yorshop.com'>info@yorshop.com</a> or call us at <strong>0700 967 7467</strong> between 8am and 10pm on weekdays and 9am to 6pm on weekends, we would be happy to guide you.</p> <address>Thank You!<br/>Your Yorshop Team</address></div></div>", array('{activation_url}' => $activation_url, '{name}' => $name, '{site_name}' => Yii::app()->name, '{site_url}' => UtilityHelper::yiiparam('site_name')))); } if ((Yii::app()->controller->module->loginNotActiv || Yii::app()->controller->module->activeAfterRegister && Yii::app()->controller->module->sendActivationMail == false) && Yii::app()->controller->module->autoLogin) { $identity = new UserIdentity($model->username, $soucePassword); $identity->authenticate(); Yii::app()->user->login($identity, 0); $this->redirect(Yii::app()->controller->module->returnUrl); } else { if (!Yii::app()->controller->module->activeAfterRegister && !Yii::app()->controller->module->sendActivationMail) { Yii::app()->user->setFlash('registration', UserModule::t("Thank you for your registration. Contact Admin to activate your account.")); } elseif (Yii::app()->controller->module->activeAfterRegister && Yii::app()->controller->module->sendActivationMail == false) { Yii::app()->user->setFlash('registration', UserModule::t("Thank you for your registration. Please {{login}}.", array('{{login}}' => CHtml::link(UserModule::t('Login'), Yii::app()->controller->module->loginUrl)))); } elseif (Yii::app()->controller->module->loginNotActiv) { Yii::app()->user->setFlash('registration', UserModule::t("Thank you for your registration. Please check your email or login.")); } else { Yii::app()->user->setFlash('registration', UserModule::t("Thank you for your registration. Please check your email.")); } $this->refresh(); } } } else { $profile->validate(); } } if (isset($this->location)) { $this->render('frontend.views.user.registration', array('model' => $model, 'profile' => $profile)); } else { $this->render('/user/registration', array('model' => $model, 'profile' => $profile)); } } }