Example #1
0
function _moduleContent(&$smarty, $module_name)
{
    global $arrConf;
    //folder path for custom templates
    $local_templates_dir = getWebDirModule($module_name);
    //conexion resource
    $pDB = new paloDB($arrConf['elastix_dsn']["elastix"]);
    //user credentials
    global $arrCredentials;
    $action = getAction();
    $content = "";
    switch ($action) {
        case "new_did":
            $content = viewFormDID($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "view":
            $content = viewFormDID($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "view_edit":
            $content = viewFormDID($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_new":
            $content = saveNewDID($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_edit":
            $content = saveEditDID($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "delete":
            $content = deleteDID($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "get_country_code":
            $content = get_country_code();
            break;
        case "validate_delete":
            $content = validate_delete($pDB, $arrCredentials);
            break;
        default:
            // report
            $content = reportDID($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
    }
    return $content;
}
Example #2
0
function photoboard_data_import()
{
    global $wpdb;
    if (!file_exists(PHOTOBOARD_IMPORT_FILE)) {
        return FALSE;
    }
    iconv_set_encoding("internal_encoding", "UTF-8");
    $handle = fopen(PHOTOBOARD_IMPORT_FILE, 'r');
    while (($import = fgetcsv($handle, 0, ",")) !== FALSE) {
        //get field names from first row
        if (!isset($field_names)) {
            //remove utf-8 BOM
            if (substr($import[0], 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
                $import[0] = trim(substr($import[0], 3), '"');
            }
            $field_names = $import;
            //set field names
            foreach ($import as $key => $field_name) {
                $field_name = trim($field_name);
                if ('Name (First)' == $field_name) {
                    $field_names[$key] = 'first_name';
                }
                if ('Name (Last)' == $field_name) {
                    $field_names[$key] = 'last_name';
                }
                if ('Do you have any other/former names you are or were known by?' == $field_name) {
                    $field_names[$key] = 'other_names_bool';
                }
                if ('Other/former names' == $field_name) {
                    $field_names[$key] = 'other_names';
                }
                if ('Email' == $field_name) {
                    $field_names[$key] = 'email';
                }
                if ('Upload your photo' == $field_name) {
                    $field_names[$key] = 'photo';
                }
                if ('I would like a new photo taken for the online photoboard' == $field_name) {
                    $field_names[$key] = 'new_photo';
                }
                if ('I am happy for you to use my existing photoboard photo' == $field_name) {
                    $field_names[$key] = 'use_existing';
                }
                if ('I am happy for you to use any of my older photoboard photos.' == $field_name) {
                    $field_names[$key] = 'use_any';
                }
                if ('I only want my photo to appear on a local version of the photoboard' == $field_name) {
                    $field_names[$key] = 'local_only';
                }
                if ('Are you currently living in the community or surrounding area?' == $field_name) {
                    $field_names[$key] = 'living_local';
                }
                if ('Your current role' == $field_name) {
                    $field_names[$key] = 'current_role';
                }
                if ('What country are you originally from?' == $field_name) {
                    $field_names[$key] = 'country_origin';
                }
                if ('What year did you first visit the community?' == $field_name) {
                    $field_names[$key] = 'year_first_visit';
                }
                if ('What year did you leave the community?' == $field_name) {
                    $field_names[$key] = 'year_leave';
                }
                if ('How long have you lived in the community?' == $field_name) {
                    $field_names[$key] = 'how_long_in_community';
                }
                if ('Brief statement about yourself' == $field_name) {
                    $field_names[$key] = 'statement';
                }
                if ('Location' == $field_name) {
                    $field_names[$key] = 'location';
                }
                if ('What country do you currently live in?' == $field_name) {
                    $field_names[$key] = 'country_current';
                }
                if ('Findhorn Foundation (LES department coworker)' == $field_name) {
                    $field_names[$key] = 'ff_member';
                }
                if ('Findhorn Foundation (management or admin department)' == $field_name) {
                    $field_names[$key] = 'ff_member_admin';
                }
                if ('Findhorn Foundation (long term guest)' == $field_name) {
                    $field_names[$key] = 'ff_guest';
                }
                if ('Findhorn Foundation (committed volunteer)' == $field_name && !isset($ff_volunteer)) {
                    $ff_volunteer = $field_names[$key] = 'ff_volunteer';
                    continue;
                }
                if ('Findhorn Foundation (other)' == $field_name && !isset($ff_other)) {
                    $ff_other = $field_names[$key] = 'ff_other';
                    continue;
                }
                if ('NFA (employee, committed volunteer or elected representative)' == $field_name && !isset($nfa_staff)) {
                    $nfa_staff = $field_names[$key] = 'nfa_staff';
                    continue;
                }
                if ('NFA (member)' == $field_name && !isset($nfa_member)) {
                    $nfa_member = $field_names[$key] = 'nfa_member';
                    continue;
                }
                if ('Employee or committed volunteer of other NFA member organisation' == $field_name && !isset($nfa_org_member)) {
                    $nfa_org_member = $field_names[$key] = 'nfa_org_member';
                    continue;
                }
                if ('Other' == $field_name && !isset($other_affiliation)) {
                    $other_affiliation = $field_names[$key] = 'other_affiliation';
                    continue;
                }
                if ('Findhorn Foundation (member, co-worker etc)' == $field_name) {
                    $field_names[$key] = 'ff_member2';
                }
                if ('Findhorn Foundation (long term guest, but not member, co-worker etc)' == $field_name) {
                    $field_names[$key] = 'ff_guest2';
                }
                if ('Findhorn Foundation (committed volunteer)' == $field_name && isset($ff_volunteer)) {
                    $field_names[$key] = 'ff_volunteer2';
                }
                if ('Findhorn Foundation (other)' == $field_name && isset($ff_other)) {
                    $field_names[$key] = 'ff_other2';
                }
                if ('NFA (employee, committed volunteer or elected representative)' == $field_name && isset($nfa_staff)) {
                    $field_names[$key] = 'nfa_staff2';
                }
                if ('NFA (member)' == $field_name && isset($nfa_member)) {
                    $field_names[$key] = 'nfa_member2';
                }
                if ('Employee or committed volunteer of other NFA member organisation' == $field_name && isset($nfa_org_member)) {
                    $field_names[$key] = 'nfa_org_member2';
                }
                if ('Other' == $field_name && isset($other_affiliation)) {
                    $field_names[$key] = 'other_affiliation2';
                }
                if ('Other affiliations' == $field_name) {
                    $field_names[$key] = 'other_affiliations';
                }
                if ('Anything else?' == $field_name) {
                    $field_names[$key] = 'comment';
                }
                if ('Entry Date' == $field_name) {
                    $field_names[$key] = 'mod_date';
                }
                if ('Entry Id' == $field_name) {
                    $field_names[$key] = 'id';
                }
                if (!empty($field_names[$key]) && strpos($field_names[$key], ' ') !== FALSE) {
                    $field_names[$key] = str_replace(' ', '_', $field_names[$key]);
                }
            }
            continue;
        }
        $field_vals = array_combine($field_names, $import);
        array_walk($field_vals, function (&$t) {
            if (is_string($t)) {
                $t = trim($t);
            }
        });
        //we are reimporting existing ID
        $record_exists = $wpdb->get_var("SELECT COUNT(id) FROM {$wpdb->prefix}photoboard_people WHERE id={$field_vals['id']};");
        //make sure we only have one record for any person
        //import is in reverse order, so if ID already exists we don't import any more
        $sql = $wpdb->prepare("SELECT id FROM {$wpdb->prefix}photoboard_people WHERE first_name='%s' AND last_name='%s' AND status=0 LIMIT 1;", $field_vals['first_name'], $field_vals['last_name']);
        $prev_id = $wpdb->get_var($sql);
        if ($prev_id && !$record_exists) {
            trigger_error("Duplicate record for {$field_vals['first_name']} {$field_vals['last_name']} (orig id:{$prev_id}, new id:{$field_vals['id']})", E_USER_NOTICE);
            continue;
        }
        if ($record_exists && !PHOTOBOARD_IMPORT_ALL) {
            continue;
        }
        //normalise case on names where people entered ALL CAPS!
        foreach (array('first_name', 'last_name') as $f) {
            if (mb_strtoupper($field_vals[$f]) == $field_vals[$f]) {
                $field_vals[$f] = mb_convert_case($field_vals[$f], MB_CASE_TITLE);
            }
        }
        //normalise year fields
        foreach (array('year_first_visit', 'year_leave') as $yr_field) {
            if (preg_match('/[0-9]{4}/', $field_vals[$yr_field], $yrs)) {
                $field_vals[$yr_field] = $yrs[0];
            } else {
                $field_vals[$yr_field] = '';
            }
        }
        //normalise country fields
        foreach (array('country_origin', 'country_current') as $ct_field) {
            $field_vals[$ct_field] = get_country_code($field_vals[$ct_field]);
        }
        //set single booleans
        $bools = array('new_photo', 'use_existing', 'use_any', 'local_only', 'ff_member_admin');
        foreach ($bools as $bool) {
            if (!empty($field_vals[$bool])) {
                $field_vals[$bool] = TRUE;
            }
        }
        //set all double booleans (which come from separate fields for old/current members)
        $bools = array('ff_member', 'ff_guest', 'ff_volunteer', 'ff_other', 'nfa_staff', 'nfa_member', 'nfa_org_member', 'other_affiliation');
        foreach ($bools as $bool) {
            if (!empty($field_vals[$bool]) || !empty($field_vals[$bool . '2'])) {
                $field_vals[$bool] = TRUE;
            }
        }
        //other booleans
        $field_vals['living_local'] = (bool) ('living-locally' == $field_vals['living_local']);
        //if we can use any photo, we can also use existing
        if ($field_vals['use_any']) {
            $field_vals['use_existing'] = 1;
        }
        //if photo, move it to proper place and update field so it just has file name
        if ($field_vals['photo']) {
            $photo = str_replace(PHOTOBOARD_PIX_URL_STRIP, '', $field_vals['photo']);
            $photo_path = PHOTOBOARD_PIX_IMPORT_DIR . $photo;
            $file_name = basename($photo_path);
            if (file_exists($photo_path)) {
                $p = @exif_read_data($photo_path);
                if (!empty($p['DateTime'])) {
                    $photo_date = date('Y-m', strtotime($p['DateTime']));
                } elseif (preg_match('|.*/([0-9]{4})/([0-9]{2})/[^/].*$|', $photo_path, $m)) {
                    $photo_date = "{$m[1]}-{$m[2]}";
                }
                $file_name = "{$photo_date}.jpg";
                @mkdir(PHOTOBOARD_PIX_DIR . "/{$field_vals['id']}", 0755, TRUE);
                copy($photo_path, PHOTOBOARD_PIX_DIR . "/{$field_vals['id']}/{$file_name}");
            }
            $field_vals['photo'] = $file_name;
        } elseif ($field_vals['use_existing']) {
            copy_existing_photo($field_vals);
        }
        $no_sets = array('other_names_bool', 'new_photo', 'ff_member2', 'ff_guest2', 'ff_volunteer2', 'ff_other2', 'nfa_staff2', 'nfa_member2', 'nfa_org_member2', 'other_affiliation2', 'comment', 'Created_By_(User_Id)', 'Source_Url', 'Transaction_Id', 'Payment_Amount', 'Payment_Date', 'Payment_Status', 'Post_Id', 'User_Agent', 'User_IP');
        foreach ($no_sets as $no_set) {
            unset($field_vals[$no_set]);
        }
        if ($record_exists) {
            $wpdb->update("{$wpdb->prefix}photoboard_people", $field_vals, array('id' => $field_vals['id']));
        } else {
            $wpdb->insert("{$wpdb->prefix}photoboard_people", $field_vals);
        }
    }
    unlink(PHOTOBOARD_IMPORT_FILE);
}
Example #3
0
 private function _process_add_order($data)
 {
     if ($this->config->item('production')) {
         $secret = $this->config->item('secret');
         $ebay_id = strtolower($data->ebay_id);
         //$ebay_id = strtolower('mallerp');
         if (is_int(strpos($ebay_id, '...'))) {
             $sub_ebay_id = rtrim($ebay_id, '...');
             foreach ($secret as $key => $value) {
                 if (is_int(strpos($key, $sub_ebay_id))) {
                     $ebay_id = $key;
                 }
             }
         }
         $this->token = $secret[$ebay_id];
     } else {
         $this->token = $this->config->item('token');
         //var_dump($this->token);die();
     }
     $transaction_id = $data->transaction_id;
     $order_id = $data->id;
     $track_code = $this->epacket_model->get_track_number($transaction_id, $order_id);
     if ($track_code) {
         return $this->_process_print_label($track_code, $transaction_id, $order_id);
     }
     $ItemList = array();
     $skus = explode(',', trim($data->sku_str, ','));
     $item_ids = explode(',', trim($data->item_id_str, ','));
     $item_titles = explode(ITEM_TITLE_SEP, trim($data->item_title_str, ','));
     //$item_ids = array_unique($item_ids);
     $qties = explode(',', trim($data->qty_str, ','));
     //$data->address_line_1 = preg_replace('/\d+/', '', $data->address_line_1, 1);
     //$this->stock_code=$data->stock_code;
     $item_count = count($item_ids);
     $i = 0;
     /*$price = ( ! empty($data->gross)) ? ($data->gross / 2) : ($data->net / 2);
       $price = $price / $item_count;*/
     $price = 5;
     $weight = $data->ship_weight / 1000 / $item_count;
     if (empty($weight)) {
         $weight = 0.05;
     }
     if ($weight < 0.05) {
         $weight = 0.05;
     }
     echo "weight:" . $weight . "\n";
     $ebay_order_ids = array();
     foreach ($item_ids as $item_id) {
         $item_title = $item_titles[$i];
         $sku = $skus[$i];
         $qty = $qties[$i];
         $product = $this->epacket_model->get_product_info_for_epacket($sku);
         // SKU
         $sku_obj = new sku();
         $sku_obj->CustomsTitleCN = $sku . "  " . $product->name_cn;
         //$sku_obj->CustomsTitleEN = $product->name_en;
         $sku_obj->CustomsTitleEN = 'Accessories ';
         $sku_obj->DeclaredValue = $price;
         $sku_obj->OriginCountryName = 'China';
         $sku_obj->OriginCountryCode = "CN";
         $sku_obj->SKUID = $sku;
         $sku_obj->Weight = $weight;
         // Item(s)
         $item_obj = new item();
         $item_obj->EBayBuyerID = $data->buyer_id;
         $item_obj->EBayItemID = $item_id;
         /*修改获取ebay交易id的方法*/
         $ebay_order_infos = $this->epacket_model->get_ebay_transaction_id($item_id, $data->transaction_id, $item_title);
         foreach ($ebay_order_infos as $ebay_order_info) {
             if (in_array($ebay_order_info->id, $ebay_order_ids)) {
                 //如果ebayorder的id已经被用过一次就不要用了。
             } else {
                 $ebay_transaction_id = $ebay_order_info->transaction_id;
                 $ebay_order_ids[] = $ebay_order_info->id;
                 break;
                 //跳出本次foreach循环
             }
         }
         //$ebay_transaction_id = $this->epacket_model->get_ebay_transaction_id($item_id, $data->transaction_id, $item_title);
         //echo 'ebay transaction id: ' . $ebay_transaction_id . "\n";
         $item_obj->EBayTransactionID = $ebay_transaction_id;
         $item_obj->EBaySiteID = 0;
         $item_obj->OrderSalesRecordNumber = 0;
         $item_obj->PaymentDate = $data->list_date;
         $item_obj->PostedQTY = $qty;
         $item_obj->ReceivedAmount = $price;
         $item_obj->SalesRecordNumber = 0;
         $item_obj->SKU = $sku_obj;
         $item_obj->SoldDate = $data->list_date;
         $item_obj->SoldPrice = $price;
         $item_obj->SoldQTY = $qty;
         $ItemList[] = $item_obj;
         $i++;
     }
     //$user_id = get_current_user_id();
     $epacket_config = $this->epacket_model->get_epacket_config_by_is_register($this->is_register);
     // ship to address
     $this->load->library('epacket/ShipToAddress');
     $this->shipToAddress->City = $data->town_city;
     //$this->shipToAddress->Company = 'company test';
     $this->shipToAddress->Contact = $data->name;
     $this->shipToAddress->Country = $data->country;
     //$this->shipToAddress->CountryCode = 'US';
     $this->shipToAddress->CountryCode = get_country_code($data->country);
     //$this->shipToAddress->District = 'tesasdt';
     $this->shipToAddress->Email = $data->from_email;
     $this->shipToAddress->Phone = $data->contact_phone_number ? $data->contact_phone_number : ' ';
     $this->shipToAddress->Postcode = $data->zip_code ? $data->zip_code : ' ';
     $this->shipToAddress->Province = $data->state_province ? $data->state_province : ' ';
     $street = '';
     $street = empty($street) ? $data->address_line_1 : $street . ', ' . $data->address_line_1;
     if (!empty($data->address_line_2)) {
         $street = $street . ',' . $data->address_line_2;
     }
     $this->shipToAddress->Street = $street;
     // order detail
     $this->load->library('epacket/OrderDetail');
     $this->orderDetail->PickUpAddress = $this->pickUpAddress;
     $this->orderDetail->ShipFromAddress = $this->shipFromAddress;
     //$this->orderDetail->ReturnAddress = $this->ReturnAddress;
     $this->orderDetail->ReturnAddress = $this->ReturnAddress;
     $this->orderDetail->ShipToAddress = $this->shipToAddress;
     $this->orderDetail->EMSPickUpType = 0;
     $this->orderDetail->ItemList = $ItemList;
     // add order
     $this->load->library('epacket/AddOrder');
     $this->addOrder->APIDevUserID = $this->token['dev_id'];
     $this->addOrder->APISellerUserID = $this->token['user_id'];
     $this->addOrder->APIPassword = $this->token['api_key'];
     $this->addOrder->MessageID = $this->config->item('message_id');
     $this->addOrder->Version = $this->config->item('version');
     $this->addOrder->OrderDetail = $this->orderDetail;
     $track_code = $this->_call_add_order($this->addOrder, $transaction_id);
     if ($track_code) {
         $this->epacket_model->save_track_number($transaction_id, $track_code, $order_id);
         $this->_process_print_label($track_code, $transaction_id, $order_id);
         echo 'done!';
     } else {
         echo 'not done!';
     }
 }
Example #4
0
     $smarty->assign('targetStateCode', get_state_code($targetLocation['state']));
 }
 $smarty->assign('targetCountry', $targetLocation['country']);
 $smarty->assign('targetCountryCode', get_country_code($targetLocation['country']));
 if ($_POST['apptab_location'] == NULL) {
     $smarty->assign('userCity', $userLocation['city']);
     $smarty->assign('userState', $userLocation['state']);
     $smarty->assign('userStateCode', get_state_code($userLocation['state']));
     $smarty->assign('userCountry', $userLocation['country']);
     $smarty->assign('userCountryCode', get_country_code($userLocation['country']));
 } else {
     $smarty->assign('userCity', $userLola[2]);
     $smarty->assign('userState', $userLocation['state']);
     $smarty->assign('userStateCode', $userLola[3]);
     $smarty->assign('userCountry', $userLola[4]);
     $smarty->assign('userCountryCode', get_country_code($userLola[4]));
 }
 if ($distance > 2 * $radius) {
     $nearby = 0;
     // Get origin codes
     $orig_codes = array();
     $orig_info = false;
     if ($userLocation != NULL) {
         if ($_POST['apptab_location'] == NULL) {
             $orig_codes = get_airport_codes($userLola, $radius);
         } else {
             $orig_codes = get_airport_codes($userLola);
         }
         $orig_info = true;
     }
     // Get destination codes
Example #5
0
function _moduleContent(&$smarty, $module_name)
{
    global $arrConf;
    #    include_once "apps/did/libs/paloSantoDID.class.php";
    include_once "libs/paloSantoOrganization.class.php";
    //folder path for custom templates
    $local_templates_dir = getWebDirModule($module_name);
    //conexion resource
    $pDB = new paloDB($arrConf['elastix_dsn']["elastix"]);
    //user credentials
    global $arrCredentials;
    $action = getAction();
    $content = "";
    switch ($action) {
        case "new_organization":
            $content = viewFormOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "view":
            $content = viewFormOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "edit":
            $content = viewFormOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_new":
            $content = saveNewOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_edit":
            $content = saveEditOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "delete":
            $content = deleteOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "get_country_code":
            $content = get_country_code();
            break;
        case "reportDIDs":
            $content = reportDIDorganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "didAssign":
            $content = didAssign($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "saveDidAssign":
            $content = didAssign($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "changeDIDfilter":
            $content = changeDIDfilter($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "removeDID":
            $content = removeDID($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "reloadAsterisk":
            $content = reloadAsterisk($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "change_state":
            $content = change_state($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "delete_org_2":
            $content = delete_org_2($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        default:
            // report
            $content = reportOrganization($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
    }
    return $content;
}
Example #6
0
           <?php 
 $s = explode(' ', $item['name']);
 for ($c = 0; $c < count($s); $c++) {
     echo $s[$c] . ' ';
     if ($c == 1) {
         echo "<br>";
     }
 }
 ?>
          </div>
       </div>
         <?php 
 $days = time() - $registry['post'][0]['date'];
 ?>
         <?php 
 if (get_country_code() == 'GE') {
     if (!in_array($i, $votes['user']['id'])) {
         $hover_stars = 'hover_stars';
     }
     if (!in_array($i, $votes['user']['id'])) {
         $addStar = "onClick='addStar(this)'";
     }
     $vote_star1 = $votes['user']['star'][$i] > 0 ? 'star.png' : 'star1.png';
     $vote_star2 = $votes['user']['star'][$i] > 1 ? 'star.png' : 'star1.png';
     $vote_star3 = $votes['user']['star'][$i] > 2 ? 'star.png' : 'star1.png';
     $contest_out = "<div class='contest_rate contest_id_" . $i . "'>\r\n    <div class='contest_stars  " . $hover_stars . " '>";
     if (abs($days / (3600 * 24)) > 7) {
         $contest_out .= "<div style='padding:5px;'>მიმდინარე კვირის კონკურსი დასრულებულია</div>";
         $registry['out_of_date'] = 1;
     } else {
         $contest_out .= "<span><span class='momeci'>მომეცი</span> სამი ვარსკვლავი</span>\r\n\t\t\t<div>\r\n\t\t\t\t<a " . $addStar . " class='star' data-star='1' data-user='******' data-id='" . $registry['post'][0]['id'] . "'>\r\n\t\t\t\t<img src='/img/icons/" . $vote_star1 . "' width='24' />\r\n\t\t\t\t</a>\r\n\t\t\t\t<a " . $addStar . " class='star' data-star='2' data-user='******' data-id='" . $registry['post'][0]['id'] . "'>\r\n\t\t\t\t<img src='/img/icons/" . $vote_star2 . "' width='24' />\r\n\t\t\t\t</a>\r\n\t\t\t\t<a " . $addStar . " class='star' data-star='3' data-user='******' data-id='" . $registry['post'][0]['id'] . "'>\r\n\t\t\t\t<img src='/img/icons/" . $vote_star3 . "' width='24' />\r\n\t\t\t\t</a>\r\n\t\t\t</div>";
Example #7
0
				<div class="row" style="margin-bottom:6px;">
					<div class="interest-menu"><a href="/category/interest/cruises-land-journeys"><img src="http://localhost/magazine/web/images/sub-menu/desktop/cruises.jpg"></a></a></div>
					<div class="interest-menu"><a href="/category/interest/luxury-spa-retreat"><img src="http://localhost/magazine/web/images/sub-menu/desktop/luxury.jpg"></a></a></div>
					<div class="interest-menu"><a href="/category/interest/family-kids"><img src="http://localhost/magazine/web/images/sub-menu/desktop/family.jpg"></a></div>					
				</div>				
				<div class="other-interest-menu">									
					<h5><a href="/category/trip-planning">TRIP PLANNING</a></h5>
					<h5><a href="/category/travel-inspiration">TRAVEL INSPIRATION</a></h5>
					<h5><a href="/category/travel-stories">TRAVEL STORIES</a></h5>					
				</div>
				<div class="clear"></div>
			</ul>
	</li>
	<li id="travel-news" class="menu-item menu-item-type-custom menu-item-object-custom"><a href="/category/travel-news">TRAVEL NEWS</a></li>
	<?php 
$location = get_country_code();
switch ($location) {
    case 'MY':
        echo '<li id="travel-deals" class="menu-item menu-item-type-custom menu-item-object-custom"><a href="http://tripzilla.my/" target="_blank">TRAVEL DEALS</a></li>';
        break;
    default:
        echo '<li id="travel-deals" class="menu-item menu-item-type-custom menu-item-object-custom"><a href="http://tripzilla.sg/" target="_blank">TRAVEL DEALS</a></li>';
        break;
}
?>
	
	<li id="travel-deals" class="menu-item menu-item-type-custom menu-item-object-custom"><a href="https://flyzilla.com/flight/deals" target="_blank">FLIGHT DEALS</a></li>
	<li id="giveaways" class="menu-item menu-item-type-custom menu-item-object-custom"><a href="/past-winner-announcement">GIVEAWAYs</a></li>
	<li id="get-involved" class="menu-item menu-item-type-custom menu-item-has-children parent-menu"><a href="#">GET INVOLVED</a>
		<ul class="sub-menu">
			<li><a href="/hall-of-fame">Writer of the month</a></li>
 private function _process_add_order($data)
 {
     $order_id = $data->id;
     $track_code = $this->epacket_model->get_ems_track_number($order_id);
     if ($track_code) {
         //return $this->_process_print_label($track_code, $transaction_id, $order_id);
         $user_name = lang('program');
         $wait_for_feedback_status = fetch_status_id('order_status', 'wait_for_feedback');
         $remark = $this->order_model->get_sys_remark($order_id);
         $remark .= sprintf(lang('confirm_shipped_remark'), date('Y-m-d H:i:s'), $user_name);
         $data1 = array('track_number' => $track_code, 'ship_confirm_date' => date('Y-m-d H:i:s'), 'order_status' => $wait_for_feedback_status, 'sys_remark' => $remark . ' epacket: order status id is ' . $wait_for_feedback_status);
         $this->order_model->update_order_information($order_id, $data1);
         $this->epacket_model->save_specification_track_number($track_code, $data->id);
         $this->get_epacket_specification_print_lable_url($track_code);
         if ($this->_check_label_exists($track_code)) {
             $this->print_sku_list($track_code, $order_id);
             /*标签文件下载成功后才生成清单*/
         }
         return;
     }
     //$product_mode = FALSE;
     $this->CI =& get_instance();
     $this->CI->load->config('config_epacket_specification');
     $ems_token = $this->CI->config->item('ems_token');
     $ems_url = $this->CI->config->item('ems_url');
     $ems_label_url = $this->CI->config->item('ems_label_url');
     $version = $this->CI->config->item('version');
     $order_info = array();
     $receiver_info = array();
     $items = array();
     $skus = explode(',', trim($data->sku_str, ','));
     $item_ids = explode(',', trim($data->item_id_str, ','));
     $item_titles = explode(ITEM_TITLE_SEP, trim($data->item_title_str, ','));
     $qties = explode(',', trim($data->qty_str, ','));
     $i = 0;
     $volweight = 0;
     $item_count = count($skus);
     /*$price = ( ! empty($data->gross)) ? ($data->gross / 2) : ($data->net / 2);
       $price = $price / $item_count;*/
     $price = 5;
     $weight = $data->ship_weight / 1000 / $item_count;
     if (empty($weight)) {
         $weight = 0.05;
     }
     echo "weight:" . $weight . "\n";
     foreach ($skus as $sku) {
         $item = array();
         $item_title = $item_titles[$i];
         $qty = $qties[$i];
         if ($this->order_model->check_exists('product_makeup_sku', array('makeup_sku' => $sku))) {
             $makeup_sku = $this->product_makeup_sku_model->fetch_makeup_sku_by_sku($sku);
             $sku_arr = explode(',', $makeup_sku->sku);
             $qty_arr = explode(',', $makeup_sku->qty);
             foreach ($sku_arr as $key => $value) {
                 $count_sku = (int) $qty * $qty_arr[$key];
                 $product = $this->epacket_model->get_product_info_for_epacket($value);
                 $item['cnname'] = $product->name_cn;
                 $item['enname'] = "Accessories ";
                 $item['count'] = $count_sku;
                 $item['weight'] = (int) $weight;
                 $item['delcarevalue'] = price($price);
                 $items[] = $item;
                 $volweight += $weight;
             }
         } else {
             $product = $this->epacket_model->get_product_info_for_epacket($sku);
             $item['cnname'] = $product->name_cn;
             $item['enname'] = "Accessories ";
             $item['count'] = $qty;
             $item['weight'] = (int) $weight;
             $item['delcarevalue'] = price($price);
             $items[] = $item;
             $volweight += $weight;
         }
         $i++;
     }
     $datetime = date('Y-m-d\\TH:i:s\\Z');
     $end_time = date('Y-m-d\\TH:i:s\\Z', mktime(substr($datetime, 11, 2), substr($datetime, 14, 2), substr($datetime, 17, 2), substr($datetime, 5, 2), substr($datetime, 8, 2) + 4, substr($datetime, 0, 4)));
     $ems_token_array = explode('_', trim($ems_token));
     $order_info['orderid'] = str_pad($data->id, 4, '0', STR_PAD_LEFT);
     $order_info['customercode'] = $ems_token_array[0];
     $order_info['volweight'] = (int) $volweight;
     $order_info['startdate'] = $datetime;
     $order_info['enddate'] = $end_time;
     $street = '';
     $street = empty($street) ? $data->address_line_1 : $street . ', ' . $data->address_line_1;
     if (!empty($data->address_line_2)) {
         $street = $street . ',' . $data->address_line_2;
     }
     $receiver_info['receiver_name'] = htmlspecialchars($data->name);
     $receiver_info['receiver_postcode'] = $data->zip_code ? trim($data->zip_code) : ' ';
     $receiver_info['receiver_phone'] = $data->contact_phone_number ? $data->contact_phone_number : ' ';
     $receiver_info['receiver_mobile'] = $data->contact_phone_number ? $data->contact_phone_number : ' ';
     $receiver_info['receiver_country'] = get_country_code($data->country);
     $receiver_info['receiver_province'] = $data->state_province ? $data->state_province : ' ';
     $receiver_info['receiver_city'] = $data->town_city;
     $receiver_info['receiver_county'] = '';
     $receiver_info['receiver_street'] = $street;
     $xml = epacket_specification_order($order_info, $this->sender_info, $receiver_info, $this->collect_info, $items);
     $order_gateway_url = $ems_url . "order/";
     var_dump($order_gateway_url);
     echo "\n";
     var_dump($xml);
     echo "\n";
     //echo "<pre>";var_dump($xml);echo "</pre>";die("***********************");
     //var_dump(utf8_encode($xml));
     //die($order_gateway_url);
     /* 开始提交xml了 */
     //$xml=utf8_encode($xml);
     $ch = curl_init();
     $header[] = "Content-type: text/xml";
     //定义content-type为xml
     $header[] = "version: " . $version;
     $header[] = "authenticate: " . $ems_token;
     curl_setopt($ch, CURLOPT_URL, $order_gateway_url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
     $response = curl_exec($ch);
     if (curl_errno($ch)) {
         print curl_error($ch);
     }
     curl_close($ch);
     var_dump($response);
     $arr = parseNamespaceXml($response);
     //echo "<br>**********************<br>";
     //print_r($arr);
     $user_name = lang('program');
     $track_code = isset($arr['mailnum']) ? $arr['mailnum'] : '';
     $wait_for_feedback_status = fetch_status_id('order_status', 'wait_for_feedback');
     $remark = $this->order_model->get_sys_remark($order_id);
     $remark .= sprintf(lang('confirm_shipped_remark'), date('Y-m-d H:i:s'), $user_name);
     $data1 = array('track_number' => $track_code, 'ship_confirm_date' => date('Y-m-d H:i:s'), 'order_status' => $wait_for_feedback_status, 'sys_remark' => $remark . ' epacket: order status id is ' . $wait_for_feedback_status);
     $this->order_model->update_order_information($order_id, $data1);
     $this->epacket_model->save_specification_track_number($track_code, $data->id);
     $this->get_epacket_specification_print_lable_url($track_code);
     if ($this->_check_label_exists($track_code)) {
         $this->print_sku_list($track_code, $order_id);
         /*标签文件下载成功后才生成清单*/
     }
 }