Пример #1
0
 public function formAction()
 {
     $reservationDetails = RM_Reservation_Manager::getInstance()->getAllDetails();
     $reservationsModel = new RM_Reservations();
     $unitModel = new RM_Units();
     $lang = RM_Environment::getInstance()->getLocale();
     //$chargetotal = 0;
     $bookingref = RM_Reservation_Manager::getInstance()->getReservationID();
     // create the description text
     $description = $bookingref . ": ";
     $count = 1;
     foreach ($reservationDetails as $details) {
         $unit = $details->getUnit();
         $period = $details->getPeriod();
         $unit_details = $unitModel->get($unit->getId(), $lang);
         $description .= $this->_translate->_('User.PayPal.Main', 'Selection') . " " . $count . "(" . $unit_details->name . " (" . $unit->getId() . ") " . $period->getStart() . " " . $this->_translate->_('User.PayPal.Main', 'To') . " " . $period->getEnd() . ")";
         $count += 1;
     }
     $plugin = new RM_Plugin_PayPal();
     $chargetotal = $plugin->getTotalPrice($reservationsModel->find($bookingref)->current());
     RM_Reservation_Manager::getInstance()->setPaymentTotal($chargetotal);
     $provider = new RM_Plugin_PayPal();
     $result = $provider->initialize($description, $bookingref, $chargetotal);
     $this->view->fields = $provider->getFields();
     $this->view->paypal_url = $provider->getPaypalURL();
     // return the json data so that the submit form can be rendered to pass this to paypal
 }
Пример #2
0
 /**
  * Return name of the extra
  *
  * @param string $iso ISO code
  * @return string
  */
 public function getName($iso = null)
 {
     if ($iso == null) {
         $iso = RM_Environment::getInstance()->getLocale();
     }
     return $this->{$iso};
 }
Пример #3
0
 /**
  * Return all language constants in javascript format for later use on the GUI.
  *
  * @return    string javascript code with all language constants
  */
 public static function getConstants()
 {
     $adapter = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN)->getAdapter();
     $messages = $adapter->getMessages(RM_Environment::getInstance()->getLocale());
     $originalMessages = $adapter->getMessages('en_GB');
     $js = "RM.Translate = {};\n";
     $nameSpaces = array();
     $nameSpaces[] = 'RM.Translate';
     foreach ($originalMessages as $section => $originalMessage) {
         $sectionChunks = explode('.', $section);
         $messageConstantName = $sectionChunks[count($sectionChunks) - 1];
         unset($sectionChunks[count($sectionChunks) - 1]);
         $nameSpace = 'RM.Translate';
         foreach ($sectionChunks as $chunk) {
             $nameSpace .= ".{$chunk}";
             if (in_array($nameSpace, $nameSpaces) == false) {
                 $nameSpaces[] = $nameSpace;
                 $js .= "{$nameSpace} = {};\n";
             }
         }
         $realSectionName = implode('.', $sectionChunks);
         if (isset($messages[$section])) {
             $message = $messages[$section];
         } else {
             $message = $originalMessage;
         }
         if (strpos($realSectionName, '.JSON') !== false) {
             $js .= "RM.Translate.{$realSectionName}.{$messageConstantName} = " . $message . ";\n";
         } else {
             $js .= "RM.Translate.{$realSectionName}.{$messageConstantName} = '" . addslashes($message) . "';\n";
         }
     }
     return $js;
 }
