本文整理汇总了PHP中Pimcore\Tool\Admin::isExtJS5方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::isExtJS5方法的具体用法?PHP Admin::isExtJS5怎么用?PHP Admin::isExtJS5使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Tool\Admin
的用法示例。
在下文中一共展示了Admin::isExtJS5方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: correctClasses
/**
* this is a hack for import see: http://www.pimcore.org/issues/browse/PIMCORE-790
* @param array
* @return array
*/
protected function correctClasses($classes)
{
// this is the new method with Ext.form.MultiSelect
if (is_string($classes) && !empty($classes) || \Pimcore\Tool\Admin::isExtJS5() && is_array($classes)) {
if (!\Pimcore\Tool\Admin::isExtJS5()) {
$classParts = explode(",", $classes);
} else {
$classParts = $classes;
}
$classes = array();
foreach ($classParts as $class) {
$classes[] = array("classes" => $class);
}
}
// this was the legacy method with Ext.SuperField
if (is_array($classes) && array_key_exists("classes", $classes)) {
$classes = array($classes);
}
if (!is_array($classes)) {
$classes = array();
}
return $classes;
}
示例2: getDataFromEditmode
/**
* @see Model\Object\ClassDefinition\Data::getDataFromEditmode
* @param string $data
* @param null|Model\Object\AbstractObject $object
* @return string
*/
public function getDataFromEditmode($data, $object = null)
{
if ($data) {
if (\Pimcore\Tool\Admin::isExtJS5()) {
return $data;
} else {
return explode(",", $data);
}
} else {
return null;
}
}
示例3: initPlugins
/**
*
*/
public static function initPlugins()
{
// add plugin include paths
$autoloader = \Zend_Loader_Autoloader::getInstance();
try {
$pluginConfigs = ExtensionManager::getPluginConfigs();
if (!empty($pluginConfigs)) {
$includePaths = array(get_include_path());
//adding plugin include paths and namespaces
if (count($pluginConfigs) > 0) {
foreach ($pluginConfigs as $p) {
if (!ExtensionManager::isEnabled("plugin", $p["plugin"]["pluginName"])) {
continue;
}
if (is_array($p['plugin']['pluginIncludePaths']['path'])) {
foreach ($p['plugin']['pluginIncludePaths']['path'] as $path) {
$includePaths[] = PIMCORE_PLUGINS_PATH . $path;
}
} else {
if ($p['plugin']['pluginIncludePaths']['path'] != null) {
$includePaths[] = PIMCORE_PLUGINS_PATH . $p['plugin']['pluginIncludePaths']['path'];
}
}
if (is_array($p['plugin']['pluginNamespaces']['namespace'])) {
foreach ($p['plugin']['pluginNamespaces']['namespace'] as $namespace) {
$autoloader->registerNamespace($namespace);
}
} else {
if ($p['plugin']['pluginNamespaces']['namespace'] != null) {
$autoloader->registerNamespace($p['plugin']['pluginNamespaces']['namespace']);
}
}
}
}
set_include_path(implode(PATH_SEPARATOR, $includePaths));
$broker = \Pimcore\API\Plugin\Broker::getInstance();
//registering plugins
foreach ($pluginConfigs as $p) {
if (!ExtensionManager::isEnabled("plugin", $p["plugin"]["pluginName"])) {
continue;
}
$jsPaths = array();
$isExtJs5 = \Pimcore\Tool\Admin::isExtJS5();
if ($isExtJs5 && is_array($p['plugin']['pluginJsPaths-extjs5']) && isset($p['plugin']['pluginJsPaths-extjs5']['path']) && is_array($p['plugin']['pluginJsPaths-extjs5']['path'])) {
$jsPaths = $p['plugin']['pluginJsPaths-extjs5']['path'];
} else {
if ($isExtJs5 && is_array($p['plugin']['pluginJsPaths-extjs5']) && $p['plugin']['pluginJsPaths-extjs5']['path'] != null) {
$jsPaths[0] = $p['plugin']['pluginJsPaths-extjs5']['path'];
} else {
if (is_array($p['plugin']['pluginJsPaths']) && isset($p['plugin']['pluginJsPaths']['path']) && is_array($p['plugin']['pluginJsPaths']['path'])) {
$jsPaths = $p['plugin']['pluginJsPaths']['path'];
} else {
if (is_array($p['plugin']['pluginJsPaths']) && $p['plugin']['pluginJsPaths']['path'] != null) {
$jsPaths[0] = $p['plugin']['pluginJsPaths']['path'];
}
}
}
}
//manipulate path for frontend
if (is_array($jsPaths) and count($jsPaths) > 0) {
for ($i = 0; $i < count($jsPaths); $i++) {
if (is_file(PIMCORE_PLUGINS_PATH . $jsPaths[$i])) {
$jsPaths[$i] = "/plugins" . $jsPaths[$i];
}
}
}
$cssPaths = array();
if ($isExtJs5 && is_array($p['plugin']['pluginCssPaths-extjs5']) && isset($p['plugin']['pluginCssPaths-extjs5']['path']) && is_array($p['plugin']['pluginCssPaths-extjs5']['path'])) {
$cssPaths = $p['plugin']['pluginCssPaths-extjs5']['path'];
} else {
if ($isExtJs5 && is_array($p['plugin']['pluginCssPaths-extjs5']) && $p['plugin']['pluginCssPaths-extjs5']['path'] != null) {
$cssPaths[0] = $p['plugin']['pluginCssPaths-extjs5']['path'];
} else {
if (is_array($p['plugin']['pluginCssPaths']) && isset($p['plugin']['pluginCssPaths']['path']) && is_array($p['plugin']['pluginCssPaths']['path'])) {
$cssPaths = $p['plugin']['pluginCssPaths']['path'];
} else {
if (is_array($p['plugin']['pluginCssPaths']) && $p['plugin']['pluginCssPaths']['path'] != null) {
$cssPaths[0] = $p['plugin']['pluginCssPaths']['path'];
}
}
}
}
//manipulate path for frontend
if (is_array($cssPaths) and count($cssPaths) > 0) {
for ($i = 0; $i < count($cssPaths); $i++) {
if (is_file(PIMCORE_PLUGINS_PATH . $cssPaths[$i])) {
$cssPaths[$i] = "/plugins" . $cssPaths[$i];
}
}
}
try {
$className = $p['plugin']['pluginClassName'];
if (!empty($className) && Tool::classExists($className)) {
$plugin = new $className($jsPaths, $cssPaths);
if ($plugin instanceof \Pimcore\API\Plugin\AbstractPlugin) {
$broker->registerPlugin($plugin);
}
//.........这里部分代码省略.........
示例4: websiteSettingsAction
public function websiteSettingsAction()
{
try {
if ($this->getParam("data")) {
$this->checkPermission("website_settings");
$data = \Zend_Json::decode($this->getParam("data"));
if (is_array($data)) {
foreach ($data as &$value) {
$value = trim($value);
}
}
if ($this->getParam("xaction") == "destroy") {
if (\Pimcore\Tool\Admin::isExtJS5()) {
$id = $data["id"];
} else {
$id = $data;
}
$setting = WebsiteSetting::getById($id);
$setting->delete();
$this->_helper->json(array("success" => true, "data" => array()));
} else {
if ($this->getParam("xaction") == "update") {
// save routes
$setting = WebsiteSetting::getById($data["id"]);
switch ($setting->getType()) {
case "document":
case "asset":
case "object":
if (isset($data["data"])) {
$path = $data["data"];
$element = Element\Service::getElementByPath($setting->getType(), $path);
$data["data"] = $element ? $element->getId() : null;
}
break;
}
$setting->setValues($data);
$setting->save();
$data = $this->getWebsiteSettingForEditMode($setting);
$this->_helper->json(array("data" => $data, "success" => true));
} else {
if ($this->getParam("xaction") == "create") {
unset($data["id"]);
// save route
$setting = new WebsiteSetting();
$setting->setValues($data);
$setting->save();
$this->_helper->json(array("data" => $setting, "success" => true));
}
}
}
} else {
// get list of routes
$list = new WebsiteSetting\Listing();
$list->setLimit($this->getParam("limit"));
$list->setOffset($this->getParam("start"));
if ($this->getParam("sort")) {
$list->setOrderKey($this->getParam("sort"));
$list->setOrder($this->getParam("dir"));
} else {
$list->setOrderKey("name");
$list->setOrder("asc");
}
if ($this->getParam("filter")) {
$list->setCondition("`name` LIKE " . $list->quote("%" . $this->getParam("filter") . "%"));
}
$totalCount = $list->getTotalCount();
$list = $list->load();
$settings = array();
foreach ($list as $item) {
$resultItem = $this->getWebsiteSettingForEditMode($item);
$settings[] = $resultItem;
}
$this->_helper->json(array("data" => $settings, "success" => true, "total" => $totalCount));
}
} catch (\Exception $e) {
throw $e;
$this->_helper->json(false);
}
$this->_helper->json(false);
}
示例5: setDocTypes
/**
* @param array $docTypes
*/
public function setDocTypes($docTypes)
{
if (!\Pimcore\Tool\Admin::isExtJS5()) {
if (strlen($docTypes)) {
$docTypes = explode(",", $docTypes);
}
}
if (empty($docTypes)) {
$docTypes = array();
}
$this->docTypes = $docTypes;
}
示例6: setAssetTypes
/**
* @param array
* @return void $assetTypes
*/
public function setAssetTypes($assetTypes)
{
// this is the new method with Ext.form.MultiSelect
if (is_string($assetTypes) && !empty($assetTypes) || \Pimcore\Tool\Admin::isExtJS5() && is_array($assetTypes)) {
if (!\Pimcore\Tool\Admin::isExtJS5()) {
$parts = explode(",", $assetTypes);
} else {
$parts = $assetTypes;
}
$assetTypes = array();
foreach ($parts as $type) {
$assetTypes[] = array("assetTypes" => $type);
}
}
$this->assetTypes = $assetTypes;
return $this;
}
示例7: getTreeNodeConfig
/**
* @param $element
* @return array
*/
protected function getTreeNodeConfig($element)
{
$childDocument = $element;
$tmpDocument = array("id" => $childDocument->getId(), "text" => $childDocument->getKey(), "type" => $childDocument->getType(), "path" => $childDocument->getFullPath(), "basePath" => $childDocument->getPath(), "locked" => $childDocument->isLocked(), "lockOwner" => $childDocument->getLocked() ? true : false, "published" => $childDocument->isPublished(), "elementType" => "document", "leaf" => true, "permissions" => array("view" => $childDocument->isAllowed("view"), "remove" => $childDocument->isAllowed("delete"), "settings" => $childDocument->isAllowed("settings"), "rename" => $childDocument->isAllowed("rename"), "publish" => $childDocument->isAllowed("publish"), "unpublish" => $childDocument->isAllowed("unpublish")));
// add icon
$tmpDocument["iconCls"] = "pimcore_icon_" . $childDocument->getType();
if (\Pimcore\Tool\Admin::isExtJS5()) {
$tmpDocument["expandable"] = $childDocument->hasChilds();
}
// set type specific settings
if ($childDocument->getType() == "page") {
$tmpDocument["leaf"] = false;
$tmpDocument["expanded"] = $childDocument->hasNoChilds();
$tmpDocument["permissions"]["create"] = $childDocument->isAllowed("create");
$tmpDocument["iconCls"] = "pimcore_icon_page";
// test for a site
try {
$site = Site::getByRootId($childDocument->getId());
$tmpDocument["iconCls"] = "pimcore_icon_site";
unset($site->rootDocument);
$tmpDocument["site"] = $site;
} catch (\Exception $e) {
}
} else {
if ($childDocument->getType() == "folder" || $childDocument->getType() == "link" || $childDocument->getType() == "hardlink") {
$tmpDocument["leaf"] = false;
$tmpDocument["expanded"] = $childDocument->hasNoChilds();
if ($childDocument->hasNoChilds() && $childDocument->getType() == "folder") {
$tmpDocument["iconCls"] = "pimcore_icon_folder";
}
$tmpDocument["permissions"]["create"] = $childDocument->isAllowed("create");
} else {
if (method_exists($childDocument, "getTreeNodeConfig")) {
$tmp = $childDocument->getTreeNodeConfig();
$tmpDocument = array_merge($tmpDocument, $tmp);
}
}
}
$tmpDocument["qtipCfg"] = array("title" => "ID: " . $childDocument->getId(), "text" => "Type: " . $childDocument->getType());
// PREVIEWS temporary disabled, need's to be optimized some time
if ($childDocument instanceof Document\Page && Config::getSystemConfig()->documents->generatepreview) {
$thumbnailFile = PIMCORE_TEMPORARY_DIRECTORY . "/document-page-previews/document-page-screenshot-" . $childDocument->getId() . ".jpg";
// only if the thumbnail exists and isn't out of time
if (file_exists($thumbnailFile) && filemtime($thumbnailFile) > $childDocument->getModificationDate() - 20) {
$thumbnailPath = str_replace(PIMCORE_DOCUMENT_ROOT, "", $thumbnailFile);
$tmpDocument["thumbnail"] = $thumbnailPath;
}
}
$tmpDocument["cls"] = "";
if (!$childDocument->isPublished()) {
$tmpDocument["cls"] .= "pimcore_unpublished ";
}
if ($childDocument->isLocked()) {
$tmpDocument["cls"] .= "pimcore_treenode_locked ";
}
if ($childDocument->getLocked()) {
$tmpDocument["cls"] .= "pimcore_treenode_lockOwner ";
}
return $tmpDocument;
}
示例8: postDispatch
/**
* @param \Zend_Controller_Request_Abstract $request
*/
public function postDispatch(\Zend_Controller_Request_Abstract $request)
{
$conf = Config::getSystemConfig();
// add scripts to editmode
if (\Pimcore\Tool\Admin::isExtJS5()) {
$editmodeLibraries = array("/pimcore/static5/js/pimcore/namespace.js", "/pimcore/static5/js/pimcore/document/edit/sandbox.js", "/pimcore/static5/js/lib/prototype-light.js", "/pimcore/static5/js/lib/jquery.min.js", "/pimcore/static5/js/lib/ext/ext-all-debug.js", "/pimcore/static5/js/lib/ckeditor/ckeditor.js");
$editmodeScripts = array("/pimcore/static5/js/pimcore/functions.js", "/pimcore/static5/js/pimcore/element/tag/imagehotspotmarkereditor.js", "/pimcore/static5/js/pimcore/element/tag/imagecropper.js", "/pimcore/static5/js/pimcore/document/edit/helper.js", "/pimcore/static5/js/pimcore/document/edit/dnd.js", "/pimcore/static5/js/pimcore/document/tag.js", "/pimcore/static5/js/pimcore/document/tags/block.js", "/pimcore/static5/js/pimcore/document/tags/date.js", "/pimcore/static5/js/pimcore/document/tags/href.js", "/pimcore/static5/js/pimcore/document/tags/multihref.js", "/pimcore/static5/js/pimcore/document/tags/checkbox.js", "/pimcore/static5/js/pimcore/document/tags/image.js", "/pimcore/static5/js/pimcore/document/tags/input.js", "/pimcore/static5/js/pimcore/document/tags/link.js", "/pimcore/static5/js/pimcore/document/tags/select.js", "/pimcore/static5/js/pimcore/document/tags/snippet.js", "/pimcore/static5/js/pimcore/document/tags/textarea.js", "/pimcore/static5/js/pimcore/document/tags/numeric.js", "/pimcore/static5/js/pimcore/document/tags/wysiwyg.js", "/pimcore/static5/js/pimcore/document/tags/renderlet.js", "/pimcore/static5/js/pimcore/document/tags/table.js", "/pimcore/static5/js/pimcore/document/tags/video.js", "/pimcore/static5/js/pimcore/document/tags/multiselect.js", "/pimcore/static5/js/pimcore/document/tags/areablock.js", "/pimcore/static5/js/pimcore/document/tags/area.js", "/pimcore/static5/js/pimcore/document/tags/pdf.js", "/pimcore/static5/js/pimcore/document/edit/helper.js");
$editmodeStylesheets = array("/pimcore/static5/css/icons.css", "/pimcore/static5/js/lib/ext/packages/ext-theme-classic-sandbox/build/resources/ext-theme-classic-sandbox-all-debug.css", "/pimcore/static5/css/editmode-classic.css?asd=" . time());
} else {
$editmodeLibraries = array("/pimcore/static/js/pimcore/namespace.js", "/pimcore/static/js/lib/prototype-light.js", "/pimcore/static/js/lib/jquery.min.js", "/pimcore/static/js/lib/ext/adapter/jquery/ext-jquery-adapter-debug.js", "/pimcore/static/js/lib/ext/ext-all-debug.js", "/pimcore/static/js/lib/ext-plugins/ux/Spinner.js", "/pimcore/static/js/lib/ext-plugins/ux/SpinnerField.js", "/pimcore/static/js/lib/ext-plugins/ux/MultiSelect.js", "/pimcore/static/js/lib/ext-plugins/GridRowOrder/roworder.js", "/pimcore/static/js/lib/ckeditor/ckeditor.js", "/pimcore/static/js/pimcore/libfixes.js");
$editmodeScripts = array("/pimcore/static/js/pimcore/functions.js", "/pimcore/static/js/pimcore/element/tag/imagehotspotmarkereditor.js", "/pimcore/static/js/pimcore/element/tag/imagecropper.js", "/pimcore/static/js/pimcore/document/edit/helper.js", "/pimcore/static/js/pimcore/document/edit/dnd.js", "/pimcore/static/js/pimcore/document/tag.js", "/pimcore/static/js/pimcore/document/tags/block.js", "/pimcore/static/js/pimcore/document/tags/date.js", "/pimcore/static/js/pimcore/document/tags/href.js", "/pimcore/static/js/pimcore/document/tags/multihref.js", "/pimcore/static/js/pimcore/document/tags/checkbox.js", "/pimcore/static/js/pimcore/document/tags/image.js", "/pimcore/static/js/pimcore/document/tags/input.js", "/pimcore/static/js/pimcore/document/tags/link.js", "/pimcore/static/js/pimcore/document/tags/select.js", "/pimcore/static/js/pimcore/document/tags/snippet.js", "/pimcore/static/js/pimcore/document/tags/textarea.js", "/pimcore/static/js/pimcore/document/tags/numeric.js", "/pimcore/static/js/pimcore/document/tags/wysiwyg.js", "/pimcore/static/js/pimcore/document/tags/renderlet.js", "/pimcore/static/js/pimcore/document/tags/table.js", "/pimcore/static/js/pimcore/document/tags/video.js", "/pimcore/static/js/pimcore/document/tags/multiselect.js", "/pimcore/static/js/pimcore/document/tags/areablock.js", "/pimcore/static/js/pimcore/document/tags/area.js", "/pimcore/static/js/pimcore/document/tags/pdf.js", "/pimcore/static/js/pimcore/document/edit/helper.js");
$editmodeStylesheets = array("/pimcore/static/css/icons.css", "/pimcore/static/css/editmode.css?asd=" . time());
}
//add plugin editmode JS and CSS
try {
$pluginConfigs = ExtensionManager::getPluginConfigs();
$jsPaths = array();
$cssPaths = array();
if (!empty($pluginConfigs)) {
//registering plugins
foreach ($pluginConfigs as $p) {
$pluginJsPaths = array();
if (array_key_exists("pluginDocumentEditmodeJsPaths", $p['plugin']) && is_array($p['plugin']['pluginDocumentEditmodeJsPaths']) && isset($p['plugin']['pluginDocumentEditmodeJsPaths']['path'])) {
if (is_array($p['plugin']['pluginDocumentEditmodeJsPaths']['path'])) {
$pluginJsPaths = $p['plugin']['pluginDocumentEditmodeJsPaths']['path'];
} else {
if ($p['plugin']['pluginDocumentEditmodeJsPaths']['path'] != null) {
$pluginJsPaths[] = $p['plugin']['pluginDocumentEditmodeJsPaths']['path'];
}
}
}
//manipulate path for frontend
if (is_array($pluginJsPaths) and count($pluginJsPaths) > 0) {
for ($i = 0; $i < count($pluginJsPaths); $i++) {
if (is_file(PIMCORE_PLUGINS_PATH . $pluginJsPaths[$i])) {
$jsPaths[] = "/plugins" . $pluginJsPaths[$i];
}
}
}
$pluginCssPaths = array();
if (array_key_exists("pluginDocumentEditmodeCssPaths", $p['plugin']) && is_array($p['plugin']['pluginDocumentEditmodeCssPaths']) && isset($p['plugin']['pluginDocumentEditmodeCssPaths']['path'])) {
if (is_array($p['plugin']['pluginDocumentEditmodeCssPaths']['path'])) {
$pluginCssPaths = $p['plugin']['pluginDocumentEditmodeCssPaths']['path'];
} else {
if ($p['plugin']['pluginDocumentEditmodeCssPaths']['path'] != null) {
$pluginCssPaths[] = $p['plugin']['pluginDocumentEditmodeCssPaths']['path'];
}
}
}
//manipulate path for frontend
if (is_array($pluginCssPaths) and count($pluginCssPaths) > 0) {
for ($i = 0; $i < count($pluginCssPaths); $i++) {
if (is_file(PIMCORE_PLUGINS_PATH . $pluginCssPaths[$i])) {
$cssPaths[] = "/plugins" . $pluginCssPaths[$i];
}
}
}
}
}
$editmodeScripts = array_merge($editmodeScripts, $jsPaths);
$editmodeStylesheets = array_merge($editmodeStylesheets, $cssPaths);
} catch (\Exception $e) {
\Logger::alert("there is a problem with the plugin configuration");
\Logger::alert($e);
}
$editmodeHeadHtml = "\n\n\n<!-- pimcore editmode -->\n";
// include stylesheets
foreach ($editmodeStylesheets as $sheet) {
$editmodeHeadHtml .= '<link rel="stylesheet" type="text/css" href="' . $sheet . '?_dc=' . Version::$revision . '" />';
$editmodeHeadHtml .= "\n";
}
$editmodeHeadHtml .= "\n\n";
$editmodeHeadHtml .= '<script type="text/javascript">var jQueryPreviouslyLoaded = (typeof jQuery == "undefined") ? false : true;</script>' . "\n";
// include script libraries
foreach ($editmodeLibraries as $script) {
$editmodeHeadHtml .= '<script type="text/javascript" src="' . $script . '?_dc=' . Version::$revision . '"></script>';
$editmodeHeadHtml .= "\n";
}
// combine the pimcore scripts in non-devmode
if ($conf->general->devmode) {
foreach ($editmodeScripts as $script) {
$editmodeHeadHtml .= '<script type="text/javascript" src="' . $script . '?_dc=' . Version::$revision . '"></script>';
$editmodeHeadHtml .= "\n";
}
} else {
$scriptContents = "";
foreach ($editmodeScripts as $scriptUrl) {
$scriptContents .= file_get_contents(PIMCORE_DOCUMENT_ROOT . $scriptUrl) . "\n\n\n";
}
$editmodeHeadHtml .= '<script type="text/javascript" src="' . \Pimcore\Tool\Admin::getMinimizedScriptPath($scriptContents) . '?_dc=' . Version::$revision . '"></script>' . "\n";
}
$user = \Pimcore\Tool\Authentication::authenticateSession();
$lang = $user->getLanguage();
$editmodeHeadHtml .= '<script type="text/javascript" src="/admin/misc/json-translations-system/language/' . $lang . '/?_dc=' . Version::$revision . '"></script>' . "\n";
$editmodeHeadHtml .= '<script type="text/javascript" src="/admin/misc/json-translations-admin/language/' . $lang . '/?_dc=' . Version::$revision . '"></script>' . "\n";
$editmodeHeadHtml .= "\n\n";
// set var for editable configurations which is filled by Document\Tag::admin()
//.........这里部分代码省略.........
示例9: translationsAction
public function translationsAction()
{
$admin = $this->getParam("admin");
if ($admin) {
$class = "\\Pimcore\\Model\\Translation\\Admin";
$this->checkPermission("translations_admin");
} else {
$class = "\\Pimcore\\Model\\Translation\\Website";
$this->checkPermission("translations");
}
// clear translation cache
Translation\Website::clearDependentCache();
if ($this->getParam("data")) {
$data = \Zend_Json::decode($this->getParam("data"));
if ($this->getParam("xaction") == "destroy") {
$data = \Zend_Json::decode($this->getParam("data"));
if (\Pimcore\Tool\Admin::isExtJS5()) {
$t = $class::getByKey($data["key"]);
} else {
$t = $class::getByKey($data);
}
$t->delete();
$this->_helper->json(array("success" => true, "data" => array()));
} else {
if ($this->getParam("xaction") == "update") {
$t = $class::getByKey($data["key"]);
foreach ($data as $key => $value) {
if ($key != "key") {
$t->addTranslation($key, $value);
}
}
if ($data["key"]) {
$t->setKey($data["key"]);
}
$t->setModificationDate(time());
$t->save();
$return = array_merge(array("key" => $t->getKey(), "creationDate" => $t->getCreationDate(), "modificationDate" => $t->getModificationDate()), $t->getTranslations());
$this->_helper->json(array("data" => $return, "success" => true));
} else {
if ($this->getParam("xaction") == "create") {
try {
$t = $class::getByKey($data["key"]);
} catch (\Exception $e) {
$t = new $class();
$t->setKey($data["key"]);
$t->setCreationDate(time());
$t->setModificationDate(time());
foreach (Tool::getValidLanguages() as $lang) {
$t->addTranslation($lang, "");
}
$t->save();
}
$return = array_merge(array("key" => $t->getKey(), "creationDate" => $t->getCreationDate(), "modificationDate" => $t->getModificationDate()), $t->getTranslations());
$this->_helper->json(array("data" => $return, "success" => true));
}
}
}
} else {
// get list of types
if ($admin) {
$list = new Translation\Admin\Listing();
} else {
$list = new Translation\Website\Listing();
}
$list->setOrder("asc");
$list->setOrderKey("key");
if (\Pimcore\Tool\Admin::isExtJS5()) {
$sortParam = $this->getParam("sort");
if ($sortParam) {
$sortParam = json_decode($sortParam, true);
$sortParam = $sortParam[0];
$orderKey = $sortParam["property"];
$order = $sortParam["direction"];
$list->setOrderKey($orderKey);
$list->setOrder($order);
}
} else {
if ($this->getParam("dir")) {
$list->setOrder($this->getParam("dir"));
}
if ($this->getParam("sort")) {
$list->setOrderKey($this->getParam("sort"));
}
}
$list->setLimit($this->getParam("limit"));
$list->setOffset($this->getParam("start"));
$condition = $this->getGridFilterCondition();
if ($condition) {
$list->setCondition($condition);
}
$list->load();
$translations = array();
foreach ($list->getTranslations() as $t) {
$translations[] = array_merge($t->getTranslations(), array("key" => $t->getKey(), "creationDate" => $t->getCreationDate(), "modificationDate" => $t->getModificationDate()));
}
$this->_helper->json(array("data" => $translations, "success" => true, "total" => $list->getTotalCount()));
}
}
示例10: gridProxyAction
//.........这里部分代码省略.........
// get list of objects
$folder = Object::getById($this->getParam("folderId"));
$class = Object\ClassDefinition::getById($this->getParam("classId"));
$className = $class->getName();
$colMappings = array("filename" => "o_key", "fullpath" => array("o_path", "o_key"), "id" => "o_id", "published" => "o_published", "modificationDate" => "o_modificationDate", "creationDate" => "o_creationDate");
$start = 0;
$limit = 20;
$orderKey = "o_id";
$order = "ASC";
$fields = array();
$bricks = array();
if ($this->getParam("fields")) {
$fields = $this->getParam("fields");
foreach ($fields as $f) {
$parts = explode("~", $f);
$sub = substr($f, 0, 1);
if (substr($f, 0, 1) == "~") {
// $type = $parts[1];
// $field = $parts[2];
// $keyid = $parts[3];
// key value, ignore for now
} else {
if (count($parts) > 1) {
$bricks[$parts[0]] = $parts[0];
}
}
}
}
if ($this->getParam("limit")) {
$limit = $this->getParam("limit");
}
if ($this->getParam("start")) {
$start = $this->getParam("start");
}
$sortParam = $this->getParam("sort");
if (\Pimcore\Tool\Admin::isExtJS5()) {
if ($sortParam) {
$sortParam = json_decode($sortParam, true);
$sortParam = $sortParam[0];
$orderKey = $sortParam["property"];
$order = $sortParam["direction"];
if (!(substr($orderKey, 0, 1) == "~")) {
if (array_key_exists($orderKey, $colMappings)) {
$orderKey = $colMappings[$orderKey];
}
}
}
} else {
if (strlen($sortParam) > 0) {
if (!(substr($sortParam, 0, 1) == "~")) {
if ($this->getParam("sort")) {
if (array_key_exists($this->getParam("sort"), $colMappings)) {
$orderKey = $colMappings[$this->getParam("sort")];
} else {
$orderKey = $this->getParam("sort");
}
}
}
}
if ($this->getParam("dir")) {
$order = $this->getParam("dir");
}
}
$listClass = "\\Pimcore\\Model\\Object\\" . ucfirst($className) . "\\Listing";
$conditionFilters = array();
if ($this->getParam("only_direct_children") == "true") {
$conditionFilters[] = "o_parentId = " . $folder->getId();
} else {
$conditionFilters[] = "(o_path = '" . $folder->getFullPath() . "' OR o_path LIKE '" . str_replace("//", "/", $folder->getFullPath() . "/") . "%')";
}
// create filter condition
if ($this->getParam("filter")) {
$conditionFilters[] = Object\Service::getFilterCondition($this->getParam("filter"), $class);
}
if ($this->getParam("condition")) {
$conditionFilters[] = "(" . $this->getParam("condition") . ")";
}
$list = new $listClass();
if (!empty($bricks)) {
foreach ($bricks as $b) {
$list->addObjectbrick($b);
}
}
$list->setCondition(implode(" AND ", $conditionFilters));
$list->setLimit($limit);
$list->setOffset($start);
$list->setOrder($order);
$list->setOrderKey($orderKey);
if ($class->getShowVariants()) {
$list->setObjectTypes([Object\AbstractObject::OBJECT_TYPE_OBJECT, Object\AbstractObject::OBJECT_TYPE_VARIANT]);
}
$list->load();
$objects = array();
foreach ($list->getObjects() as $object) {
$o = Object\Service::gridObjectData($object, $fields);
$objects[] = $o;
}
$this->_helper->json(array("data" => $objects, "success" => true, "total" => $list->getTotalCount()));
}
}
示例11: strtolower
echo $language;
?>
] */
.pimcore_icon_language_<?php
echo strtolower($language);
?>
{
background: url(<?php
echo $iconFile;
?>
) left center no-repeat;
}
<?php
if (!\Pimcore\Tool\Admin::isExtJS5()) {
?>
/* grid column header icon in translations [ <?php
echo $language;
?>
] */
.x-grid3-hd-translation_column_<?php
echo strtolower($language);
?>
{
background: url(<?php
echo $iconFile;
?>
) no-repeat 3px 3px ! important;
padding-left:22px !important;
}