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


PHP Document::getType方法代码示例

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


在下文中一共展示了Document::getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDependencyForFrontend

 /**
  * @param Document|Asset|Object_Abstract $element
  * @return array
  */
 public static function getDependencyForFrontend($element)
 {
     if ($element instanceof Document) {
         return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => "document", "subtype" => $element->getType());
     } else {
         if ($element instanceof Asset) {
             return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => "asset", "subtype" => $element->getType());
         } else {
             if ($element instanceof Object_Abstract) {
                 return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => "object", "subtype" => $element->geto_Type());
             }
         }
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:18,代码来源:Service.php

示例2: display

 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     Plugin::import('content');
     $vName = Request::getCmd('view', 'images');
     switch ($vName) {
         case 'imagesList':
             $mName = 'list';
             $vLayout = Request::getCmd('layout', 'default');
             break;
         case 'images':
         default:
             $vLayout = Request::getCmd('layout', 'default');
             $mName = 'manager';
             $vName = 'images';
             break;
     }
     $vType = Document::getType();
     // Get/Create the view
     $view = $this->getView($vName, $vType);
     $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . '/views/' . strtolower($vName) . '/tmpl');
     // Get/Create the model
     if ($model = $this->getModel($mName)) {
         // Push the model into the view (as default)
         $view->setModel($model, true);
     }
     // Set the layout
     $view->setLayout($vLayout);
     // Display the view
     $view->display();
     return $this;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:40,代码来源:controller.php