Пример #4
0
 function editJsonAction()
 {
     $formID = $this->_getParam('formID');
     $formModel = new RM_Forms();
     $form = $formModel->find($formID)->current();
     // check if there are any units
     $unitDAO = new RM_Units();
     $unitTypeID = $this->_getParam('unitTypeID');
     if ($unitTypeID === null) {
         return array('data' => "{ 'error': true }", 'encoded' => true);
     }
     $unitTypeModel = new RM_UnitTypes();
     $unitType = $unitTypeModel->find($unitTypeID)->current();
     $total = $unitDAO->getAll(new RM_Unit_Search_Criteria(array('type' => $unitType)))->count();
     if ($unitTypeID == RM_UnitTypes::DEFAULT_TYPE && $total == 0) {
         $total = $unitDAO->getAll(new RM_Unit_Search_Criteria())->count();
     }
     if ($total == 0) {
         return array('data' => "{ 'error': true }", 'encoded' => true);
     }
     $panelModel = new RM_FormPanels();
     $panels = $panelModel->fetchByForm($formID);
     $jsonPanels = array();
     foreach ($panels as $panel) {
         $jsonPanels[] = '{id : "' . $panel->id . '", name : "' . $panel->name . '"}';
     }
     $unitTypeFormModel = new RM_UnitTypeForms();
     $unitTypeForm = $unitTypeFormModel->fetchBy($form, $unitType);
     $json = "{\n            formID: '" . $formID . "',\n            formName: '" . $form->name . "',\n            columns: " . $unitTypeForm->columns . ",\n            max_columns: " . $form->max_columns . ",\n            column1width: " . $unitTypeForm->column1width . ",\n            column2width: " . $unitTypeForm->column2width . ",\n            column3width: " . $unitTypeForm->column3width . ",\n            panels: [" . implode(',', $jsonPanels) . "],\n            formState: " . $unitTypeForm->state . ",\n            unitTypeID: {$unitTypeID},\n            unitTypeName: '" . $unitType->getName(RM_Environment::getInstance()->getLocale()) . "'\n        }";
     return array('data' => $json, 'encoded' => true);
 }
Пример #5
0
 /**
  * This method for internal use, for checking translation
  * @example
  * administrator/index.php?option=com_resmania&act=Language&task=testJson&main=en&test=ru&type=rm_translate_main
  * it will combine 2 language no admin end and will check what language constants are in 'en' but not in 'ru' translation
  * the same method is also for user end
  */
 public function testJsonAction()
 {
     ob_clean();
     $type = $this->_getParam('type', RM_Environment::TRANSLATE_MAIN);
     $adapter = RM_Environment::getInstance()->getTranslation($this->_getParam('type', $type))->getAdapter();
     $enMessages = $adapter->getMessages($this->_getParam('main', 'en_GB'));
     $ruMessages = $adapter->getMessages($this->_getParam('test', 'ru_RU'));
     $diffMessages = array();
     foreach ($enMessages as $key => $value) {
         list($name, $section) = $this->_parseKey($key);
         if (isset($ruMessages[$key]) == false || $ruMessages[$key] == $enMessages[$key]) {
             if (isset($diffMessages[$section]) == false) {
                 $diffMessages[$section] = array();
             }
             $diffMessages[$section][$name] = $value;
         }
     }
     foreach ($diffMessages as $section => $messages) {
         echo "[" . $section . "] <br/>";
         foreach ($messages as $key => $value) {
             echo "{$key}=\"\" ;" . $value . " <br/>";
         }
         echo "<br/>";
     }
     die;
 }
Пример #6
0
 function validate(RM_Module_Config $config)
 {
     if (isset($config->information['name']) === false) {
         $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_ERRORS);
         throw new RM_Exception($translate->_('RM.Module.Config.Validator', 'NoModuleName'));
     }
     return true;
 }
Пример #7
0
 function getAllAssigned($language = null)
 {
     if ($language == null) {
         $language = RM_Environment::getInstance()->getLocale();
     }
     $sql = "\r\n        SELECT u.id, u." . $language . ", ut.type_id\r\n        FROM rm_unit_types u\r\n        JOIN rm_units ut\r\n        ";
     return $this->_getBySQL($sql);
 }
Пример #8
0
 public function getadminmapAction()
 {
     // do a quick net check
     $parsed = parse_url('http://maps.google.com/maps');
     $host = $parsed["host"];
     $fp = @fsockopen($host, 80, $errno, $errstr, 20);
     if (!$fp) {
         $this->view->error = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_ERRORS)->_('Admin.GMaps.Errors', 'ConnectionError');
     } else {
         $this->view->error = 'false';
         // get the unit information
         ob_clean();
         $unitID = $this->_getParam('unit_id');
         $locationsModel = new RM_Locations();
         $location = $locationsModel->fetchByUnit($unitID)->toArray();
         if (!empty($location)) {
             $location = $location[0];
             // get the coordinates
             $coordinates = new stdClass();
             // set default map center points...
             if (empty($location['longitude']) || empty($location['latitude'])) {
                 $location['longitude'] = 150.644;
                 $location['latitude'] = -34.397;
             }
             $coordinates->longitude = $location['longitude'];
             $coordinates->latitude = $location['latitude'];
             $this->view->coordinates = $coordinates;
             // construct the address for GMAPs to use
             $address = "";
             if ($location['address1']) {
                 $address .= $location['address1'];
             }
             if ($location['address2']) {
                 $address .= ", " . $location['address2'];
             }
             if ($location['city']) {
                 $address .= ", " . $location['city'];
             }
             if ($location['address1']) {
                 $address .= ", " . $location['state'];
             }
             if ($location['address1']) {
                 $address .= ", " . $location['postcode'];
             }
             if ($location['address1']) {
                 $address .= ", " . $location['country'];
             }
             $this->view->address = $address;
         }
         // gmaps settings
         $settingsObj = new RM_GMaps();
         $settings = $settingsObj->getSettings()->toArray();
         $this->view->settings = $settings[0];
     }
     // call the view
     echo $this->view->render('GMaps/adminmap.phtml');
     die;
 }
