예제 #1
0
 public function process($template = null)
 {
     list($tpl_block, $tpl_item) = def_module::loadTemplates("emarket/payment/invoice/" . $template, 'legal_person_block', 'legal_person_item');
     $collection = umiObjectsCollection::getInstance();
     $types = umiObjectTypesCollection::getInstance();
     $typeId = $types->getBaseType("emarket", "legal_person");
     $customer = customer::get();
     $order = $this->order;
     $mode = getRequest('param2');
     if ($mode == 'do') {
         $personId = getRequest('legal-person');
         $isNew = $personId == null || $personId == 'new';
         if ($isNew) {
             $typeId = $types->getBaseType("emarket", "legal_person");
             $personId = $collection->addObject("", $typeId);
             $controller = cmsController::getInstance();
             $data = getRequest('data');
             if ($data && ($dataModule = $controller->getModule("data"))) {
                 $person = $collection->getObject($personId);
                 $person->setName($data['new']['name']);
                 $dataModule->saveEditedObject($personId, $isNew, true);
             }
             if ($collection->getObject($personId) instanceof umiObject) {
                 $customer = customer::get();
                 $customer->legal_persons = array_merge($customer->legal_persons, array($personId));
             }
         }
         $order->legal_person = $personId;
         $order->order();
         $order->payment_document_num = $order->id;
         $result = $this->printInvoice($order);
         $buffer = outputBuffer::current();
         $buffer->charset('utf-8');
         $buffer->contentType('text/html');
         $buffer->clear();
         $buffer->push($result);
         $buffer->end();
         return true;
     } else {
         if ($mode == 'delete') {
             $personId = (int) getRequest('person-id');
             if ($collection->isExists($personId)) {
                 $customer = customer::get();
                 $customer->legal_persons = array_diff($customer->legal_persons, array($personId));
                 $collection->delObject($personId);
             }
         }
     }
     $items = array();
     $persons = $customer->legal_persons;
     if (is_array($persons)) {
         foreach ($persons as $personId) {
             $person = $collection->getObject($personId);
             $item_arr = array('attribute:id' => $personId, 'attribute:name' => $person->name);
             $items[] = def_module::parseTemplate($tpl_item, $item_arr, false, $personId);
         }
     }
     $block_arr = array('attribute:type-id' => $typeId, 'attribute:type_id' => $typeId, 'xlink:href' => 'udata://data/getCreateForm/' . $typeId, 'subnodes:items' => $items);
     return def_module::parseTemplate($tpl_block, $block_arr);
 }
예제 #2
0
 public function process($template = null)
 {
     $this->order->order();
     $currency = strtoupper(mainConfiguration::getInstance()->get('system', 'default-currency'));
     // NB! Possible values for PayOnline are RUB (not RUR!), EUR and USD
     if (!in_array($currency, array('RUB', 'EUR', 'USD'))) {
         $currency = 'RUB';
     }
     $merchantId = $this->object->merchant_id;
     $privateKey = $this->object->private_key;
     $orderId = $this->order->getId();
     $amount = number_format($this->order->getActualPrice(), 2, '.', '');
     $keyString = "MerchantId={$merchantId}&OrderId={$orderId}&Amount={$amount}&Currency={$currency}&PrivateSecurityKey={$privateKey}";
     $securityKey = md5($keyString);
     $formAction = "?MerchantId={$merchantId}&OrderId={$orderId}&Amount={$amount}&Currency={$currency}&SecurityKey={$securityKey}&order-id={$orderId}";
     $formAction = "https://secure.payonlinesystem.com/ru/payment/" . $formAction;
     $param = array();
     $param['formAction'] = $formAction;
     $param['MerchantId'] = $merchantId;
     $param['OrderId'] = $orderId;
     $param['Amount'] = $amount;
     $param['Currency'] = $currency;
     $param['SecurityKey'] = $securityKey;
     $param['orderId'] = $orderId;
     $param['ReturnUrl'] = 'http://' . cmsController::getInstance()->getCurrentDomain()->getHost();
     $this->order->setPaymentStatus('initialized');
     list($templateString) = def_module::loadTemplates("emarket/payment/payonline/" . $template, "form_block");
     return def_module::parseTemplate($templateString, $param);
 }
예제 #3
0
 public function tagsCloud($template = "default", $limit = 50, $max_font_size = 16)
 {
     list($template_block, $template_line, $template_separator) = def_module::loadTemplates("stat/" . $template, "tags_block", "tags_block_line", "tags_separator");
     $factory = new statisticFactory(dirname(__FILE__) . '/classes');
     $factory->isValid('allTags');
     $report = $factory->get('allTags');
     $report->setStart(0);
     $report->setFinish(strtotime("+1 day", time()));
     $result = $report->get();
     $max = $result['max'];
     $lines = array();
     $i = 0;
     $sz = sizeof($result['labels']);
     for ($i = 0; $i < min($sz, $limit); $i++) {
         $label = $result['labels'][$i];
         $line_arr = array();
         $tag = $label['tag'];
         $cnt = $label['cnt'];
         $fontSize = ceil($max_font_size * ($cnt / $max));
         $line_arr['node:tag'] = $tag;
         $line_arr['attribute:cnt'] = $cnt;
         $line_arr['attribute:font-size'] = $fontSize;
         $line_arr['void:separator'] = $i < $sz - 1 ? $template_separator : "";
         $line_arr['void:font_size'] = $fontSize;
         $lines[] = def_module::parseTemplate($template_line, $line_arr);
     }
     $block_arr = array();
     $block_arr['subnodes:lines'] = $lines;
     $block_arr['total'] = $sz;
     $block_arr['per_page'] = $limit;
     return def_module::parseTemplate($template_block, $block_arr);
 }
예제 #4
0
 public function list_users($template = "default", $per_page = 10)
 {
     list($template_block, $template_block_item) = $this->loadTemplates("users/list_users/" . $template, "block", "block_item");
     $block_arr = array();
     $curr_page = (int) getRequest('p');
     $type_id = umiObjectTypesCollection::getInstance()->getBaseType("users", "user");
     $type = umiObjectTypesCollection::getInstance()->getType($type_id);
     $is_active_field_id = $type->getFieldId('is_activated');
     $sel = new umiSelection();
     $sel->addLimit($per_page, $curr_page);
     $sel->addObjectType($type_id);
     $sel->addPropertyFilterEqual($is_active_field_id, true);
     $this->autoDetectOrders($sel, $type_id);
     $this->autoDetectFilters($sel, $type_id);
     $result = umiSelectionsParser::runSelection($sel);
     $total = umiSelectionsParser::runSelectionCounts($sel);
     $items = array();
     foreach ($result as $user_id) {
         $item_arr = array();
         $item_arr['void:user_id'] = $user_id;
         $item_arr['attribute:id'] = $user_id;
         $item_arr['xlink:href'] = "uobject://" . $user_id;
         $items[] = def_module::parseTemplate($template_block_item, $item_arr, false, $user_id);
     }
     $block_arr['subnodes:items'] = $items;
     $block_arr['per_page'] = $per_page;
     $block_arr['total'] = $total;
     return def_module::parseTemplate($template_block, $block_arr);
 }