示例3: upperCastDocument

 /**
  * @static
  * @param Document $doc
  * @return Document
  */
 public static function upperCastDocument(Document $doc)
 {
     $to_class = "Document_Hardlink_Wrapper_" . ucfirst($doc->getType());
     $old_serialized_prefix = "O:" . strlen(get_class($doc));
     $old_serialized_prefix .= ":\"" . get_class($doc) . "\":";
     $old_serialized_object = Pimcore_Tool_Serialize::serialize($doc);
     $new_serialized_object = 'O:' . strlen($to_class) . ':"' . $to_class . '":';
     $new_serialized_object .= substr($old_serialized_object, strlen($old_serialized_prefix));
     $document = Pimcore_Tool_Serialize::unserialize($new_serialized_object);
     return $document;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:16,代码来源:Service.php

示例4: onAfterDispatch

 /**
  * Method to catch the onAfterDispatch event.
  *
  * This is where we setup the click-through content highlighting for.
  * The highlighting is done with JavaScript so we just
  * need to check a few parameters and the JHtml behavior will do the rest.
  *
  * @return  boolean  True on success
  *
  * @since   2.5
  */
 public function onAfterDispatch()
 {
     // Check that we are in the site application.
     if (!App::isSite()) {
         return true;
     }
     // Set the variables
     $extension = Request::getCmd('option', '');
     // Check if the highlighter is enabled.
     if (!Component::params($extension)->get('highlight_terms', 1)) {
         return true;
     }
     // Check if the highlighter should be activated in this environment.
     if (Document::getType() !== 'html' || Request::getCmd('tmpl', '') === 'component') {
         return true;
     }
     // Get the terms to highlight from the request.
     $terms = Request::getVar('highlight', null, 'base64');
     $terms = $terms ? json_decode(base64_decode($terms)) : null;
     // Check the terms.
     if (empty($terms)) {
         return true;
     }
     // Clean the terms array
     $filter = JFilterInput::getInstance();
     $cleanTerms = array();
     foreach ($terms as $term) {
         $cleanTerms[] = htmlspecialchars($filter->clean($term, 'string'));
     }
     // Activate the highlighter.
     Html::behavior('highlighter', $cleanTerms);
     // Adjust the component buffer.
     $buf = Document::getBuffer('component');
     $buf = '<br id="highlighter-start" />' . $buf . '<br id="highlighter-end" />';
     Document::setBuffer($buf, 'component');
     return true;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:48,代码来源:highlight.php

示例5: getDataForEditmode

 /**
  * @see Object_Class_Data::getDataForEditmode
  * @param Asset|Document|Object_Abstract $data
  * @param null|Object_Abstract $object
  * @return array
  */
 public function getDataForEditmode($data, $object = null)
 {
     if ($data) {
         $r = array("id" => $data->getId(), "path" => $data->getFullPath());
         if ($data instanceof Document) {
             $r["subtype"] = $data->getType();
             $r["type"] = "document";
         } else {
             if ($data instanceof Asset) {
                 $r["subtype"] = $data->getType();
                 $r["type"] = "asset";
             } else {
                 if ($data instanceof Object_Abstract) {
                     $r["subtype"] = $data->getO_Type();
                     $r["type"] = "object";
                 }
             }
         }
         return $r;
     }
     return;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:28,代码来源:Href.php

示例6: onAfterDispatch

 /**
  * This method adds alternate meta tags for associated menu items
  *
  * @return	nothing
  * @since	1.7
  */
 public function onAfterDispatch()
 {
     if (App::isSite() && $this->params->get('alternate_meta') && Document::getType() == 'html') {
         // Get active menu item
         $active = App::get('menu')->getActive();
         if (!$active) {
             return;
         }
         // Get menu item link
         if (Config::get('sef')) {
             $active_link = Route::url('index.php?Itemid=' . $active->id, false);
         } else {
             $active_link = Route::url($active->link . '&Itemid=' . $active->id, false);
         }
         if ($active_link == JUri::base(true) . '/') {
             $active_link .= 'index.php';
         }
         // Get current link
         $current_link = Request::getUri();
         if ($current_link == Request::base(true) . '/') {
             $current_link .= 'index.php';
         }
         // Check the exact menu item's URL
         if ($active_link == $current_link) {
             // Get menu item associations
             JLoader::register('MenusHelper', PATH_CORE . '/components/com_menus/admin/helpers/menus.php');
             $associations = MenusHelper::getAssociations($active->id);
             // Remove current menu item
             unset($associations[$active->language]);
             // Associated menu items in other languages
             if ($associations && $this->params->get('menu_associations')) {
                 $menu = App::get('menu');
                 $server = JURI::getInstance()->toString(array('scheme', 'host', 'port'));
                 foreach (JLanguageHelper::getLanguages() as $language) {
                     if (isset($associations[$language->lang_code])) {
                         $item = $menu->getItem($associations[$language->lang_code]);
                         if ($item && Lang::exists($language->lang_code)) {
                             if (Config::get('sef')) {
                                 $link = Route::url('index.php?Itemid=' . $associations[$language->lang_code] . '&lang=' . $language->sef);
                             } else {
                                 $link = Route::url($item->link . '&Itemid=' . $associations[$language->lang_code] . '&lang=' . $language->sef);
                             }
                             // Check if language is the default site language and remove url language code is on
                             if ($language->sef == self::$default_sef && $this->params->get('remove_default_prefix') == '1') {
                                 $relLink = preg_replace('|/' . $language->sef . '/|', '/', $link, 1);
                                 Document::addHeadLink($server . $relLink, 'alternate', 'rel', array('hreflang' => $language->lang_code));
                             } else {
                                 Document::addHeadLink($server . $link, 'alternate', 'rel', array('hreflang' => $language->lang_code));
                             }
                         }
                     }
                 }
             } elseif ($active->home) {
                 $menu = App::get('menu');
                 $server = JURI::getInstance()->toString(array('scheme', 'host', 'port'));
                 foreach (JLanguageHelper::getLanguages() as $language) {
                     $item = $menu->getDefault($language->lang_code);
                     if ($item && $item->language != $active->language && $item->language != '*' && JLanguage::exists($language->lang_code)) {
                         if (Config::get('sef')) {
                             $link = Route::url('index.php?Itemid=' . $item->id . '&lang=' . $language->sef);
                         } else {
                             $link = Route::url($item->link . '&Itemid=' . $item->id . '&lang=' . $language->sef);
                         }
                         // Check if language is the default site language and remove url language code is on
                         if ($language->sef == self::$default_sef && $this->params->get('remove_default_prefix') == '1') {
                             $relLink = preg_replace('|/' . $language->sef . '/|', '/', $link, 1);
                             Document::addHeadLink($server . $relLink, 'alternate', 'rel', array('hreflang' => $language->lang_code));
                         } else {
                             Document::addHeadLink($server . $link, 'alternate', 'rel', array('hreflang' => $language->lang_code));
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:82,代码来源:languagefilter.php

示例7: getById

 /**
  * Static helper to get a Document by it's id, only type Document is returned, not Document_Page, ... (see getConcreteById() )
  *
  * @param integer $id
  * @return Document
  */
 public static function getById($id)
 {
     $id = intval($id);
     if ($id < 1) {
         return null;
     }
     $cacheKey = "document_" . $id;
     try {
         $document = Zend_Registry::get($cacheKey);
         if (!$document) {
             throw new Exception("Document in registry is null");
         }
     } catch (Exception $e) {
         try {
             if (!($document = Pimcore_Model_Cache::load($cacheKey))) {
                 $document = new Document();
                 $document->getResource()->getById($id);
                 $typeClass = "Document_" . ucfirst($document->getType());
                 $typeClass = Pimcore_Tool::getModelClassMapping($typeClass);
                 if (Pimcore_Tool::classExists($typeClass)) {
                     $document = new $typeClass();
                     Zend_Registry::set($cacheKey, $document);
                     $document->getResource()->getById($id);
                     Pimcore_Model_Cache::save($document, $cacheKey);
                 }
             } else {
                 Zend_Registry::set($cacheKey, $document);
             }
         } catch (Exception $e) {
             Logger::warning($e);
             return null;
         }
     }
     if (!$document) {
         return null;
     }
     return $document;
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:44,代码来源:Document.php

示例8: getContent

/**
 * Функция вызывается перед тем как отдать содержимое файла
 * @param \Document $doc            Документ
 * @param string    $accessToken    Ключ доступа пользователя
 */
function getContent($doc, $accessToken)
{
    $ext = $doc->getType() == 1 ? ".p7s" : "";
    $doc->setName($doc->getName() . $ext);
}
开发者ID:Digt,项目名称:trusted-php,代码行数:10,代码来源:custom.php

示例9: countForDocument

 /**
  * @param $item   Document object
  **/
 static function countForDocument(Document $item)
 {
     return countElementsInTable(array('glpi_documents_items'), ['glpi_documents_items.documents_id' => $item->getField('id'), 'NOT' => ['glpi_documents_items.itemtype' => $item->getType()]]);
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:7,代码来源:document_item.class.php

示例10: countForDocument

 /**
  * @param $item   Document object
  **/
 static function countForDocument(Document $item)
 {
     $restrict = "`glpi_documents_items`.`documents_id` = '" . $item->getField('id') . "'\n                   AND `glpi_documents_items`.`itemtype` != '" . $item->getType() . "'";
     return countElementsInTable(array('glpi_documents_items'), $restrict);
 }
开发者ID:pvasener,项目名称:glpi,代码行数:8,代码来源:document_item.class.php

示例11: insertDocument

 /**
  * Добавляет новый документ в БД
  * @global \TDataBase $DB
  * @param \Document $doc
  */
 static function insertDocument($doc)
 {
     global $DB;
     $parentId = $doc->getParentId();
     $childId = $doc->getChildId();
     if (is_null($parentId)) {
         $parentId = 'NULL';
     }
     if (is_null($childId)) {
         $childId = 'NULL';
     }
     $sql = 'INSERT INTO ' . TRUSTED_DB_TABLE_DOCUMENTS . '  ' . '(ORIGINAL_NAME, SYS_NAME, PATH, SIGNERS, TYPE, PARENT_ID, CHILD_ID)' . 'VALUES (' . '"' . $DB->EscapeString($doc->getName()) . '", ' . '"' . $DB->EscapeString($doc->getSysName()) . '", ' . '"' . $doc->getPath() . '", ' . "'" . $DB->EscapeString($doc->getSigners()) . "', " . $doc->getType() . ', ' . $parentId . ', ' . $childId . ')';
     $DB->Query($sql);
     $doc->setId($DB->LastID());
     TDataBaseDocument::saveDocumentParent($doc, $doc->getId());
 }
开发者ID:Digt,项目名称:trusted-php,代码行数:21,代码来源:document.php

示例12: __destruct

 /**
  * Show the debug info
  */
 public function __destruct()
 {
     if (!App::isAdmin() && !App::isSite()) {
         return;
     }
     // Do not render if debugging or language debug is not enabled
     if (!Config::get('debug') && !Config::get('debug_lang')) {
         return;
     }
     // Load the language
     $this->loadLanguage();
     // Capture output
     // [!] zooley Nov 03, 2014 - PHP 5.4 changed behavior for ob_end_clean().
     //     ob_end_clean(), called in JError, clears and stops buffering.
     //     On error, pages, there will be no buller to get so ob_get_contents()
     //     will be false.
     $contents = ob_get_contents();
     if ($contents) {
         ob_end_clean();
     } else {
         return;
     }
     // No debug for Safari and Chrome redirection
     if (isset($_SERVER['HTTP_USER_AGENT']) && strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit') !== false && substr($contents, 0, 50) == '<html><head><meta http-equiv="refresh" content="0;') {
         echo $contents;
         return;
     }
     // Only render for HTML output
     if ('html' !== Document::getType()) {
         echo $contents;
         return;
     }
     // If the user is not allowed to view the output then end here
     $filterGroups = (array) $this->params->get('filter_groups', null);
     if (!empty($filterGroups)) {
         $userGroups = User::get('groups');
         if (!array_intersect($filterGroups, $userGroups)) {
             echo $contents;
             return;
         }
     } else {
         $filterUsers = $this->params->get('filter_users', null);
         if (!empty($filterUsers)) {
             $filterUsers = explode(',', $filterUsers);
             $filterUsers = array_map('trim', $filterUsers);
             if (!in_array(\User::get('username'), $filterUsers)) {
                 echo $contents;
                 return;
             }
         }
     }
     // Load language file
     $this->loadLanguage('plg_system_debug');
     $html = '';
     // Some "mousewheel protecting" JS
     $html .= '<div id="system-debug" class="' . $this->params->get('theme', 'dark') . ' profiler">';
     $html .= '<div class="debug-head" id="debug-head">';
     $html .= '<h1>' . Lang::txt('PLG_DEBUG_TITLE') . '</h1>';
     $html .= '<a class="debug-close-btn" href="javascript:" onclick="Debugger.close();"><span class="icon-remove">' . Lang::txt('PLG_DEBUG_CLOSE') . '</span></a>';
     if (Config::get('debug')) {
         if ($this->params->get('memory', 1)) {
             $html .= '<span class="debug-indicator"><span class="icon-memory text" data-hint="' . Lang::txt('PLG_DEBUG_MEMORY_USAGE') . '">' . $this->displayMemoryUsage() . '</span></span>';
         }
         if (\JError::getErrors()) {
             $html .= '<a href="javascript:" class="debug-tab debug-tab-errors" onclick="Debugger.toggleContainer(this, \'debug-errors\');"><span class="text">' . Lang::txt('PLG_DEBUG_ERRORS') . '</span><span class="badge">' . count(\JError::getErrors()) . '</span></a>';
         }
         $dumper = \Hubzero\Debug\Dumper::getInstance();
         if ($dumper->hasMessages()) {
             $html .= '<a href="javascript:" class="debug-tab debug-tab-console" onclick="Debugger.toggleContainer(this, \'debug-debug\');"><span class="text">' . Lang::txt('PLG_DEBUG_CONSOLE') . '</span>';
             $html .= '<span class="badge">' . count($dumper->messages()) . '</span>';
             $html .= '</a>';
         }
         $html .= '<a href="javascript:" class="debug-tab debug-tab-request" onclick="Debugger.toggleContainer(this, \'debug-request\');"><span class="text">' . Lang::txt('PLG_DEBUG_REQUEST_DATA') . '</span></a>';
         $html .= '<a href="javascript:" class="debug-tab debug-tab-session" onclick="Debugger.toggleContainer(this, \'debug-session\');"><span class="text">' . Lang::txt('PLG_DEBUG_SESSION') . '</span></a>';
         if ($this->params->get('profile', 1)) {
             $html .= '<a href="javascript:" class="debug-tab debug-tab-timeline" onclick="Debugger.toggleContainer(this, \'debug-profile_information\');"><span class="text">' . Lang::txt('PLG_DEBUG_PROFILE_TIMELINE') . '</span></a>';
         }
         if ($this->params->get('queries', 1)) {
             $html .= '<a href="javascript:" class="debug-tab debug-tab-database" onclick="Debugger.toggleContainer(this, \'debug-queries\');"><span class="text">' . Lang::txt('PLG_DEBUG_QUERIES') . '</span><span class="badge">' . \App::get('db')->getCount() . '</span></a>';
         }
     }
     if (Config::get('debug_lang')) {
         if ($this->params->get('language_errorfiles', 1)) {
             $html .= '<a href="javascript:" class="debug-tab debug-tab-lang-errors" onclick="Debugger.toggleContainer(this, \'debug-language_files_in_error\');"><span class="text">' . Lang::txt('PLG_DEBUG_LANGUAGE_FILE_ERRORS') . '</span>';
             $html .= '<span class="badge">' . count(\Lang::getErrorFiles()) . '</span>';
             $html .= '</a>';
         }
         if ($this->params->get('language_files', 1)) {
             $total = 0;
             foreach (\Lang::getPaths() as $extension => $files) {
                 $total += count($files);
             }
             $html .= '<a href="javascript:" class="debug-tab debug-tab-lang-files" onclick="Debugger.toggleContainer(this, \'debug-language_files_loaded\');"><span class="text">' . Lang::txt('PLG_DEBUG_LANGUAGE_FILES_LOADED') . '</span>';
             $html .= '<span class="badge">' . $total . '</span>';
             $html .= '</a>';
         }
         if ($this->params->get('language_strings')) {
//.........这里部分代码省略.........
开发者ID:zooley,项目名称:hubzero-cms,代码行数:101,代码来源:debug.php

示例13: asLink

 /**
  * This method convert a document into document link
  *
  * @param Document $document The document
  *
  * @return Fragment\Link\DocumentLink The document link
  */
 private function asLink($document)
 {
     return new Fragment\Link\DocumentLink($document->getId(), $document->getUid(), $document->getType(), $document->getTags(), $document->getSlug(), $document->getFragments(), false);
 }
开发者ID:lamenath,项目名称:fbp,代码行数:11,代码来源:LinkResolver.php

示例14: display

 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     // Get the document object.
     $document = Document::instance();
     // Set the default view name and format from the Request.
     $vName = Request::getCmd('view', 'login');
     $vFormat = Document::getType();
     $lName = Request::getCmd('layout', 'default');
     if ($view = $this->getView($vName, $vFormat)) {
         // Do any specific processing by view.
         switch ($vName) {
             case 'registration':
                 App::abort(403, Lang::txt('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
                 return;
                 // If the user is already logged in, redirect to the profile page.
                 if (User::get('guest') != 1) {
                     // Redirect to profile page.
                     $this->setRedirect(Route::url('index.php?option=com_users&view=profile', false));
                     return;
                 }
                 // Check if user registration is enabled
                 if (Component::params('com_users')->get('allowUserRegistration') == 0) {
                     // Registration is disabled - Redirect to login page.
                     $this->setRedirect(Route::url('index.php?option=com_users&view=login', false));
                     return;
                 }
                 // The user is a guest, load the registration model and show the registration page.
                 $model = $this->getModel('Registration');
                 break;
                 // Handle view specific models.
             // Handle view specific models.
             case 'profile':
                 App::abort(403, Lang::txt('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
                 return;
                 // If the user is a guest, redirect to the login page.
                 if (User::get('guest') == 1) {
                     // Redirect to login page.
                     $this->setRedirect(Route::url('index.php?option=com_users&view=login', false));
                     return;
                 }
                 $model = $this->getModel($vName);
                 break;
                 // Handle the default views.
             // Handle the default views.
             case 'login':
                 $model = $this->getModel($vName);
                 break;
             case 'reset':
                 // If the user is already logged in, redirect to the profile page.
                 if (User::get('guest') != 1) {
                     // Redirect to profile page.
                     $this->setRedirect(Route::url('index.php?option=com_members&task=myaccount', false));
                     return;
                 }
                 $model = $this->getModel($vName);
                 break;
             case 'remind':
                 // If the user is already logged in, redirect to the profile page.
                 if (User::get('guest') != 1) {
                     // Redirect to profile page.
                     $this->setRedirect(Route::url('index.php?option=com_members&task=myaccount', false));
                     return;
                 }
                 $model = $this->getModel($vName);
                 break;
             default:
                 $model = $this->getModel('Login');
                 break;
         }
         // Push the model into the view (as default).
         $view->setModel($model, true);
         $view->setLayout($lName);
         // Push document object into the view.
         $view->assignRef('document', $document);
         $view->display();
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:86,代码来源:controller.php

示例15: getTreeNodePermissionConfig

 /**
  * @param  User $user
  * @param  Document $childDocument
  * @param  Document $parentDocument
  * @param boolean $expanded
  * @return
  */
 protected function getTreeNodePermissionConfig($user, $childDocument, $parentDocument, $expanded)
 {
     $userGroup = $user->getParent();
     if ($userGroup instanceof User) {
         $childDocument->getPermissionsForUser($userGroup);
         $lock_list = $childDocument->isAllowed("list");
         $lock_view = $childDocument->isAllowed("view");
         $lock_save = $childDocument->isAllowed("save");
         $lock_publish = $childDocument->isAllowed("publish");
         $lock_unpublish = $childDocument->isAllowed("unpublish");
         $lock_delete = $childDocument->isAllowed("delete");
         $lock_rename = $childDocument->isAllowed("rename");
         $lock_create = $childDocument->isAllowed("create");
         $lock_permissions = $childDocument->isAllowed("permissions");
         $lock_settings = $childDocument->isAllowed("settings");
         $lock_versions = $childDocument->isAllowed("versions");
         $lock_properties = $childDocument->isAllowed("properties");
         $lock_properties = $childDocument->isAllowed("properties");
     }
     if ($parentDocument) {
         $parentDocument->getPermissionsForUser($user);
     }
     $documentPermission = $childDocument->getPermissionsForUser($user);
     $generallyAllowed = $user->isAllowed("documents");
     $parentId = (int) $childDocument->getParentId();
     $parentAllowedList = true;
     if ($parentDocument instanceof Document) {
         $parentAllowedList = $parentDocument->isAllowed("list") and $generallyAllowed;
     }
     $tmpDocument = array("_parent" => $parentId > 0 ? $parentId : null, "_id" => (int) $childDocument->getId(), "text" => $childDocument->getKey(), "type" => $childDocument->getType(), "path" => $childDocument->getFullPath(), "basePath" => $childDocument->getPath(), "elementType" => "document", "permissionSet" => $documentPermission->getId() > 0 and $documentPermission->getCid() === $childDocument->getId(), "list" => $childDocument->isAllowed("list"), "list_editable" => $parentAllowedList and $generallyAllowed and !$lock_list and !$user->isAdmin(), "view" => $childDocument->isAllowed("view"), "view_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_view and !$user->isAdmin(), "save" => $childDocument->isAllowed("save"), "save_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_save and !$user->isAdmin(), "publish" => $childDocument->isAllowed("publish"), "publish_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_publish and !$user->isAdmin(), "unpublish" => $childDocument->isAllowed("unpublish"), "unpublish_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_unpublish and !$user->isAdmin(), "delete" => $childDocument->isAllowed("delete"), "delete_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_delete and !$user->isAdmin(), "rename" => $childDocument->isAllowed("rename"), "rename_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_rename and !$user->isAdmin(), "create" => $childDocument->isAllowed("create"), "create_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_create and !$user->isAdmin(), "permissions" => $childDocument->isAllowed("permissions"), "permissions_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_permissions and !$user->isAdmin(), "settings" => $childDocument->isAllowed("settings"), "settings_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_settings and !$user->isAdmin(), "versions" => $childDocument->isAllowed("versions"), "versions_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_versions and !$user->isAdmin(), "properties" => $childDocument->isAllowed("properties"), "properties_editable" => $childDocument->isAllowed("list") and $generallyAllowed and !$lock_properties and !$user->isAdmin());
     $tmpDocument["expanded"] = $expanded;
     $tmpDocument["iconCls"] = "pimcore_icon_" . $childDocument->getType();
     // set type specific settings
     if ($childDocument->getType() == "page") {
         $tmpDocument["_is_leaf"] = $childDocument->hasNoChilds();
         $tmpDocument["iconCls"] = "pimcore_icon_page";
         // test for a site
         try {
             $site = Site::getByRootId($childDocument->getId());
             $tmpDocument["iconCls"] = "pimcore_icon_site";
             $tmpDocument["site"] = $site;
         } catch (Exception $e) {
         }
     } else {
         if ($childDocument->getType() == "folder") {
             $tmpDocument["_is_leaf"] = $childDocument->hasNoChilds();
             if ($childDocument->hasNoChilds()) {
                 $tmpDocument["iconCls"] = "pimcore_icon_folder";
             }
         } else {
             if ($childDocument->getType() == "link") {
                 $tmpDocument["_is_leaf"] = $childDocument->hasNoChilds();
                 if ($childDocument->hasNoChilds()) {
                     $tmpDocument["iconCls"] = "pimcore_icon_link";
                 }
             } else {
                 $tmpDocument["leaf"] = true;
                 $tmpDocument["_is_leaf"] = true;
             }
         }
     }
     if (!$childDocument->isPublished()) {
         $tmpDocument["cls"] = "pimcore_unpublished";
     }
     return $tmpDocument;
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:73,代码来源:DocumentController.php


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