Пример #9
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN);
     $this->setTranslator($translate);
     $this->setMethod('post');
     $this->setDecorators(array('FormElements', array('TabContainer', array('id' => 'tabContainer', 'style' => 'width: 600px; height: 500px;', 'dijitParams' => array('tabPosition' => 'top'))), 'DijitForm'));
     $this->addElement('HorizontalSlider', 'horizontal', array('label' => 'HorizontalSlider', 'value' => 5, 'minimum' => -10, 'maximum' => 10, 'discreteValues' => 5, 'intermediateChanges' => true, 'showButtons' => true, 'topDecorationDijit' => 'HorizontalRuleLabels', 'topDecorationContainer' => 'topContainer'));
     $this->addElement('editor', 'content', array('plugins' => array('undo', '|', 'bold', 'italic'), 'editActionInterval' => 2, 'focusOnLoad' => true, 'height' => '250px', 'inheritWidth' => true, 'styleSheets' => array('/js/custom/editor.css')));
 }
Пример #10
0
 function getTitle($iso = null)
 {
     $titles = Zend_Json::decode(str_replace("'", '"', RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN)->_('Common.JSON', 'Titles')));
     foreach ($titles as $title) {
         if ($this->title == $title['id']) {
             return $title['title'];
         }
     }
     return '';
 }
Пример #11
0
 /**
  * @return string
  */
 public function __toString()
 {
     $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN);
     $value = $this->_getValue();
     if (is_array($value)) {
         return sprintf($translate->_('Admin.Dependency', 'INIDependencyMultiple'), $this->_getName(), implode(", ", $value));
     } else {
         return sprintf($translate->_('Admin.Dependency', 'INIDependency'), $this->_getName(), $value);
     }
 }
Пример #12
0
 private function _initTotalPrice()
 {
     $priceSystem = RM_Environment::getInstance()->getPriceSystem();
     $information = new RM_Prices_Information($this->_unit, $this->_period, $this->_persons, $this->_otherInfo);
     try {
         $this->_total = $priceSystem->getTotalUnitPrice($information);
     } catch (Exception $e) {
         $this->_total = 0;
     }
 }
Пример #13
0
 protected function _getUpgradeURL($extensionName)
 {
     $config = new RM_Config();
     $licenseKey = $config->getValue('rm_config_licensekey');
     if ($licenseKey == "") {
         return false;
     }
     $sourceFile = RM_Environment::getInstance()->getDistroURL() . "d.php?d=" . base64_encode('{"d": "' . $_SERVER['SERVER_NAME'] . '", "l": "' . $licenseKey . '", "v":"0", "p": "' . $extensionName . '", "qt": "validate"}');
     return $sourceFile;
 }
Пример #14
0
 /**
  * Return dependency object by it's database row representation
  *
  * @param RM_Dependency_Row $row
  * @return RM_Dependency_Abstract
  * @throw RM_Exception if dependency class name not exists
  */
 private function _getDependencyInstance($row)
 {
     $type = $row->parent_type;
     $className = 'RM_Dependency_' . ucfirst(strtolower($type));
     if (!class_exists($className)) {
         $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN);
         throw new RM_Exception($translate->_('Admin.Dependencies', 'WrongDependencyClassName'));
     }
     return new $className($row);
 }
Пример #15
0
 public function isRestricted(RM_Plugin_Row $plugin)
 {
     if ($plugin->module_name != $this->name) {
         return false;
     }
     $currentActive = $this->getAllPlugins(true)->count();
     if ($plugin->enabled == 1 && $currentActive <= 1) {
         throw new RM_Exception(RM_Environment::getInstance()->getTranslation()->_('Admin.Payments.Restriction', 'LastError'));
     }
     return false;
 }
