/** * Получить массив описания параметров компонента * @return Array - массив настроек компонента */ public function getSettings() { $arComponentName = array('NAMESPACE' => &$this->_componentNamespace, 'NAME' => &$this->_componentName, 'PATH' => &$this->_componentPath, 'DESCRIPTION' => &$this->_componentDescription); $arTemplateName = array('NAME' => &$this->_templateName, 'SKIN' => &$this->_templateSkin, 'PATH' => &$this->_templatePath, 'DESCRIPTION' => &$this->_templateDescription); $arSettings = ComponentTools::_getSettingsByName($arComponentName, $arTemplateName); ComponentTools::setParametersListForEachGroup($arSettings); return $arSettings; }
<?php namespace ScriptAcid; require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/application.php"; $fileApplicationTemplate = DOC_ROOT . '/' . App::getTemplatePath() . '/' . App::get()->TEMPLATE_FILENAME . '.php'; if (file_exists($fileApplicationTemplate)) { $strAppclicationTemplate = file_get_contents($fileApplicationTemplate); } else { echo 'Шаблон не найден' . endl; die; } $strAppclicationTemplate = trim($strAppclicationTemplate); $arPhpEntries = ComponentTools::parseString($strAppclicationTemplate, 'all'); $strResult = ''; foreach ($arPhpEntries['SPLIT_STRING'] as $key => &$arStrPart) { if ($arPhpEntries['MATCHES'][$key][1] < $arStrPart[1]) { $strResult .= $arPhpEntries['MATCHES'][$key][0] . $arStrPart[0]; } else { $strResult .= $arStrPart[0] . $arPhpEntries['MATCHES'][$key][0]; } } $strResult = trim($strResult); if (false) { echo '<!--' . "\n" . 'ORIG_FILE_CONTENT:' . "\n" . $strAppclicationTemplate . "\n\n" . 'GENERATED_AFTER_PART_CONTENT:' . "\n" . $strResult . '-->'; } if ($strResult == $strAppclicationTemplate) { echo "ok.\n"; } else { echo "error.\n"; }
//$_POST['template_name']; //$_POST['replacement_params']; unset($_POST['currentCall']['obArParams']['COMPONENT_AJAX_READY']); //unset($_POST['replacement_params']['COMPONENT_AJAX_SEND_PAGE_POST']); unset($_POST['replacementCall']['obArParams']['COMPONENT_CALL_KEY']); //d($_POST); if (!@isset($_POST['currentCall']['inFileComponentNum'])) { throw new ComponentException('component number in file not set', ComponentException::E_CMP_EDIT_WRONG_CMP_NUM); } if (!is_file(DOC_ROOT . $_POST['currentCall']['inFile'])) { throw new ComponentException('wrong file name for edit', ComponentException::E_CMP_EDIT_WRONG_FILE); } $arReplacementCall = ComponentTools::makeComponentCallArray($_POST['replacementCall']['componentName'], $_POST['replacementCall']['templateName'] . ':' . $_POST['replacementCall']['templateSkin'], $_POST['replacementCall']['obArParams']); if ($arReplacementCall['COMPONENT_EXISTS'] == 'N') { throw new ComponentException('wrong component name', ComponentException::E_WRONG_CMP_NAME); } if ($arReplacementCall['TEMPLATE_EXISTS'] == 'N') { throw new ComponentException('wrong template name', ComponentException::E_WRONG_TPL_NAME); } //d($arReplacementCall); if (ComponentTools::replaceComponentInFile($_POST['currentCall']['inFileComponentNum'], $arReplacementCall, $_POST['currentCall']['inFile'])) { echo 'ok.'; } } catch (ComponentException $except) { //if($except->getCode() == ComponentTools::E_PARSE_FAIL) { //} //d($except->getComponentCallArray()); echo $except->getMessage() . '.'; } catch (AppErrorException $except) { d($arReplacementCall); }
if (is_array($_POST['current_params'])) { $arCurrentParams = $_POST['current_params']; } $arHiddenParams = array(); // Задаем текущие значения foreach ($arComponentSettings['PARAMETERS'] as $keyParameter => &$arParameter) { $arParameter['CURRENT_VALUE'] = null; if (@isset($arCurrentParams[$keyParameter])) { $arParameter['CURRENT_VALUE'] = $arCurrentParams[$keyParameter]; } if ($arParameter['TYPE'] == 'HIDDEN') { $arHiddenParams[$keyParameter] = $arParameter; } } // Получаем список шаблонов компонента $arComponentSettings['COMPONENT']['TEMPLATES_LIST'] = ComponentTools::_getTemplatesList($arComponentSettings['COMPONENT']); //if(false) { //d($arComponentSettings, '$arComponentSettings'); //d($arComponentSettings['PARAMETERS'], '$arComponentSettings[PARAMETERS]'); //d($arComponentSettings['PARAMETERS_GROUPS'], '$arComponentSettings[PARAMETERS_GROUPS]'); //} //$arComponentSettings['PARAMETERS']['COMPONENT_AJAX_MODE']['LIST_SETTINGS']['MULTIPLE'] = 'Y'; //$arComponentSettings['PARAMETERS']['COMPONENT_AJAX_MODE']['LIST_SETTINGS']['RADIO'] = 'Y'; //d($arComponentSettings['PARAMETERS'], 'PARAMETERS'); ?> <form action="" method="post"> <table width="100%"> <tr class="sacid-cmp-param-group-title"> <td colspan="2"> Компонент: <b><?php
public function showPage() { if ($this->_pageFunctionAlreadyCreated) { Event::run('main', 'OnBeforeShowPage'); if (APP_DISPLAY_MODE == 'EDIT') { ComponentTools::setCurrentFileName('public_page'); } call_user_func($this->_pageFunction, &$this->_arPageParams); Event::run('main', 'OnAfterShowPage'); if (APP_DISPLAY_MODE == 'EDIT') { ComponentTools::setCurrentFileName('application_template'); } } }
<?php namespace ScriptAcid; require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/application.php"; SetTitle('Проект "ScriptACID CMF". Тест получения параметров компонента'); App::page(function (&$arPageParams) { ?> <?php echo "<b>:catalog.element.add@_default</b>" . endl; $arCatalogElementAddComponentSettings = ComponentTools::getSettingsByName(':catalog.element.add'); d($arCatalogElementAddComponentSettings, ':catalog.element.add'); $arTplList = ComponentTools::getTemplatesList(':catalog.element.add'); d($arTplList, ':catalog.element.add - templates list'); echo "<b>:menu@top</b>" . endl; $arMenuTopComponentSettings = ComponentTools::getSettingsByName(":menu", 'top'); d($arMenuTopComponentSettings, ':menu@top'); echo "<b>:menu@left</b>" . endl; $arMenuLeftComponentSettings = ComponentTools::getSettingsByName(':menu', 'left'); d($arMenuLeftComponentSettings, ':menu@left'); $arTplList = ComponentTools::getTemplatesList(':menu'); d($arTplList, ':menu - templates list'); ?> <?php }); // end of makePage