本文整理汇总了PHP中cmsController::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsController::getInstance方法的具体用法?PHP cmsController::getInstance怎么用?PHP cmsController::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsController
的用法示例。
在下文中一共展示了cmsController::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
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: validateItem
public function validateItem(iUmiHierarchyElement $element)
{
$relatedItems = array();
foreach ($this->related_items as $element) {
if ($element instanceof iUmiHierarchyElement) {
$relatedItems[] = $element->id;
}
}
$cmsController = cmsController::getInstance();
$emarket = $cmsController->getModule('emarket');
if ($emarket instanceof def_module) {
$order = $emarket->getBasketOrder();
foreach ($order->getItems() as $orderItem) {
$element = $orderItem->getItemElement();
if ($element instanceof iUmiHierarchyElement) {
if (in_array($element->id, $relatedItems)) {
return true;
}
}
}
return false;
} else {
throw new privateException('Emarket module must be installed');
}
}
示例3: process
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);
}
示例4: parse
public function parse($v87cd8b8808600624d8c590cfc2e6e94b, $v9a0364b9e99bb480dd25e1f0284c8555 = null)
{
if (is_null($this->domXSL)) {
$this->domXSL = $this->prepareXSL($this->templatesSource);
}
$va3c3308ab3cad416697b6e49b5481ce2 = $this->domXML instanceof DOMDocument ? $this->domXML : $this->prepareXML($v87cd8b8808600624d8c590cfc2e6e94b);
$v801f7201346b43f8ee8390a1ef20ddcd = new xsltProcessor();
$v801f7201346b43f8ee8390a1ef20ddcd->registerPHPFunctions();
if (defined("UMI_XSLT_PROFILER_LOG") && version_compare(PHP_VERSION, '5.3.0', '>=')) {
$v801f7201346b43f8ee8390a1ef20ddcd->setProfiling(UMI_XSLT_PROFILER_LOG);
}
$v818f9c45cfa30eeff277ef38bcbe9910 = errorsXsltListen();
$v801f7201346b43f8ee8390a1ef20ddcd->importStyleSheet($this->domXSL);
if ($va0f97308110b5ffc40d784efae2257bb = cmsController::getInstance()->detectCurrentDesignTemplate()) {
$v40def08eb6011aefb2505a262252de92 = array('template-name' => $va0f97308110b5ffc40d784efae2257bb->getName(), 'template-resources' => $va0f97308110b5ffc40d784efae2257bb->getResourcesDirectory(true));
$this->addRequestParams($v801f7201346b43f8ee8390a1ef20ddcd, $v40def08eb6011aefb2505a262252de92);
}
if (is_array($this->additionalVariables)) {
$this->addRequestParams($v801f7201346b43f8ee8390a1ef20ddcd, $this->additionalVariables);
}
$this->addRequestParams($v801f7201346b43f8ee8390a1ef20ddcd, $_COOKIE);
$this->addRequestParams($v801f7201346b43f8ee8390a1ef20ddcd, $_REQUEST);
$this->addRequestParams($v801f7201346b43f8ee8390a1ef20ddcd, $_SERVER, "_");
$v9b207167e5381c47682c6b4f58a623fb = $v801f7201346b43f8ee8390a1ef20ddcd->transformToXML($va3c3308ab3cad416697b6e49b5481ce2);
errorsXsltCheck($v818f9c45cfa30eeff277ef38bcbe9910);
return $v9b207167e5381c47682c6b4f58a623fb;
}
示例5: onAddTopicToDispatch
public function onAddTopicToDispatch(iUmiEventPoint $oEvent)
{
$iDispatchId = regedit::getInstance()->getVal("//modules/forum/dispatch_id");
if (!$iDispatchId) {
return false;
}
$dispatches_module = cmsController::getInstance()->getModule('dispatches');
if (!$dispatches_module) {
return false;
}
$iTopicId = (int) $oEvent->getParam('topic_id');
$oTopicElement = umiHierarchy::getInstance()->getElement($iTopicId);
if ($oTopicElement instanceof umiHierarchyElement) {
$sTitle = (string) getRequest('title');
$sMessage = (string) getRequest('body');
$iHierarchyTypeId = umiHierarchyTypesCollection::getInstance()->getTypeByName("dispatches", "message")->getId();
$iMsgTypeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($iHierarchyTypeId);
$oMsgType = umiObjectTypesCollection::getInstance()->getType($iMsgTypeId);
$iMsgObjId = umiObjectsCollection::getInstance()->addObject($sTitle, $iMsgTypeId);
$oMsgObj = umiObjectsCollection::getInstance()->getObject($iMsgObjId);
if ($oMsgObj instanceof umiObject) {
$iReleaseId = $dispatches_module->getNewReleaseInstanceId($iDispatchId);
$oMsgObj->setValue('release_reference', $iReleaseId);
$oMsgObj->setValue('header', $sTitle);
$oMsgObj->setValue('body', $sMessage);
$oMsgObj->commit();
return true;
} else {
return false;
}
} else {
return false;
}
}
示例6: __construct
public function __construct()
{
parent::__construct();
if (cmsController::getInstance()->getCurrentMode() == "admin") {
$commonTabs = $this->getCommonTabs();
if ($commonTabs) {
$commonTabs->add("types", array("type_add", "type_edit"));
$commonTabs->add("guides", array("guide_add", "guide_items", "guide_item_edit", "guide_item_add"));
}
$configTabs = $this->getConfigTabs();
if ($configTabs) {
$configTabs->add("config");
}
$this->__loadLib("__admin.php");
$this->__implement("__data");
$this->__loadLib("__json.php");
$this->__implement("__json_data");
$this->__loadLib("__trash.php");
$this->__implement("__trash_data");
$this->__loadLib("__guides.php");
$this->__implement("__guides_data");
$this->__loadLib("__files.php");
$this->__implement("__files_data");
} else {
$this->__loadLib("__rss.php");
$this->__implement("__rss_data");
}
$this->__loadLib("__client_reflection.php");
$this->__implement("__client_reflection_data");
$this->__loadLib("__search.php");
$this->__implement("__search_data");
$this->__loadLib("__custom.php");
$this->__implement("__custom_data");
}
示例7: search
/**
* Найти наиболее подходящую скидку для заказа $order
* @param order $order заказ
* @return orderDiscount самая подходящая скидка для заказа $order
*/
public static function search(order $order) {
$cmsController = cmsController::getInstance();
$emarket = $cmsController->getModule('emarket');
if($emarket instanceof def_module == false) {
throw new coreException('Emarket module must be installed in order to calculate discounts');
}
$allDiscounts = $emarket->getAllDiscounts('bonus');
$discounts = array();
foreach($allDiscounts as $discountObject) {
$discount = discount::get($discountObject->id);
if($discount instanceof bonusDiscount == false) continue;
if($discount->validate($order)) $discounts[] = $discount;
}
switch(sizeof($discounts)) {
case 0: return null;
default:
$orderPrice = $order->getOriginalPrice();
$maxDiscount = null; $minPrice = null;
foreach($discounts as $i => $discount) {
$price = $discount->recalcPrice($orderPrice);
if($price <= 0) continue;
if(is_null($minPrice) || $minPrice > $price) {
$minPrice = $price;
$maxDiscount = $discount;
}
}
return $maxDiscount;
}
}
示例8: autoExport
public static function autoExport(selector $v8be74552df93e31bbdd6b36ed74bdb6a, $vb8c8ec69026adfe891bf5e618eabb17b = false)
{
$v4aed429835809b0214b31d7ff74f05ba = new quickCsvExporter($v8be74552df93e31bbdd6b36ed74bdb6a);
$v0e8133eb006c0f85ed9444ae07a60842 = umiObjectTypesCollection::getInstance();
foreach ($v8be74552df93e31bbdd6b36ed74bdb6a->types as $v599dcce2998a6b40b1e38e8c6006cb0a) {
if (is_null($v599dcce2998a6b40b1e38e8c6006cb0a->objectType) == false) {
$v6301cee35ea764a1e241978f93f01069 = $v599dcce2998a6b40b1e38e8c6006cb0a->objectType->getId();
$v4aed429835809b0214b31d7ff74f05ba->setObjectTypeId($v6301cee35ea764a1e241978f93f01069);
}
if (is_null($v599dcce2998a6b40b1e38e8c6006cb0a->hierarchyType) == false) {
$vacf567c9c3d6cf7c6e2cc0ce108e0631 = $v599dcce2998a6b40b1e38e8c6006cb0a->hierarchyType->getId();
$v6301cee35ea764a1e241978f93f01069 = $v0e8133eb006c0f85ed9444ae07a60842->getTypeByHierarchyTypeId($vacf567c9c3d6cf7c6e2cc0ce108e0631);
$v4aed429835809b0214b31d7ff74f05ba->setObjectTypeId($v6301cee35ea764a1e241978f93f01069);
}
}
if ($v8be74552df93e31bbdd6b36ed74bdb6a->mode == "pages" || $v8be74552df93e31bbdd6b36ed74bdb6a->hierarchy || $vb8c8ec69026adfe891bf5e618eabb17b) {
$v4aed429835809b0214b31d7ff74f05ba->setResultsMode("element");
} else {
$v4aed429835809b0214b31d7ff74f05ba->setResultsMode("object");
}
$v52a43e48ec4649dee819dadabcab1bde = cmsController::getInstance()->getCurrentModule();
$v2245023265ae4cf87d02c8b6ba991139 = mainConfiguration::getInstance();
$v435ed7e9f07f740abf511a62c00eef6e = $v52a43e48ec4649dee819dadabcab1bde ? $v52a43e48ec4649dee819dadabcab1bde . "-" . date("Y-m-d_H.i.s") : "csv-export-" . uniqid();
$vedcf819b71ce7a0689cd83e44f16b702 = $v2245023265ae4cf87d02c8b6ba991139->includeParam('system.runtime-cache') . $v435ed7e9f07f740abf511a62c00eef6e . ".csv";
$v4aed429835809b0214b31d7ff74f05ba->setUsedFields(getRequest('used-fields'));
$v4aed429835809b0214b31d7ff74f05ba->exportToFile($vedcf819b71ce7a0689cd83e44f16b702);
$v8c7dd922ad47494fc02c388e12c00eac = new umiFile($vedcf819b71ce7a0689cd83e44f16b702);
$v8c7dd922ad47494fc02c388e12c00eac->download(true);
}
示例9: merge
/**
* Слить все заказы покупателя в профиль пользователя.
* Объект покупателя после этого будет уничтожен
*/
public function merge(umiObject $customer) {
$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->id);
$sel->where('domain_id')->equals($domainId);
$sel->order('id')->desc();
$permissions = permissionsCollection::getInstance();
$userId = $permissions->getUserId();
foreach($sel as $order) {
if(!$order->status_id) {
$this->mergeBasket($order);
continue;
}
$order->customer_id = $userId;
$order->commit();
}
if (!defined('UMICMS_CLI_MODE') || !UMICMS_CLI_MODE) {
setcookie('customer-id', 0, 1, '/');
}
$customer->delete();
}
示例10: registerEvent
/**
* Зарегистрировать событие в истории событий
* @param string $eventTypeId идентификатор типа события
* @param array $params массив параметров события
* @param int $elementId id связанной страницы
* @param int $objectId id связанного объекта
*/
public function registerEvent($eventTypeId, $params = array(), $elementId = null, $objectId = null) {
$pool = ConnectionPool::getInstance();
$connection = $pool->getConnection();
umiEventFeed::setConnection($connection);
umiEventFeedType::setConnection($connection);
try {
$eventType = umiEventFeedType::get($eventTypeId);
} catch (Exception $e) {
$eventType = umiEventFeedType::create($eventTypeId);
}
$userId = permissionsCollection::getInstance()->getUserId();
$user = umiObjectsCollection::getInstance()->getObject($userId)->getName();
$module = cmsController::getInstance()->getModule('users');
$link = $module->getObjectEditLink($userId);
array_unshift($params, $user);
array_unshift($params, $link);
umiEventFeed::create($eventType, $params, $elementId, $objectId);
$maxDays = (int) regedit::getInstance()->getVal("//modules/events/max-days-storing-events");
if ($maxDays > 0) {
$lastDate = time() - ($maxDays * 24 * 60 * 60);
umiEventFeed::deleteList(array(), $lastDate);
}
}
示例11: _network_settings
public function _network_settings($network) {
$this->setHeaderLabel(getLabel("header-social_networks-settings") . $network->getName());
$mode = getRequest("param0");
$cmsController = cmsController::getInstance();
$type = $network->getCodeName();
$module = $cmsController->getCurrentModule();
$method = $cmsController->getCurrentMethod();
$config = mainConfiguration::getInstance();
$templateId = $config->get("templates", "{$module}.{$method}");
$inputData = array(
'object' => $network->getObject(),
'type' => $type
);
if($mode == "do") {
$config->set("templates", "{$module}.{$method}", getRequest('template-id'));
$object = $this->saveEditedObjectData($inputData);
$this->chooseRedirect($this->pre_lang . '/admin/social_networks/' . $type . '/');
}
$this->setDataType("form");
$this->setActionType("modify");
$data = $this->prepareData($inputData, "object");
$data['template-id'] = array('@id' => $templateId);
$this->setData($data);
return $this->doData();
}
示例12: item_element
public function item_element()
{
if ($this->breakMe()) {
return;
}
$element_id = (int) cmsController::getInstance()->getCurrentElementId();
return $this->view($element_id);
}
示例13: getDataModule
public function getDataModule()
{
static $dataModule;
if (!$dataModule) {
$dataModule = cmsController::getInstance()->getModule('data');
}
return $dataModule;
}
示例14: config
public function config()
{
$regedit = regedit::getInstance();
$domains = domainsCollection::getInstance()->getList();
$lang_id = cmsController::getInstance()->getCurrentLang()->getId();
$params = array();
if ($regedit->getVal("//modules/seo/yandex-token")) {
$params['yandex']['string:token'] = $regedit->getVal("//modules/seo/yandex-token");
} else {
$params['yandex']['string:code'] = '';
}
foreach ($domains as $domain) {
$domain_id = $domain->getId();
$domain_name = $domain->getHost();
$seo_info = array();
$seo_info['status:domain'] = $domain_name;
$seo_info['string:title-' . $domain_id] = $regedit->getVal("//settings/title_prefix/{$lang_id}/{$domain_id}");
$seo_info['string:keywords-' . $domain_id] = $regedit->getVal("//settings/meta_keywords/{$lang_id}/{$domain_id}");
$seo_info['string:description-' . $domain_id] = $regedit->getVal("//settings/meta_description/{$lang_id}/{$domain_id}");
$params[$domain_name] = $seo_info;
}
$mode = (string) getRequest('param0');
if ($mode == "do") {
$params = $this->expectParams($params);
foreach ($domains as $domain) {
$domain_id = $domain->getId();
$domain_name = $domain->getHost();
$title = $params[$domain_name]['string:title-' . $domain_id];
$keywords = $params[$domain_name]['string:keywords-' . $domain_id];
$description = $params[$domain_name]['string:description-' . $domain_id];
$regedit->setVal("//settings/title_prefix/{$lang_id}/{$domain_id}", $title);
$regedit->setVal("//settings/meta_keywords/{$lang_id}/{$domain_id}", $keywords);
$regedit->setVal("//settings/meta_description/{$lang_id}/{$domain_id}", $description);
}
if (isset($params['yandex']['string:code'])) {
$queryParams = array('grant_type' => "authorization_code", 'code' => $params['yandex']['string:code'], 'client_id' => "47fc30ca18e045cdb75f17c9779cfc36", 'client_secret' => "8c744620c2414522867e358b74b4a2ff");
$response = umiRemoteFileGetter::get("https://oauth.yandex.ru/token", false, array(), $queryParams, true, "POST");
$response = preg_split("|(\r\n\r\n)|", $response);
$result = json_decode($response[1]);
if (!isset($result) || $result->error || !$result->access_token) {
$this->errorNewMessage(getLabel('webmaster-wrong-code'));
$this->errorPanic();
}
$token = $result->access_token;
$regedit->setVal("//modules/seo/yandex-token", $token);
} else {
$regedit->setVal("//modules/seo/yandex-token", $params['yandex']['string:token']);
}
$this->chooseRedirect();
}
$this->setDataType('settings');
$this->setActionType('modify');
$data = $this->prepareData($params, 'settings');
$this->setData($data);
return $this->doData();
}
示例15: executeCallback
protected function executeCallback($v924a8ceeac17f54d3be3f8cdf1c04eb2, $v70e8822b2e035fa3777d666207aeafa8)
{
$v22884db148f0ffb0d830ba431102b0b5 = $v924a8ceeac17f54d3be3f8cdf1c04eb2->getCallbackModule();
$vea9f6aca279138c58f705c8d4cb4b8ce = $v924a8ceeac17f54d3be3f8cdf1c04eb2->getCallbackMethod();
if ($v47a12618c9a47b69a3050e6b9313a351 = cmsController::getInstance()->getModule($v22884db148f0ffb0d830ba431102b0b5)) {
$v47a12618c9a47b69a3050e6b9313a351->{$vea9f6aca279138c58f705c8d4cb4b8ce}($v70e8822b2e035fa3777d666207aeafa8);
} else {
throw new coreException("Cannot find module \"{$v22884db148f0ffb0d830ba431102b0b5}\"");
}
}