Пример #16
0
 /**
  * This method internally return total reservation due for payment
  * There could be a deposit system installed and enabled
  *
  * @deprecated
  * @param RM_Reservation_Row $reservation
  * @return float
  */
 public function getTotalPrice(RM_Reservation_Row $reservation)
 {
     $totalPrice = $reservation->getTotalPrice();
     $depositSystem = RM_Environment::getInstance()->getDepositSystem();
     if ($depositSystem == null) {
         return $totalPrice;
     }
     if ($depositSystem->isDepositUsedFor($reservation->id)) {
         return $depositSystem->calculate($totalPrice);
     }
     return $totalPrice;
 }
Пример #17
0
 function validate(RM_Plugin_Config $config)
 {
     if (isset($config->information['name']) === false) {
         $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_ERRORS);
         throw new RM_Exception($translate->_('RM.Plugin.Config.Validator', 'NoPluginName'));
     }
     //TODO: checkk all files that needed in zip folder
     //SQL install
     //SQL uninstall
     //Main class
     return true;
 }
Пример #18
0
 /**
  * Returns array of translated error messages
  *
  * @param array $errors
  * @param string $locale
  * @return array
  */
 public function getErrorMessages($errors, $locale = null)
 {
     $errorMessages = array();
     $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_ERRORS);
     if (!is_array($errors)) {
         $errors = array($errors);
     }
     foreach ($errors as $errormsg) {
         $errorMessages[] = $translate->_('User.Form.' . ucfirst($this->id) . '.Validation', $errormsg, $locale);
     }
     return $errorMessages;
 }
Пример #19
0
 /**
  * Returns all translated periods.
  *
  * @param Zend_Translate $translate OPTIONAL If don't provide method will use default one from Zend_Registry
  * @return array
  */
 public static function getAllTranslated($translate = null)
 {
     if ($translate == null) {
         $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN);
     }
     $section = self::languageSection;
     $result = array();
     foreach (self::$periods as $id => $name) {
         $result[$id] = $translate->_($section, $name);
     }
     return $result;
 }
Пример #20
0
 /**
  * Returns all countries and cities in this format
  * <ISO country code> => array(
  *  'iso' => 'country_ico'
  *  'name' => 'country_name'
  *  'cities' => array(
  *   'pk' => 'city_name', //'pk' = en cityname, 'cityname' = name of city in selected locale
  *   ...
  *  )
  * )
  * ...
  *
  * @param $locale string - iso name of the locale
  * @return array or null, null if there is no such language file.
  */
 public static function getAll($locale = null)
 {
     if ($locale == null) {
         $locale = RM_Environment::getInstance()->getLocale();
     }
     if (self::$_locations[$locale] == null) {
         $locations = self::_load($locale);
         if (!$locations) {
             return null;
         }
         self::$_locations[$locale] = $locations;
     }
     return self::$_locations[$locale];
 }
Пример #21
0
 function listallAction()
 {
     ob_clean();
     $uid = $this->_getParam('uid');
     $unitModel = new RM_Units();
     $language = RM_Environment::getInstance()->getLocale();
     $unit = $unitModel->get($uid, $language);
     $priceObj = new RM_UnitDailyPrices();
     $prices = $priceObj->getCurrent($unit)->toArray();
     $this->view->unit = $unit;
     $this->view->prices = $prices;
     echo $this->view->render('DailyPrices/listall.phtml');
     die;
 }
Пример #22
0
 /**
  * Recalculate all reservation extras information. Important!!!
  * this method need to be extended if we will add some other system that are affected reservation price. 
  */
 public function recalculate()
 {
     $extrasSystems = RM_Environment::getInstance()->getExtrasSystems();
     foreach ($extrasSystems as $extrasSystem) {
         $extrasSystem->recalculate($this);
     }
     $othersSystems = RM_Environment::getInstance()->getOthersSystems();
     foreach ($othersSystems as $othersSystem) {
         $othersSystem->recalculate($this);
     }
     $discountsSystems = RM_Environment::getInstance()->getDiscounts();
     foreach ($discountsSystems as $system) {
         $system->recalculate($this);
     }
     RM_Environment::getInstance()->getTaxSystem()->recalculate($this);
 }
