User: Workstation Date: 8/14/2015 Time: 2:40 PM
Inheritance: extends CI_Controller
Example #1
0
 public function testNavigateOverSizes()
 {
     $expected = range(0, 7, 2);
     $s = new Size($expected);
     foreach ($s as $sItem) {
         $this->assertTrue(in_array($sItem, $expected));
     }
     $s->rewind();
     for ($i = 0; $i < count($expected); $i++) {
         $this->AssertEquals($expected[$i], $s->current());
         $s->next();
     }
 }
 public function run()
 {
     $size1 = new Size();
     $size1->size = 'small';
     $size1->save();
     $size2 = new Size();
     $size2->size = 'medium';
     $size2->save();
     $size3 = new Size();
     $size3->size = 'large';
     $size3->save();
     $size4 = new Size();
     $size4->size = 'x-large';
     $size4->save();
 }
Example #3
0
 public function getAll()
 {
     // Get all the products.
     $products = Product::with('product_media.media')->get();
     // Render the view.
     return View::make('brochure.product.all', ['products' => $products, 'sizes' => Size::all()]);
 }
Example #4
0
 /**
  * @dataProvider limits
  */
 public function testCoversAUniformSubsetWhenLimitedToTheNumberOfIterations($limit)
 {
     $size = Size::withTriangleGrowth(1000)->limit($limit);
     $this->assertEquals($limit, count($size));
     $this->assertEquals(0, $size->at(0));
     $this->assertEquals(990, $size->at($limit - 1));
     $this->assertEquals(0, $size->at($limit));
 }
Example #5
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     echo "\n| This command will fake a whole lot of pet data! It will create\n";
     echo "| as many pet records as you specify, and then associate five\n";
     echo "| random pictures in /public/img/uploads with each new pet\n\n";
     echo "How many pets would you like to fake?\n> ";
     $n = intval($this->ask(''));
     echo "working...";
     //get size, user, and species ids
     $species_ids = [];
     $size_ids = [];
     $user_ids = [];
     Species::all()->each(function ($species) use(&$species_ids) {
         $species_ids[] = $species->id;
     });
     Size::all()->each(function ($size) use(&$size_ids) {
         $size_ids[] = $size->id;
     });
     User::all()->each(function ($user) use(&$user_ids) {
         $user_ids[] = $user->id;
     });
     $names = ['fido', 'fluffy', 'muffins', 'whiskers', 'benji', 'kitty'];
     $colors = ['white', 'brown', 'black', 'calico', 'grey'];
     $descriptions = ['Use lap as chair. I am the best pooping rainbow while flying in a toasted bread costume in space lick yarn hanging out of own butt and stare at wall turn and meow stare at wall some more meow again continue staring . Stare at ceiling light eat grass, throw it back up, yet make meme, make cute face. Eat and than sleep on your face climb leg, so has closed eyes but still sees you. Hunt by meowing loudly at 5am next to human slave food dispenser drink water out of the faucet hide at bottom of staircase to trip human chew iPad power cord poop in litter box, scratch the walls yet fall over dead (not really but gets sypathy). Poop in the plant pot lick plastic bags. Sniff other cat\'s butt and hang jaw half open thereafter intently sniff hand get video posted to internet for chasing red dot attack feet, yet immediately regret falling into bathtub but run in circles. I am the best knock over christmas tree hunt anything that moves. Eat a plant, kill a hand. Sweet beast thug cat . Meow all night having their mate disturbing sleeping humans flop over, so ears back wide eyed. Please stop looking at your phone and pet me behind the couch claw drapes, eat from dog\'s food asdflkjaertvlkjasntvkjn (sits on keyboard). Pee in the shoe human is washing you why halp oh the horror flee scratch hiss bite.', 'Poop in litter box, scratch the walls refuse to drink water except out of someone\'s glass or leave dead animals as gifts, and put toy mouse in food bowl run out of litter box at full speed . Run in circles intently stare at the same spot. Lounge in doorway. Walk on car leaving trail of paw prints on hood and windshield cat snacks. Refuse to drink water except out of someone\'s glass pelt around the house and up and down stairs chasing phantoms eat prawns daintily with a claw then lick paws clean wash down prawns with a lap of carnation milk then retire to the warmest spot on the couch to claw at the fabric before taking a catnap, so if it smells like fish eat as much as you wish or the dog smells bad. Leave hair everywhere meowzer! so chew iPad power cord, and poop on grasses yet sleep on dog bed, force dog to sleep on floor. Stare at wall turn and meow stare at wall some more meow again continue staring touch water with paw then recoil in horror spread kitty litter all over house but all of a sudden cat goes crazy chase laser instantly break out into full speed gallop across the house for no reason. Cat is love, cat is life. Sweet beast destroy the blinds pee in human\'s bed until he cleans the litter box, stare at wall turn and meow stare at wall some more meow again continue staring yet brown cats with pink ears and curl into a furry donut. Jump around on couch, meow constantly until given food, sit in box. Hide from vacuum cleaner human give me attention meow but has closed eyes but still sees you. Bathe private parts with tongue then lick owner\'s face lick butt love to play with owner\'s hair tie but poop in the plant pot for inspect anything brought into the house find something else more interesting. Mark territory mark territory stare out the window, but leave hair everywhere claws in your leg and get video posted to internet for chasing red dot. When in doubt, wash spot something, big eyes, big eyes, crouch, shake butt, prepare to pounce but hunt by meowing loudly at 5am next to human slave food dispenser. Meow for food, then when human fills food dish, take a few bites of food and continue meowing jump launch to pounce upon little yarn mouse, bare fangs at toy run hide in litter box until treats are fed hack up furballs. Eat and than sleep on your face pelt around the house and up and down stairs chasing phantoms but touch water with paw then recoil in horror meow chase mice. I like big cats and i can not lie meowing non stop for food, tuxedo cats always looking dapper or hack up furballs asdflkjaertvlkjasntvkjn (sits on keyboard). Mark territory attack the dog then pretend like nothing happened shake treat bag, rub face on everything, for damn that dog . Get video posted to internet for chasing red dot sniff other cat\'s butt and hang jaw half open thereafter unwrap toilet paper i like big cats and i can not lie yet present belly, scratch hand when stroked, so poop on grasses chew foot. Meow paw at beetle and eat it before it gets away, eat from dog\'s food sun bathe, but scratch leg; meow for can opener to feed me but spit up on light gray carpet instead of adjacent linoleum and the dog smells bad. Leave hair everywhere kitty power! , human is washing you why halp oh the horror flee scratch hiss bite hide from vacuum cleaner meow all night having their mate disturbing sleeping humans. Mark territory spread kitty litter all over house play riveting piece on synthesizer keyboard thug cat . Hopped up on catnip purr while eating but scream at teh bath, make meme, make cute face or lick plastic bags yet spit up on light gray carpet instead of adjacent linoleum. Hide head under blanket so no one can see.', 'Eat from dog\'s food. Paw at beetle and eat it before it gets away play time, yet meow chase ball of string has closed eyes but still sees you hide when guests come over, and have secret plans. White cat sleeps on a black shirt stretch destroy couch as revenge. Leave hair everywhere put toy mouse in food bowl run out of litter box at full speed but asdflkjaertvlkjasntvkjn (sits on keyboard) ears back wide eyed yet my left donut is missing, as is my right asdflkjaertvlkjasntvkjn (sits on keyboard), or stare at ceiling. Vommit food and eat it again sun bathe intently sniff hand, fall over dead (not really but gets sypathy) paw at beetle and eat it before it gets away, for meow under the bed.'];
     $status = ['lost', 'found', 'adoptable'];
     $age = ['baby', 'young', 'adult', 'senior'];
     $gender = ['male', 'female', 'unknown'];
     $a_num = ['342335', '234567', '234412', '123123', '123345', '345345'];
     $breeds = ['doberman', 'short hair', 'long hair', 'husky'];
     $images = explode("\n", trim(`ls public/img/uploads`));
     for ($i = 0; $i < $n; $i++) {
         if ($i % 10 == 0) {
             echo '.';
         }
         $pet = new Pet();
         $pet->name = $names[array_rand($names)];
         $pet->species_id = $species_ids[array_rand($species_ids)];
         $pet->status = $status[array_rand($status)];
         $pet->color = $colors[array_rand($colors)];
         $pet->age = $age[array_rand($age)];
         $pet->description = $descriptions[array_rand($descriptions)];
         $pet->gender = $gender[array_rand($gender)];
         $pet->a_num = $a_num[array_rand($a_num)];
         $pet->breed = $breeds[array_rand($breeds)];
         $pet->size_id = $size_ids[array_rand($size_ids)];
         $pet->user_id = $user_ids[array_rand($user_ids)];
         $pet->save();
         for ($j = 0; $j < 5; $j++) {
             $img = new Image();
             $img->pet_id = $pet->id;
             $img->img_path = '/img/uploads/' . $images[array_rand($images)];
             $img->save();
         }
     }
     echo "\n";
     $this->info('pets created!');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $product = Product::find($id);
     $departments = Department::all()->lists('name', 'id');
     $categories = Category::all()->lists('name', 'id');
     $brands = Brand::all()->lists('name', 'id');
     $sizes = Size::all()->lists('name', 'id');
     $colors = Color::all()->lists('name', 'id');
     return View::make('admin::products.edit', compact('product', 'departments', 'categories', 'brands', 'sizes', 'colors'));
 }