예제 #5
0
 public function getGuideList($id, $template = 'guidelist', $arrayOnly = false)
 {
     if (!$id) {
         return null;
     }
     //id справочника
     $o = umiObjectsCollection::getInstance();
     $items = $o->getGuidedItems($id);
     if (!sizeof($items)) {
         return null;
     }
     if ($arrayOnly) {
         return $items;
     }
     list($guide_block, $guide_item) = def_module::loadTemplates("catalog/{$template}.tpl", "guide_block", "guide_item");
     $s = '';
     $block_array = array();
     foreach ($items as $k => $v) {
         $line_array = array();
         $line_array['id'] = $k;
         $line_array['name'] = $items[$k];
         $s .= def_module::parseTemplate($guide_item, $line_array);
     }
     $block_array['lines'] = $s;
     unset($items);
     $s = def_module::parseTemplate($guide_block, $block_array);
     return $s;
 }
예제 #6
0
 public function process($template = null)
 {
     $productId = $this->object->product_id;
     $siteId = $this->object->site_id;
     $productName = $this->order->getId();
     $cmsController = cmsController::getInstance();
     $language = strtolower($cmsController->getCurrentLang()->getPrefix());
     switch ($language) {
         case 'ru':
             $language = 'ru';
             break;
         default:
             $language = 'en';
             break;
     }
     $this->order->order();
     $productPrice = $this->order->getActualPrice();
     $secretCode = $this->object->secret;
     $priceString = number_format($productPrice, 2, '.', '');
     $sign = md5($productId . '-' . $priceString . '-' . $secretCode);
     $answerUrl = $cmsController->getCurrentDomain()->getHost() . "/emarket/gateway/" . $this->order->getId() . "/";
     $param = array();
     $param["formAction"] = "https://payments.chronopay.com/index.php";
     $param["product_id"] = $productId;
     $param["product_price"] = $productPrice;
     $param["language"] = $language;
     $param["order_id"] = $this->order->getId();
     $param["cb_type"] = "P";
     $param["cb_url"] = $answerUrl;
     $param["decline_url"] = $cmsController->getCurrentDomain()->getHost();
     $param["sign"] = $sign;
     $this->order->setPaymentStatus('initialized');
     list($templateString) = def_module::loadTemplates("emarket/payment/chronopay/" . $template, "form_block");
     return def_module::parseTemplate($templateString, $param);
 }
예제 #7
0
 public function process($template = null)
 {
     $this->order->order();
     $currency = strtoupper(mainConfiguration::getInstance()->get('system', 'default-currency'));
     if ($currency == 'RUR') {
         $currency = 'RUB';
     }
     $amount = number_format($this->order->getActualPrice(), 2, '.', '');
     $orderId = $this->order->getId() . '.' . time();
     $merchantId = $this->object->mnt_id;
     $dataIntegrityCode = $this->object->mnt_data_integrity_code;
     $successUrl = $this->object->mnt_success_url;
     $failUrl = $this->object->mnt_fail_url;
     $testMode = $this->object->mnt_test_mode;
     $systemUrl = $this->object->mnt_system_url;
     if (empty($testMode)) {
         $testMode = 0;
     }
     $signature = md5("{$merchantId}{$orderId}{$amount}{$currency}{$testMode}{$dataIntegrityCode}");
     $param = array();
     $param['formAction'] = "https://{$systemUrl}/assistant.htm";
     $param['mntId'] = $merchantId;
     $param['mnTransactionId'] = $orderId;
     $param['mntCurrencyCode'] = $currency;
     $param['mntAmount'] = $amount;
     $param['mntTestMode'] = $testMode;
     $param['mntSignature'] = $signature;
     $param['mntSuccessUrl'] = $successUrl;
     $param['mntFailUrl'] = $failUrl;
     $this->order->setPaymentStatus('initialized');
     list($templateString) = def_module::loadTemplates("emarket/payment/payanyway/" . $template, "form_block");
     return def_module::parseTemplate($templateString, $param);
 }
예제 #8
0
 public function profile($template = "default", $user_id = false)
 {
     if (!$template) {
         $template = "default";
     }
     list($template_block, $template_bad_user_block) = def_module::loadTemplates("users/profile/" . $template, "profile_block", "bad_user_block");
     $block_arr = array();
     if (!$user_id) {
         $user_id = (int) getRequest('param0');
     }
     if (!$user_id) {
         $permissions = permissionsCollection::getInstance();
         if ($permissions->isAuth()) {
             $user_id = $permissions->getUserId();
         }
     }
     if ($user = selector::get('object')->id($user_id)) {
         $this->validateEntityByTypes($user, array('module' => 'users', 'method' => 'user'));
         $block_arr['xlink:href'] = "uobject://" . $user_id;
         $userTypeId = $user->getTypeId();
         if ($userType = umiObjectTypesCollection::getInstance()->getType($userTypeId)) {
             $userHierarchyTypeId = $userType->getHierarchyTypeId();
             if ($userHierarchyType = umiHierarchyTypesCollection::getInstance()->getType($userHierarchyTypeId)) {
                 if ($userHierarchyType->getName() == "users" && $userHierarchyType->getExt() == "user") {
                     $block_arr['id'] = $user_id;
                     return def_module::parseTemplate($template_block, $block_arr, false, $user_id);
                 }
             }
         }
     } else {
         throw new publicException(getLabel('error-object-does-not-exist', null, $user_id));
     }
     return def_module::parseTemplate($template_bad_user_block, $block_arr);
 }
