public function indexAction() { $version = Config::factory(Config::File_Array, $this->_configMain['configs'] . 'versions.php')->get('orm'); $res = Resource::getInstance(); $dbConfigs = array(); foreach ($this->_configMain->get('db_configs') as $k => $v) { $dbConfigs[] = array('id' => $k, 'title' => $this->_lang->get($v['title'])); } //tooltips $lPath = $this->_configMain->get('lang_path') . $this->_configMain->get('language') . '/orm.php'; Lang::addDictionaryLoader('orm_tooltips', $lPath, Config::File_Array); $this->_resource->addInlineJs(' var canPublish = ' . (int) $this->_user->canPublish($this->_module) . '; var canEdit = ' . (int) $this->_user->canEdit($this->_module) . '; var canDelete = ' . (int) $this->_user->canDelete($this->_module) . '; var useForeignKeys = ' . (int) $this->_configMain['foreign_keys'] . '; var canUseBackup = ' . (int) $this->_isLocalhost() . '; var dbConfigsList = ' . json_encode($dbConfigs) . '; '); $this->_resource->addRawJs('var ormTooltips = ' . Lang::lang('orm_tooltips')->getJson() . ';'); $res->addJs('/js/app/system/SearchPanel.js', 0); $res->addJs('/js/app/system/ORM.js?v=' . $version, 2); $res->addJs('/js/app/system/EditWindow.js', 1); $res->addJs('/js/app/system/HistoryPanel.js', 1); $res->addJs('/js/app/system/ContentWindow.js', 1); $res->addJs('/js/app/system/RevisionPanel.js', 2); $res->addJs('/js/app/system/RelatedGridPanel.js', 2); $res->addJs('/js/lib/uml/raphael.js', 3); // $res->addJs('/js/lib/uml/raphael.2.1.min.js' , 3); $res->addJs('/js/lib/uml/joint.js', 4); $res->addJs('/js/lib/uml/joint.dia.js', 5); $res->addJs('/js/lib/uml/joint.dia.uml.js', 6); }
/** * Conver field from ORM format and add to the project * @param string $name * @param Db_Object_Config $importObject */ protected function _importOrmField($name, $importObjectConfig) { $tabName = $this->_object->getName() . '_generalTab'; if (!$this->_project->objectExists($tabName)) { $tab = Ext_Factory::object('Panel'); $tab->setName($tabName); $tab->frame = false; $tab->border = false; $tab->layout = 'anchor'; $tab->bodyPadding = 3; $tab->bodyCls = 'formBody'; $tab->anchor = '100%'; $tab->autoScroll = true; $tab->title = Lang::lang()->GENERAL; $tab->fieldDefaults = "{\n\t\t\t labelAlign: 'right',\n\t\t\t labelWidth: 160,\n\t\t\t anchor: '100%'\n\t\t\t }"; $this->_project->addObject($this->_object->getName(), $tab); } $tabsArray = array('Component_Field_System_Medialibhtml', 'Component_Field_System_Related', 'Component_Field_System_Objectslist'); $newField = Backend_Designer_Import::convertOrmFieldToExtField($name, $importObjectConfig->getFieldConfig($name)); if ($newField !== false) { $fieldClass = $newField->getClass(); if ($fieldClass == 'Component_Field_System_Objectslist' || $fieldClass == 'Component_Field_System_Objectlink') { $newField->controllerUrl = $this->_object->controllerUrl; } $newField->setName($this->_object->getName() . '_' . $name); if (in_array($fieldClass, $tabsArray, true)) { $this->_project->addObject($this->_object->getName(), $newField); } else { $this->_project->addObject($tabName, $newField); } } }
public static function setLanguage($value) { if (!in_array($value, self::$languages)) { return; } self::$lang = $value; }
public static function ini() { self::$supportedLangs = self::getSupported(); // self::$lang = self::detect(); self::put(); }
public function __construct() { parent::__construct(); $langPath = $this->_configMain->get('lang_path') . $this->_configMain->get('language') . '/import.php'; Lang::addDictionaryLoader('import', $langPath, Config::File_Array); $this->_iLang = Lang::lang('import'); }
/** Load Dictionary * * @param Array $load - Dictionary array * */ public static function load($load) { Trace::add_trace('construct class', __METHOD__); self::$dic = isset($load['dic']) ? $load['dic'] : array(); self::$hooks = isset($load['js']) ? $load['js'] : array(); self::$lang = isset($load['lang']) ? $load['lang'] : array(); }
/** * (non-PHPdoc) * @see Bgtask_Abstract::run() */ public function run() { $lang = Lang::lang(); $appConfig = Registry::get('main', 'config'); $deployCfg = Config::factory(Config::File_Array, $appConfig->get('configs') . 'deploy.php'); $this->setTotalCount(3); $dirName = $deployCfg->get('datadir') . $this->_config['server'] . DIRECTORY_SEPARATOR . date('Y-m-d_H_i_s'); if (!is_dir($dirName) && !mkdir($dirName, 0775, true)) { $this->error($lang->CANT_WRITE_FS . '(' . $dirName . ')'); } $dirName .= DIRECTORY_SEPARATOR; $this->_nextStep(); if (isset($this->_config['files']) && !empty($this->_config['files']) && is_array($this->_config['files'])) { if (!File::zipFiles($dirName . 'www.zip', $this->_config['files'], $dirName)) { $this->error($lang->CANT_WRITE_FS . '(' . $dirName . 'www.zip' . ')'); } } $this->_nextStep(); if (isset($this->_config['files_delete']) && !empty($this->_config['files_delete']) && is_array($this->_config['files_delete'])) { if (!@file_put_contents($dirName . 'delete.txt', implode("\n", $this->_config['files_delete']))) { $this->error($lang->CANT_WRITE_FS . '(' . $dirName . 'delete.txt' . ')'); } if (!File::zipFiles($dirName . 'www.zip', array($dirName . 'delete.txt'), $dirName)) { $this->error($lang->CANT_WRITE_FS . '(' . $dirName . 'www.zip' . ')'); } unlink($dirName . 'delete.txt'); } $this->_nextStep(); $this->finish(); }
public function getWorkflowValue() { if (isset($this->workflowList[$this->workflow])) { return $this->workflowList[$this->workflow]; } return Lang::lang('undefined'); }
public function __construct() { $this->_page = Page::getInstance(); $this->_resource = Resource::getInstance(); $this->_lang = Lang::lang(); $this->_db = static::$_defaultDb; $this->_configMain = Registry::get('main', 'config'); }
public function __construct() { $this->_configMain = Registry::get('main', 'config'); $this->_lang = Lang::lang(); $this->_db = Application::getDbConnection(); $this->_config = Config::factory(Config::File_Array, $this->_configMain['configs'] . 'designer.php'); $this->_session = Store_Session::getInstance('Designer'); $this->_storage = Designer_Storage::getInstance($this->_config->get('storage'), $this->_config); }
/** * Loads a language, and sets as current. * * @param string $code * @return boolean */ public static function load($code) { global $root; if (file_exists("{$root}/lang/{$code}.php")) { require_once "{$root}/lang/{$code}.php"; if (isset($charset) && isset($lang)) { self::$charset = $charset; self::$lang = $lang; return true; } } return false; }
public function testGet() { $enDict = Config::factory(Config::File_Array, Registry::get('main', 'config')->get('lang_path') . 'en.php'); $ruDict = Config::factory(Config::File_Array, Registry::get('main', 'config')->get('lang_path') . 'ru.php'); Lang::addDictionary('en', $enDict); Lang::addDictionary('ru', $ruDict); Lang::setDefaultDictionary('en'); $lang = Lang::lang(); $this->assertEquals($lang->ACTION, 'Action'); $this->assertEquals($lang->get('ACTION'), 'Action'); $lang = Lang::lang('ru'); $this->assertEquals($lang->ACTION, 'Действие'); $this->assertEquals($lang->get('ACTION'), 'Действие'); }
/** * (non-PHPdoc) * @see Bgtask_Abstract::run() */ public function run() { $lang = Lang::lang(); $this->setTotalCount(4); $config = Registry::get('main', 'config'); $deployCfg = Config::factory(Config::File_Array, $config->get('configs') . 'deploy.php'); $delimiter = $config->get('urlDelimiter'); $url = 'http://' . str_replace(array('http://', $delimiter . $delimiter, $config->get('urlExtension')), array('', $delimiter, ''), $this->_config['url'] . $delimiter . 'deploy' . $delimiter . 'syncfiles'); $dataSend = array('key' => Utils::hash($this->_config['key'])); $curl = curl_init(); $this->log('Connecting to ' . $url . '...'); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_VERBOSE, 0); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $dataSend); curl_setopt($curl, CURLOPT_TIMEOUT, 3600); $result = curl_exec($curl); $this->_nextStep(); if ($result === false) { $this->error(curl_error($curl)); } $data = json_decode($result, true); if (empty($data) || !is_array($data)) { $this->error('Empty response from server'); } if (!$data['success']) { $this->error('Remote server error. ' . $data['msg']); } if (!isset($data['data']['files'])) { $this->error('Invalid result'); } $data = $data['data']; $serverDir = $deployCfg->get('datadir') . $this->_config['id'] . '/'; if (!file_exists($serverDir) && !mkdir($serverDir)) { $this->error($lang->CANT_WRITE_FS . '(' . $serverDir . ')'); } $this->_nextStep(); if (!Utils::exportArray($serverDir . 'map.php', $data['files'])) { $this->error($lang->CANT_WRITE_FS . '(' . $serverDir . 'map.php' . ')'); } $this->_nextStep(); if (!@file_put_contents($serverDir . 'lastfsupdate', date('Y-m-d H:i:s'))) { $this->error($lang->CANT_WRITE_FS . '(' . $serverDir . 'lastfsupdate' . ')'); } $this->_nextStep(); $this->finish(); }
/** * Run controller * @param string $controller - controller class * @param string $action - action name * @return mixed */ public function runController($controller, $action = false) { if (!class_exists($controller)) { return false; } $controller = new $controller(); $controller->setRouter($this); if ($controller instanceof Router_Interface) { return $controller->route(); } if ($action === false || !strlen($action) || !method_exists($controller, $action . 'Action')) { if (strlen($action) && Request::isAjax()) { Response::jsonError(Lang::lang()->get('WRONG_REQUEST') . ' ' . Request::getInstance()->getUri()); } $action = 'index'; } return $controller->{$action . 'Action'}(); }
/** * Route request to the Controller * @return void */ public function route() { $cfg = Registry::get('backend', 'config'); $controller = $this->_request->getPart(1); $controller = Utils_String::formatClassName(Filter::filterValue('pagecode', $controller)); if (in_array('Backend_' . $controller . '_Controller', $cfg->get('system_controllers'))) { $controller = 'Backend_' . $controller . '_Controller'; } else { $manager = new Backend_Modules_Manager(); $controller = $manager->getModuleController($controller); if ($controller === false) { if (Request::isAjax()) { Response::jsonError(Lang::lang()->get('WRONG_REQUEST') . ' ' . Request::getInstance()->getUri()); } $controller = 'Backend_Index_Controller'; } } $this->runController($controller, $this->_request->getPart(2)); }
public function __construct(\Rebond\App $app) { if ($app->site()->getStatus() == \Rebond\Core\StatusType::INACTIVE) { if ($app->ajax()) { return ['result' => ResultType::ERROR, 'message' => Lang::lang('error.maintenance')]; } else { Util\Session::redirect('/error/maintenance'); } } parent::__construct($app); if ($this->signedUser->getId() != 0) { $options = ['where' => [['id = ?', $this->signedUser->getId()]]]; $this->player = \Own\Bus\Player\Data::load($options); if ($this->player == null) { $this->player = \Own\Bus\Player\Service::create($this->signedUser); } } else { $this->player = new \Own\Bus\Player\Model(); } }
/** * Remove DB Connection config * Caution! Connection settings will be removed for all system modes. * @param string $id * @throws Exception */ public function removeConnection($id) { $errors = array(); /* * Check for write permissions before operation */ foreach ($this->_config as $devType => $data) { $file = $data['dir'] . $id . '.php'; if (file_exists($file) && !is_writable($file)) { $errors[] = $file; } } if (!empty($errors)) { throw new Exception(Lang::lang()->get('CANT_WRITE_FS') . ' ' . implode(', ', $errors)); } foreach ($this->_config as $devType => $data) { $file = $data['dir'] . $id . '.php'; if (!@unlink($file)) { throw new Exception(Lang::lang()->get('CANT_WRITE_FS') . ' ' . $file); } } }
public function __construct() { $this->_page = Page::getInstance(); $this->_resource = Resource::getInstance(); $this->_module = $this->getModule(); $this->_lang = Lang::lang(); $this->_db = static::$_defaultDb; $this->_configMain = Registry::get('main', 'config'); $cacheManager = new Cache_Manager(); $this->_configBackoffice = Config::factory(Config::File_Array, $this->_configMain->get('configs') . 'backend.php'); $this->_cache = $cacheManager->get('data'); if (Request::get('logout', 'boolean', false)) { User::getInstance()->logout(); session_destroy(); if (!Request::isAjax()) { Response::redirect(Request::url(array('index'))); } } $this->checkAuth(); if ($this->_configBackoffice->get('use_csrf_token')) { $csrf = new Security_Csrf(); $this->_page->csrfToken = $csrf->createToken(); } }
public static function allError($text, $param, $location) { self::setAndRedirect('allError', Lang::lang($text, $param), $location); }
public function setLang($lang = 'en') { self::$lang = $lang; $_SERVER["lang"] = $lang; }
/** * Compile JS Lang file (used current lang) * @return void */ public function langAction() { $langPath = $this->_configMain->get('lang_path'); $jsPath = $this->_configMain->get('js_lang_path'); $lManager = new Backend_Localization_Manager($this->_configMain); $langs = $lManager->getLangs(false); foreach ($langs as $lang) { $langFile = $langPath . $lang . '.php'; $name = $lang; $dictionary = Config::factory(Config::File_Array, $langFile, false); Lang::addDictionary($name, $dictionary); $filePath = $jsPath . $lang . '.js'; $dir = dirname($lang); if (!empty($dir) && $dir !== '.' && !is_dir($jsPath . '/' . $dir)) { mkdir($jsPath . '/' . $dir, 0755, true); } if (strpos($name, '/') === false) { $varName = 'appLang'; } else { $varName = basename($name) . 'Lang'; } if (!@file_put_contents($filePath, 'var ' . $varName . ' = ' . Lang::lang($name)->getJsObject() . ';')) { Response::jsonError($this->_lang->CANT_WRITE_FS . ' ' . $filePath); } } Response::jsonSuccess(); }
/** * Validate unique fields, object field groups * Returns errors array or returns false, is used for ExtJS forms * @property boolean $new * @return mixed false / array */ public function validateUniqueValues() { $uniqGroups = array(); foreach ($this->_config->get('fields') as $k => $v) { if ($k === $this->_primaryKey) { continue; } if (!$this->_config->isUnique($k)) { continue; } $value = $this->get($k); if (is_array($value)) { $value = serialize($value); } if (is_array($v['unique'])) { foreach ($v['unique'] as $val) { if (!isset($uniqGroups[$val])) { $uniqGroups[$val] = array(); } $uniqGroups[$val][$k] = $value; } } else { $v['unique'] = strval($v['unique']); if (!isset($uniqGroups[$v['unique']])) { $uniqGroups[$v['unique']] = array(); } $uniqGroups[$v['unique']][$k] = $value; } } if (empty($uniqGroups)) { return false; } $db = $this->_model->getDbConnection(); foreach ($uniqGroups as $group) { $sql = $db->select()->from($this->_model->table(), array('count' => 'COUNT(*)')); if ($this->getId()) { $sql->where(' ' . $db->quoteIdentifier($this->_primaryKey) . ' != ?', $this->getId()); } foreach ($group as $k => $v) { if ($k === $this->_primaryKey) { continue; } $sql->where($db->quoteIdentifier($k) . ' =?', $v); } $count = $db->fetchOne($sql); if ($count > 0) { foreach ($group as $k => &$v) { $v = Lang::lang()->get('SB_UNIQUE'); } unset($v); return $group; } } return false; }
private function setMsg_three($rule, $parameter_name, $bind_value_1, $bind_value_2) { $this->has_fails = true; $custom_key = $parameter_name . "." . $rule; if (array_key_exists($custom_key, $this->messages)) { $this->err_msg = $this->messages[$custom_key]; } else { $replace = ['{parameter-name}' => $parameter_name, '{bind-value_1}' => $bind_value_1, '{bind-value_2}' => $bind_value_2]; $this->err_msg = strtr(Lang::lang($rule), $replace); } }
public function createModule($object, $projectFile, $actionFile) { $lang = Lang::lang(); //prepare class name $name = Utils_String::formatClassName($object); $jsName = str_replace('_', '', $name); $runNamespace = 'app' . $jsName . 'Run'; $classNamespace = 'app' . $jsName . 'Classes'; $objectConfig = Db_Object_Config::getInstance($object); $primaryKey = $objectConfig->getPrimaryKey(); $appConfig = Registry::get('main', 'config'); $designerConfig = Config::factory(Config::File_Array, $appConfig->get('configs') . 'designer.php'); $objectFieldsConfig = $objectConfig->getFieldsConfig(false); $objectFields = array(); $searchFields = array(); $linkedObjects = array(); /* * Skip text fields */ foreach ($objectFieldsConfig as $key => $item) { if ($objectConfig->isObjectLink($key) || $objectConfig->isMultiLink($key)) { $linkedObjects[] = $objectConfig->getLinkedObject($key); } if (in_array($item['db_type'], Db_Object_Builder::$textTypes, true)) { continue; } $objectFields[] = $key; if (isset($item['is_search']) && $item['is_search']) { $searchFields[] = $key; } } $dataFields = array(); foreach ($objectConfig->getFieldsConfig(true) as $key => $item) { if (in_array($item['db_type'], Db_Object_Builder::$textTypes, true)) { continue; } $dataFields[] = $key; } array_unshift($objectFields, $primaryKey); $controllerContent = '<?php ' . "\n" . 'class Backend_' . $name . '_Controller extends Backend_Controller_Crud{' . "\n" . ' protected $_listFields = array("' . implode('","', $dataFields) . '");' . "\n" . ' protected $_canViewObjects = array("' . implode('","', $linkedObjects) . '");' . "\n" . '} '; /* * Create controller */ $controllerDir = $appConfig->get('backend_controllers') . str_replace('_', '/', $name); $this->_createControllerFile($controllerDir, $controllerContent); @chmod($controllerDir . DIRECTORY_SEPARATOR . 'Controller.php', $controllerContent, 0775); /* * Designer project */ $project = new Designer_Project(); $project->namespace = $classNamespace; $project->runnamespace = $runNamespace; /* * Project events */ $eventManager = $project->getEventManager(); $storeFields = Backend_Designer_Import::checkImportORMFields($object, $dataFields); $urlTemplates = $designerConfig->get('templates'); Request::setDelimiter($urlTemplates['urldelimiter']); $controllerUrl = Request::url(array($urlTemplates['adminpath'], $object, ''), false); $storeUrl = Request::url(array($urlTemplates['adminpath'], $object, 'list')); Request::setDelimiter($appConfig->get('urlDelimiter')); $dataStore = Ext_Factory::object('Data_Store'); $dataStore->setName('dataStore'); $dataStore->autoLoad = true; $dataStore->addFields($storeFields); $dataProxy = Ext_Factory::object('Data_Proxy_Ajax'); $dataProxy->type = 'ajax'; $dataReader = Ext_Factory::object('Data_Reader_Json'); $dataReader->root = 'data'; $dataReader->totalProperty = 'count'; $dataReader->idProperty = $primaryKey; $dataReader->type = 'json'; $dataProxy->reader = $dataReader; $dataProxy->url = $storeUrl; $dataProxy->startParam = 'pager[start]'; $dataProxy->limitParam = 'pager[limit]'; $dataProxy->sortParam = 'pager[sort]'; $dataProxy->directionParam = 'pager[dir]'; $dataProxy->simpleSortMode = true; $dataStore->proxy = $dataProxy; $dataStore->remoteSort = true; $project->addObject(0, $dataStore); /* * Data grid */ $dataGrid = Ext_Factory::object('Grid'); $dataGrid->setName('dataGrid'); $dataGrid->store = 'dataStore'; $dataGrid->columnLines = true; $dataGrid->title = $objectConfig->getTitle() . ' :: ' . $lang->HOME; $dataGrid->setAdvancedProperty('paging', true); $dataGrid->viewConfig = '{enableTextSelection: true}'; $eventManager->setEvent('dataGrid', 'itemdblclick', 'show' . $jsName . 'EditWindow(record.get("id"));'); $objectFieldList = Backend_Designer_Import::checkImportORMFields($object, $objectFields); if (!empty($objectFieldList)) { foreach ($objectFieldList as $fieldConfig) { switch ($fieldConfig->type) { case 'boolean': $column = Ext_Factory::object('Grid_Column_Boolean'); $column->renderer = 'Ext_Component_Renderer_System_Checkbox'; $column->width = 50; $column->align = 'center'; break; case 'integer': $column = Ext_Factory::object('Grid_Column'); break; case 'float': $column = Ext_Factory::object('Grid_Column_Number'); if (isset($objectFieldsConfig[$fieldConfig->name]['db_precision'])) { $column->format = '0,000.' . str_repeat('0', $objectFieldsConfig[$fieldConfig->name]['db_precision']); } break; case 'date': $column = Ext_Factory::object('Grid_Column_Date'); if ($objectFieldsConfig[$fieldConfig->name]['db_type'] == 'time') { $column->format = 'H:i:s'; } break; default: $column = Ext_Factory::object('Grid_Column'); } if ($objectConfig->fieldExists($fieldConfig->name)) { $cfg = $objectConfig->getFieldConfig($fieldConfig->name); $column->text = $cfg['title']; } else { $column->text = $fieldConfig->name; } $column->dataIndex = $fieldConfig->name; $column->setName($fieldConfig->name); $column->itemId = $column->getName(); $dataGrid->addColumn($column->getName(), $column, $parent = 0); } } $project->addObject(0, $dataGrid); /* * Top toolbar */ $dockObject = Ext_Factory::object('Docked'); $dockObject->setName($dataGrid->getName() . '__docked'); $project->addObject($dataGrid->getName(), $dockObject); $filters = Ext_Factory::object('Toolbar'); $filters->setName('filters'); $project->addObject($dockObject->getName(), $filters); /* * Top toolbar items */ $addButton = Ext_Factory::object('Button'); $addButton->setName('addButton'); $addButton->text = $lang->ADD_ITEM; $eventManager->setEvent('addButton', 'click', 'show' . $jsName . 'EditWindow(false);'); $project->addObject($filters->getName(), $addButton); $sep1 = Ext_Factory::object('Toolbar_Separator'); $sep1->setName('sep1'); $project->addObject($filters->getName(), $sep1); if (!empty($searchFields)) { $searchField = Ext_Factory::object('Component_Field_System_Searchfield'); $searchField->setName('searchField'); $searchField->width = 200; $searchField->store = $dataStore->getName(); $searchField->fieldNames = json_encode($searchFields); $fill = Ext_Factory::object('Toolbar_Fill'); $fill->setName('fill1'); $project->addObject($filters->getName(), $fill); $project->addObject($filters->getName(), $searchField); } /* * Editor window */ $editWindow = Ext_Factory::object('Component_Window_System_Crud'); $editWindow->setName('editWindow'); $editWindow->objectName = $object; $editWindow->controllerUrl = $controllerUrl; $editWindow->width = 800; $editWindow->height = 650; $editWindow->modal = true; $editWindow->resizable = true; $editWindow->extendedComponent(true); $eventManager->setEvent('editWindow', 'dataSaved', $runNamespace . '.dataStore.load();'); if (!$objectConfig->hasHistory()) { $editWindow->hideEastPanel = true; } $project->addObject(0, $editWindow); $tab = Ext_Factory::object('Panel'); $tab->setName($editWindow->getName() . '_generalTab'); $tab->frame = false; $tab->border = false; $tab->layout = 'anchor'; $tab->bodyPadding = 3; $tab->bodyCls = 'formBody'; $tab->anchor = '100%'; $tab->title = $lang->GENERAL; $tab->autoScroll = true; $tab->fieldDefaults = "{\n\t\t labelAlign: 'right',\n\t\t labelWidth: 160,\n\t\t anchor: '100%'\n\t\t }"; $project->addObject($editWindow->getName(), $tab); $objectFieldList = array_keys($objectConfig->getFieldsConfig(false)); foreach ($objectFieldList as $field) { if ($field == $primaryKey) { continue; } $newField = Backend_Designer_Import::convertOrmFieldToExtField($field, $objectConfig->getFieldConfig($field)); if ($newField === false) { continue; } $newField->setName($editWindow->getName() . '_' . $field); $fieldClass = $newField->getClass(); if ($fieldClass == 'Component_Field_System_Objectslist' || $fieldClass == 'Component_Field_System_Objectlink') { $newField->controllerUrl = $controllerUrl; } if (in_array($fieldClass, $this->tabTypes, true)) { $project->addObject($editWindow->getName(), $newField); } else { $project->addObject($tab->getName(), $newField); } } /* * Save designer project */ $designerStorage = Designer_Factory::getStorage($designerConfig); $project->actionjs = $actionFile; if (!$designerStorage->save($projectFile, $project)) { throw new Exception('Can`t create Designer project'); } /* * Create ActionJS file */ $this->_createActionJS($runNamespace, $classNamespace, $actionFile, $jsName); return true; }
/** * (non-PHPdoc) * @see Bgtask_Abstract::getDescription() */ public function getDescription() { $lang = Lang::lang(); return $lang->TASK_MEDIALIB_RECROP . ': ' . implode(',', $this->_config['types']); }
/** * (non-PHPdoc) * @see Bgtask_Abstract::getDescription() */ public function getDescription() { $lang = Lang::lang(); return $lang->get('ENCRYPT_DATA') . ': ' . $this->_config['object']; }
public function getTypeValue() { if (isset($this->typeList[$this->type])) { return $this->typeList[$this->type]; } return Lang::lang('undefined'); }
/** * Get dictionary as JavaScript code representation * @param boolean $addAll - add value 'All' with a blank key, * @param boolean $addBlank - add empty value is used in drop-down lists * @param string, optional - text for not selected value * @return string */ public function __toJs($addAll = false, $addBlank = false, $allText = false) { $result = array(); if ($addAll) { if ($allText === false) { $allText = Lang::lang()->get('ALL'); } $result[] = array('id' => '', 'title' => $allText); } if (!$addAll && $addBlank) { $result[] = array('id' => '', 'title' => ''); } foreach ($this->_data as $k => $v) { $result[] = array('id' => strval($k), 'title' => $v); } return json_encode($result); }
public static function buildMedia($field, \Rebond\Core\Media\Model $media) { $html = '<div class="input-media" data-field="' . $field . '">'; $html .= '<img src="' . \Rebond\Util\Media::showFromModel($media) . '" alt="media" />'; $html .= '<input type="text" class="input" id="media-' . $field . '" disabled value="' . $media->getTitle() . '">'; $html .= '<a href="#" class="button media-select" id="media-select-' . $field . '" data-field="' . $field . '">' . Lang::lang('select') . '</a>'; $html .= '<a href="#" class="button media-clear" id="media-clear-' . $field . '" data-field="' . $field . '">' . Lang::lang('clear') . '</a>'; $html .= '<input type="hidden" id="' . $field . '" name="' . $field . '" value="' . $media->getId() . '">'; $html .= '</div>'; return $html; }
/** * (non-PHPdoc) * @see Ext_Object::__toString() */ public function __toString() { $this->_convertListeners(); $lang = Lang::lang(); $plugins = array(); $features = array(); if (isset($this->_advancedPropertyValues['checkboxSelection']) && $this->_advancedPropertyValues['checkboxSelection']) { $this->_config->selModel = 'Ext.create("Ext.selection.CheckboxModel")'; } if (isset($this->_advancedPropertyValues['rowexpander']) && $this->_advancedPropertyValues['rowexpander']) { if (!empty($this->_advancedPropertyValues['expander_rowbodytpl'])) { $tpl = 'rowBodyTpl:' . $this->_advancedPropertyValues['expander_rowbodytpl']; } else { $tpl = ''; } $plugins[] = '{' . "\n" . "\t" . 'ptype: "rowexpander",' . "\n" . "\t" . 'pluginId:"rowexpander",' . "\n" . "\t" . $tpl . "\n" . '}'; } if (isset($this->_advancedPropertyValues['editable']) && $this->_advancedPropertyValues['editable']) { $plugins[] = 'Ext.create("Ext.grid.plugin.CellEditing", {' . "\n" . "\t" . 'clicksToEdit: ' . $this->_advancedPropertyValues['clicksToEdit'] . ',' . "\n" . "\t" . 'pluginId:"cellediting"' . "\n" . '})'; } if (isset($this->_advancedPropertyValues['grouping']) && $this->_advancedPropertyValues['grouping']) { if (isset($this->_advancedPropertyValues['groupsummary']) && $this->_advancedPropertyValues['groupsummary']) { $remoteRoot = ''; if (isset($this->_advancedPropertyValues['remoteRoot']) && $this->_advancedPropertyValues['remoteRoot']) { } $remoteRoot = 'remoteRoot: "' . $this->_advancedPropertyValues['remoteRoot'] . '"'; $features[] = "{" . "\t" . "id: '" . $this->getName() . "_groupingsummary'," . "\n" . "\t" . "ftype: 'groupingsummary'," . "\n" . "\t" . "groupHeaderTpl: '" . $this->_advancedPropertyValues['groupHeaderTpl'] . "'," . "\n" . "\t" . "hideGroupedHeader:" . intval($this->_advancedPropertyValues['hideGroupedHeader']) . "," . "\n" . "\t" . "startCollapsed: " . intval($this->_advancedPropertyValues['startCollapsed']) . "," . "\n" . "\t" . "enableGroupingMenu: " . intval($this->_advancedPropertyValues['enableGroupingMenu']) . "," . "\n" . "\t" . $remoteRoot . "\n" . "}"; } else { $features[] = "Ext.create('Ext.grid.feature.Grouping',{" . "\n" . "\t" . "groupHeaderTpl: '" . $this->_advancedPropertyValues['groupHeaderTpl'] . "'," . "\n" . "\t" . "startCollapsed: " . intval($this->_advancedPropertyValues['startCollapsed']) . "," . "\n" . "\t" . "enableGroupingMenu: " . intval($this->_advancedPropertyValues['enableGroupingMenu']) . "," . "\n" . "\t" . "hideGroupedHeader:" . intval($this->_advancedPropertyValues['hideGroupedHeader']) . "\n" . "})"; } } $filtersFeature = $this->getFiltersFeature(); $filters = $filtersFeature->getFilters(); if (!empty($filters)) { $features[] = $filtersFeature->__toString(); } if (isset($this->_advancedPropertyValues['summary']) && $this->_advancedPropertyValues['summary']) { $features[] = '{id:"summary" , ftype: "summary"}'; } $columns = '[]'; $columnsList = $this->getColumnsConfig(); if (!empty($columnsList)) { if (isset($this->_advancedPropertyValues['numberedRows']) && $this->_advancedPropertyValues['numberedRows']) { $columns = "[\n\tExt.create('Ext.grid.RowNumberer'),\n" . implode(",\n\t", $columnsList) . "\n]"; } else { $columns = "[\n" . implode(",\n\t", $columnsList) . "\n]"; } } unset($columnsList); if ($this->_config->isValidProperty('store') && strlen($this->_config->store)) { if (isset($this->_advancedPropertyValues['paging']) && $this->_advancedPropertyValues['paging']) { $this->_config->bbar = 'Ext.create("Ext.PagingToolbar", {' . "\n" . "\t" . 'displayInfo: true,' . "\n" . "\t" . 'displayMsg: "' . $lang->DISPLAYING_RECORDS . ' {0} - {1} ' . $lang->OF . ' {2}",' . "\n" . "\t" . 'emptyMsg:appLang.NO_RECORDS_TO_DISPLAY,' . "\n" . "\t" . "listeners:{ \n" . "\t\t" . "beforerender:{\n" . "\t\t\t" . "fn:function(cmp){\n" . "\t\t\t\t" . "cmp.bindStore(cmp.up('grid').getStore());\n" . "\t\t\t" . "}\n" . "\t\t" . "}\n" . "\t" . "}\n" . "})"; } } $this->_config->items = null; $this->_config->columns = $columns; if (!empty($plugins)) { $this->_config->plugins = '[' . "\n" . Utils_String::addIndent(implode(",\n", $plugins)) . "\n]"; } if (!empty($features)) { $this->_config->features = '[' . "\n" . Utils_String::addIndent(implode(",\n", $features)) . "\n]"; } return $this->_config->__toString(); }