Example #7
0
 /**
  * Изменяет, x-координату ыерхнего левого угла
  *
  * @param int
  * @throws IllegalArgumentException
  */
 public function setLeft($left)
 {
     if (!is_int($left)) {
         throw new IllegalArgumentException();
     }
     if ($this->size->getWidth() > 0) {
         $this->setX($left);
     } else {
         $x = $left + $this->getWidth();
         $this->setX($x);
     }
 }
Example #8
0
 /**
  * Return standard class from this class
  * @return stdClass
  */
 public function toStdClass()
 {
     $stdClass = new stdClass();
     $stdClass->billOfLading = $this->_billOfLading;
     $stdClass->parcelId = $this->_parcelId;
     $stdClass->packId = $this->_packId;
     $stdClass->weight = $this->_weight;
     if (isset($this->_size)) {
         $stdClass->size = $this->_size->toStdClass();
     }
     $stdClass->foreignParcelNumber = $this->_foreignParcelNumber;
     return $stdClass;
 }
Example #9
0
 /**
  * Returns formated text according to box settings
  *
  * @return string
  */
 protected function format()
 {
     if ($this->isBoxed()) {
         $line = array();
         $lines = array();
         foreach ($this->getWords() as $word) {
             $linesize = $this->getCoreBoxSize(implode(' ', array_merge($line, array(trim($word)))));
             if ($linesize->getWidth() <= $this->box->getWidth()) {
                 $line[] = trim($word);
             } else {
                 $lines[] = implode(' ', $line);
                 $line = array(trim($word));
             }
         }
         $lines[] = trim(implode(' ', $line));
         return implode(PHP_EOL, $lines);
     }
 }
Example #10
0
 /**
  * Sets validator options
  *
  * Min limits the used diskspace for all files, when used with max=null it is the maximum filesize
  * It also accepts an array with the keys 'min' and 'max'
  *
  * @param  integer|array|\Zend\Config\Config $options Options for this validator
  * @return void
  */
 public function __construct($options)
 {
     $this->_files = array();
     $this->_setSize(0);
     if ($options instanceof \Zend\Config\Config) {
         $options = $options->toArray();
     } elseif (is_scalar($options)) {
         $options = array('max' => $options);
     } elseif (!is_array($options)) {
         throw new \Zend\Validator\Exception('Invalid options to validator provided');
     }
     if (1 < func_num_args()) {
         $argv = func_get_args();
         array_shift($argv);
         $options['max'] = array_shift($argv);
         if (!empty($argv)) {
             $options['bytestring'] = array_shift($argv);
         }
     }
     parent::__construct($options);
 }
