本文整理汇总了PHP中cmsController类的典型用法代码示例。如果您正苦于以下问题:PHP cmsController类的具体用法?PHP cmsController怎么用?PHP cmsController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cmsController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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);
}
示例3: 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');
}
}
示例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: _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();
}
示例6: run
public function run()
{
$form = $this->getForm('options');
if (!$form) {
cmsCore::error404();
}
$is_submitted = $this->request->has('submit');
$options = cmsController::loadOptions($this->name);
$source_controllers = cmsEventsManager::hookAll('sitemap_sources');
if (is_array($source_controllers)) {
foreach ($source_controllers as $controller) {
foreach ($controller['sources'] as $id => $title) {
$form->addField('sources', new fieldCheckbox("sources:{$controller['name']}|{$id}", array('title' => $title)));
}
}
}
if ($is_submitted) {
$options = $form->parse($this->request, $is_submitted);
$errors = $form->validate($this, $options);
if (!$errors) {
cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
cmsController::saveOptions($this->name, $options);
$this->redirectToAction('options');
}
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
return cmsTemplate::getInstance()->render('backend/options', array('options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
}
示例7: 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;
}
}
示例8: actionOptions
public function actionOptions()
{
if (empty($this->useDefaultOptionsAction)) {
cmsCore::error404();
}
$form = $this->getForm('options');
if (!$form) {
cmsCore::error404();
}
$form = $this->addControllerSeoOptions($form);
$options = cmsController::loadOptions($this->name);
if ($this->request->has('submit')) {
$options = array_merge($options, $form->parse($this->request, true));
$errors = $form->validate($this, $options);
if (!$errors) {
cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
cmsController::saveOptions($this->name, $options);
$this->processCallback(__FUNCTION__, array($options));
$this->redirectToAction('options');
}
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
$template_params = array('toolbar' => $this->getOptionsToolbar(), 'options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false);
// если задан шаблон опций в контроллере
if ($this->cms_template->getTemplateFileName('controllers/' . $this->name . '/backend/options', true)) {
return $this->cms_template->render('backend/options', $template_params);
} else {
$default_admin_tpl = $this->cms_template->getTemplateFileName('controllers/admin/controllers_options');
return $this->cms_template->processRender($default_admin_tpl, $template_params);
}
}
示例9: 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);
}
示例10: __construct
/**
* @desc Конструктор
*/
public function __construct()
{
parent::__construct();
if (cmsController::getInstance()->getCurrentMode() == "admin") {
$regedit = regedit::getInstance();
$systemEdition = $regedit->getVal("//modules/autoupdate/system_edition");
$patches_disabled = false;
if (strpos($systemEdition, 'trial') !== false || strpos($systemEdition, 'commerce_enc') !== false || strpos($systemEdition, 'start') !== false) {
$patches_disabled = true;
}
if ($patches_disabled) {
$regedit->setVar("//modules/autoupdate/disable_patches", "1");
} else {
$regedit->setVar("//modules/autoupdate/disable_patches", "0");
}
$commonTabs = $this->getCommonTabs();
if ($commonTabs && !$patches_disabled) {
$commonTabs->add('versions');
$commonTabs->add('patches');
}
$this->__loadLib("__admin.php");
$this->__implement("__autoupdate");
$this->__loadLib("__json.php");
$this->__implement("__json_autoupdate");
}
}
示例11: 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);
}
}
示例12: 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;
}
}
示例13: 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);
}
示例14: actionOptions
public function actionOptions()
{
if (empty($this->useDefaultOptionsAction)) {
cmsCore::error404();
}
$form = $this->getForm('options');
if (!$form) {
cmsCore::error404();
}
$is_submitted = $this->request->has('submit');
$options = cmsController::loadOptions($this->name);
if ($is_submitted) {
$options = $form->parse($this->request, $is_submitted);
$errors = $form->validate($this, $options);
if (!$errors) {
cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
cmsController::saveOptions($this->name, $options);
$this->redirectToAction('options');
}
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
return cmsTemplate::getInstance()->render('backend/options', array('options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
}
示例15: __construct
public function __construct()
{
parent::__construct();
$this->config = cmsController::loadOptions('photos');
if (!empty($this->config['types'])) {
$this->config['types'] = string_explode_list($this->config['types']);
}
}