Пример #23
0
 /**
  * this returns the saved price information for a reservation
  *
  * @param  	string  $reservationID
  * @return 	object	a complete price breakdown.
  */
 public function getPrice($reservationID)
 {
     // TODO: we will need to add code to dynamically check modules and plugins that
     // have code that adds prices/charges in order to dynamcially check any saved
     // prices that have been charged to customers
     if (!isset($reservationID)) {
         return false;
     }
     $reservationModel = new RM_Reservations();
     $reservation = $reservationModel->find($reservationID)->current();
     $priceObj = new stdClass();
     $priceObj->tax = RM_Environment::getInstance()->getTaxSystem()->getTotalTaxes($reservation);
     $priceObj->total = $reservation->getTotalPrice();
     $priceObj->subtotal = $priceObj->total - $priceObj->tax;
     return $priceObj;
 }
Пример #24
0
 /**
  * Parsed ini file into config object
  *
  * @param string $filepath Physical path to ini config file
  * @return RM_Language_Config
  * @throws RM_Exception If ini file have wrong format or validation fails
  */
 function getConfig($filepath)
 {
     $configArray = parse_ini_file($filepath);
     if ($configArray === false) {
         $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_ERRORS);
         throw new RM_Exception($translate->_('RM.Language.Config.Parser', 'InvalidIniFileFormat'));
     }
     $config = new RM_Language_Config();
     foreach ($configArray as $key => $value) {
         $config->{$key} = $value;
     }
     if ($config->validate() == false) {
         $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_ERRORS);
         throw new RM_Exception($translate->_('RM.Language.Config.Parser', 'InvalidIniFileFormat'));
     }
     return $config;
 }
Пример #25
0
 /**
  * Calculate
  *
  * @param RM_Discounts_Row $row
  * @param float $amount
  * @return float
  */
 public function calculate(RM_Reservation_Details $detail)
 {
     $discountPeriod = $this->_discount->getPeriod();
     $totalDiscount = 0;
     $discountPercentage = $this->_discount->amount;
     $priceSystem = RM_Environment::getInstance()->getPriceSystem();
     try {
         $priceDays = $priceSystem->getTotalUnitPrice(new RM_Prices_Information($detail->getUnit(), $detail->getPeriod(), $detail->getPersons()), true);
     } catch (RM_Exception $e) {
         $priceDays = 0;
     }
     foreach ($priceDays as $day) {
         if ($discountPeriod->isInternal($day['step'])) {
             $discountedPrice = $day['price'];
             $totalDiscount += $day['price'] / 100 * $discountPercentage;
         }
     }
     return RM_Environment::getInstance()->roundPrice($totalDiscount);
 }
Пример #26
0
 public function listJsonAction()
 {
     $offset = $this->_getParam('start');
     $count = $this->_getParam('limit');
     $sort = $this->_getParam('sort', 'id');
     $direction = $this->_getParam('dir', 'DESC');
     $filters = $this->_getParam('filter', array());
     $order = $sort . ' ' . $direction;
     $dao = new RM_Modules();
     $total = $dao->filterAll($order, null, null, $filters)->count();
     $rows = $dao->filterAll($order, $count, $offset, $filters)->toArray();
     $extensions = RM_Environment::getInstance()->getOutOfDateExtensions();
     foreach ($rows as $key => $row) {
         $rows[$key]['upgrade'] = in_array($row['name'], $extensions['modules']);
     }
     $json = new stdClass();
     $json->total = $total;
     $json->data = $rows;
     return array('data' => $json);
 }