Example #11
0
 /**
  * Return standard class from this class
  * @return stdClass
  */
 public function toStdClass()
 {
     $stdClass = new stdClass();
     $stdClass->billOfLading = $this->_billOfLading;
     $stdClass->takingDate = $this->_takingDate;
     $stdClass->serviceTypeId = $this->_serviceTypeId;
     $stdClass->officeToBeCalledId = $this->_officeToBeCalledId;
     if (isset($this->_optionsBeforePayment)) {
         $stdClass->optionsBeforePayment = $this->_optionsBeforePayment->toStdClass();
     }
     $stdClass->fixedTimeDelivery = $this->_fixedTimeDelivery;
     $stdClass->deferredDeliveryWorkDays = $this->_deferredDeliveryWorkDays;
     $stdClass->backDocumentsRequest = $this->_backDocumentsRequest;
     $stdClass->backReceiptRequest = $this->_backReceiptRequest;
     $stdClass->willBringToOffice = $this->_willBringToOffice;
     $stdClass->willBringToOfficeId = $this->_willBringToOfficeId;
     $stdClass->specialDeliveryId = $this->_specialDeliveryId;
     $stdClass->amountInsuranceBase = $this->_amountInsuranceBase;
     $stdClass->amountCodBase = $this->_amountCodBase;
     $stdClass->payCodToThirdParty = $this->_payCodToThirdParty;
     $stdClass->retMoneyTransferReqAmount = $this->_retMoneyTransferReqAmount;
     $stdClass->retThirdPartyPayer = $this->_retThirdPartyPayer;
     $stdClass->parcelsCount = $this->_parcelsCount;
     if (isset($this->_size)) {
         $stdClass->size = $this->_size->toStdClass();
     }
     $stdClass->weightDeclared = $this->_weightDeclared;
     $stdClass->contents = $this->_contents;
     $stdClass->packing = $this->_packing;
     $arrStdClassParamPackings = array();
     if (isset($this->_packings)) {
         if (is_array($this->_packings)) {
             for ($i = 0; $i < count($this->_packings); $i++) {
                 $arrStdClassParamPackings[$i] = $this->_packings[$i]->toStdClass();
             }
         } else {
             $arrStdClassParamPackings[0] = $this->_packings->toStdClass();
         }
     }
     $stdClass->packings = $arrStdClassParamPackings;
     $stdClass->packId = $this->_packId;
     $stdClass->documents = $this->_documents;
     $stdClass->fragile = $this->_fragile;
     $stdClass->palletized = $this->_palletized;
     if (isset($this->_sender)) {
         $stdClass->sender = $this->_sender->toStdClass();
     }
     if (isset($this->_receiver)) {
         $stdClass->receiver = $this->_receiver->toStdClass();
     }
     $stdClass->payerType = $this->_payerType;
     $stdClass->payerRefId = $this->_payerRefId;
     $stdClass->payerTypeInsurance = $this->_payerTypeInsurance;
     $stdClass->payerTypePackings = $this->_payerTypePackings;
     $stdClass->payerRefInsuranceId = $this->_payerRefInsuranceId;
     $stdClass->payerRefPackingsId = $this->_payerRefPackingsId;
     $stdClass->noteClient = $this->_noteClient;
     if (isset($this->_discCalc)) {
         $stdClass->discCalc = $this->_discCalc->toStdClass();
     }
     $stdClass->retToClientId = $this->_retToClientId;
     $stdClass->ref1 = $this->_ref1;
     $stdClass->ref2 = $this->_ref2;
     $stdClass->clientSystemId = $this->_clientSystemId;
     $arrStdClassParamParcelInfo = array();
     if (isset($this->_parcels)) {
         if (is_array($this->_parcels)) {
             for ($i = 0; $i < count($this->_parcels); $i++) {
                 $arrStdClassParamParcelInfo[$i] = $this->_parcels[$i]->toStdClass();
             }
         } else {
             $arrStdClassParamParcelInfo[0] = $this->_parcels->toStdClass();
         }
     }
     $stdClass->parcels = $arrStdClassParamParcelInfo;
     $stdClass->skipAutomaticParcelsCreation = $this->_skipAutomaticParcelsCreation;
     $stdClass->pendingParcelsDescription = $this->_pendingParcelsDescription;
     $stdClass->pendingShipmentDescription = $this->_pendingShipmentDescription;
     $arrStdClassParamReturnServiceRequest = array();
     if (isset($this->_retServicesRequest)) {
         if (is_array($this->_retServicesRequest)) {
             for ($i = 0; $i < count($this->_retServicesRequest); $i++) {
                 $arrStdClassParamReturnServiceRequest[$i] = $this->_retServicesRequest[$i]->toStdClass();
             }
         } else {
             $arrStdClassParamReturnServiceRequest[0] = $this->_retServicesRequest->toStdClass();
         }
     }
     $stdClass->retServicesRequest = $arrStdClassParamReturnServiceRequest;
     if (isset($this->_retShipmentRequest)) {
         $stdClass->retShipmentRequest = $this->_retShipmentRequest->toStdClass();
     }
     return $stdClass;
 }
Example #12
0
 /**
  * Displays the view for product stock.
  */
 public function getProductStock($id)
 {
     // Get the product.
     $product = Product::with('stock', 'colours')->findOrFail($id);
     // Get the sizes.
     $sizes = Size::all();
     // Get the stock.
     $stock = $product->stockToArray();
     // Render the view.
     return View::make('admin.products.stock', ['product' => $product, 'sizes' => $sizes, 'stock' => $stock]);
 }