예제 #9
0
 public function process($template = null)
 {
     $this->order->order();
     $currency = strtoupper(mainConfiguration::getInstance()->get('system', 'default-currency'));
     $amount = number_format($this->order->getActualPrice(), 2, '.', '');
     $orderId = $this->order->getId();
     $mnt_ubrir_id = $this->object->mnt_ubrir_id;
     $mnt_secret_key = $this->object->mnt_secret_key;
     $mnt_uni_id = $this->object->mnt_uni_id;
     $mnt_uni_login = $this->object->mnt_uni_login;
     $mnt_uni_pass = $this->object->mnt_uni_pass;
     $mnt_uni_emp = $this->object->mnt_uni_emp;
     $mnt_two = $this->object->mnt_two;
     $cmsController = cmsController::getInstance();
     $answerUrl = 'http://' . $cmsController->getCurrentDomain()->getHost() . "/emarket/gateway/" . $this->order->getId() . '/';
     $failUrl = 'http://' . $cmsController->getCurrentDomain()->getHost() . '/emarket/purchase/result/fail/';
     $successUrl = 'http://' . $cmsController->getCurrentDomain()->getHost() . '/emarket/purchase/result/successful/';
     if (is_array($mnt_ubrir_id)) {
         $mnt_ubrir_id = $mnt_ubrir_id[0];
     }
     if (is_array($mnt_secret_key)) {
         $mnt_secret_key = $mnt_secret_key[0];
     }
     $bankHandler = new Ubrir(array('shopId' => $mnt_ubrir_id, 'order_id' => $orderId, 'sert' => $mnt_secret_key, 'amount' => $amount, 'approve_url' => $answerUrl, 'cancel_url' => $failUrl, 'decline_url' => $failUrl));
     $response_order = $bankHandler->prepare_to_pay();
     $new_order_twpg = l_mysql_query('INSERT INTO `umi_twpg` (`umi_id`, `twpg_id`, `session_id`) VALUES ("' . $orderId . '", "' . $response_order->OrderID[0] . '", "' . $response_order->SessionID[0] . '")');
     $param = array();
     if (is_array($mnt_uni_id)) {
         $mnt_uni_id = $mnt_uni_id[0];
     }
     //if(is_array($mnt_uni_login))
     if (is_array($mnt_uni_pass)) {
         $mnt_uni_pass = $mnt_uni_pass[0];
     }
     //var_dump($mnt_uni_login); die;
     $param['sign'] = strtoupper(md5(md5($mnt_uni_id) . '&' . md5($mnt_uni_login) . '&' . md5($mnt_uni_pass) . '&' . md5($orderId) . '&' . md5($amount)));
     $param['twpg_url'] = $response_order->URL[0] . '?orderid=' . $response_order->OrderID[0] . '&sessionid=' . $response_order->SessionID[0];
     $param['uni_id'] = $mnt_uni_id;
     $param['uni_login'] = $mnt_uni_login;
     $param['amount'] = $amount;
     $param['order_id'] = $orderId;
     $param['urlno'] = $failUrl;
     $param['urlok'] = $successUrl;
     if ($mnt_two == 1) {
         $param['uni_submit'] = ' <INPUT TYPE="button" onclick="document.forms.uniteller.submit()" value="Оплатить MasterCard">';
     } else {
         $param['uni_submit'] = '';
     }
     $this->order->setPaymentStatus('initialized');
     list($templateString) = def_module::loadTemplates("tpls/emarket/payment/ubrir/ubrir.tpl", "form_block");
     return def_module::parseTemplate($templateString, $param);
 }
예제 #10
0
		public function process($template = null) {
			$this->order->order();
			$currency = strtoupper( mainConfiguration::getInstance()->get('system', 'default-currency') );
			$amount = number_format($this->order->getActualPrice(), 2, '.', '');
			$param = array();
			$param["formAction"] = "https://rbkmoney.ru/acceptpurchase.aspx";
			$param["eshopId"] = $this->object->eshopId;
			$param["orderId"] = $this->order->id;
			$param["recipientAmount"] = $amount;
			$param["recipientCurrency"] = $currency;
			$param["version"] = "2"; // May be 1 or 2, see documentation
			$this->order->setPaymentStatus('initialized');
			list($templateString) = def_module::loadTemplates("emarket/payment/rbk/".$template, "form_block");
			return def_module::parseTemplate($templateString, $param);
		}
예제 #11
0
 public function getElementRating($element_id)
 {
     $element = umiHierarchy::getInstance()->getElement($element_id);
     if (!$element) {
         return '';
     }
     $block_arr = array();
     $block_arr['rate_sum'] = (int) $element->getValue("rate_sum");
     $block_arr['rate_voters'] = (int) $element->getValue("rate_voters");
     $block_arr['is_rated'] = self::getIsRated($element_id);
     if ($block_arr['rate_voters'] > 0) {
         $block_arr['rate'] = round($block_arr['rate_sum'] / $block_arr['rate_voters'], 2);
         $block_arr['ceil_rate'] = round($block_arr['rate']);
     }
     return def_module::parseTemplate("", $block_arr, $element_id);
 }
예제 #12
0
 public function stores($elementId, $template = 'default')
 {
     if (!$template) {
         $tempate = 'default';
     }
     $hierarchy = umiHierarchy::getInstance();
     $objects = umiObjectsCollection::getInstance();
     list($tpl_block, $tpl_block_empty, $tpl_item) = def_module::loadTemplates("emarket/stores/" . $template, 'stores_block', 'stores_block_empty', 'stores_item');
     $elementId = $this->analyzeRequiredPath($elementId);
     if ($elementId == false) {
         throw new publicException("Wrong element id given");
     }
     $element = $hierarchy->getElement($elementId);
     if ($element instanceof iUmiHierarchyElement == false) {
         throw new publicException("Wrong element id given");
     }
     $storesInfo = $element->stores_state;
     $items_arr = array();
     $stores = array();
     $total = 0;
     if (is_array($storesInfo)) {
         foreach ($storesInfo as $storeInfo) {
             $object = $objects->getObject(getArrayKey($storeInfo, 'rel'));
             if ($object instanceof iUmiObject) {
                 $amount = (int) getArrayKey($storeInfo, 'int');
                 $total += $amount;
                 $store = array('attribute:amount' => $amount);
                 if ($object->primary) {
                     $reserved = (int) $element->reserved;
                     $store['attribute:amount'] -= $reserved;
                     $store['attribute:reserved'] = $reserved;
                     $store['attribute:primary'] = 'primary';
                 }
                 $store['item'] = $object;
                 $stores[] = $store;
                 $items_arr[] = def_module::parseTemplate($tpl_item, array('store_id' => $object->id, 'amount' => $amount, 'name' => $object->name), false, $object->id);
             }
         }
     }
     $result = array('stores' => array('attribute:total-amount' => $total, 'nodes:store' => $stores));
     $result['void:total-amount'] = $total;
     $result['void:items'] = $items_arr;
     if (!$total) {
         $tpl_block = $tpl_block_empty;
     }
     return def_module::parseTemplate($tpl_block, $result);
 }
