attributeLabels() public method

public attributeLabels ( ) : array
return array customized attribute labels (name=>label)
Beispiel #1
0
 /**
  * Show the customers orders with address for each order in case they use different addresses.
  */
 function openAction()
 {
     $customer_id = AF::get($this->params, 'customer_id', false);
     // Get the $_GET['customer_id']
     if (!$customer_id) {
         throw new AFHttpException(0, 'no_customer_id');
     }
     // uses en.php to get string
     $this->filter();
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params));
     $models = AFActiveDataProvider::models('Customer', $this->params, $pagination);
     $dataProvider = $models->getOrdersByCustomerId($customer_id);
     $orderModel = new Order();
     $labels = $orderModel->attributeLabels();
     $this->addToPageTitle('View Client');
     $this->render('open', array('lables' => $labels, 'pagination' => $pagination, 'dataProvider' => $dataProvider, 'countOrders' => count($dataProvider), 'email' => $dataProvider[0]->email));
 }
Beispiel #2
0
 function exportAction()
 {
     // make sure we have a valid ID
     $id = AF::get($this->params, 'id', FALSE);
     if (!$id) {
         throw new AFHttpException(0, 'no_id');
     }
     $connectionModel = new Fulfillment();
     $connectionModel->findByPk($id);
     $model0 = new FulfillmentField();
     $model1 = new FulfillmentFields('FulfillmentField');
     $model2 = new Order();
     $model3 = new Payment();
     $model4 = new Click();
     // grab fields assigned to fulfillment_id
     $assignedFields = $model1->getFulfillmentFieldsByFulfillmentId($id);
     $assignColumns = array();
     $assignedOColumns = array();
     $assignedPColumns = array();
     $assignedCColumns = array();
     foreach ($assignedFields as $af) {
         $assignColumns[] = $af['fulfillment_field_column'];
         if ($af['fulfillment_field_model'] == 'order') {
             $assignedOColumns[] = $af['fulfillment_field_column'];
         } else {
             if ($af['fulfillment_field_model'] == 'payment') {
                 $assignedPColumns[] = $af['fulfillment_field_column'];
             } else {
                 if ($af['fulfillment_field_model'] == 'click') {
                     $assignedCColumns[] = $af['fulfillment_field_column'];
                 }
             }
         }
     }
     // build fieldsArray to be used in the "default" export columns selection.  don't include fields that are already assigned
     $fields = $model1->getFulfillmentFieldsByFulfillmentId(0);
     $fieldsArray = array();
     $parentsArray = array();
     foreach ($fields as $field) {
         if ($field['fulfillment_field_model'] == 'parent') {
             $parentsArray[] = array("fulfillment_field_column" => $field['fulfillment_field_column'], "fulfillment_field_name" => $field['fulfillment_field_name'], "fulfillment_field_model" => $field['fulfillment_field_model'], "checked" => false, "fulfillment_field_rank" => '', "fulfillment_field_static" => '');
         } else {
             if (!in_array($field['fulfillment_field_column'], $assignColumns)) {
                 $fieldsArray[] = array("fulfillment_field_column" => $field['fulfillment_field_column'], "fulfillment_field_name" => $field['fulfillment_field_name'], "fulfillment_field_model" => $field['fulfillment_field_model'], "checked" => false, "fulfillment_field_rank" => '', "fulfillment_field_static" => '');
             }
         }
         // , "rank"=>$idex++
     }
     // build orderFieldsArray to be used in the "additional order" export columns selection.  don't include fields that are already assigned
     $oFields = $model2->attributeLabels();
     $oKeys = array_keys($oFields);
     $oFieldsArray = array();
     foreach ($oKeys as $field) {
         if (!in_array($field, $assignedOColumns)) {
             $oFieldsArray[] = array("fulfillment_field_column" => $field, "fulfillment_field_name" => $oFields[$field], "fulfillment_field_model" => 'order', "checked" => false, "fulfillment_field_rank" => '', "fulfillment_field_static" => '');
         }
         // , "rank"=>$idex++
     }
     // build paymentFieldsArray to be used in the "additional payment" export columns selection.  don't include fields that are already assigned
     $pFields = $model3->attributeLabels();
     $pKeys = array_keys($pFields);
     $pFieldsArray = array();
     foreach ($pKeys as $field) {
         if (!in_array($field, $assignedPColumns)) {
             $pFieldsArray[] = array("fulfillment_field_column" => $field, "fulfillment_field_name" => $pFields[$field], "fulfillment_field_model" => 'payment', "checked" => false, "fulfillment_field_rank" => '', "fulfillment_field_static" => '');
         }
         // , "rank"=>$idex++
     }
     // build cFieldsArray to be used in the "additional click" export columns selection.  don't include fields that are already assigned
     $cFields = $model4->attributeLabels();
     $cKeys = array_keys($cFields);
     $cFieldsArray = array();
     foreach ($cKeys as $field) {
         if (!in_array($field, $assignedCColumns)) {
             $cFieldsArray[] = array("fulfillment_field_column" => $field, "fulfillment_field_name" => $cFields[$field], "fulfillment_field_model" => 'click', "checked" => false, "fulfillment_field_rank" => '', "fulfillment_field_static" => '');
         }
         // , "rank"=>$idex++
     }
     // preload the JQX assets
     Assets::css('jqwidgets/jqx.base');
     Assets::js('jqwidgets/jqxcore');
     Assets::js('jqwidgets/jqxdata');
     Assets::js('jqwidgets/jqxbuttons');
     Assets::js('jqwidgets/jqxscrollbar');
     Assets::js('jqwidgets/jqxmenu');
     Assets::js('jqwidgets/jqxcheckbox');
     Assets::js('jqwidgets/jqxlistbox');
     Assets::js('jqwidgets/jqxdropdownlist');
     Assets::js('jqwidgets/jqxgrid');
     Assets::js('jqwidgets/jqxgrid.edit');
     Assets::js('jqwidgets/jqxgrid.selection');
     Assets::js('jqwidgets/jqxdata.export');
     Assets::js('jqwidgets/jqxgrid.export');
     Assets::js('jqwidgets/jqxgrid.columnsresize');
     Assets::js('jqwidgets/jqxdropdownbutton');
     $this->render('export', array('model' => $model0, 'connectionModel' => $connectionModel, 'defaultFields' => $fieldsArray, 'assignedFields' => $assignedFields, 'orderFields' => $oFieldsArray, 'paymentCCFields' => $pFieldsArray, 'clickFields' => $cFieldsArray, 'parentFields' => $parentsArray));
 }