Example #13
0
 private static function getViewModel()
 {
     return ['entityType' => ENTITY_QUOTE, 'account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels()];
 }
 private static function getViewModel()
 {
     $recurringHelp = '';
     foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
         $parts = explode("=>", $line);
         if (count($parts) > 1) {
             $line = $parts[0] . ' => ' . Utils::processVariables($parts[0]);
             $recurringHelp .= '<li>' . strip_tags($line) . '</li>';
         } else {
             $recurringHelp .= $line;
         }
     }
     return ['account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId())->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), 'frequencies' => array(1 => 'Weekly', 2 => 'Two weeks', 3 => 'Four weeks', 4 => 'Monthly', 5 => 'Three months', 6 => 'Six months', 7 => 'Annually'), 'recurringHelp' => $recurringHelp];
 }
 private static function getViewModel()
 {
     return ['sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'customLabel1' => Auth::user()->account->custom_client_label1, 'customLabel2' => Auth::user()->account->custom_client_label2];
 }
Example #16
0
 /**
  *
  * Вычитает из высоты и ширины размера координаты точки или
  * высоту и ширину другого размера и возвращает получившийся размер.
  *
  * @param Size $s
  * @param Size|Point $obj
  * @return Size
  * @throws IllegalArgumentException
  */
 public static function subtract(Size $s, $obj)
 {
     if ($obj instanceof Size) {
         return new Size($s->getWidth() - $obj->getWidth(), $s->getHeight() - $obj->getHeight());
     } else {
         if ($obj instanceof Point) {
             return new Size($s->getWidth() - $obj->getX(), $s->getHeigth() - $obj->getY());
         }
     }
     throw new IllegalArgumentException();
 }
 public function run()
 {
     // TEST DATA
     /*
     $contact = new Contact;
     $contact->first_name = 'Hillel';
     $contact->last_name = 'Hillel';
     $contact->email = '*****@*****.**';
     $contact->last_name = '2125551234';
     $client->contacts()->save($contact);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0001';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0002';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0003';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0004';
     $client->invoices()->save($invoice);
     */
     PaymentType::create(array('name' => 'Apply Credit'));
     PaymentType::create(array('name' => 'Bank Transfer'));
     PaymentType::create(array('name' => 'Cash'));
     PaymentType::create(array('name' => 'Debit'));
     PaymentType::create(array('name' => 'ACH'));
     PaymentType::create(array('name' => 'Visa Card'));
     PaymentType::create(array('name' => 'MasterCard'));
     PaymentType::create(array('name' => 'American Express'));
     PaymentType::create(array('name' => 'Discover Card'));
     PaymentType::create(array('name' => 'Diners Card'));
     PaymentType::create(array('name' => 'EuroCard'));
     PaymentType::create(array('name' => 'Nova'));
     PaymentType::create(array('name' => 'Credit Card Other'));
     PaymentType::create(array('name' => 'PayPal'));
     PaymentType::create(array('name' => 'Google Wallet'));
     PaymentType::create(array('name' => 'Check'));
     Theme::create(array('name' => 'amelia'));
     Theme::create(array('name' => 'cerulean'));
     Theme::create(array('name' => 'cosmo'));
     Theme::create(array('name' => 'cyborg'));
     Theme::create(array('name' => 'flatly'));
     Theme::create(array('name' => 'journal'));
     Theme::create(array('name' => 'readable'));
     Theme::create(array('name' => 'simplex'));
     Theme::create(array('name' => 'slate'));
     Theme::create(array('name' => 'spacelab'));
     Theme::create(array('name' => 'united'));
     Theme::create(array('name' => 'yeti'));
     InvoiceStatus::create(array('name' => 'Draft'));
     InvoiceStatus::create(array('name' => 'Sent'));
     InvoiceStatus::create(array('name' => 'Viewed'));
     InvoiceStatus::create(array('name' => 'Partial'));
     InvoiceStatus::create(array('name' => 'Paid'));
     Frequency::create(array('name' => 'Weekly'));
     Frequency::create(array('name' => 'Two weeks'));
     Frequency::create(array('name' => 'Four weeks'));
     Frequency::create(array('name' => 'Monthly'));
     Frequency::create(array('name' => 'Three months'));
     Frequency::create(array('name' => 'Six months'));
     Frequency::create(array('name' => 'Annually'));
     Industry::create(array('name' => 'Accounting & Legal'));
     Industry::create(array('name' => 'Advertising'));
     Industry::create(array('name' => 'Aerospace'));
     Industry::create(array('name' => 'Agriculture'));
     Industry::create(array('name' => 'Automotive'));
     Industry::create(array('name' => 'Banking & Finance'));
     Industry::create(array('name' => 'Biotechnology'));
     Industry::create(array('name' => 'Broadcasting'));
     Industry::create(array('name' => 'Business Services'));
     Industry::create(array('name' => 'Commodities & Chemicals'));
     Industry::create(array('name' => 'Communications'));
     Industry::create(array('name' => 'Computers & Hightech'));
     Industry::create(array('name' => 'Defense'));
     Industry::create(array('name' => 'Energy'));
     Industry::create(array('name' => 'Entertainment'));
     Industry::create(array('name' => 'Government'));
     Industry::create(array('name' => 'Healthcare & Life Sciences'));
     Industry::create(array('name' => 'Insurance'));
     Industry::create(array('name' => 'Manufacturing'));
     Industry::create(array('name' => 'Marketing'));
     Industry::create(array('name' => 'Media'));
     Industry::create(array('name' => 'Nonprofit & Higher Ed'));
     Industry::create(array('name' => 'Pharmaceuticals'));
     Industry::create(array('name' => 'Professional Services & Consulting'));
     Industry::create(array('name' => 'Real Estate'));
     Industry::create(array('name' => 'Retail & Wholesale'));
     Industry::create(array('name' => 'Sports'));
     Industry::create(array('name' => 'Transportation'));
     Industry::create(array('name' => 'Travel & Luxury'));
     Industry::create(array('name' => 'Other'));
     Industry::create(array('name' => 'Photography'));
     Size::create(array('name' => '1 - 3'));
     Size::create(array('name' => '4 - 10'));
     Size::create(array('name' => '11 - 50'));
     Size::create(array('name' => '51 - 100'));
     Size::create(array('name' => '101 - 500'));
     Size::create(array('name' => '500+'));
     PaymentTerm::create(array('num_days' => 7, 'name' => 'Net 7'));
     PaymentTerm::create(array('num_days' => 10, 'name' => 'Net 10'));
     PaymentTerm::create(array('num_days' => 14, 'name' => 'Net 14'));
     PaymentTerm::create(array('num_days' => 15, 'name' => 'Net 15'));
     PaymentTerm::create(array('num_days' => 30, 'name' => 'Net 30'));
     PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60'));
     PaymentTerm::create(array('num_days' => 90, 'name' => 'Net 90'));
     Currency::create(array('name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Euro', 'code' => 'EUR', 'symbol' => '€', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => 'SGD ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'));
     DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));
     DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013'));
     DatetimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013'));
     DatetimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm'));
     DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013'));
     DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013'));
     DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013'));
     DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013'));
     DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013'));
     DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
     DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'));
     PaymentLibrary::create(['name' => 'Omnipay']);
     PaymentLibrary::create(['name' => 'PHP-Payments']);
     /*	
     d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
     D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
     m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
     M, MM: Abbreviated and full month names, respectively. Eg, Jan, January
     yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.)
     */
     $gateways = [array('name' => 'Authorize.Net AIM', 'provider' => 'AuthorizeNet_AIM'), array('name' => 'Authorize.Net SIM', 'provider' => 'AuthorizeNet_SIM'), array('name' => 'CardSave', 'provider' => 'CardSave'), array('name' => 'Eway Rapid', 'provider' => 'Eway_Rapid'), array('name' => 'FirstData Connect', 'provider' => 'FirstData_Connect'), array('name' => 'GoCardless', 'provider' => 'GoCardless'), array('name' => 'Migs ThreeParty', 'provider' => 'Migs_ThreeParty'), array('name' => 'Migs TwoParty', 'provider' => 'Migs_TwoParty'), array('name' => 'Mollie', 'provider' => 'Mollie'), array('name' => 'MultiSafepay', 'provider' => 'MultiSafepay'), array('name' => 'Netaxept', 'provider' => 'Netaxept'), array('name' => 'NetBanx', 'provider' => 'NetBanx'), array('name' => 'PayFast', 'provider' => 'PayFast'), array('name' => 'Payflow Pro', 'provider' => 'Payflow_Pro'), array('name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay'), array('name' => 'PaymentExpress PxPost', 'provider' => 'PaymentExpress_PxPost'), array('name' => 'PayPal Express', 'provider' => 'PayPal_Express'), array('name' => 'PayPal Pro', 'provider' => 'PayPal_Pro'), array('name' => 'Pin', 'provider' => 'Pin'), array('name' => 'SagePay Direct', 'provider' => 'SagePay_Direct'), array('name' => 'SagePay Server', 'provider' => 'SagePay_Server'), array('name' => 'SecurePay DirectPost', 'provider' => 'SecurePay_DirectPost'), array('name' => 'Stripe', 'provider' => 'Stripe'), array('name' => 'TargetPay Direct eBanking', 'provider' => 'TargetPay_Directebanking'), array('name' => 'TargetPay Ideal', 'provider' => 'TargetPay_Ideal'), array('name' => 'TargetPay Mr Cash', 'provider' => 'TargetPay_Mrcash'), array('name' => 'TwoCheckout', 'provider' => 'TwoCheckout'), array('name' => 'WorldPay', 'provider' => 'WorldPay')];
     foreach ($gateways as $gateway) {
         Gateway::create($gateway);
     }
     $timezones = array('Pacific/Midway' => "(GMT-11:00) Midway Island", 'US/Samoa' => "(GMT-11:00) Samoa", 'US/Hawaii' => "(GMT-10:00) Hawaii", 'US/Alaska' => "(GMT-09:00) Alaska", 'US/Pacific' => "(GMT-08:00) Pacific Time (US &amp; Canada)", 'America/Tijuana' => "(GMT-08:00) Tijuana", 'US/Arizona' => "(GMT-07:00) Arizona", 'US/Mountain' => "(GMT-07:00) Mountain Time (US &amp; Canada)", 'America/Chihuahua' => "(GMT-07:00) Chihuahua", 'America/Mazatlan' => "(GMT-07:00) Mazatlan", 'America/Mexico_City' => "(GMT-06:00) Mexico City", 'America/Monterrey' => "(GMT-06:00) Monterrey", 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan", 'US/Central' => "(GMT-06:00) Central Time (US &amp; Canada)", 'US/Eastern' => "(GMT-05:00) Eastern Time (US &amp; Canada)", 'US/East-Indiana' => "(GMT-05:00) Indiana (East)", 'America/Bogota' => "(GMT-05:00) Bogota", 'America/Lima' => "(GMT-05:00) Lima", 'America/Caracas' => "(GMT-04:30) Caracas", 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)", 'America/La_Paz' => "(GMT-04:00) La Paz", 'America/Santiago' => "(GMT-04:00) Santiago", 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland", 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires", 'Greenland' => "(GMT-03:00) Greenland", 'Atlantic/Stanley' => "(GMT-02:00) Stanley", 'Atlantic/Azores' => "(GMT-01:00) Azores", 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.", 'Africa/Casablanca' => "(GMT) Casablanca", 'Europe/Dublin' => "(GMT) Dublin", 'Europe/Lisbon' => "(GMT) Lisbon", 'Europe/London' => "(GMT) London", 'Africa/Monrovia' => "(GMT) Monrovia", 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam", 'Europe/Belgrade' => "(GMT+01:00) Belgrade", 'Europe/Berlin' => "(GMT+01:00) Berlin", 'Europe/Bratislava' => "(GMT+01:00) Bratislava", 'Europe/Brussels' => "(GMT+01:00) Brussels", 'Europe/Budapest' => "(GMT+01:00) Budapest", 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen", 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana", 'Europe/Madrid' => "(GMT+01:00) Madrid", 'Europe/Paris' => "(GMT+01:00) Paris", 'Europe/Prague' => "(GMT+01:00) Prague", 'Europe/Rome' => "(GMT+01:00) Rome", 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo", 'Europe/Skopje' => "(GMT+01:00) Skopje", 'Europe/Stockholm' => "(GMT+01:00) Stockholm", 'Europe/Vienna' => "(GMT+01:00) Vienna", 'Europe/Warsaw' => "(GMT+01:00) Warsaw", 'Europe/Zagreb' => "(GMT+01:00) Zagreb", 'Europe/Athens' => "(GMT+02:00) Athens", 'Europe/Bucharest' => "(GMT+02:00) Bucharest", 'Africa/Cairo' => "(GMT+02:00) Cairo", 'Africa/Harare' => "(GMT+02:00) Harare", 'Europe/Helsinki' => "(GMT+02:00) Helsinki", 'Europe/Istanbul' => "(GMT+02:00) Istanbul", 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem", 'Europe/Kiev' => "(GMT+02:00) Kyiv", 'Europe/Minsk' => "(GMT+02:00) Minsk", 'Europe/Riga' => "(GMT+02:00) Riga", 'Europe/Sofia' => "(GMT+02:00) Sofia", 'Europe/Tallinn' => "(GMT+02:00) Tallinn", 'Europe/Vilnius' => "(GMT+02:00) Vilnius", 'Asia/Baghdad' => "(GMT+03:00) Baghdad", 'Asia/Kuwait' => "(GMT+03:00) Kuwait", 'Africa/Nairobi' => "(GMT+03:00) Nairobi", 'Asia/Riyadh' => "(GMT+03:00) Riyadh", 'Asia/Tehran' => "(GMT+03:30) Tehran", 'Europe/Moscow' => "(GMT+04:00) Moscow", 'Asia/Baku' => "(GMT+04:00) Baku", 'Europe/Volgograd' => "(GMT+04:00) Volgograd", 'Asia/Muscat' => "(GMT+04:00) Muscat", 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi", 'Asia/Yerevan' => "(GMT+04:00) Yerevan", 'Asia/Kabul' => "(GMT+04:30) Kabul", 'Asia/Karachi' => "(GMT+05:00) Karachi", 'Asia/Tashkent' => "(GMT+05:00) Tashkent", 'Asia/Kolkata' => "(GMT+05:30) Kolkata", 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu", 'Asia/Yekaterinburg' => "(GMT+06:00) Ekaterinburg", 'Asia/Almaty' => "(GMT+06:00) Almaty", 'Asia/Dhaka' => "(GMT+06:00) Dhaka", 'Asia/Novosibirsk' => "(GMT+07:00) Novosibirsk", 'Asia/Bangkok' => "(GMT+07:00) Bangkok", 'Asia/Jakarta' => "(GMT+07:00) Jakarta", 'Asia/Krasnoyarsk' => "(GMT+08:00) Krasnoyarsk", 'Asia/Chongqing' => "(GMT+08:00) Chongqing", 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong", 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur", 'Australia/Perth' => "(GMT+08:00) Perth", 'Asia/Singapore' => "(GMT+08:00) Singapore", 'Asia/Taipei' => "(GMT+08:00) Taipei", 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar", 'Asia/Urumqi' => "(GMT+08:00) Urumqi", 'Asia/Irkutsk' => "(GMT+09:00) Irkutsk", 'Asia/Seoul' => "(GMT+09:00) Seoul", 'Asia/Tokyo' => "(GMT+09:00) Tokyo", 'Australia/Adelaide' => "(GMT+09:30) Adelaide", 'Australia/Darwin' => "(GMT+09:30) Darwin", 'Asia/Yakutsk' => "(GMT+10:00) Yakutsk", 'Australia/Brisbane' => "(GMT+10:00) Brisbane", 'Australia/Canberra' => "(GMT+10:00) Canberra", 'Pacific/Guam' => "(GMT+10:00) Guam", 'Australia/Hobart' => "(GMT+10:00) Hobart", 'Australia/Melbourne' => "(GMT+10:00) Melbourne", 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby", 'Australia/Sydney' => "(GMT+10:00) Sydney", 'Asia/Vladivostok' => "(GMT+11:00) Vladivostok", 'Asia/Magadan' => "(GMT+12:00) Magadan", 'Pacific/Auckland' => "(GMT+12:00) Auckland", 'Pacific/Fiji' => "(GMT+12:00) Fiji");
     foreach ($timezones as $name => $location) {
         Timezone::create(array('name' => $name, 'location' => $location));
     }
 }
 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id];
         return View::make('accounts.details', $data);
     } else {
         if ($section == ACCOUNT_PAYMENTS) {
             $account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
             $accountGateway = null;
             $config = null;
             $configFields = null;
             $selectedCards = 0;
             if (count($account->account_gateways) > 0) {
                 $accountGateway = $account->account_gateways[0];
                 $config = $accountGateway->config;
                 $selectedCards = $accountGateway->accepted_credit_cards;
                 $configFields = json_decode($config);
                 foreach ($configFields as $configField => $value) {
                     $configFields->{$configField} = str_repeat('*', strlen($value));
                 }
             } else {
                 $accountGateway = AccountGateway::createNew();
                 $accountGateway->gateway_id = GATEWAY_MOOLAH;
             }
             $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '1')->orderBy('sort_order')->get();
             $recommendedGatewayArray = array();
             foreach ($recommendedGateways as $recommendedGateway) {
                 $arrayItem = array('value' => $recommendedGateway->id, 'other' => 'false', 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), 'data-siteUrl' => $recommendedGateway->site_url);
                 $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
             }
             $creditCardsArray = unserialize(CREDIT_CARDS);
             $creditCards = [];
             foreach ($creditCardsArray as $card => $name) {
                 if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
                 } else {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
                 }
             }
             $otherItem = array('value' => 1000000, 'other' => 'true', 'data-imageUrl' => '', 'data-siteUrl' => '');
             $recommendedGatewayArray['Other Options'] = $otherItem;
             $gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get();
             foreach ($gateways as $gateway) {
                 $paymentLibrary = $gateway->paymentlibrary;
                 $gateway->fields = $gateway->getFields();
                 if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
                     $accountGateway->fields = $gateway->fields;
                 }
             }
             $data = ['account' => $account, 'accountGateway' => $accountGateway, 'config' => $configFields, 'gateways' => $gateways, 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '0')->orderBy('name')->get(), 'recommendedGateways' => $recommendedGatewayArray, 'creditCardTypes' => $creditCards];
             return View::make('accounts.payments', $data);
         } else {
             if ($section == ACCOUNT_NOTIFICATIONS) {
                 $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
                 return View::make('accounts.notifications', $data);
             } else {
                 if ($section == ACCOUNT_IMPORT_EXPORT) {
                     return View::make('accounts.import_export');
                 } else {
                     if ($section == ACCOUNT_ADVANCED_SETTINGS) {
                         $data = ['account' => Auth::user()->account, 'feature' => $subSection];
                         if ($subSection == ACCOUNT_INVOICE_DESIGN) {
                             $invoice = new stdClass();
                             $client = new stdClass();
                             $invoiceItem = new stdClass();
                             $client->name = 'Sample Client';
                             $client->address1 = '';
                             $client->city = '';
                             $client->state = '';
                             $client->postal_code = '';
                             $client->work_phone = '';
                             $client->work_email = '';
                             $invoice->invoice_number = Auth::user()->account->getNextInvoiceNumber();
                             $invoice->invoice_date = date_create()->format('Y-m-d');
                             $invoice->account = json_decode(Auth::user()->account->toJson());
                             $invoice->amount = $invoice->balance = 100;
                             $invoiceItem->cost = 100;
                             $invoiceItem->qty = 1;
                             $invoiceItem->notes = 'Notes';
                             $invoiceItem->product_key = 'Item';
                             $invoice->client = $client;
                             $invoice->invoice_items = [$invoiceItem];
                             $data['invoice'] = $invoice;
                             $data['invoiceDesigns'] = InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId())->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get();
                         }
                         return View::make("accounts.{$subSection}", $data);
                     } else {
                         if ($section == ACCOUNT_PRODUCTS) {
                             $data = ['account' => Auth::user()->account];
                             return View::make('accounts.products', $data);
                         }
                     }
                 }
             }
         }
     }
 }