Пример #27
0
 function getpriceJsonAction()
 {
     $unitIDs = $this->_getParam('ids');
     $start_datetime = $this->_getParam('start_datetime');
     $end_datetime = $this->_getParam('end_datetime');
     $adults = $this->_getParam("adults", 1);
     $children = $this->_getParam("children", 0);
     $infants = $this->_getParam("infants", 0);
     $persons = new RM_Reservation_Persons(array("adults" => $adults, "children" => $children, "infants" => $infants));
     $unitsDAO = new RM_Units();
     $stardateObj = new RM_Date(strtotime($start_datetime));
     $enddateObj = new RM_Date(strtotime($end_datetime));
     $periodObj = new RM_Reservation_Period($stardateObj, $enddateObj);
     $priceSystem = RM_Environment::getInstance()->getPriceSystem();
     $units = explode(",", $unitIDs);
     $taxSystem = RM_Environment::getInstance()->getTaxSystem();
     $tax = 0;
     foreach ($units as $uid) {
         $unitObj = $unitsDAO->get($uid);
         $information = new RM_Prices_Information($unitObj, $periodObj, $persons);
         try {
             $subtotal = $subtotal + $priceSystem->getTotalUnitPrice($information);
         } catch (Exception $e) {
             // no return needed
         }
         $tax += $taxSystem->calculateTotalTax($unitObj, $subtotal);
     }
     // get currency symbol
     $config = new RM_Config();
     $currency_symbol = $config->get('rm_config_currency_symbol');
     // calculate the total
     $total = $subtotal + $tax;
     return array('data' => '{ data: [{
                             info: "Subtotal", value: "' . $currency_symbol['rm_config_currency_symbol'] . ' ' . $subtotal . '"
                     },{
                             info: "Tax", value: "' . $currency_symbol['rm_config_currency_symbol'] . ' ' . $tax . '"
                     },{
                             info: "Total", value: "' . $currency_symbol['rm_config_currency_symbol'] . ' ' . $total . '"
                     }]
                 }', 'encoded' => true);
 }
Пример #28
0
 public function configJsonAction()
 {
     $rmUnitTypes = new RM_UnitTypes();
     $language = RM_Environment::getInstance()->getLocale();
     $unittypes = $rmUnitTypes->getAll();
     $type = array();
     foreach ($unittypes as $unittype) {
         $type[] = array('id' => $unittype->id, 'name' => $unittype->{$language}, 'price' => $unittype->price);
     }
     $json = new stdClass();
     $json->unitTypes = $type;
     $systems = RM_Prices_Manager::getAllPriceSystems();
     $json->systems = array();
     foreach ($systems as $system) {
         $json->systems[] = array('value' => $system->name, 'text' => $system->getName(RM_Environment::getInstance()->getLocale()));
     }
     $module = new RM_Module_UnitTypeManager();
     $defaultUnitType = $module->getDefaultUnitType();
     $json->defaultUnitType = $defaultUnitType->id;
     return array('data' => $json, 'encoded' => false);
 }
 protected function _assign(Dwoo_Data $data)
 {
     $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN);
     $locationsDAO = new RM_Locations();
     $reservationID = $this->_eventData->getReservationID();
     $reservationModel = new RM_Reservations();
     $reservation = $reservationModel->find($reservationID)->current();
     // reservation details
     $details = $this->_eventData->getAllDetails();
     $arrayDetails = array();
     foreach ($details as $detail) {
         $unit = $detail->getUnit()->toArray();
         $period = $detail->getPeriod()->toArray();
         $periodWithTime = $detail->getPeriod()->toArray(true);
         $location = $locationsDAO->fetchByUnit($unit['id'])->toArray();
         $extrasForTemplate = array();
         $extras = $detail->getExtras();
         foreach ($extras as $extra) {
             $extrasForTemplate[] = $extra->toArray();
         }
         $arrayDetails[] = array('unit' => $unit, 'locationInfo' => isset($location[0]) ? $location[0] : '', 'period' => $period, 'periodtime' => $periodWithTime, 'persons' => $detail->getPersons()->getAll(), 'total' => $detail->getTotal(), 'extras' => $extrasForTemplate);
     }
     // total paid and total due
     $billing = new RM_Billing();
     $priceCharges = $billing->getPrice($reservationID);
     $billingArray['tax'] = $priceCharges->tax;
     $billingArray['paid'] = $billing->getPaymentsTotal($reservation);
     $billingArray['due'] = $priceCharges->total;
     $billingArray['confirmed'] = $reservation->confirmed ? $translate->_('MessageYes') : $translate->_('MessageNo');
     // return the data to the template
     $data->assign('extras', $extrasForTemplate);
     $data->assign('details', $arrayDetails);
     $data->assign('user', $this->_eventData->getUser()->toArray());
     $data->assign('reservation_id', $reservationID);
     $data->assign('billing', $billingArray);
     return $data;
 }
Пример #30
0
 /**
  * @return string
  */
 public function __toString()
 {
     $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN);
     return sprintf($translate->_('Admin.Dependency', 'PluginDependency'), $this->_getName(), $this->_getVersion());
 }