예제 #13
0
 /**
  * Функция рисует список заказов пользователя
  * @param string $template Название шаблона
  * @return mixed Список заказов пользователя
  */
 public function show_user_orders($template = 'default')
 {
     list($tpl_block, $tpl_block_empty, $tpl_item, $tpl_order_item) = def_module::loadTemplates("emarket/" . $template, 'orders_block', 'orders_block_empty', 'orders_item', 'orders_order_item');
     $cmsController = cmsController::getInstance();
     $domain = $cmsController->getCurrentDomain();
     $domainId = $domain->getId();
     $sel = new selector('objects');
     $sel->types('object-type')->name('emarket', 'order');
     $sel->where('customer_id')->equals(customer::get()->id);
     $sel->where('name')->isNull(false);
     $sel->where('domain_id')->equals($domainId);
     if ($sel->length == 0) {
         $tpl_block = $tpl_block_empty;
     }
     $items_arr = array();
     foreach ($sel->result as $selOrder) {
         $order = order::get($selOrder->id);
         $item_arr['attribute:id'] = $order->id;
         $item_arr['attribute:name'] = $order->name;
         $item_arr['attribute:type-id'] = $order->typeId;
         $item_arr['attribute:guid'] = $order->GUID;
         $item_arr['attribute:type-guid'] = $order->typeGUID;
         $item_arr['attribute:ownerId'] = $order->ownerId;
         $item_arr['xlink:href'] = $order->xlink;
         $item_arr['attribute:delivery_allow_date'] = date('d.m.Y', $order->getValue('delivery_allow_date')->timestamp);
         //print_r($order->getValue('order_items'));
         //Получаем список товаров заказа
         $items = array();
         foreach ($order->getItems() as $orderItem) {
             //					print_r($order_item); die;
             $item_line = array();
             //					print_r(umiHierarchy::getInstance()->getObjectInstances($orderItem->id));
             $item_line['attribute:element_id'] = $orderItem->id;
             $item_line['attribute:name'] = $orderItem->name;
             $item_line['attribute:item_amount'] = $orderItem->getAmount();
             //					$item_line['attribute:options'] = $orderItem->getOptions();
             //						print_r($order_item->options);
             $items[] = def_module::parseTemplate($tpl_order_item, $item_line, false, $iOrderItemId);
             umiObjectsCollection::getInstance()->unloadObject($iOrderItemId);
         }
         $item_arr['subnodes:order_items'] = $items;
         $items_arr[] = def_module::parseTemplate($tpl_item, $item_arr, false, $order->id);
     }
     return def_module::parseTemplate($tpl_block, array('subnodes:items' => $items_arr));
 }
예제 #14
0
 public function discountInfo($discountId = false, $template = 'default')
 {
     if (!$template) {
         $template = 'default';
     }
     list($tpl_block, $tpl_block_empty) = def_module::loadTemplates("emarket/discounts/{$template}", 'discount_block', 'discount_block_empty');
     try {
         $discount = itemDiscount::get($discountId);
     } catch (privateException $e) {
         $discount = null;
     }
     if ($discount instanceof discount) {
         $info = array('attribute:id' => $discount->id, 'attribute:name' => $discount->getName(), 'description' => $discount->getValue('description'));
         return def_module::parseTemplate($tpl_block, $info, false, $discount->id);
     } else {
         return def_module::parseTemplate($tpl_block_empty, array());
     }
 }
예제 #15
0
 public function getUserSettings()
 {
     $vb10a8c0bede9eb4ea771b04db3149f28 = ConnectionPool::getInstance();
     $v4717d53ebfdfea8477f780ec66151dcb = $vb10a8c0bede9eb4ea771b04db3149f28->getConnection();
     umiEventFeedType::setConnection($v4717d53ebfdfea8477f780ec66151dcb);
     umiEventFeedUser::setConnection($v4717d53ebfdfea8477f780ec66151dcb);
     $vee11cbb19052e40b07aac0ca060c23ee = $this->getUser();
     $v2e5d8aa3dfa8ef34ca5131d20f9dad51 = umiEventFeedType::getAllowedList($vee11cbb19052e40b07aac0ca060c23ee->getSettings());
     $vd14a8022b085f9ef19d479cbdd581127 = umiEventFeedType::getList();
     $result = array('nodes:type' => array());
     foreach ($vd14a8022b085f9ef19d479cbdd581127 as $v599dcce2998a6b40b1e38e8c6006cb0a) {
         $v5f694956811487225d15e973ca38fbab = $v599dcce2998a6b40b1e38e8c6006cb0a->getId();
         $result['nodes:type'][$v5f694956811487225d15e973ca38fbab]['attribute:id'] = $v5f694956811487225d15e973ca38fbab;
         $result['nodes:type'][$v5f694956811487225d15e973ca38fbab]['attribute:name'] = getLabel($v5f694956811487225d15e973ca38fbab);
         $result['nodes:type'][$v5f694956811487225d15e973ca38fbab]['attribute:checked'] = in_array($v5f694956811487225d15e973ca38fbab, $v2e5d8aa3dfa8ef34ca5131d20f9dad51) ? 1 : 0;
     }
     return def_module::parseTemplate('', $result);
 }
예제 #16
0
 /**
  * Получить типы событий, отслеживаемые пользователем
  */
 public function getUserSettings()
 {
     $pool = ConnectionPool::getInstance();
     $connection = $pool->getConnection();
     umiEventFeedType::setConnection($connection);
     umiEventFeedUser::setConnection($connection);
     $user = $this->getUser();
     $settings = umiEventFeedType::getAllowedList($user->getSettings());
     $types = umiEventFeedType::getList();
     $result = array('nodes:type' => array());
     foreach ($types as $type) {
         $typeId = $type->getId();
         $result['nodes:type'][$typeId]['attribute:id'] = $typeId;
         $result['nodes:type'][$typeId]['attribute:name'] = getLabel($typeId);
         $result['nodes:type'][$typeId]['attribute:checked'] = in_array($typeId, $settings) ? 1 : 0;
     }
     return def_module::parseTemplate('', $result);
 }
예제 #17
0
 public function checkLogged($template = "default")
 {
     if (!$template) {
         $template = "default";
     }
     if (!$this->is_auth()) {
         list($template_reg_form) = def_module::loadTemplates("users/" . $template, "login_registration_form");
         $from_page = getRequest('from_page');
         if (!$from_page) {
             $from_page = getServer('REQUEST_URI');
         }
         $block_arr = array();
         $block_arr['from_page'] = def_module::protectStringVariable($from_page);
         return def_module::parseTemplate($template_reg_form, $block_arr, false);
     } else {
         return;
     }
 }