Example #19
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Size $value A Size object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Size $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Example #20
0
<?php

include 'model.php';
include 'connect.php';
session_start();
$crust = new Crust();
$personalinfo = new PersonalInfo();
$order = new Order();
$size = new Size();
$province = new Province();
$numberoftopping = count($_SESSION['topping']);
$province->setProvinceId($_SESSION['provinceid']);
$crust->setCrustId($_SESSION['crust']);
$size->setSizeId($_SESSION['size']);
$userid = rand();
$personalinfo->setUserId($userid);
$personalinfo->setFirstName($_SESSION['fname']);
$personalinfo->setLastName($_SESSION['lname']);
$personalinfo->setAddress($_SESSION['address']);
$personalinfo->setCity($_SESSION['city']);
$personalinfo->setProvinceId($_SESSION['provinceid']);
$personalinfo->setPostalCode($_SESSION['pcode']);
$personalinfo->setTelephone($_SESSION['telephone']);
$personalinfo->setEmailId($_SESSION['email']);
$uid = $personalinfo->getUserId();
$fname = $personalinfo->getFirstName();
$lname = $personalinfo->getLastName();
$address = $personalinfo->getAddress();
$city = $personalinfo->getCity();
$provid = $personalinfo->getProvinceId();
$postalcode = $personalinfo->getPostalCode();
Example #21
0
 /**
  * @dataProvider getFromContentData
  */
 public function testFromContent($content, $expected, $message)
 {
     $this->assertEquals($expected, Size::fromContent($content), $message);
 }