Beispiel #3
0
 function printAction()
 {
     $id = AF::get($this->params, 'id', FALSE);
     if (!$id) {
         throw new AFHttpException(0, 'no_id');
     }
     $orderArray = Order::getPrintFields($id);
     if (!$orderArray) {
         throw new AFHttpException(0, 'incorrect_id');
     }
     $orderModel = new Order();
     $orderModel->order_id = $id;
     $lables = $orderModel->attributeLabels();
     $orderInfo = array('full_order_id' => $orderArray['order_id'], 'created' => $orderArray['created'], 'status' => $orderArray['status'], 'campaign_name' => $orderArray['campaign_id'], 'amount_product' => Currency::getSingPrice($orderArray['amount_product'], $orderArray['currency_id']), 'amount_shipping' => Currency::getSingPrice($orderArray['amount_shipping'], $orderArray['currency_id']));
     if ($orderArray['amount_refunded']) {
         $orderInfo['amount_refunded'] = Currency::getSingPrice($orderArray['amount_refunded'], $orderArray['currency_id']);
     }
     $modelAttempt = new Attempt();
     $modelAttempt->getLastOrderAttempt($id, Attempt::DEBIT_TYPE);
     $orderInfo2 = array('payment_total' => Currency::getSingPrice($orderArray['payment_total'], $orderArray['currency_id']), 'AFID' => $orderArray['aff_id'], 'SID' => $orderArray['sid'], 'c1' => $orderArray['c1'], 'c2' => $orderArray['c2'], 'c3' => $orderArray['c3'], 'billing_cycle' => $orderArray['billing_cycle'], 'tracking_number' => $modelAttempt->tracking_number ? $modelAttempt->tracking_number : __('no'));
     $orderInfo2['rma_code'] = $orderArray['rma_code'] ? $orderArray['rma_code'] : __('no');
     $orderInfo2['gateway_name'] = $orderArray['gateway_name'];
     $orderInfo = array_merge($orderInfo, $orderInfo2);
     $customerInfo = array('order_customer_name' => $orderArray['fname'] . ' ' . $orderArray['lname'], 'email' => $orderArray['email'], 'ip' => long2ip($orderArray['ip']), 'phone' => $orderArray['phone'], 'order_address1' => $orderArray['address1'], 'order_address2' => $orderArray['address2'], 'order_city' => $orderArray['city'], 'order_state' => $orderArray['state_name'], 'order_country' => $orderArray['country_name'], 'order_zip' => $orderArray['zip'], 'order_billing_fname' => $orderArray['billing_country_id'] ? $orderArray['billing_fname'] : $orderArray['fname'], 'order_billing_lname' => $orderArray['billing_country_id'] ? $orderArray['billing_lname'] : $orderArray['lname'], 'order_billing_address1' => $orderArray['billing_country_id'] ? $orderArray['billing_address1'] : $orderArray['address1'], 'order_billing_address2' => $orderArray['billing_country_id'] ? $orderArray['billing_address2'] : $orderArray['address2'], 'order_billing_city' => $orderArray['billing_country_id'] ? $orderArray['billing_city'] : $orderArray['city'], 'order_billing_state' => $orderArray['billing_country_id'] ? $orderArray['billing_state_name'] : $orderArray['state_name'], 'order_billing_country' => $orderArray['billing_country_id'] ? $orderArray['billing_country_name'] : $orderArray['country_name'], 'order_billing_zip' => $orderArray['billing_country_id'] ? $orderArray['billing_zip'] : $orderArray['zip']);
     $paymentModel = new Payment();
     $paymentModel->fillFromArray($orderArray);
     $paymentInfo = array('payment_type' => $orderArray['payment_type']);
     if ($orderArray['payment_type'] == 'pn') {
         $addPaymentInfo = array('order_payment_status' => $modelAttempt->status, 'order_cc_number' => $paymentModel->cc_number_formatted, 'order_expiry_date' => $paymentModel->exp_date_formatted, 'order_transaction_id' => $modelAttempt->tracking_number ? $modelAttempt->tracking_number : __('no'));
         $paymentInfo = array_merge($paymentInfo, $addPaymentInfo);
     }
     $orderProducts = $orderModel->getOrderProducts();
     $this->layout = array('layouts', 'main_print');
     $this->render('print', array('order' => $orderArray, 'lables' => $lables, 'orderInfo' => $orderInfo, 'customerInfo' => $customerInfo, 'paymentInfo' => $paymentInfo, 'orderProducts' => $orderProducts));
 }