예제 #18
0
		public function process($template = null) {
			$this->order->order();
			$login = $this->object->login;
			$password = $this->object->password1;
			$amount = number_format($this->order->getActualPrice(), 2, '.', '');
			$sign = md5("{$login}:{$amount}:{$this->order->id}:{$password}:shp_orderId={$this->order->id}");
			$param = array();
			$param['formAction'] = $this->object->test_mode ? "http://test.robokassa.ru/Index.aspx" : "https://merchant.roboxchange.com/Index.aspx";
			$param['MrchLogin']  = $login;
			$param['OutSum']  	 = $amount;
			$param['InvId']  	 = $this->order->id;
			$param['Desc']  	 = "Payment for order {$this->order->id}";
			$param['SignatureValue'] = $sign;
			$param['shp_orderId']    = $this->order->id;
			$param['IncCurrLabel'] = "";
			$param['Culture']  	 = strtolower(cmsController::getInstance()->getCurrentLang()->getPrefix());
			$this->order->setPaymentStatus('initialized');
			list($templateString) = def_module::loadTemplates("emarket/payment/robokassa/".$template, "form_block");
			return def_module::parseTemplate($templateString, $param);
		}
예제 #19
0
 public function process($template = null)
 {
     $this->order->order();
     $shopId = $this->object->shop_id;
     $bankId = $this->object->bank_id;
     $scid = $this->object->scid;
     if (!strlen($shopId) || !strlen($scid)) {
         throw new publicException(getLabel('error-payment-wrong-settings'));
     }
     $productPrice = (double) $this->order->getActualPrice();
     $param = array();
     $param['shopId'] = $shopId;
     $param['Sum'] = $productPrice;
     $param['BankId'] = $bankId;
     $param['scid'] = $scid;
     $param['CustomerNumber'] = $this->order->getId();
     $param['formAction'] = $this->object->demo_mode ? 'https://demomoney.yandex.ru/eshop.xml' : 'https://money.yandex.ru/eshop.xml';
     $param['orderId'] = $this->order->getId();
     $this->order->setPaymentStatus('initialized');
     list($templateString) = def_module::loadTemplates("emarket/payment/yandex/" . $template, "form_block");
     return def_module::parseTemplate($templateString, $param);
 }
예제 #20
0
    public function process($template = null)
    {
        $currency = strtoupper(mainConfiguration::getInstance()->get('system', 'default-currency'));
        if ($currency == 'RUR') {
            $currency = 'RUB';
        }
        list($templateString, $modeItem) = def_module::loadTemplates("emarket/payment/dengionline/" . $template, 'form_block', 'mode_type_item');
        $modeTypeItems = array();
        $xml = '<request>
				<action>get_project_paymodes</action>
				<projectId>' . $this->object->project . '</projectId>
			</request>';
        $headers = array("Content-type" => "application/x-www-form-urlencoded");
        $paymentsXML = umiRemoteFileGetter::get('http://www.onlinedengi.ru/dev/xmltalk.php', false, $headers, array('xml' => $xml));
        $dom = new DOMDocument('1.0', 'utf-8');
        $dom->loadXML($paymentsXML);
        if ($dom->getElementsByTagName('paymentMode')->length) {
            foreach ($dom->getElementsByTagName('paymentMode') as $payment) {
                $modeTypeItems[] = def_module::parseTemplate($modeItem, array('id' => $payment->getAttribute('id'), 'label' => $payment->getAttribute('title'), 'banner' => $payment->getAttribute('banner')));
            }
        }
        $order = $this->order;
        $order->order();
        $orderId = $order->getId();
        $param = array();
        $param['formAction'] = "http://www.onlinedengi.ru/wmpaycheck.php?priznak=UMI";
        $param['project'] = $this->object->project;
        // Задаётся пользователем в настройках магазина, поле "ID проекта"
        $param['amount'] = $order->getActualPrice();
        $param['nickname'] = $orderId;
        $param['order_id'] = $orderId;
        $param['source'] = $this->object->source;
        // Задаётся пользователем в настройках магазина, поле "Source (если есть)"
        $param['comment'] = "Payment for order " . $orderId;
        $param['paymentCurrency'] = $currency;
        $param['subnodes:items'] = $param['void:mode_type_list'] = $modeTypeItems;
        $order->setPaymentStatus('initialized');
        return def_module::parseTemplate($templateString, $param);
    }
예제 #21
0
 public static function generateCaptcha($v66f6181bcb4cff4cd38fbc804a036db6 = "default", $vb082bdddeadb1ea23f679c64ae900ef9 = "sys_captcha", $ve98737036f7752124468103e7fcdb14d = "")
 {
     if (!self::isNeedCaptha()) {
         return def_module::isXSLTResultMode() ? array('comment:explain' => 'Captcha is not required for logged users') : '';
     }
     if (!$v66f6181bcb4cff4cd38fbc804a036db6) {
         $v66f6181bcb4cff4cd38fbc804a036db6 = "default";
     }
     if (!$vb082bdddeadb1ea23f679c64ae900ef9) {
         $vb082bdddeadb1ea23f679c64ae900ef9 = "sys_captcha";
     }
     if (!$ve98737036f7752124468103e7fcdb14d) {
         $ve98737036f7752124468103e7fcdb14d = "";
     }
     $v9af24b163db8fe13fd0c36ae8c4080c1 = "?" . time();
     $vfca1bff8ad8b3a8585abfb0ad523ba42 = array();
     $vfca1bff8ad8b3a8585abfb0ad523ba42['void:input_id'] = $vb082bdddeadb1ea23f679c64ae900ef9;
     $vfca1bff8ad8b3a8585abfb0ad523ba42['attribute:captcha_hash'] = $ve98737036f7752124468103e7fcdb14d;
     $vfca1bff8ad8b3a8585abfb0ad523ba42['attribute:random_string'] = $v9af24b163db8fe13fd0c36ae8c4080c1;
     $vfca1bff8ad8b3a8585abfb0ad523ba42['url'] = array('attribute:random-string' => $v9af24b163db8fe13fd0c36ae8c4080c1, 'node:value' => '/captcha.php');
     list($vb7c60eca084c05c6f9d7b6f220a32025) = def_module::loadTemplates("captcha/" . $v66f6181bcb4cff4cd38fbc804a036db6, "captcha");
     return def_module::parseTemplate($vb7c60eca084c05c6f9d7b6f220a32025, $vfca1bff8ad8b3a8585abfb0ad523ba42);
 }