Example #22
0
 public function generateHTML()
 {
     return $this->context->getErrorHTML() . "<div class=\"centered\" style=\"width: 55%\">\n\t\t<form action=\"index.php?pageid=createAd\" method=\"POST\" enctype=\"multipart/form-data\">\n\t\t<div class=\"centered\">\n\t\t\t<br /><input name=\"exit109\" type=\"checkbox\" checked> Exit109 \n\t\t\t<input name=\"roctv\" type=\"checkbox\" checked> RocTv \n\t\t\t<input name=\"whim\" type=\"checkbox\" checked> Whim \n\t\t\t<input name=\"tartan\" type=\"checkbox\" checked> Tartan \n\t\t\t<input name=\"beehive\" type=\"checkbox\" checked> Beehive \n\t\t\t<input name=\"rfr\" type=\"checkbox\" checked> RFR\n\t\t\t<br />\n\t\t</div>\n\t\t<div style=\"float: left; text-align: left;\">\n\t\t\t<label for=\"name\" class=\"above\">Name</label>\n\t\t\t<input type=\"text\" name=\"name\" placeholder=\"Name\" class=\"bluefocus text\" tabindex=\"1\"\\>\n\t\t\t<label for=\"start\" class=\"above\">Starting Date</label>\n\t\t\t<input type=\"text\" readonly name=\"start\" placeholder=\"Starting Date\" class=\"bluefocus text date\" tabindex=\"3\"\\><br />\n\t\t\t<label for=\"start\" class=\"above\">Ending Date</label>\n\t\t\t<input type=\"text\" readonly name=\"end\" placeholder=\"Ending Date\" class=\"bluefocus text date\" tabindex=\"4\"\\><br /><br />\n\t\t\t<!--<input type=\"button\" name=\"selectimage\" value=\"Select Sample Image\" onclick=\"javascript:\$('#image').show();\$('#image').focus();\$('#image').click();\$('#image').hide();\" class=\"stdbutton bluefocus\" tabindex=\"4\">-->\n\t\t</div>\n\t\t<div style=\"float: right; text-align: right;\">\n\t\t\t<label for=\"name\" class=\"above\">Click Url</label>\n\t\t\t<input type=\"text\" name=\"url\" placeholder=\"Click Url\" class=\"bluefocus text\" tabindex=\"2\"\\>\n\t\t\t<label for=\"size\" class=\"above\">Size</label>\n\t\t\t" . Size::getSelectHTHL("size", 5) . "<br /><br />\n\t\t\t\n\t\t\t<input type=\"file\" name=\"image\" id=\"image\" style=\"\" tabindex=\"6\"/><br />\n\t\t\t<input type=\"submit\" value=\"Create\" class=\"stdbutton bluefocus\" tabindex=\"7\"/>\n\t\t</div>\n\t\t<input type=\"hidden\" name=\"action\" value=\"createAd\" />\n\t\t</form>\n\t\t\n\t\t</div>";
 }
