当前位置: 首页>>代码示例>>PHP>>正文


PHP Admin::isExtJS6方法代码示例

本文整理汇总了PHP中Pimcore\Tool\Admin::isExtJS6方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::isExtJS6方法的具体用法?PHP Admin::isExtJS6怎么用?PHP Admin::isExtJS6使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Tool\Admin的用法示例。


在下文中一共展示了Admin::isExtJS6方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
     /**
      * @extjs6
      * @todo this need to be refactored when extjs3 support is removed
      */
     if (is_string($classes) && !empty($classes) || \Pimcore\Tool\Admin::isExtJS6() && is_array($classes)) {
         if (!\Pimcore\Tool\Admin::isExtJS6()) {
             $classParts = explode(",", $classes);
         } else {
             $classParts = $classes;
         }
         $classes = array();
         foreach ($classParts as $class) {
             if (is_array($class)) {
                 $classes[] = $class;
             } else {
                 if ($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;
 }
开发者ID:rolandstoll,项目名称:pimcore,代码行数:38,代码来源:AbstractRelations.php

示例2: saveAction

 public function saveAction()
 {
     try {
         if ($this->getParam("id")) {
             $link = Document\Hardlink::getById($this->getParam("id"));
             $this->setValuesToDocument($link);
             $link->setModificationDate(time());
             $link->setUserModification($this->getUser()->getId());
             if ($this->getParam("task") == "unpublish") {
                 $link->setPublished(false);
             }
             if ($this->getParam("task") == "publish") {
                 $link->setPublished(true);
             }
             // only save when publish or unpublish
             if ($this->getParam("task") == "publish" && $link->isAllowed("publish") || $this->getParam("task") == "unpublish" && $link->isAllowed("unpublish")) {
                 $link->save();
                 $this->_helper->json(["success" => true]);
             }
         }
     } catch (\Exception $e) {
         \Logger::log($e);
         if (\Pimcore\Tool\Admin::isExtJS6() && $e instanceof Element\ValidationException) {
             $this->_helper->json(["success" => false, "type" => "ValidationException", "message" => $e->getMessage(), "stack" => $e->getTraceAsString(), "code" => $e->getCode()]);
         }
         throw $e;
     }
     $this->_helper->json(false);
 }
开发者ID:solverat,项目名称:pimcore,代码行数:29,代码来源:HardlinkController.php

示例3: getRecordIdForGridRequest

 public static function getRecordIdForGridRequest($param)
 {
     if (!\Pimcore\Tool\Admin::isExtJS6() && is_numeric($param)) {
         return intval($param);
     } else {
         $param = json_decode($param, true);
         return $param['id'];
     }
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:9,代码来源:QueryParams.php

示例4: updateAction

 public function updateAction()
 {
     $report = CustomReport\Config::getByName($this->getParam("name"));
     $data = \Zend_Json::decode($this->getParam("configuration"));
     if (\Pimcore\Tool\Admin::isExtJS6() && !is_array($data["yAxis"])) {
         $data["yAxis"] = strlen($data["yAxis"]) ? [$data["yAxis"]] : [];
     }
     foreach ($data as $key => $value) {
         $setter = "set" . ucfirst($key);
         if (method_exists($report, $setter)) {
             $report->{$setter}($value);
         }
     }
     $report->save();
     $this->_helper->json(["success" => true]);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:16,代码来源:CustomReportController.php

示例5: 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::isExtJS6()) {
                     $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"));
             $sortingSettings = \Pimcore\Admin\Helper\QueryParams::extractSortingSettings($this->getAllParams());
             if ($sortingSettings['orderKey']) {
                 $list->setOrderKey($sortingSettings['orderKey']);
                 $list->setOrder($sortingSettings['order']);
             } 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);
 }
开发者ID:elavarasann,项目名称:pimcore,代码行数:81,代码来源:SettingsController.php

示例6: propertiesAction

 public function propertiesAction()
 {
     if ($this->getParam("data")) {
         $dataParam = $this->getParam("data");
         $data = \Zend_Json::decode($dataParam);
         $id = $data["id"];
         $config = Classificationstore\KeyConfig::getById($id);
         foreach ($data as $key => $value) {
             if ($key != "id") {
                 $setter = "set" . $key;
                 if (method_exists($config, $setter)) {
                     $config->{$setter}($value);
                 }
             }
         }
         $config->save();
         $item = $this->getConfigItem($config);
         $this->_helper->json(array("success" => true, "data" => $item));
     } else {
         $start = 0;
         $limit = 15;
         $orderKey = "name";
         $order = "ASC";
         if ($this->getParam("dir")) {
             $order = $this->getParam("dir");
         }
         $sortingSettings = \Pimcore\Admin\Helper\QueryParams::extractSortingSettings($this->getAllParams());
         if ($sortingSettings['orderKey'] && $sortingSettings['order']) {
             $orderKey = $sortingSettings['orderKey'];
             $order = $sortingSettings['order'];
         }
         if ($this->getParam("overrideSort") == "true") {
             $orderKey = "id";
             $order = "DESC";
         }
         if ($this->getParam("limit")) {
             $limit = $this->getParam("limit");
         }
         if ($this->getParam("start")) {
             $start = $this->getParam("start");
         }
         $list = new Classificationstore\KeyConfig\Listing();
         if ($limit > 0) {
             $list->setLimit($limit);
         }
         $list->setOffset($start);
         $list->setOrder($order);
         $list->setOrderKey($orderKey);
         $condition = "";
         $db = \Pimcore\Db::get();
         $searchfilter = $this->getParam("searchfilter");
         if ($searchfilter) {
             $condition = "(name LIKE " . $db->quote("%" . $searchfilter . "%") . " OR description LIKE " . $db->quote("%" . $searchfilter . "%") . ")";
         }
         if ($this->getParam("filter")) {
             $filterString = $this->getParam("filter");
             $filters = json_decode($filterString);
             $count = 0;
             foreach ($filters as $f) {
                 if ($count > 0) {
                     $condition .= " AND ";
                 }
                 $count++;
                 if (\Pimcore\Tool\Admin::isExtJS6()) {
                     $condition .= $db->getQuoteIdentifierSymbol() . $f->property . $db->getQuoteIdentifierSymbol() . " LIKE " . $db->quote("%" . $f->value . "%");
                 } else {
                     $condition .= $db->getQuoteIdentifierSymbol() . $f->field . $db->getQuoteIdentifierSymbol() . " LIKE " . $db->quote("%" . $f->value . "%");
                 }
             }
         }
         $list->setCondition($condition);
         if ($this->getParam("groupIds") || $this->getParam("keyIds")) {
             $db = Db::get();
             if ($this->getParam("groupIds")) {
                 $ids = \Zend_Json::decode($this->getParam("groupIds"));
                 $col = "group";
             } else {
                 $ids = \Zend_Json::decode($this->getParam("keyIds"));
                 $col = "id";
             }
             $condition = $db->getQuoteIdentifierSymbol() . $col . $db->getQuoteIdentifierSymbol() . " IN (";
             $count = 0;
             foreach ($ids as $theId) {
                 if ($count > 0) {
                     $condition .= ",";
                 }
                 $condition .= $theId;
                 $count++;
             }
             $condition .= ")";
             $list->setCondition($condition);
         }
         $list->load();
         $configList = $list->getList();
         $rootElement = array();
         $data = array();
         foreach ($configList as $config) {
             $item = $this->getConfigItem($config);
             $data[] = $item;
         }
//.........这里部分代码省略.........
开发者ID:elavarasann,项目名称:pimcore,代码行数:101,代码来源:ClassificationstoreController.php

示例7: saveAction

 public function saveAction()
 {
     try {
         if ($this->getParam("id")) {
             $page = Document\Page::getById($this->getParam("id"));
             // check if there's a document in session which should be used as data-source
             // see also self::clearEditableDataAction() | this is necessary to reset all fields and to get rid of
             // outdated and unused data elements in this document (eg. entries of area-blocks)
             $pageSession = Session::useSession(function ($session) use($page) {
                 if (isset($session->{"document_" . $page->getId()}) && isset($session->{"document_" . $page->getId() . "_useForSave"})) {
                     if ($session->{"document_" . $page->getId() . "_useForSave"}) {
                         // only use the page from the session once
                         unset($session->{"document_" . $page->getId() . "_useForSave"});
                         return $session->{"document_" . $page->getId()};
                     }
                 }
                 return null;
             }, "pimcore_documents");
             if ($pageSession) {
                 $page = $pageSession;
             } else {
                 $page = $this->getLatestVersion($page);
             }
             $page->setUserModification($this->getUser()->getId());
             if ($this->getParam("task") == "unpublish") {
                 $page->setPublished(false);
             }
             if ($this->getParam("task") == "publish") {
                 $page->setPublished(true);
             }
             $settings = [];
             if ($this->getParam("settings")) {
                 $settings = \Zend_Json::decode($this->getParam("settings"));
             }
             // check for redirects
             if ($this->getUser()->isAllowed("redirects") && $this->getParam("settings")) {
                 if (is_array($settings)) {
                     $redirectList = new Redirect\Listing();
                     $redirectList->setCondition("target = ?", $page->getId());
                     $existingRedirects = $redirectList->load();
                     $existingRedirectIds = [];
                     foreach ($existingRedirects as $existingRedirect) {
                         $existingRedirectIds[$existingRedirect->getId()] = $existingRedirect->getId();
                     }
                     for ($i = 1; $i < 100; $i++) {
                         if (array_key_exists("redirect_url_" . $i, $settings)) {
                             // check for existing
                             if ($settings["redirect_id_" . $i]) {
                                 $redirect = Redirect::getById($settings["redirect_id_" . $i]);
                                 unset($existingRedirectIds[$redirect->getId()]);
                             } else {
                                 // create new one
                                 $redirect = new Redirect();
                             }
                             $redirect->setSource($settings["redirect_url_" . $i]);
                             $redirect->setTarget($page->getId());
                             $redirect->setStatusCode(301);
                             $redirect->save();
                         }
                     }
                     // remove existing redirects which were delete
                     foreach ($existingRedirectIds as $existingRedirectId) {
                         $redirect = Redirect::getById($existingRedirectId);
                         $redirect->delete();
                     }
                 }
             }
             // check if settings exist, before saving meta data
             if ($this->getParam("settings") && is_array($settings)) {
                 $metaData = [];
                 for ($i = 1; $i < 30; $i++) {
                     if (array_key_exists("metadata_" . $i, $settings)) {
                         $metaData[] = $settings["metadata_" . $i];
                     }
                 }
                 $page->setMetaData($metaData);
             }
             // only save when publish or unpublish
             if ($this->getParam("task") == "publish" && $page->isAllowed("publish") or $this->getParam("task") == "unpublish" && $page->isAllowed("unpublish")) {
                 $this->setValuesToDocument($page);
                 try {
                     $page->save();
                     $this->saveToSession($page);
                     $this->_helper->json(["success" => true]);
                 } catch (\Exception $e) {
                     if (\Pimcore\Tool\Admin::isExtJS6() && $e instanceof Element\ValidationException) {
                         throw $e;
                     }
                     Logger::err($e);
                     $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
                 }
             } else {
                 if ($page->isAllowed("save")) {
                     $this->setValuesToDocument($page);
                     try {
                         $page->saveVersion();
                         $this->saveToSession($page);
                         $this->_helper->json(["success" => true]);
                     } catch (\Exception $e) {
                         Logger::err($e);
//.........这里部分代码省略.........
开发者ID:pimcore,项目名称:pimcore,代码行数:101,代码来源:PageController.php

示例8: saveAction

 public function saveAction()
 {
     try {
         $success = false;
         if ($this->getParam("id")) {
             $asset = Asset::getById($this->getParam("id"));
             if ($asset->isAllowed("publish")) {
                 // metadata
                 if ($this->getParam("metadata")) {
                     $metadata = \Zend_Json::decode($this->getParam("metadata"));
                     $metadata = Asset\Service::minimizeMetadata($metadata);
                     $asset->setMetadata($metadata);
                 }
                 // properties
                 if ($this->getParam("properties")) {
                     $properties = [];
                     $propertiesData = \Zend_Json::decode($this->getParam("properties"));
                     if (is_array($propertiesData)) {
                         foreach ($propertiesData as $propertyName => $propertyData) {
                             $value = $propertyData["data"];
                             try {
                                 $property = new Model\Property();
                                 $property->setType($propertyData["type"]);
                                 $property->setName($propertyName);
                                 $property->setCtype("asset");
                                 $property->setDataFromEditmode($value);
                                 $property->setInheritable($propertyData["inheritable"]);
                                 $properties[$propertyName] = $property;
                             } catch (\Exception $e) {
                                 Logger::err("Can't add " . $propertyName . " to asset " . $asset->getRealFullPath());
                             }
                         }
                         $asset->setProperties($properties);
                     }
                 }
                 // scheduled tasks
                 if ($this->getParam("scheduler")) {
                     $tasks = [];
                     $tasksData = \Zend_Json::decode($this->getParam("scheduler"));
                     if (!empty($tasksData)) {
                         foreach ($tasksData as $taskData) {
                             $taskData["date"] = strtotime($taskData["date"] . " " . $taskData["time"]);
                             $task = new Model\Schedule\Task($taskData);
                             $tasks[] = $task;
                         }
                     }
                     $asset->setScheduledTasks($tasks);
                 }
                 if ($this->hasParam("data")) {
                     $asset->setData($this->getParam("data"));
                 }
                 $asset->setUserModification($this->getUser()->getId());
                 try {
                     $asset->save();
                     $asset->getData();
                     $success = true;
                 } catch (\Exception $e) {
                     if (Tool\Admin::isExtJS6() && $e instanceof Element\ValidationException) {
                         throw $e;
                     }
                     $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
                 }
             } else {
                 Logger::debug("prevented save asset because of missing permissions ");
             }
             $this->_helper->json(["success" => $success]);
         }
         $this->_helper->json(false);
     } catch (\Exception $e) {
         Logger::log($e);
         if (Tool\Admin::isExtJS6() && $e instanceof Element\ValidationException) {
             $this->_helper->json(["success" => false, "type" => "ValidationException", "message" => $e->getMessage(), "stack" => $e->getTraceAsString(), "code" => $e->getCode()]);
         }
         throw $e;
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:76,代码来源:AssetController.php

示例9: indexAction

 public function indexAction()
 {
     // clear open edit locks for this session (in the case of a reload, ...)
     \Pimcore\Model\Element\Editlock::clearSession(session_id());
     // check maintenance
     $maintenance_enabled = false;
     $manager = Model\Schedule\Manager\Factory::getManager("maintenance.pid");
     $lastExecution = $manager->getLastExecution();
     if ($lastExecution) {
         if (time() - $lastExecution < 610) {
             // maintenance script should run at least every 10 minutes + a little tolerance
             $maintenance_enabled = true;
         }
     }
     $this->view->maintenance_enabled = \Zend_Json::encode($maintenance_enabled);
     // configuration
     $sysConfig = Config::getSystemConfig();
     $this->view->config = $sysConfig;
     //mail settings
     $mailIncomplete = false;
     if ($sysConfig->email) {
         if (!$sysConfig->email->debug->emailaddresses) {
             $mailIncomplete = true;
         }
         if (!$sysConfig->email->sender->email) {
             $mailIncomplete = true;
         }
         if ($sysConfig->email->method == "smtp" && !$sysConfig->email->smtp->host) {
             $mailIncomplete = true;
         }
     }
     $this->view->mail_settings_complete = \Zend_Json::encode(!$mailIncomplete);
     // report configuration
     $this->view->report_config = Config::getReportConfig();
     $cvData = [];
     // still needed when publishing objects
     $cvConfig = Tool::getCustomViewConfig();
     if ($cvConfig) {
         foreach ($cvConfig as $node) {
             $tmpData = $node;
             // backwards compatibility
             $treeType = $tmpData["treetype"] ? $tmpData["treetype"] : "object";
             $rootNode = Model\Element\Service::getElementByPath($treeType, $tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = $tmpData["classes"] ? explode(",", $tmpData["classes"]) : null;
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 // Check if a user has privileges to that node
                 if ($rootNode->isAllowed("list")) {
                     $cvData[] = $tmpData;
                 }
             }
         }
     }
     $this->view->customview_config = $cvData;
     // upload limit
     $max_upload = filesize2bytes(ini_get("upload_max_filesize") . "B");
     $max_post = filesize2bytes(ini_get("post_max_size") . "B");
     $upload_mb = min($max_upload, $max_post);
     $this->view->upload_max_filesize = $upload_mb;
     // session lifetime (gc)
     $session_gc_maxlifetime = ini_get("session.gc_maxlifetime");
     if (empty($session_gc_maxlifetime)) {
         $session_gc_maxlifetime = 120;
     }
     $this->view->session_gc_maxlifetime = $session_gc_maxlifetime;
     // csrf token
     $user = $this->getUser();
     $this->view->csrfToken = Tool\Session::useSession(function ($adminSession) use($user) {
         if (!isset($adminSession->csrfToken) && !$adminSession->csrfToken) {
             $adminSession->csrfToken = sha1(microtime() . $user->getName() . uniqid());
         }
         return $adminSession->csrfToken;
     });
     if (\Pimcore\Tool\Admin::isExtJS6()) {
         $this->forward("index6");
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:78,代码来源:IndexController.php

示例10: getFilterCondition

 /**
  *
  * @param string $filterJson
  * @param ClassDefinition $class
  * @return string
  */
 public static function getFilterCondition($filterJson, $class)
 {
     $systemFields = array("o_path", "o_key", "o_id", "o_published", "o_creationDate", "o_modificationDate", "o_fullpath");
     // create filter condition
     $conditionPartsFilters = array();
     if ($filterJson) {
         $db = \Pimcore\Db::get();
         $filters = \Zend_Json::decode($filterJson);
         foreach ($filters as $filter) {
             $operator = "=";
             /**
              * @extjs
              */
             $filterField = $filter["field"];
             $filterOperator = $filter["comparison"];
             if (\Pimcore\Tool\Admin::isExtJS6()) {
                 $filterField = $filter["property"];
                 $filterOperator = $filter["operator"];
             }
             if ($filter["type"] == "string") {
                 $operator = "LIKE";
             } else {
                 if ($filter["type"] == "numeric") {
                     if ($filterOperator == "lt") {
                         $operator = "<";
                     } else {
                         if ($filterOperator == "gt") {
                             $operator = ">";
                         } else {
                             if ($filterOperator == "eq") {
                                 $operator = "=";
                             }
                         }
                     }
                 } else {
                     if ($filter["type"] == "date") {
                         if ($filterOperator == "lt") {
                             $operator = "<";
                         } else {
                             if ($filterOperator == "gt") {
                                 $operator = ">";
                             } else {
                                 if ($filterOperator == "eq") {
                                     $operator = "=";
                                 }
                             }
                         }
                         $filter["value"] = strtotime($filter["value"]);
                     } else {
                         if ($filter["type"] == "list") {
                             $operator = "=";
                         } else {
                             if ($filter["type"] == "boolean") {
                                 $operator = "=";
                                 $filter["value"] = (int) $filter["value"];
                             }
                         }
                     }
                 }
             }
             $field = $class->getFieldDefinition($filterField);
             $brickField = null;
             $brickType = null;
             if (!$field) {
                 // if the definition doesn't exist check for a localized field
                 $localized = $class->getFieldDefinition("localizedfields");
                 if ($localized instanceof ClassDefinition\Data\Localizedfields) {
                     $field = $localized->getFieldDefinition($filterField);
                 }
                 //if the definition doesn't exist check for object brick
                 $keyParts = explode("~", $filterField);
                 if (substr($filterField, 0, 1) == "~") {
                     // not needed for now
                     //                            $type = $keyParts[1];
                     //                            $field = $keyParts[2];
                     //                            $keyid = $keyParts[3];
                 } else {
                     if (count($keyParts) > 1) {
                         $brickType = $keyParts[0];
                         $brickKey = $keyParts[1];
                         $key = self::getFieldForBrickType($class, $brickType);
                         $field = $class->getFieldDefinition($key);
                         $brickClass = Objectbrick\Definition::getByKey($brickType);
                         $brickField = $brickClass->getFieldDefinition($brickKey);
                     }
                 }
             }
             if ($field instanceof ClassDefinition\Data\Objectbricks) {
                 // custom field
                 $db = \Pimcore\Db::get();
                 if (is_array($filter["value"])) {
                     $fieldConditions = array();
                     foreach ($filter["value"] as $filterValue) {
                         $fieldConditions[] = $db->getQuoteIdentifierSymbol() . $brickType . $db->getQuoteIdentifierSymbol() . "." . $brickField->getFilterCondition($filterValue, $operator);
//.........这里部分代码省略.........
开发者ID:elavarasann,项目名称:pimcore,代码行数:101,代码来源:Service.php

示例11: 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::isExtJS6()) {
            $editmodeLibraries = array("/pimcore/static6/js/pimcore/namespace.js", "/pimcore/static6/js/lib/prototype-light.js", "/pimcore/static6/js/lib/jquery.min.js", "/pimcore/static6/js/lib/ext/ext-all.js", "/pimcore/static6/js/lib/ckeditor/ckeditor.js");
            $editmodeScripts = array("/pimcore/static6/js/pimcore/functions.js", "/pimcore/static6/js/pimcore/element/tag/imagehotspotmarkereditor.js", "/pimcore/static6/js/pimcore/element/tag/imagecropper.js", "/pimcore/static6/js/pimcore/document/edit/helper.js", "/pimcore/static6/js/pimcore/document/edit/dnd.js", "/pimcore/static6/js/pimcore/document/tag.js", "/pimcore/static6/js/pimcore/document/tags/block.js", "/pimcore/static6/js/pimcore/document/tags/date.js", "/pimcore/static6/js/pimcore/document/tags/href.js", "/pimcore/static6/js/pimcore/document/tags/multihref.js", "/pimcore/static6/js/pimcore/document/tags/checkbox.js", "/pimcore/static6/js/pimcore/document/tags/image.js", "/pimcore/static6/js/pimcore/document/tags/input.js", "/pimcore/static6/js/pimcore/document/tags/link.js", "/pimcore/static6/js/pimcore/document/tags/select.js", "/pimcore/static6/js/pimcore/document/tags/snippet.js", "/pimcore/static6/js/pimcore/document/tags/textarea.js", "/pimcore/static6/js/pimcore/document/tags/numeric.js", "/pimcore/static6/js/pimcore/document/tags/wysiwyg.js", "/pimcore/static6/js/pimcore/document/tags/renderlet.js", "/pimcore/static6/js/pimcore/document/tags/table.js", "/pimcore/static6/js/pimcore/document/tags/video.js", "/pimcore/static6/js/pimcore/document/tags/multiselect.js", "/pimcore/static6/js/pimcore/document/tags/areablock.js", "/pimcore/static6/js/pimcore/document/tags/area.js", "/pimcore/static6/js/pimcore/document/tags/pdf.js", "/pimcore/static6/js/pimcore/document/edit/helper.js");
            $editmodeStylesheets = array("/pimcore/static6/css/icons.css", "/pimcore/static6/css/editmode.css?_dc=" . 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()
//.........这里部分代码省略.........
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:101,代码来源:Editmode.php

示例12: setDocTypes

 /**
  * @param array $docTypes
  */
 public function setDocTypes($docTypes)
 {
     if (!\Pimcore\Tool\Admin::isExtJS6()) {
         if (strlen($docTypes)) {
             $docTypes = explode(",", $docTypes);
         }
     }
     if (empty($docTypes)) {
         $docTypes = array();
     }
     $this->docTypes = $docTypes;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:15,代码来源:UserRole.php

示例13: 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();
                 $isExtJs6 = \Pimcore\Tool\Admin::isExtJS6();
                 if ($isExtJs6 && is_array($p['plugin']['pluginJsPaths-extjs6']) && isset($p['plugin']['pluginJsPaths-extjs6']['path']) && is_array($p['plugin']['pluginJsPaths-extjs6']['path'])) {
                     $jsPaths = $p['plugin']['pluginJsPaths-extjs6']['path'];
                 } else {
                     if ($isExtJs6 && is_array($p['plugin']['pluginJsPaths-extjs6']) && $p['plugin']['pluginJsPaths-extjs6']['path'] != null) {
                         $jsPaths[0] = $p['plugin']['pluginJsPaths-extjs6']['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 ($isExtJs6 && is_array($p['plugin']['pluginCssPaths-extjs6']) && isset($p['plugin']['pluginCssPaths-extjs6']['path']) && is_array($p['plugin']['pluginCssPaths-extjs6']['path'])) {
                     $cssPaths = $p['plugin']['pluginCssPaths-extjs6']['path'];
                 } else {
                     if ($isExtJs6 && is_array($p['plugin']['pluginCssPaths-extjs6']) && $p['plugin']['pluginCssPaths-extjs6']['path'] != null) {
                         $cssPaths[0] = $p['plugin']['pluginCssPaths-extjs6']['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);
                         }
//.........这里部分代码省略.........
开发者ID:rolandstoll,项目名称:pimcore,代码行数:101,代码来源:Pimcore.php

示例14: 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::isExtJS6()) {
         $tmpDocument["expandable"] = $childDocument->hasChilds();
         $tmpDocument["loaded"] = !$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) {
         }
     } elseif ($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");
     } elseif (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;
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:61,代码来源:DocumentController.php

示例15: listAction

 public function listAction()
 {
     if ($this->getParam("xaction") == "destroy") {
         $item = Recyclebin\Item::getById(\Pimcore\Admin\Helper\QueryParams::getRecordIdForGridRequest($this->getParam("data")));
         $item->delete();
         $this->_helper->json(array("success" => true, "data" => array()));
     } else {
         $list = new Recyclebin\Item\Listing();
         $list->setLimit($this->getParam("limit"));
         $list->setOffset($this->getParam("start"));
         $list->setOrderKey("date");
         $list->setOrder("DESC");
         $sortingSettings = \Pimcore\Admin\Helper\QueryParams::extractSortingSettings($this->getAllParams());
         if ($sortingSettings['orderKey']) {
             $list->setOrderKey($sortingSettings['orderKey']);
             $list->setOrder($sortingSettings['order']);
         }
         $conditionFilters = array();
         if ($this->getParam("filterFullText")) {
             $conditionFilters[] = "path LIKE " . $list->quote("%" . $this->getParam("filterFullText") . "%");
         }
         $filters = $this->getParam("filter");
         if ($filters) {
             $filters = \Zend_Json::decode($filters);
             foreach ($filters as $filter) {
                 $operator = "=";
                 $filterField = $filter["field"];
                 $filterOperator = $filter["comparison"];
                 if (\Pimcore\Tool\Admin::isExtJS6()) {
                     $filterField = $filter["property"];
                     $filterOperator = $filter["operator"];
                 }
                 if ($filter["type"] == "string") {
                     $operator = "LIKE";
                 } elseif ($filter["type"] == "numeric") {
                     if ($filterOperator == "lt") {
                         $operator = "<";
                     } elseif ($filterOperator == "gt") {
                         $operator = ">";
                     } elseif ($filterOperator == "eq") {
                         $operator = "=";
                     }
                 } elseif ($filter["type"] == "date") {
                     if ($filterOperator == "lt") {
                         $operator = "<";
                     } elseif ($filterOperator == "gt") {
                         $operator = ">";
                     } elseif ($filterOperator == "eq") {
                         $operator = "=";
                     }
                     $filter["value"] = strtotime($filter["value"]);
                 } elseif ($filter["type"] == "list") {
                     $operator = "=";
                 } elseif ($filter["type"] == "boolean") {
                     $operator = "=";
                     $filter["value"] = (int) $filter["value"];
                 }
                 // system field
                 $value = $filter["value"];
                 if ($operator == "LIKE") {
                     $value = "%" . $value . "%";
                 }
                 $field = "`" . $filterField . "` ";
                 if ($filter["field"] == "fullpath") {
                     $field = "CONCAT(path,filename)";
                 }
                 $conditionFilters[] = $field . $operator . " '" . $value . "' ";
             }
         }
         if (!empty($conditionFilters)) {
             $condition = implode(" AND ", $conditionFilters);
             $list->setCondition($condition);
         }
         $items = $list->load();
         $this->_helper->json(array("data" => $items, "success" => true, "total" => $list->getTotalCount()));
     }
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:77,代码来源:RecyclebinController.php


注:本文中的Pimcore\Tool\Admin::isExtJS6方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。