예제 #22
0
 public function navibar($v66f6181bcb4cff4cd38fbc804a036db6 = 'default', $v67278b1893f28aa5a341740e3d75ff1c = true, $vb7b50d03c3f733165f5701ac7fcf81bf = 0, $v94b05a0fe0ef80a92c054adf7e668bf1 = 0)
 {
     if (!$v66f6181bcb4cff4cd38fbc804a036db6) {
         $v66f6181bcb4cff4cd38fbc804a036db6 = 'default';
     }
     $v8b1dc169bf460ee884fceef66c6607d6 = cmsController::getInstance();
     $vb81ca7c0ccaa77e7aa91936ab0070695 = umiHierarchy::getInstance();
     $v50d644c42a9f32486af6d339527e1020 = $v8b1dc169bf460ee884fceef66c6607d6->getCurrentElementId();
     list($v31912934b8f34be4364cc043cd8a0176, $vd268fd226c122b3da2fabee66e798225, $v5ad10ccde9b1728f3d06c1eb0b05ab0f, $v5499ddd845fc4355a16a16559fa94a0c, $v6bf63b3047051a28085cdb91a050acf3) = def_module::loadTemplates("content/navibar/" . $v66f6181bcb4cff4cd38fbc804a036db6, 'navibar', 'navibar_empty', 'element', 'element_active', 'quantificator');
     $vc68ad910ed49ac65f21f1bf2c5dbf912 = $vb81ca7c0ccaa77e7aa91936ab0070695->getAllParents($v50d644c42a9f32486af6d339527e1020);
     $vc68ad910ed49ac65f21f1bf2c5dbf912[] = $v50d644c42a9f32486af6d339527e1020;
     $v691d502cfd0e0626cd3b058e5682ad1c = array();
     foreach ($vc68ad910ed49ac65f21f1bf2c5dbf912 as $v7552cd149af7495ee7d8225974e50f80) {
         if (!$v7552cd149af7495ee7d8225974e50f80) {
             continue;
         }
         $v8e2dcfd7e7e24b1ca76c1193f645902b = $vb81ca7c0ccaa77e7aa91936ab0070695->getElement($v7552cd149af7495ee7d8225974e50f80);
         if ($v8e2dcfd7e7e24b1ca76c1193f645902b instanceof iUmiHierarchyElement) {
             $v691d502cfd0e0626cd3b058e5682ad1c[] = $v8e2dcfd7e7e24b1ca76c1193f645902b;
         }
     }
     $v7dabf5c198b0bab2eaa42bb03a113e55 = sizeof($v691d502cfd0e0626cd3b058e5682ad1c) - $v94b05a0fe0ef80a92c054adf7e668bf1;
     $vf1386a17eed513dff70798b0551dc170 = array();
     for ($v865c0c0b4ab0e063e5caa3387c1a8741 = (int) $vb7b50d03c3f733165f5701ac7fcf81bf; $v865c0c0b4ab0e063e5caa3387c1a8741 < $v7dabf5c198b0bab2eaa42bb03a113e55; $v865c0c0b4ab0e063e5caa3387c1a8741++) {
         $v8e2dcfd7e7e24b1ca76c1193f645902b = $v691d502cfd0e0626cd3b058e5682ad1c[$v865c0c0b4ab0e063e5caa3387c1a8741];
         $vb7983678c84fd38bc2a4db875f31215d = !$v67278b1893f28aa5a341740e3d75ff1c && $v865c0c0b4ab0e063e5caa3387c1a8741 == $v7dabf5c198b0bab2eaa42bb03a113e55 - 1 ? $v5499ddd845fc4355a16a16559fa94a0c : $v5ad10ccde9b1728f3d06c1eb0b05ab0f;
         $ve253bed1357afcefc5fadfbc92f9eb97 = def_module::parseTemplate($vb7983678c84fd38bc2a4db875f31215d, array('attribute:id' => $v8e2dcfd7e7e24b1ca76c1193f645902b->id, 'attribute:link' => $v8e2dcfd7e7e24b1ca76c1193f645902b->link, 'xlink:href' => 'upage://' . $v8e2dcfd7e7e24b1ca76c1193f645902b->id, 'node:text' => $v8e2dcfd7e7e24b1ca76c1193f645902b->name), $v8e2dcfd7e7e24b1ca76c1193f645902b->id);
         if (is_string($ve253bed1357afcefc5fadfbc92f9eb97) && $v865c0c0b4ab0e063e5caa3387c1a8741 != $v7dabf5c198b0bab2eaa42bb03a113e55 - 1) {
             $ve253bed1357afcefc5fadfbc92f9eb97 .= $v6bf63b3047051a28085cdb91a050acf3;
         }
         $vf1386a17eed513dff70798b0551dc170[] = $ve253bed1357afcefc5fadfbc92f9eb97;
     }
     if ($v7dabf5c198b0bab2eaa42bb03a113e55 == 0) {
         $v31912934b8f34be4364cc043cd8a0176 = $vd268fd226c122b3da2fabee66e798225;
     }
     return def_module::parseTemplate($v31912934b8f34be4364cc043cd8a0176, array('items' => array('nodes:item' => $vf1386a17eed513dff70798b0551dc170), 'void:elements' => $vf1386a17eed513dff70798b0551dc170));
 }
예제 #23
0
 /**
  * Получает список режимов отображения
  * Текущий помечается как current
  *
  * @param string $template TPL шаблон
  *
  * @return mixed
  */
 public function getMobileModesList($template = "default")
 {
     $isMobile = (bool) system_is_mobile();
     $modes = array("is_mobile" => 1, "is_desktop" => 0);
     $items = array();
     foreach ($modes as $mode => $value) {
         $itemArray = array("@name" => $mode, "@link" => '/content/setMobileMode/' . ($value ? 0 : 1));
         if ($value == $isMobile) {
             $itemArray["@status"] = "active";
             $items[] = def_module::renderTemplate("content/mobile/" . $template, $mode, $itemArray);
         } else {
             $items[] = def_module::parseTemplate("", $itemArray);
         }
     }
     return def_module::renderTemplate("content/mobile/" . $template, "modes", array("subnodes:items" => $items));
 }
예제 #24
0
 public function personal($template = 'default')
 {
     list($tpl_block) = def_module::loadTemplates("emarket/" . $template, "personal");
     return def_module::parseTemplate($tpl_block, array());
 }