Example #23
0
 /**
  * @param $action string
  * @param $sizeId int
  * @return nothing
  * @author Tremor
  */
 public function sizeAction($action, $sizeId = 0)
 {
     if (isset($sizeId) && !empty($sizeId) && !is_numeric($sizeId)) {
         return Redirect::to('admin/size');
     }
     switch ($action) {
         case 'add':
             $size = new Size();
             $size->save();
             $newId = $size->id;
             return Redirect::to('admin/size/' . $newId);
             break;
         case 'edit':
             $post = Input::except('_token');
             $affectedRows = Size::find($sizeId)->update($post);
             return Redirect::to('admin/size/' . $sizeId);
             break;
         case 'delete':
             $size = Size::find($sizeId);
             $size->delete();
             break;
         default:
             break;
     }
     return Redirect::to('admin/size');
 }
Example #24
0
 public function getAccount()
 {
     return View::make('brochure.my.account', ['user' => Auth::user(), 'sizes' => Size::all()]);
 }
Example #25
0
 private static function getViewModel()
 {
     return ['account' => Auth::user()->account, 'branches' => Branch::where('account_id', '=', Auth::user()->account_id)->where('id', Auth::user()->branch_id)->orderBy('public_id')->get(), 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'frequencies' => array(1 => 'Semanal', 2 => 'Cada 2 semanas', 3 => 'Cada 4 semanas', 4 => 'Mensual', 5 => 'Trimestral', 6 => 'Semestral', 7 => 'Anual')];
 }
Example #26
0
 /**
  * "Умное" создание миниатюр.
  *
  * @param int ширина
  * @param int высота
  * @param float коэффициент превышения.
  * @throws IllegalArgumentException
  * @return AcImage
  */
 public function thumbnail($width, $height, $c = 2)
 {
     if ($c <= 1 || !is_finite($c) || $width <= 0 || $height <= 0) {
         throw new IllegalArgumentException();
     }
     $size = new Size($width, $height);
     if ($this->getSize()->lessThen($size)) {
         $size = $this->getSize();
     }
     $imageSize = $this->getSize();
     $isRotate = false;
     if ($size->getWidth() / $imageSize->getWidth() <= $size->getHeight() / $imageSize->getHeight()) {
         $size->flip();
         $imageSize->flip();
         $isRotate = true;
     }
     $width = $size->getWidth();
     $height = $size->getHeight();
     $imageWidth = $imageSize->getWidth();
     $imageHeight = $imageSize->getHeight();
     $lim = (int) ($c * $height);
     $newHeight = (int) ($imageHeight * $width / $imageWidth);
     if ($imageWidth > $width) {
         if ($newHeight <= $lim) {
             $size = new Size($width, $newHeight);
         } else {
             if ($newHeight <= 2 * $lim) {
                 $size = new Size((int) ($imageWidth * $lim / $imageHeight), $lim);
             } else {
                 $size = new Size((int) ($width / 2), (int) ($imageHeight * $width / $imageWidth));
             }
         }
     } else {
         if ($imageHeight <= $lim) {
             $size = $this->getSize();
         } else {
             if ($imageHeight <= 2 * $lim) {
                 if ($imageWidth * $lim / $imageHeight >= $width / 2) {
                     $size = new Size((int) ($imageWidth * $lim / $imageHeight), $lim);
                 } else {
                     $size = new Size((int) ($width / 2), (int) ($imageHeight * $width / ($imageWidth * 2)));
                 }
             } else {
                 $size = new Size((int) ($width / 2), (int) ($imageHeight * $width / ($imageWidth * 2)));
             }
         }
     }
     if ($isRotate) {
         $size->flip();
         $imageSize->flip();
     }
     return $this->resize($size);
 }
 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get()];
         return View::make('accounts.details', $data);
     } else {
         if ($section == ACCOUNT_PAYMENTS) {
             $account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
             $accountGateway = null;
             $config = null;
             $configFields = null;
             $selectedCards = 0;
             if (count($account->account_gateways) > 0) {
                 $accountGateway = $account->account_gateways[0];
                 $config = $accountGateway->config;
                 $selectedCards = $accountGateway->accepted_credit_cards;
                 $configFields = json_decode($config);
                 foreach ($configFields as $configField => $value) {
                     $configFields->{$configField} = str_repeat('*', strlen($value));
                 }
             }
             $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '1')->orderBy('sort_order')->get();
             $recommendedGatewayArray = array();
             foreach ($recommendedGateways as $recommendedGateway) {
                 $arrayItem = array('value' => $recommendedGateway->id, 'other' => 'false', 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), 'data-siteUrl' => $recommendedGateway->site_url);
                 $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
             }
             $creditCardsArray = unserialize(CREDIT_CARDS);
             $creditCards = [];
             foreach ($creditCardsArray as $card => $name) {
                 if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
                 } else {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
                 }
             }
             $otherItem = array('value' => 1000000, 'other' => 'true', 'data-imageUrl' => '', 'data-siteUrl' => '');
             $recommendedGatewayArray['Other Options'] = $otherItem;
             $data = ['account' => $account, 'accountGateway' => $accountGateway, 'config' => $configFields, 'gateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '0')->orderBy('name')->get(), 'recommendedGateways' => $recommendedGatewayArray, 'creditCardTypes' => $creditCards];
             foreach ($data['gateways'] as $gateway) {
                 $paymentLibrary = $gateway->paymentlibrary;
                 $gateway->fields = $gateway->getFields();
                 if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
                     $accountGateway->fields = $gateway->fields;
                 }
             }
             return View::make('accounts.payments', $data);
         } else {
             if ($section == ACCOUNT_NOTIFICATIONS) {
                 $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
                 return View::make('accounts.notifications', $data);
             } else {
                 if ($section == ACCOUNT_IMPORT_EXPORT) {
                     return View::make('accounts.import_export');
                 } else {
                     if ($section == ACCOUNT_ADVANCED_SETTINGS) {
                         $data = ['account' => Auth::user()->account, 'feature' => $subSection];
                         return View::make("accounts.{$subSection}", $data);
                     } else {
                         if ($section == ACCOUNT_PRODUCTS) {
                             $data = ['account' => Auth::user()->account];
                             return View::make('accounts.products', $data);
                         }
                     }
                 }
             }
         }
     }
 }
