本文整理汇总了PHP中Pimcore\Tool\Admin::reorderWebsiteLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::reorderWebsiteLanguages方法的具体用法?PHP Admin::reorderWebsiteLanguages怎么用?PHP Admin::reorderWebsiteLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Tool\Admin
的用法示例。
在下文中一共展示了Admin::reorderWebsiteLanguages方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentUserAction
public function getCurrentUserAction()
{
header("Content-Type: text/javascript");
$user = $this->getUser();
$list = new User\Permission\Definition\Listing();
$definitions = $list->load();
foreach ($definitions as $definition) {
$user->setPermission($definition->getKey(), $user->isAllowed($definition->getKey()));
}
// unset confidential informations
$userData = object2array($user);
$contentLanguages = Tool\Admin::reorderWebsiteLanguages($user, Tool::getValidLanguages());
$userData["contentLanguages"] = $contentLanguages;
unset($userData["password"]);
echo "pimcore.currentuser = " . \Zend_Json::encode($userData);
exit;
}
示例2: gridGetColumnConfigAction
//.........这里部分代码省略.........
if (!empty($fieldConfig)) {
$availableFields[] = $fieldConfig;
$count++;
}
}
}
}
}
}
} else {
if (empty($types) || in_array($field->getFieldType(), $types)) {
$fieldConfig = $this->getFieldGridConfig($field, $gridType, $count, !empty($types));
if (!empty($fieldConfig)) {
$availableFields[] = $fieldConfig;
$count++;
}
}
}
}
}
} else {
$savedColumns = $gridConfig['columns'];
foreach ($savedColumns as $key => $sc) {
if (!$sc['hidden']) {
if (in_array($key, $systemColumns)) {
$colConfig = array("key" => $key, "type" => "system", "label" => $key, "position" => $sc['position']);
if (isset($sc['width'])) {
$colConfig['width'] = $sc['width'];
}
$availableFields[] = $colConfig;
} else {
$keyParts = explode("~", $key);
if (substr($key, 0, 1) == "~") {
// not needed for now
// $type = $keyParts[1];
// $field = $keyParts[2];
// $keyid = $keyParts[3];
} else {
if (count($keyParts) > 1) {
$brick = $keyParts[0];
$key = $keyParts[1];
$brickClass = Object\Objectbrick\Definition::getByKey($brick);
$fd = $brickClass->getFieldDefinition($key);
if (!empty($fd)) {
$fieldConfig = $this->getFieldGridConfig($fd, $gridType, $sc['position'], true, $brick . "~");
if (!empty($fieldConfig)) {
if (isset($sc['width'])) {
$fieldConfig['width'] = $sc['width'];
}
$availableFields[] = $fieldConfig;
}
}
} else {
$fd = $class->getFieldDefinition($key);
//if not found, look for localized fields
if (empty($fd)) {
foreach ($localizedFields as $lf) {
$fd = $lf->getFieldDefinition($key);
if (!empty($fd)) {
break;
}
}
}
if (!empty($fd)) {
$fieldConfig = $this->getFieldGridConfig($fd, $gridType, $sc['position'], true);
if (!empty($fieldConfig)) {
if (isset($sc['width'])) {
$fieldConfig['width'] = $sc['width'];
}
$availableFields[] = $fieldConfig;
}
}
}
}
}
}
}
}
usort($availableFields, function ($a, $b) {
if ($a["position"] == $b["position"]) {
return 0;
}
return $a["position"] < $b["position"] ? -1 : 1;
});
$config = \Pimcore\Config::getSystemConfig();
$frontendLanguages = Tool\Admin::reorderWebsiteLanguages(\Pimcore\Tool\Admin::getCurrentUser(), $config->general->validLanguages);
if ($frontendLanguages) {
$language = explode(',', $frontendLanguages)[0];
} else {
$language = $this->getLanguage();
}
if (!Tool::isValidLanguage($language)) {
$validLanguages = Tool::getValidLanguages();
$language = $validLanguages[0];
}
if (!empty($gridConfig) && !empty($gridConfig['language'])) {
$language = $gridConfig['language'];
}
$this->_helper->json(array("sortinfo" => $gridConfig['sortinfo'], "language" => $language, "availableFields" => $availableFields, "onlyDirectChildren" => $gridConfig['onlyDirectChildren'], "pageSize" => $gridConfig['pageSize']));
}
示例3: setLayoutPermission
public function setLayoutPermission(&$layout, $allowedView, $allowedEdit)
{
if ($layout->{"fieldtype"} == "localizedfields") {
if (is_array($allowedView) && count($allowedView) > 0) {
$layout->{"permissionView"} = \Pimcore\Tool\Admin::reorderWebsiteLanguages(\Pimcore\Tool\Admin::getCurrentUser(), array_keys($allowedView), true);
}
if (is_array($allowedEdit) && count($allowedEdit) > 0) {
$layout->{"permissionEdit"} = \Pimcore\Tool\Admin::reorderWebsiteLanguages(\Pimcore\Tool\Admin::getCurrentUser(), array_keys($allowedEdit), true);
}
} else {
if (method_exists($layout, "getChilds")) {
$children = $layout->getChilds();
if (is_array($children)) {
foreach ($children as $child) {
$this->setLayoutPermission($child, $allowedView, $allowedEdit);
}
}
}
}
}
示例4:
?>
,
google_webmastertools_enabled: <?php
echo \Zend_Json::encode((bool) \Pimcore\Google\Webmastertools::isConfigured());
?>
,
customviews: <?php
echo \Zend_Json::encode($this->customview_config);
?>
,
language: '<?php
echo $this->language;
?>
',
websiteLanguages: <?php
echo \Zend_Json::encode(explode(",", \Pimcore\Tool\Admin::reorderWebsiteLanguages(\Pimcore\Tool\Admin::getCurrentUser(), $this->config->general->validLanguages)));
?>
,
google_translate_api_key: "<?php
echo $this->config->services->translate->apikey;
?>
",
google_maps_api_key: "<?php
echo $googleMapsApiKey;
?>
",
showCloseConfirmation: true,
debug_admin_translations: <?php
echo \Zend_Json::encode((bool) $this->config->general->debug_admin_translations);
?>
,
示例5: getAction
public function getAction()
{
if (intval($this->getParam("id")) < 1) {
$this->_helper->json(array("success" => false));
}
$user = User::getById(intval($this->getParam("id")));
if ($user->isAdmin() && !$this->getUser()->isAdmin()) {
throw new \Exception("Only admin users are allowed to modify admin users");
}
// workspaces
$types = array("asset", "document", "object");
foreach ($types as $type) {
$workspaces = $user->{"getWorkspaces" . ucfirst($type)}();
foreach ($workspaces as $workspace) {
$el = Element\Service::getElementById($type, $workspace->getCid());
if ($el) {
// direct injection => not nice but in this case ok ;-)
$workspace->path = $el->getFullPath();
}
}
}
// object <=> user dependencies
$userObjects = Object\Service::getObjectsReferencingUser($user->getId());
$userObjectData = array();
foreach ($userObjects as $o) {
$hasHidden = false;
if ($o->isAllowed("list")) {
$userObjectData[] = array("path" => $o->getFullPath(), "id" => $o->getId(), "subtype" => $o->getClass()->getName());
} else {
$hasHidden = true;
}
}
// get available permissions
$availableUserPermissionsList = new User\Permission\Definition\Listing();
$availableUserPermissions = $availableUserPermissionsList->load();
// get available roles
$roles = array();
$list = new User\Role\Listing();
$list->setCondition("`type` = ?", array("role"));
$list->load();
$roles = array();
if (is_array($list->getItems())) {
foreach ($list->getItems() as $role) {
$roles[] = array($role->getId(), $role->getName());
}
}
// unset confidential informations
$userData = object2array($user);
$contentLanguages = Tool\Admin::reorderWebsiteLanguages($user, Tool::getValidLanguages());
$userData["contentLanguages"] = $contentLanguages;
unset($userData["password"]);
$conf = \Pimcore\Config::getSystemConfig();
$this->_helper->json(array("success" => true, "wsenabled" => $conf->webservice->enabled, "user" => $userData, "roles" => $roles, "permissions" => $user->generatePermissionList(), "availablePermissions" => $availableUserPermissions, "objectDependencies" => array("hasHidden" => $hasHidden, "dependencies" => $userObjectData)));
}