예제 #25
0
 public function getCompareLink($elementId = null, $template = 'default')
 {
     if (!$elementId) {
         return;
     }
     if (!$template) {
         $template = "default";
     }
     list($tpl_add_link, $tpl_del_link) = def_module::loadTemplates("emarket/compare/{$template}", 'add_link', 'del_link');
     $elements = $this->getCompareElements();
     $inCompare = in_array($elementId, $elements);
     $addLink = $this->pre_lang . '/emarket/addToCompare/' . $elementId . '/';
     $delLink = $this->pre_lang . '/emarket/removeFromCompare/' . $elementId . '/';
     $block_arr = array('add-link' => $inCompare ? null : $addLink, 'del-link' => $inCompare ? $delLink : null);
     return def_module::parseTemplate($inCompare ? $tpl_del_link : $tpl_add_link, $block_arr, $elementId);
 }
예제 #26
0
 public function parseCurrencyPricesTpl($template = 'default', $pricesData = array(), iUmiObject $currentCurrency = null)
 {
     list($tpl_block, $tpl_item) = def_module::loadTemplates("emarket/currency/{$template}", 'currency_prices_block', 'currency_prices_item');
     if (is_null($currentCurrency)) {
         $currentCurrency = $this->getCurrentCurrency();
     }
     $block_arr = array();
     $currencyIds = $this->getCurrencyList();
     foreach ($currencyIds as $currency) {
         if ($currentCurrency->id == $currency->id) {
             continue;
         }
         if ($info = $this->formatCurrencyPrice($pricesData, $currency, $currentCurrency)) {
             if (!$info['original']) {
                 $info['original'] = $info['actual'];
             }
             $info['price-original'] = $info['original'];
             $info['price-actual'] = $info['actual'];
             $items_arr[] = def_module::parseTemplate($tpl_item, $info);
         }
     }
     $block_arr['subnodes:items'] = $items_arr;
     return def_module::parseTemplate($tpl_block, $block_arr);
 }
예제 #27
0
 public function restore($activate_code = false, $template = "default")
 {
     static $result = array();
     if (isset($result[$template])) {
         return $result[$template];
     }
     list($template_restore_failed_block, $template_restore_ok_block, $template_mail_password, $template_mail_password_subject) = def_module::loadTemplatesForMail("users/forget/" . $template, "restore_failed_block", "restore_ok_block", "mail_password", "mail_password_subject");
     if (!$activate_code) {
         $activate_code = (string) getRequest('param0');
         $activate_code = trim($activate_code);
     }
     $object_type_id = umiObjectTypesCollection::getInstance()->getBaseType("users", "user");
     $object_type = umiObjectTypesCollection::getInstance()->getType($object_type_id);
     $activate_code_field_id = $object_type->getFieldId("activate_code");
     $sel = new selector('objects');
     $sel->types('object-type')->name('users', 'user');
     $sel->where('activate_code')->equals($activate_code);
     $sel->limit(0, 1);
     if ($sel->first) {
         $object = $sel->first;
         $user_id = $object->id;
     } else {
         $object = false;
         $user_id = false;
     }
     $block_arr = array();
     if ($user_id && $activate_code) {
         $password = self::getRandomPassword();
         $login = $object->getValue("login");
         $email = $object->getValue("e-mail");
         $fio = $object->getValue("lname") . " " . $object->getValue("fname") . " " . $object->getValue("father_name");
         $object->setValue("password", md5($password));
         $object->setValue("activate_code", "");
         $object->commit();
         $email_from = regedit::getInstance()->getVal("//settings/email_from");
         $fio_from = regedit::getInstance()->getVal("//settings/fio_from");
         $mail_arr = array();
         $mail_arr['domain'] = $domain = $_SERVER['HTTP_HOST'];
         $mail_arr['password'] = $password;
         $mail_arr['login'] = $login;
         $mail_subject = def_module::parseTemplateForMail($template_mail_password_subject, $mail_arr, false, $user_id);
         $mail_content = def_module::parseTemplateForMail($template_mail_password, $mail_arr, false, $user_id);
         $someMail = new umiMail();
         $someMail->addRecipient($email, $fio);
         $someMail->setFrom($email_from, $fio_from);
         $someMail->setSubject($mail_subject);
         $someMail->setContent($mail_content);
         $someMail->commit();
         $someMail->send();
         $block_arr['attribute:status'] = "success";
         $block_arr['login'] = $login;
         $block_arr['password'] = $password;
         return $result[$template] = def_module::parseTemplate($template_restore_ok_block, $block_arr, false, $user_id);
     } else {
         $block_arr['attribute:status'] = "fail";
         return $result[$template] = def_module::parseTemplate($template_restore_failed_block, $block_arr);
     }
 }
 public function tags_mk_cloud($i_domain_id = NULL, $s_template = "tags", $i_per_page = -1, $b_ignore_paging = true, $b_by_usage = false, $arr_users = array())
 {
     // init and context :
     $s_tpl_tags = "cloud_tags";
     $s_tpl_tag = "cloud_tag";
     $s_tpl_tag_sep = "cloud_tagseparator";
     $s_tpl_tags_empty = "cloud_tags_empty";
     // validate input :
     if (!$arr_users || intval($arr_users) === -1 || strval($arr_users) === 'all' || $arr_users == "Все") {
         $arr_users = array();
     }
     if (is_int($arr_users)) {
         $arr_users = array(intval($arr_users));
     } elseif (is_array($arr_users)) {
         $arr_users = array_map('intval', $arr_users);
     } else {
         $arr_users = array(intval(strval($arr_users)));
     }
     $i_per_page = intval($i_per_page);
     if (!$i_per_page) {
         $i_per_page = 10;
     }
     if ($i_per_page === -1) {
         $b_ignore_paging = true;
     }
     $s_template = strval($s_template);
     if (!strlen($s_template)) {
         $s_template = "tags";
     }
     $i_curr_page = intval(getRequest('p'));
     if ($b_ignore_paging) {
         $i_curr_page = 0;
     }
     // load templates :
     list($tpl_tags, $tpl_tag, $tpl_tag_sep, $tpl_tags_empty) = $this->loadTemplates("content/" . $s_template, $s_tpl_tags, $s_tpl_tag, $s_tpl_tag_sep, $s_tpl_tags_empty);
     // process :
     $max_font_size = 32;
     $min_font_size = 10;
     //
     $s_prefix = '';
     //
     if ($b_by_usage) {
         $o_object_type = umiObjectTypesCollection::getInstance()->getTypeByGUID('root-pages-type');
         $i_tags_field_id = $o_object_type->getFieldId('tags');
         //
         $result = umiObjectProperty::objectsByValue($i_tags_field_id, 'all', true, true, $i_domain_id ? $i_domain_id : -1);
     } else {
         $stat = cmsController::getInstance()->getModule('stat');
         $sStatIncPath = dirname(dirname(dirname(dirname(__FILE__)))) . '/stat/classes';
         if (class_exists("statisticFactory") == false) {
             return;
         }
         $factory = new statisticFactory($sStatIncPath);
         $factory->isValid('allTags');
         $report = $factory->get('allTags');
         if ($i_domain_id) {
             $s_prefix = 'Domain';
             $v_domains = $report->setDomain($i_domain_id);
         } else {
             $s_prefix = 'Account';
             $v_domains = $report->setDomain(-1);
         }
         if (is_array($arr_users) && count($arr_users)) {
             $report->setUserIDs($arr_users);
         }
         $result = $report->get();
     }
     if (isset($result['values']) && is_array($result['values'])) {
         natsort2d($result['values'], "cnt");
         $result['values'] = array_slice($result['values'], -$i_per_page, $i_per_page);
         natsort2d($result['values'], "value");
     }
     $max = intval($result['max']);
     $sum = intval($result['sum']);
     $arrTags = array();
     $s_values_label = $b_by_usage ? 'values' : 'labels';
     $s_value_label = $b_by_usage ? 'value' : 'tag';
     $s_value_cnt = 'cnt';
     $sz = sizeof($result[$s_values_label]);
     for ($i = 0; $i < $sz; $i++) {
         $label = $result[$s_values_label][$i];
         $tag = $label[$s_value_label];
         if (is_null($tag)) {
             continue;
         }
         //$tag = '[nontagged]';
         $cnt = intval($label[$s_value_cnt]);
         $f_weight = round($cnt * 100 / $sum, 1);
         $font_size = round(($max_font_size - $min_font_size) / 100 * $f_weight + $min_font_size);
         $arrTags[$tag] = array('weight' => $f_weight, 'font' => $font_size);
     }
     //
     $summ_weight = 0;
     if (count($arrTags)) {
         $arrTagsTplteds = array();
         foreach ($arrTags as $sTag => $arrTagStat) {
             $summ_weight += $arrTagStat['weight'];
             $params = array('tag' => $sTag, 'tag_urlencoded' => rawurlencode($sTag), 'attribute:weight' => $arrTagStat['weight'], 'attribute:font' => $arrTagStat['font'], 'attribute:context' => $s_prefix);
             $arrTagsTplteds[] = def_module::parseTemplate($tpl_tag, $params);
         }
         if (isset($arrTagsTplteds[0]) && is_array($arrTagsTplteds[0])) {
             // udata
             $arrForTags = array('subnodes:items' => $arrTagsTplteds);
         } else {
             // not udata
             $arrForTags = array('items' => implode($tpl_tag_sep, $arrTagsTplteds));
         }
         //
         $arrForTags['attribute:summ_weight'] = ceil($summ_weight);
         $arrForTags['attribute:context'] = $s_prefix;
         // RETURN
         return def_module::parseTemplate($tpl_tags, $arrForTags);
     } else {
         $arrForTags = array();
         // RETURN
         return def_module::parseTemplate($tpl_tags_empty, $arrForTags);
     }
 }