Example #28
0
 /** Creates bill of loading
  * @param $data
  * @param $order
  * @return array
  */
 public function createBillOfLading($data, $order)
 {
     require_once __DIR__ . '/lib/speedy-eps-lib/ver01/ParamCalculation.class.php';
     $this->_error = '';
     $bol = array();
     if (isset($this->resultLogin)) {
         try {
             $sender = new \ParamClientData();
             $sender->setClientId($this->resultLogin->getClientId());
             if ($this->config->get('speedy_telephone')) {
                 $senderPhone = new \ParamPhoneNumber();
                 $senderPhone->setNumber($this->config->get('speedy_telephone'));
                 $sender->setPhones(array(0 => $senderPhone));
             }
             $receiverAddress = new \ParamAddress();
             $receiverAddress->setSiteId($data['city_id']);
             if ($data['quarter']) {
                 $receiverAddress->setQuarterName($data['quarter']);
             }
             if ($data['quarter_id']) {
                 $receiverAddress->setQuarterId($data['quarter_id']);
             }
             if ($data['street']) {
                 $receiverAddress->setStreetName($data['street']);
             }
             if ($data['street_id']) {
                 $receiverAddress->setStreetId($data['street_id']);
             }
             if ($data['street_no']) {
                 $receiverAddress->setStreetNo($data['street_no']);
             }
             if ($data['block_no']) {
                 $receiverAddress->setBlockNo($data['block_no']);
             }
             if ($data['entrance_no']) {
                 $receiverAddress->setEntranceNo($data['entrance_no']);
             }
             if ($data['floor_no']) {
                 $receiverAddress->setFloorNo($data['floor_no']);
             }
             if ($data['apartment_no']) {
                 $receiverAddress->setApartmentNo($data['apartment_no']);
             }
             if ($data['note']) {
                 $receiverAddress->setAddressNote($data['note']);
             }
             $receiver = new \ParamClientData();
             $receiver->setPartnerName($order['firstname'] . ' ' . $order['lastname']);
             $receiverPhone = new \ParamPhoneNumber();
             $receiverPhone->setNumber($order['telephone']);
             $receiver->setPhones(array(0 => $receiverPhone));
             $receiver->setEmail($order['email']);
             $picking = new \ParamPicking();
             $picking->setClientSystemId(1310221100);
             //OpenCart
             $picking->setRef1($order['order_id']);
             if ($data['depth'] || $data['height'] || $data['width']) {
                 $size = new Size();
                 if ($data['depth']) {
                     $size->setDepth($data['depth']);
                 }
                 if ($data['height']) {
                     $size->setHeight($data['height']);
                 }
                 if ($data['width']) {
                     $size->setWidth($data['width']);
                 }
                 $picking->setSize($size);
             }
             if (!empty($data['fixed_time'])) {
                 $picking->setFixedTimeDelivery($data['fixed_time']);
             }
             $picking->setServiceTypeId($data['shipping_method_id']);
             if ($data['to_office'] && $data['office_id']) {
                 $picking->setOfficeToBeCalledId($data['office_id']);
             } else {
                 $receiver->setAddress($receiverAddress);
                 $picking->setOfficeToBeCalledId(null);
             }
             $picking->setBackDocumentsRequest($this->config->get('speedy_back_documents'));
             $picking->setBackReceiptRequest($this->config->get('speedy_back_receipt'));
             if ($this->config->get('speedy_from_office') && $this->config->get('speedy_office_id')) {
                 $picking->setWillBringToOffice(true);
                 $picking->setWillBringToOfficeId($this->config->get('speedy_office_id'));
             } else {
                 $picking->setWillBringToOffice(false);
             }
             $picking->setParcelsCount($data['count']);
             $picking->setWeightDeclared($data['weight']);
             $picking->setContents($data['contents']);
             $picking->setPacking($data['packing']);
             $picking->setPackId(null);
             $picking->setDocuments($this->config->get('speedy_documents'));
             $picking->setPalletized(false);
             $payerType = $this->getPayerType($order['order_id'], $data['shipping_method_cost']);
             if ($data['insurance']) {
                 if ($data['fragile']) {
                     $picking->setFragile(true);
                 } else {
                     $picking->setFragile(false);
                 }
                 $picking->setAmountInsuranceBase($data['totalNoShipping']);
                 /*
                                     if ($this->config->get('speedy_pricing') == 'free' || $this->config->get('speedy_pricing') == 'fixed') {
                                         $picking->setPayerTypeInsurance($payerType);
                                     } else {
                                         $picking->setPayerTypeInsurance($payerType);
                                     } */
                 $picking->setPayerTypeInsurance($payerType);
             } else {
                 $picking->setFragile(false);
             }
             $picking->setSender($sender);
             $picking->setReceiver($receiver);
             /*
                             if ($this->config->get('speedy_pricing') == 'free' || $this->config->get('speedy_pricing') == 'fixed') {
                                 $picking->setPayerType($payerType);
                             } else {
                                   $picking->setPayerType($payerType);
                             }
             */
             $picking->setPayerType($payerType);
             $picking->setTakingDate($data['taking_date']);
             if ($data['deffered_days']) {
                 $picking->setDeferredDeliveryWorkDays($data['deffered_days']);
             }
             if ($data['client_note']) {
                 $picking->setNoteClient($data['client_note']);
             }
             if ($data['cod']) {
                 $picking->setAmountCodBase($data['total']);
             } else {
                 $picking->setAmountCodBase(0);
             }
             $result = $this->ePSFacade->createBillOfLading($picking);
             $parcels = $result->getGeneratedParcels();
             $bol['bol_id'] = $parcels[0]->getParcelId();
             $bol['total'] = $result->getAmounts()->getTotal();
         } catch (\Exception $e) {
             $this->_error = $e->getMessage();
             $this->log->addError('Speedy :: createBillOfLading :: ' . $e->getMessage());
         }
     }
     return $bol;
 }
Example #29
0
 public function deletetshirtsizeAction()
 {
     $this->_helper->layout()->disableLayout();
     global $mySession;
     $db = new Db();
     $sizeModel = new Size();
     $ids = $this->getRequest()->getParam('ids');
     $idArray = explode("|", $ids);
     if ($ids != "" && count($idArray)) {
         foreach ($idArray as $key => $id) {
             $sizeModel->removeSize((int) $id);
         }
         echo "true";
     } else {
         echo "false";
     }
     exit;
 }
 private static function getViewModel()
 {
     return ['account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels(), 'frequencies' => array(1 => 'Weekly', 2 => 'Two weeks', 3 => 'Four weeks', 4 => 'Monthly', 5 => 'Three months', 6 => 'Six months', 7 => 'Annually')];
 }