Ejemplo n.º 1
0
 public static function onAfterDelete(Event $event)
 {
     $parameters = $event->getParameter("id");
     $code = $parameters["CODE"];
     Designer\ConfigTable::delete(array("APP_CODE" => $code));
     parent::onAfterDelete($event);
 }
Ejemplo n.º 2
0
$componentParams = array('INPUT_NAME' => 'FILE_NEW', 'INPUT_NAME_UNSAVED' => 'FILE_NEW_TMP', 'MAX_FILE_SIZE' => 0, 'MODULE_ID' => 'mobileapp', 'ALLOW_UPLOAD' => "F", 'CONTROL_ID' => "designer", 'ALLOW_UPLOAD_EXT' => "jpg,png,jpeg");
$GLOBALS['APPLICATION']->IncludeComponent('bitrix:mobileapp.designer.file.input', 'drag_n_drop', $componentParams, false);
$initData = __DSGetInitData();
$initDataJS = CUtil::PhpToJSObject($initData);
?>


<script>
	BX.ready(function ()
	{
		if (BX.browser.IsIE() && BX.browser.DetectIeVersion() < 9)
		{
			return false;
		}

		window.designer = new BX.Mobile.Designer({
			containerId: "designer-wrapper",
			platforms:<?php 
echo CUtil::PhpToJSObject(\Bitrix\MobileApp\Designer\ConfigTable::getSupportedPlatforms());
?>
		});
		window.designer.init();
	});
</script>

<?php 
require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_admin.php";
?>


Ejemplo n.º 3
0
 /**
  * Return configuration in JSON format
  *
  * @param $appCode - application code
  * @param bool $platform - platform code
  *
  * @see ConfigTable::getSupportedPlatforms for details on availible platforms
  * @return string
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function getConfigJSON($appCode, $platform = false)
 {
     $map = new \Bitrix\MobileApp\Designer\ConfigMap();
     $res = ConfigTable::getList(array("filter" => array("APP_CODE" => $appCode)));
     $configs = $res->fetchAll();
     $targetConfig = array();
     for ($i = 0; $i < count($configs); $i++) {
         if ($configs[$i]["PLATFORM"] == $platform) {
             $targetConfig = $configs[$i];
             break;
         } elseif ($configs[$i]["PLATFORM"] == "global") {
             $targetConfig = $configs[$i];
         }
     }
     $params = array_key_exists("PARAMS", $targetConfig) ? $targetConfig["PARAMS"] : array();
     $imageParamList = $map->getParamsByType(ParameterType::IMAGE);
     $imageSetParamList = $map->getParamsByType(ParameterType::IMAGE_SET);
     $structuredConfig = array();
     foreach ($params as $key => $value) {
         if (!$map->has($key)) {
             continue;
         }
         if (array_key_exists($key, $imageParamList)) {
             $imagePath = \CFile::GetPath($value);
             if (strlen($imagePath) > 0) {
                 $value = $imagePath;
             } else {
                 continue;
             }
         }
         if (array_key_exists($key, $imageSetParamList)) {
             $tmpValue = array();
             foreach ($value as $imageCode => $imageId) {
                 $imagePath = \CFile::GetPath($imageId);
                 if (strlen($imagePath) > 0) {
                     $tmpValue[$imageCode] = $imagePath;
                 } else {
                     continue;
                 }
             }
             $value = $tmpValue;
         }
         $structuredConfig = array_merge_recursive(self::nameSpaceToArray($key, $value), $structuredConfig);
     }
     $structuredConfig["info"] = array("designer_version" => ConfigMap::VERSION, "platform" => $platform);
     if (toUpper(SITE_CHARSET) != "UTF-8") {
         $structuredConfig = Encoding::convertEncodingArray($structuredConfig, SITE_CHARSET, "UTF-8");
     }
     return json_encode($structuredConfig);
 }