private function loadModel($id) { $model=Destination::model()->findByPk($id); if($model===null) throw new CHttpException(404,'The requested page does not exist.'); return $model; }
public function show($id) { $destination = Destination::where('ID_Destination', '=', $id)->firstOrFail(); $listDest = Destination::where('Status', '=', 'Active')->get(); $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); return View::make('Destinations.show', compact('destination', 'listDest'))->with('data', $data); }
public function getDestinaByPk($id) { $model = Destination::model()->find(array( 'select'=>'name', 'condition'=>"id=$id", )); return $model->name; }
function runExternal(Destination $destination, $purpose) { $destination->setAmount($_POST['amount']); $destination->setPurpose1($purpose); $destination->setPurpose2($_POST['purpose1']); $url = $destination->getUrl(); $params = http_build_query($destination->getParams()); $completeUrl = $url . '?' . $params; header('Location: ' . $completeUrl); }
public function run() { $unit = 1; $country = $this->CheckoutForm->shippingCountryCode; $state = $this->CheckoutForm->shippingStateCode; $zipcode = $this->CheckoutForm->shippingPostal; // We can't do a lookup if the country is blank if (empty($country)) { Yii::log('DESTINATION TABLE: insufficient details for destination shipping. Shipping Country is blank.', 'info', 'application.' . __CLASS__ . '.' . __FUNCTION__); return false; } Yii::log("DESTINATION TABLE: searching for {$country}/{$state}/{$zipcode}", 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); if (!isset($this->config['per'])) { Yii::log("DESTINATION TABLE: could not get destination shipping unit.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); return false; } // Get the best matching destination $model = Destination::LoadMatching($country, $state, $zipcode); if ($model === null) { Yii::log("DESTINATION TABLE: No matching entry found for {$country} {$state} {$zipcode} .", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); return false; } if ($this->config['per'] == 'item') { $unit = $this->objCart->TotalItemCount; } elseif ($this->config['per'] == 'weight') { $unit = $this->objCart->Weight; } elseif ($this->config['per'] == 'volume') { $unit = $this->objCart->Length * $this->objCart->Width * $this->objCart->Height; } if ($unit >= $model->ship_free) { $unit -= $model->ship_free; } if ($unit < 0) { $unit = 0; } // If the Base Charge is unset or lesser than 0, don't apply this module if ($model->base_charge == '' || $model->base_charge == null) { $label = Country::CodeById($model->country) . "/" . State::CodeById($model->state); Yii::log("DESTINATION TABLE: Base charge not set for entry '" . $label . "'", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); return false; } $desc = isset($this->config['offerservices']) ? $this->config['offerservices'] : Yii::t('global', 'Standard 3-5 Business Days'); $ret[$desc] = $model->base_charge + $unit * $model->ship_rate; return $this->convertRetToDisplay($ret); }
/** * Get the available shipping states for a given country. * * Respects SHIP_RESTRICT_DESTINATION - if this configuration is enable * then only the states that are defined will be returned. * * @param string $intCountryId The ID of the country. * @return string[] An associative array mapping the state ID to the state * code. */ public static function getCountryShippingStates($intCountryId) { $noStatesAvailable = array('' => 'n/a'); if (is_null($intCountryId)) { $intCountryId = _xls_get_conf('DEFAULT_COUNTRY', 224); } $criteria = new CDbCriteria(); $criteria->alias = 'state'; $criteria->select = 'state.id, state.code'; $criteria->addCondition('country_id = :country_id'); $criteria->addCondition('active = 1'); $criteria->order = 'state.sort_order, state.state'; // Check for 'only ship to defined destinations'. if (Yii::app()->params['SHIP_RESTRICT_DESTINATION']) { // If we have an entry for the country in xlsws_destination with a // null state, that means that the destination is defined for the // entire country so we don't need to restrict by state. // That's because state IS NULL corresponds to State=ANY. $destinations = Destination::model()->findAll('country=:country_id AND state IS NULL', array('country_id' => $intCountryId)); // If there are no results then we don't have a destination for the // country as a whole so we restrict further by state. if (count($destinations) === 0) { // Filter the results further by state destinations. $criteria->join = 'JOIN xlsws_destination ON (xlsws_destination.state = state.id)'; } } $criteria->params[':country_id'] = $intCountryId; $states = State::model()->findAll($criteria); if (count($states) === 0) { return $noStatesAvailable; } return CHtml::listData($states, 'id', 'code'); }
function __construct() { parent::__construct('https://www.sofort.com/payment/start'); $this->addParam('user_id', '113524')->addParam('project_id', '235565'); }
} $response = json_encode($synced); } else { return false; } } } else { if ($action == "get_tour_num") { $response = Tour::get_tour_num(); } else { if ($action == "get_destination_by_area") { if (isset($_POST['area'])) { $area_id = $_POST['area']; $department = $_POST['department']; $country_id = $_POST['country_id']; $destinations = Destination::getDestinationsByArea($country_id, $area_id, $department); $response = get_select_options_with_id($destinations, ''); } } else { if ($action == "get_cities_by_areas") { if (isset($_POST['areas'])) { $areas = $_POST['areas']; $areas = explode("|", $areas); $countries = explode(",", $_POST['country']); $countries = implode("','", $countries); $cities = array(); $query = "SELECT \r\n D.* \r\n FROM\r\n destinations D \r\n JOIN c_areas_destinations_c AD \r\n ON D.ID = AD.c_areas_de577anations_idb \r\n JOIN c_areas A \r\n ON A.ID = AD.c_areas_de9d4fc_areas_ida \r\n JOIN countries_destinations_c cd \r\n ON cd.countries_bc13nations_idb = D.id\r\n JOIN countries c \r\n ON c.id = cd.countries_5a12untries_ida\r\n WHERE (1!=1 "; foreach ($areas as $id) { $query .= " or A.id = '{$id}'"; } $query .= ') and cd.deleted =0 and c.deleted =0 and D.deleted = 0 and AD.deleted=0 and A.deleted = 0 ';
*/ require_once 'helper/loader.php'; echo "<h1>Create Destination :: Class Demo</h1>"; echo "<p>\n\tSteps are starting from <b>A</b> to <b>L</b>\n\t<br />\n\tIn this demo start point sets to <b>B</b> and end point <b>J</b> and current location <b>D</b>\n\t</p>"; Destination::add('A', 'Info here'); Destination::add('B', 'Info here'); Destination::add('C', 'Info here'); Destination::add('D', 'Info here'); Destination::add('E', 'Info here'); Destination::add('F', 'Info here'); Destination::add('J', 'Info here'); Destination::add('K', 'Info here'); Destination::add('L', 'Info here'); Destination::setBegin('B'); Destination::setCurrent('D'); Destination::setEnd('J'); echo "<h2>Current point:</h2><pre>"; print_r(Destination::getCurrent()); echo "</pre>"; echo "<h2>Next point:</h2><pre>"; print_r(Destination::getNext()); echo "</pre>"; echo "<h2>Previous point:</h2><pre>"; print_r(Destination::getPrev()); echo "</pre>"; echo "<h2>All next steps:</h2><pre>getAllNext"; print_r(Destination::getAllNext()); echo "</pre>"; echo "<h2>All Previous steps:</h2><pre>"; print_r(Destination::getAllPrev()); echo "</pre>";
/** * @group configuration * @test */ public function two_destinations_with_the_different_values_are_not_equal() { $destinationOne = new Destination('a'); $destinationTwo = new Destination('a'); $this->assertTrue($destinationOne->equals($destinationTwo)); }
function AnnotationLowLevelAPI($doc) { $page = $doc->GetPageIterator()->Current(); $annots = $page->GetAnnots(); if (!$annots) { // If there are no annotations, create a new annotation // array for the page. $annots = $doc->CreateIndirectArray(); $page->GetSDFObj()->Put("Annots", $annots); } // Create a Text annotation $annot = $doc->CreateIndirectDict(); $annot->PutName("Subtype", "Text"); $annot->PutBool("Open", true); $annot->PutString("Contents", "The quick brown fox ate the lazy mouse."); $annot->PutRect("Rect", 266, 116, 430, 204); // Insert the annotation in the page annotation array $annots->PushBack($annot); // Create a Link annotation $link1 = $doc->CreateIndirectDict(); $link1->PutName("Subtype", "Link"); $dest = Destination::CreateFit($doc->GetPage(2)); $link1->Put("Dest", $dest->GetSDFObj()); $link1->PutRect("Rect", 85, 705, 503, 661); $annots->PushBack($link1); // Create another Link annotation $link2 = $doc->CreateIndirectDict(); $link2->PutName("Subtype", "Link"); $dest2 = Destination::CreateFit($doc->GetPage(3)); $link2->Put("Dest", $dest2->GetSDFObj()); $link2->PutRect("Rect", 85, 638, 503, 594); $annots->PushBack($link2); // Note that PDFNet API can be used to modify existing annotations. // In the following example we will modify the second link annotation // (link2) so that it points to the 10th page. We also use a different // destination page fit type. // $link2 = $annots->GetAt($annots->Size()-1); $link2->Put("Dest", Destination::CreateXYZ($doc->GetPage(10), 100, 792 - 70, 10)->GetSDFObj()); // Create a third link annotation with a hyperlink action (all other // annotation types can be created in a similar way) $link3 = $doc->CreateIndirectDict(); $link3->PutName("Subtype", "Link"); $link3->PutRect("Rect", 85, 570, 503, 524); // Create a URI action $action = $link3->PutDict("A"); $action->PutName("S", "URI"); $action->PutString("URI", "http://www.pdftron.com"); $annots->PushBack($link3); }
if(!isset($_POST['value']) || $_POST['value'] != '437d04d169b9b9a592f944802c6b3c39'){ die('Try again.'); } $string = isset($_POST['key']) ? $_POST['key'] : ''; if(strlen($string) < 1){ die(false); } $quaries = ['c' => [], 'h' => [], 'd' => []]; $objC = new SubCity(); $list1 = $objC->where('name', 'like', '%' . $string . '%') ->take(7) ->get(['name']); foreach($list1 as $list1Val){ $quaries['c'][] = $list1Val->name; } $objH = new Hotel(); $list2 = $objH->where('name', 'like', '%' . $string . '%')->take(7)->get(['name']); foreach($list2 as $list2Val){ $quaries['h'][] = $list2Val->name; } $objD = new Destination(); $list3 = $objD->where('destination', 'like', '%' . $string . '%') ->take(7) ->get(['destination']); foreach($list3 as $list3Val){ $quaries['d'][] = $list3Val->destination; } $quaries = json_encode($quaries); echo $quaries; ?>
public function setParamsByArray($array) { foreach ($array as $regionKey => $regionValue) { if (property_exists($this, $regionKey)) { if (in_array($regionKey, array('ref', 'regionGiataList', 'dstList'))) { if ($regionKey == 'dstList') { $this->{$regionKey} = array(); if (is_array($regionValue)) { foreach ($regionValue as $dstValue) { $dst = new Destination(); $dst->setParamsByArray($dstValue); array_push($this->{$regionKey}, $dst); } } else { $dst = new Destination(); $dst->setParamsByArray($regionValue); array_push($this->{$regionKey}, $dst); } } else { $this->{$regionKey} = explode(' ', $regionValue); } } else { $this->{$regionKey} = $regionValue; } } } }
/** * This function will run parse an order that we get from Amazon MWS. * It saves orders of the customers to the DB. * @param $response ListOrderItemsResponse Contains the orders from Amazon * Marketplace WebService * @return void */ public function parseListOrders($response) { $checkDate = date("Y-m-d", strtotime($this->amazon_check_time)); $listOrdersResult = $response->getListOrdersResult(); if ($listOrdersResult->isSetOrders()) { $orders = $listOrdersResult->getOrders(); $orderList = $orders->getOrder(); foreach ($orderList as $order) { if ($order->isSetAmazonOrderId()) { $strOrderId = $order->getAmazonOrderId(); Yii::log("Found Amazon Order " . $strOrderId, 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); $objCart = Cart::LoadByIdStr($strOrderId); if (!$objCart instanceof Cart) { //We ignore orders we've already downloaded $objCart = new Cart(); $objCart->id_str = $strOrderId; $objCart->origin = 'amazon'; //We mark this as just a cart, not an order, because we download the items next $objCart->cart_type = CartType::cart; $objOrderTotal = $order->getOrderTotal(); Yii::log("Order total information " . print_r($objOrderTotal, true), 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); $objCart->total = $objOrderTotal->getAmount(); $objCart->currency = $objOrderTotal->getCurrencyCode(); $objCart->status = OrderStatus::Requested; $objCart->datetime_cre = $order->getPurchaseDate(); $objCart->modified = $order->getLastUpdateDate(); if (!$objCart->save()) { Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } //Since email from is Anonymous, we probably will have to create a shell record $objCustomer = Customer::LoadByEmail($order->getBuyerEmail()); if (!$objCustomer) { $customerName = $this->_getCustomerName($order->getBuyerName()); $objCustomer = new Customer(); $objCustomer->email = $order->getBuyerEmail(); $objCustomer->first_name = $customerName['first_name']; $objCustomer->last_name = $customerName['last_name']; $objCustomer->record_type = Customer::EXTERNAL_SHELL_ACCOUNT; $objCustomer->allow_login = Customer::UNAPPROVED_USER; $objCustomer->save(); } $objCart->customer_id = $objCustomer->id; if (!$objCart->save()) { Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } if ($order->isSetShippingAddress()) { $shippingAddress = $order->getShippingAddress(); $countrycode = Country::IdByCode($shippingAddress->getCountryCode()); if ($shippingAddress->isSetStateOrRegion()) { $objState = State::LoadByCode($shippingAddress->getStateOrRegion(), $countrycode); } $customerName = $this->_getCustomerName($shippingAddress->getName()); $config = array('address_label' => 'amazon', 'customer_id' => $objCustomer->id, 'first_name' => $customerName['first_name'], 'last_name' => $customerName['last_name'], 'address1' => $shippingAddress->getAddressLine1(), 'address2' => trim($shippingAddress->getAddressLine2() . " " . $shippingAddress->getAddressLine3()), 'city' => $shippingAddress->getCity(), 'state_id' => $objState->id, 'postal' => $shippingAddress->getPostalCode(), 'country_id' => $countrycode, 'phone' => $shippingAddress->getPhone()); $objCustAddress = CustomerAddress::findOrCreate($config); $objCustomer->default_billing_id = $objCustAddress->id; $objCustomer->default_shipping_id = $objCustAddress->id; $objCustomer->save(); $objCart->shipaddress_id = $objCustAddress->id; $objCart->billaddress_id = $objCustAddress->id; //Amazon doesn't provide billing data, just dupe if (!$objCart->save()) { Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } Yii::log("Looking for destination " . $objState->country_code . " " . $objState->code . " " . $shippingAddress->getPostalCode(), 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); $objDestination = Destination::LoadMatching($objState->country_code, $objState->code, $shippingAddress->getPostalCode()); if ($objDestination === null) { Yii::log("Did not find destination, using default in Web Store ", 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); $objDestination = Destination::getAnyAny(); } $objCart->tax_code_id = $objDestination->taxcode; $objCart->recalculateAndSave(); } if ($order->isSetShipServiceLevel()) { $strShip = $order->getShipServiceLevel(); //If we have a shipping object already, update it, otherwise create it if (isset($objCart->shipping)) { $objShipping = $objCart->shipping; } else { //create $objShipping = new CartShipping(); if (!$objShipping->save()) { Yii::log("Error saving shipping info for cart " . print_r($objShipping->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } } if ($order->isSetShipmentServiceLevelCategory()) { $strShip = $order->getShipmentServiceLevelCategory(); } $objShipping->shipping_module = get_class($this); $objShipping->shipping_data = $strShip; $objShipping->shipping_method = $this->objModule->getConfig('product'); $objShipping->shipping_cost = 0; $objShipping->shipping_sell = 0; $objShipping->save(); $objCart->shipping_id = $objShipping->id; if (!$objCart->save()) { Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } } //Because Amazon comes down with no payment info, just generate one here $objP = new CartPayment(); $objP->payment_method = $this->objModule->getConfig('ls_payment_method'); $objP->payment_module = get_class($this); $objP->payment_data = 'Amazon'; $objP->payment_amount = $objOrderTotal->getAmount(); $objP->datetime_posted = $order->getPurchaseDate(); if (!$objP->save()) { Yii::log("Error saving payment " . print_r($objP->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } $objCart->payment_id = $objP->id; if (!$objCart->save()) { Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } TaskQueue::CreateEvent('integration', get_class($this), 'ListOrderDetails', $objCart->id_str . "," . $checkDate); } } } } }
private function addDestination(Destination $destination) { $this->destinations[$destination->getName()] = $destination; }
/** * 18 Change destination tables and map to country/state ids */ protected function actionConvertDestinationTables() { //Convert Wish List items to new formats //Ship to me //Ship to buyer //Keep in store //find and remove any destinations with an erroneous taxcode $sql = 'SELECT `id` FROM `xlsws_destination` WHERE `taxcode` NOT IN (SELECT xlsws_tax_code.lsid FROM xlsws_tax_code);'; $array = Yii::app()->db->createCommand($sql)->queryAll(); foreach ($array as $a) { Yii::log('Destination id ' . $a['id'] . 'deleted due to erroneous tax code', 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); _dbx('DELETE FROM `xlsws_destination` WHERE `id`=' . $a['id'] . ';'); } $objDestinations = Destination::model()->findAll(); foreach ($objDestinations as $objDestination) { if ($objDestination->country == "*") { $objDestination->country = null; } else { if (!is_numeric($objDestination->country)) { $objC = Country::LoadByCode($objDestination->country); $objDestination->country = $objC->id; } } if ($objDestination->state == "*" || $objDestination->state == null) { $objDestination->state = null; } else { if (!is_numeric($objDestination->state)) { $objS = State::LoadByCode($objDestination->state, $objDestination->country); $objDestination->state = $objS->id; } } if (!$objDestination->save()) { return print_r($objDestination->getErrors()); } } //Need to map destinations to IDs before doing this _dbx("update `xlsws_destination` set country=null where country=0;"); _dbx("update `xlsws_destination` set state=null where state=0;"); _dbx("ALTER TABLE `xlsws_destination` CHANGE `country` `country` INT(11) UNSIGNED NULL DEFAULT NULL;"); _dbx("ALTER TABLE `xlsws_destination` CHANGE `state` `state` INT(11) UNSIGNED NULL DEFAULT NULL;"); _dbx("ALTER TABLE `xlsws_destination` CHANGE `taxcode` `taxcode` INT(11) UNSIGNED NULL DEFAULT NULL;"); _dbx("ALTER TABLE `xlsws_destination` ADD FOREIGN KEY (`state`) REFERENCES `xlsws_state` (`id`);"); _dbx("ALTER TABLE `xlsws_destination` ADD FOREIGN KEY (`country`) REFERENCES `xlsws_country` (`id`);"); _dbx("ALTER TABLE `xlsws_destination` ADD FOREIGN KEY (`taxcode`) REFERENCES `xlsws_tax_code` (`lsid`);"); _dbx("ALTER TABLE `xlsws_category` CHANGE `custom_page` `custom_page` INT(11) UNSIGNED NULL DEFAULT NULL;"); _dbx("UPDATE `xlsws_category` set `custom_page`=null where `custom_page`=0;"); _dbx("ALTER TABLE `xlsws_category` ADD FOREIGN KEY (`custom_page`) REFERENCES `xlsws_custom_page` (`id`);"); _dbx("ALTER TABLE `xlsws_country` DROP `code_a3`;"); _dbx("update `xlsws_shipping_tiers` set `class_name`='tieredshipping';"); return array('result' => "success", 'makeline' => 19, 'tag' => 'Applying database schema changes', 'total' => 50); }
/** * Match a given address to the most accurate Destination * @param string $country * @param string $state * @param string $zip * @return object :: The matching destination */ public static function LoadMatching($country, $state, $zip) { //We may get id numbers instead of text strings so convert here if (is_numeric($country)) { $country = Country::CodeById($country); } if (is_numeric($state)) { $state = State::CodeById($state); } $arrDestinations = Destination::LoadByCountry($country); if (is_array($arrDestinations) === false && $arrDestinations instanceof Traversable === false) { return null; } $objState = State::LoadByCode($state, $country); $zip = preg_replace('/[^A-Z0-9]/', '', strtoupper($zip)); foreach ($arrDestinations as $objDestination) { if ($objDestination->state == null || $objState !== null && $objState->id == $objDestination->state) { $zipStart = $objDestination->Zipcode1; $zipEnd = $objDestination->Zipcode2; if ($zipStart <= $zip && $zipEnd >= $zip || $zipStart == '' || $zipStart == '*' || $zip == '') { return $objDestination; } } } return null; }
/** * getPrev * * Get just the previous step before current location * * @name getPrev * @access public * @return array */ public function getPrev() { return Destination::getPrev(); }
/** * For a product, returns tax rate for all defined destinations * Useful for RSS exports * @return TaxGrid[] */ public function GetTaxRateGrid() { $arrGrid = array(); $intTaxStatus = $this->tax_status_id; $objStatus = TaxStatus::LoadByLS($intTaxStatus); $objDestinations = Destination::model()->findAll(); foreach ($objDestinations as $objDestination) { //Because of differences in how Google defines zip code ranges, we can't convert our ranges //to theirs. At this time we won't be able to support zip code ranges if (!is_null($objDestination->country) && $objDestination->Zipcode1 == '') { $objTaxCode = TaxCode::LoadByLS($objDestination->taxcode); //print_r($objTaxCode); $fltRate = 0.0; for ($x = 1; $x <= 5; $x++) { $statusstring = "tax" . $x . "_status"; $codestring = "tax" . $x . "_rate"; if ($objStatus->{$statusstring} == 0) { $fltRate += $objTaxCode->{$codestring}; } } //Our four elements $strCountry = Country::CodeById($objDestination->country); if (!is_null($objDestination->state)) { $strState = State::CodeById($objDestination->state); } else { $strState = ''; } //$fltRate -- built above $strTaxShip = Yii::app()->params['SHIPPING_TAXABLE'] == '1' ? "y" : "n"; $arrGrid[] = array($strCountry, $strState, $fltRate, $strTaxShip); } } return $arrGrid; }
for ($i = 0; $i < $package->count(); $i++) { if (File::exists($filename)) { File::delete($filename); } $package->delete(); } } }); /*---------------------------------------------------*/ //home Route::get('/', function () { $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['dinas'] = Dinasevents::select(DB::raw("Event_ID, Event_Picture, Event_Date, Event_Title, CONCAT(SUBSTRING(Event_Description,1,100),'...') as IsiEvent"))->orderby('Event_Date', 'DESC')->take(40)->get()->all(); $data['travel'] = Travel::where('Status', '=', 'Active')->take(40)->get()->all(); $data['destination'] = Destination::where('Status', '=', 'Active')->take(40)->get()->all(); $data['gallery'] = Gallery::where("Status", "!=", "Delete")->get()->all(); $data['about'] = About::get()->all(); Session::put('key', 'expiry', 1); $value = Session::get('key'); return View::make('home')->with('index', 'active')->with('data', $data); }); Route::get('post/listing', array('uses' => 'PostController@listing', 'as' => 'get.post.listing')); Route::get('post/{id}', array('uses' => 'PostController@single', 'as' => 'get.post.single'))->where(array('id' => '[1-9][0-9]*', 'slug' => '[a-zA-Z0-9-_]+')); Route::post('post/{id}', array('uses' => 'PostController@update', 'as' => 'post.post.update'))->where(array('id' => '[1-9][0-9]*')); Route::resource('user', 'UserController'); //resource Route::resource('/tourism', 'DestinationController'); Route::resource('/book', 'BooksController'); Route::resource('/rooms', 'RoomsController'); Route::resource('/facilities', 'FacilitiesController');
/** * setEnd * * Set end point of the journey * * @name setEnd * @param string * @access public * @method void */ public function setEnd($node) { self::$end = $node; }
public function actionNewdestination() { if (isset($_POST['Destination'])) { $obj = new Destination(); $obj->attributes = $_POST['Destination']; if ($obj->validate()) { if ($obj->country == "0") { $obj->country = null; } if ($obj->country == "") { $obj->country = null; } if ($obj->state == "0") { $obj->state = null; } if ($obj->state == "") { $obj->state = null; } if ($obj->save()) { echo "success"; } else { echo print_r($obj->getErrors, true); } } else { echo print_r($obj->getErrors, true); } } }
/** * Find the tax code associated with the provided address * * When the shipping country is empty, the Store Default tax code is used. * This is generally used before an address is entered and for store * pickup. * * If the provided address is not matched to any destination, the tax code * for ANY/ANY is used. * * @param mixed $shippingCountry The 2-letter country code for the country or the country ID. * @param mixed $shippingState The 2-letter code for the state or the state ID. * @param string $shippingPostal The postal code with all spaces removed. * @return TaxCode|null The taxcode object, or null if no corresponding tax code. * @throws CException If tax destinations are not configured. */ public static function getTaxCodeByAddress($shippingCountry, $shippingState, $shippingPostal) { if (empty($shippingCountry)) { // Without a shipping country, we use the default tax code. // This is only likely to occur for store pickup. return static::getDefault(); } // Calculate tax since that may change depending on shipping address. Yii::log(sprintf("Attempting to match with a defined Destination to Country/State/Postal %s/%s/%s", $shippingCountry, $shippingState, $shippingPostal), 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); $objDestination = Destination::LoadMatching($shippingCountry, $shippingState, $shippingPostal); if ($objDestination === null) { Yii::log('Destination not matched, going with default (Any/Any)', 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); $objDestination = Destination::getAnyAny(); } if ($objDestination === null) { // TODO: We shoudn't need to check for this here, since it should be a // configuration error to not have a tax destination configured. throw new CException(Yii::t('checkout', 'Website configuration error. No tax destinations have been defined by the Store Administrator. Cannot continue.')); } Yii::log('Matched Destination destination.id=' . $objDestination->id . ' to tax code destination.taxcode=' . $objDestination->taxcode, 'info', 'application.' . __CLASS__ . '.' . __FUNCTION__); return static::LoadByLS($objDestination->taxcode); }
protected function getDestionaModel() { $des = explode(';',$this->to_addr); $str = '没有目的地'; $tempArr = array(); $DestArr = Destination::model()->findAll(array('select'=>'id,name')); if(!empty($DestArr)){ $str = ''; foreach($DestArr as $model){ $tempArr[$model->id] = $model->name; } if(is_array($des)){ $slash = ''; foreach($des as $destid){ $str .= $slash.$tempArr[$destid]; $slash = '/'; } }else{ $str = $tempArr[$des]; } } return $str; }
/** * Checks if the user's shipping destination is a valid one based on the * configuration by the store owner. * * @param $checkoutForm - The user's current checkout form. * @return bool - true if the shipping destination is a valid one * false if the destination is restricted to that shipping destination. */ public static function verifyUserShippingDestination($checkoutForm) { $objDestination = Destination::LoadMatching($checkoutForm->shippingCountryCode, $checkoutForm->shippingStateCode, $checkoutForm->shippingPostal); if (is_null($objDestination)) { Yii::log('Destination not matched, going with default (Any/Any)', 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); $objDestination = Destination::getAnyAny(); if ($objDestination === null) { return false; } } return true; }
<?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } require_once 'modules/Destinations/Destination.php'; require_once 'include/formbase.php'; require_once 'include/upload_file.php'; $focus = new Destination(); $focus->retrieve($_POST['record']); if (!$focus->ACLAccess('Save')) { ACLController::displayNoAccess(true); sugar_cleanup(true); } if (!empty($_POST['assigned_user_id']) && $focus->assigned_user_id != $_POST['assigned_user_id'] && $_POST['assigned_user_id'] != $current_user->id) { $check_notify = TRUE; } else { $check_notify = FALSE; } foreach ($focus->column_fields as $field) { if (isset($_POST[$field])) { $value = $_POST[$field]; $focus->{$field} = $value; } } foreach ($focus->additional_column_fields as $field) { if (isset($_POST[$field])) { $value = $_POST[$field]; $focus->{$field} = $value; } }
$key = "blue1"; $blue_action = Action::CreateGoto($key, strlen($key), Destination::CreateFit($doc->GetPage(19))); $blue->SetAction($blue_action); // We can now add children Bookmarks $sub_red1 = $red->AddChild("Red - Page 1"); $sub_red1->SetAction(Action::CreateGoto(Destination::CreateFit($doc->GetPage(1)))); $sub_red2 = $red->AddChild("Red - Page 2"); $sub_red2->SetAction(Action::CreateGoto(Destination::CreateFit($doc->GetPage(2)))); $sub_red3 = $red->AddChild("Red - Page 3"); $sub_red3->SetAction(Action::CreateGoto(Destination::CreateFit($doc->GetPage(3)))); $sub_red4 = $sub_red3->AddChild("Red - Page 4"); $sub_red4->SetAction(Action::CreateGoto(Destination::CreateFit($doc->GetPage(4)))); $sub_red5 = $sub_red3->AddChild("Red - Page 5"); $sub_red5->SetAction(Action::CreateGoto(Destination::CreateFit($doc->GetPage(5)))); $sub_red6 = $sub_red3->AddChild("Red - Page 6"); $sub_red6->SetAction(Action::CreateGoto(Destination::CreateFit($doc->GetPage(6)))); // Example of how to find and delete a bookmark by title text. $foo = $doc->GetFirstBookmark()->Find("foo"); if ($foo->IsValid()) { $foo->Delete(); } else { assert(false); } $bar = $doc->GetFirstBookmark()->Find("bar"); if ($bar->IsValid()) { $bar->Delete(); } else { assert(false); } // Adding color to Bookmarks. Color and other formatting can help readers // get around more easily in large PDF documents.
/** * Check if a customer's default shipping address is no-tax destination. * * @return bool true if the current customer's default shipping address is in no-tax destination. */ public function defaultShippingIsNoTax() { if (isset($this->defaultShipping) === false) { // TODO: Should we return store default here instead? return false; } $objDestination = Destination::LoadMatching($this->defaultShipping->country, $this->defaultShipping->state, $this->defaultShipping->postal); if ($objDestination === null) { // TODO: Should we return store default here instead? return false; } return $objDestination->taxcode0->IsNoTax(); }
} */ $country_id = ''; if (count($areas) > 0) { $area_options .= '<option value ="">none</option>'; foreach ($areas as $row) { if ($row['id'] == $focus->area && $row['country_id'] == $focus->country_id) { $area_options .= "<option selected='selected' data-code='" . $row['code'] . "' data-country='" . $row['country_id'] . "' value='" . $row['id'] . "' >" . $row['name'] . '-' . $row['country'] . "</option>"; } else { $area_options .= "<option data-code='" . $row['code'] . "' data-country='" . $row['country_id'] . "' value='" . $row['id'] . "' >" . $row['name'] . '-' . $row['country'] . "</option>"; } $area_pattern .= $area_pattern == "" ? "" : "|"; $area_pattern .= $row['code']; } } $destination = Destination::getDestinationsByArea($focus->country_id, $focus->area, $focus->deparment); if (!empty($focus->noiden)) { $noiden = explode('^,^', $focus->noiden); $ss->assign('DESTINATIONS', get_select_options_with_id($destination, $noiden)); } else { $ss->assign('DESTINATIONS', '<option data-code="" value="">--None--</option>'); } $ss->assign("TOUR_AREA", $area_options); //$ss->assign("TOUR_AREA", get_select_options_with_id($app_list_strings['destination_region_dom'],$focus->area)); // custom if ($focus->tour_code) { // $tour_code_area = substr($focus->tour_code, 0, 5); if (preg_match('/^(' . $frame_types_pattern . ')(' . $area_pattern . ')(\\d+)(\\/)(\\w+)-(\\d+)$/', $focus->tour_code, $matches)) { $tour_frame_type = $matches[1]; $tour_code_area = $matches[2]; $tour_code_num = $matches[3];