예제 #29
0
 public function parseSearchSymlink(umiField $field, $template, $category_id)
 {
     $block_arr = array();
     $items = array();
     $name = $field->getName();
     $title = $field->getTitle();
     $sel = new selector('pages');
     $sel->types('hierarchy-type');
     $sel->where('hierarchy')->page($category_id)->childs(1);
     $guide_items = array();
     foreach ($sel->result as $element) {
         if ($value = $element->getValue($name)) {
             foreach ($value as $object) {
                 $guide_items[$object->id] = $object->name;
             }
         }
     }
     $fields_filter = getRequest('fields_filter');
     $value = getArrayKey($fields_filter, $name);
     $is_tpl = !def_module::isXSLTResultMode();
     $unfilter_link = "";
     foreach ($guide_items as $object_id => $object_name) {
         if (is_array($value)) {
             $selected = in_array($object_id, $value) ? "selected" : "";
         } else {
             $selected = $object_id == $value ? "selected" : "";
         }
         if ($is_tpl) {
             $items[] = "<option value=\"{$object_id}\" {$selected}>{$object_name}</option>";
         } else {
             $line_arr = array();
             $line_arr['attribute:id'] = $line_arr['void:object_id'] = $object_id;
             $line_arr['node:object_name'] = $object_name;
             $params = $_GET;
             unset($params['path']);
             unset($params['p']);
             $params['fields_filter'][$name] = $object_id;
             $filter_link = "?" . http_build_query($params, '', '&amp;');
             unset($params['fields_filter'][$name]);
             $unfilter_link = "?" . http_build_query($params, '', '&amp;');
             $line_arr['attribute:filter_link'] = $filter_link;
             $line_arr['attribute:unfilter_link'] = $unfilter_link;
             if ($selected) {
                 $line_arr['attribute:selected'] = "selected";
             }
             $items[] = def_module::parseTemplate('', $line_arr);
         }
     }
     $block_arr['attribute:unfilter_link'] = $unfilter_link;
     $block_arr['attribute:name'] = $name;
     $block_arr['attribute:title'] = $title;
     $block_arr['subnodes:values'] = $block_arr['void:items'] = $items;
     $block_arr['void:selected'] = $value ? "" : "selected";
     return def_module::parseTemplate($template, $block_arr);
 }
예제 #30
-1
 public function process($template = null)
 {
     $order = $this->order;
     $order->order();
     $order->setPaymentStatus('initialized');
     // Ставим заказу статус "инициализирована оплата"
     // Загружаем API класс LiqPay
     objectProxyHelper::includeClass('emarket/classes/payment/api/', 'LiqPay');
     $liqpay = new LiqPay($this->getValue('public_key'), $this->getValue('private_key'));
     $sandbox_status = 0;
     if ($this->getValue('sandbox_status')) {
         $sandbox_status = 1;
     }
     $domain = $_SERVER['HTTP_HOST'];
     $html = $liqpay->cnb_form(array('version' => '3', 'sandbox' => $sandbox_status, 'amount' => $order->getActualPrice(), 'currency' => $this->getValue('currency'), 'description' => $this->getValue('desc'), 'pay_way' => $this->getValue('pay_way'), 'order_id' => $order->getId(), 'type' => 'buy', 'result_url' => $domain . '/emarket/purchase/result/successful/?order_id=' . $order->getId() . '&amp;order_type=liq_pay'));
     $param = array();
     $param['form_html'] = $html;
     list($templateString) = def_module::loadTemplates("emarket/payment/liqpay/" . $template, "form_block");
     return def_module::parseTemplate($templateString, $param);
 }