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


PHP Tools::getNodeType方法代码示例

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


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

示例1: getAddLabel

 /**
  * Attempts to get a translated label which can be used when composing an "add" link.
  *
  * @return string Localised "add" label
  */
 public function getAddLabel()
 {
     $key = 'link_' . $this->fieldName() . '_add';
     $label = Tools::atktext($key, $this->m_ownerInstance->m_module, $this->m_ownerInstance->m_type, '', '', true);
     if ($label == '') {
         $label = Tools::atktext($key, $this->m_destInstance->m_module, '', '', '', true);
         if ($label == '') {
             $key = 'link_' . Tools::getNodeType($this->m_destination) . '_add';
             $label = Tools::atktext($key, $this->m_destInstance->m_module, '', '', '', true);
             if ($label == '') {
                 $label = Tools::atktext('link_add', 'atk');
             }
         }
     }
     return $label;
 }
开发者ID:sintattica,项目名称:atk,代码行数:21,代码来源:Relation.php

示例2: registerNode

 /**
  * Tells ATK that a node exists, and what actions are available to
  * perform on that node.  Note that registerNode() is not involved in
  * deciding which users can do what, only in establishing the full set
  * of actions that can potentially be performed on the node.
  *
  * @param string $nodeUri uri of the node
  * @param string $class class of the node
  * @param array $actions actions that can be performed on the node
  * @param array $tabs tabnames for which security should be handled.
  *              Note that tabs that every user may see need not be
  *              registered.
  * @param string $section
  */
 public function registerNode($nodeUri, $class, $actions = null, $tabs = [], $section = null)
 {
     if (!is_array($tabs)) {
         $section = $tabs;
         $tabs = [];
     }
     $module = Tools::getNodeModule($nodeUri);
     $type = Tools::getNodeType($nodeUri);
     $this->g_nodesClasses[$nodeUri] = $class;
     if ($actions) {
         // prefix tabs with tab_
         for ($i = 0, $_i = count($tabs); $i < $_i; ++$i) {
             $tabs[$i] = 'tab_' . $tabs[$i];
         }
         if ($module == '') {
             $module = 'main';
         }
         if ($section == null) {
             $section = $module;
         }
         $this->g_nodes[$section][$module][$type] = array_merge($actions, $tabs);
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:37,代码来源:Atk.php

示例3: descriptorTrace

 /**
  * Gets the node and the descriptor for the current item
  * and returns a trace of that.
  *
  * So for instance, if we were adding a grade to a student,
  * it would show:
  * Student [ Teknoman ] - Grade [ A+ ]
  *
  * @return string The descriptortrace
  */
 public function descriptorTrace()
 {
     $sessionData =& self::getSession();
     $stack = $sessionData[$this->m_namespace]['stack'][$this->atkStackID()];
     $res = [];
     $node = null;
     $module = null;
     $nodename = null;
     $stackcount = count($stack);
     $atk = Atk::getInstance();
     for ($i = 0; $i < $stackcount; ++$i) {
         if (isset($stack[$i]['descriptor']) || $i == $stackcount - 1) {
             if ($stack[$i]['atknodeuri'] != '') {
                 $node = $atk->atkGetNode($stack[$i]['atknodeuri']);
                 $module = Tools::getNodeModule($stack[$i]['atknodeuri']);
                 $nodename = Tools::getNodeType($stack[$i]['atknodeuri']);
             }
             if (is_object($node)) {
                 $ui = Ui::getInstance();
                 $txt = $ui->title($module, $nodename);
             } else {
                 $txt = Tools::atktext($nodename, $module);
             }
             $res[] = $txt . (isset($stack[$i]['descriptor']) ? " [ {$stack[$i]['descriptor']} ] " : '');
         }
     }
     return $res;
 }
开发者ID:sintattica,项目名称:atk,代码行数:38,代码来源:SessionManager.php

示例4: _getSelectLink

 /**
  * Get the select link to select the value using a select action on the destination node.
  *
  * @param string $selname
  * @param string $filter
  *
  * @return string HTML-code with the select link
  */
 public function _getSelectLink($selname, $filter)
 {
     $result = '';
     // we use the current level to automatically return to this page
     // when we come from the select..
     $sm = SessionManager::getInstance();
     $atktarget = Tools::atkurlencode(Config::getGlobal('dispatcher') . '?atklevel=' . $sm->atkLevel() . '&' . $selname . '=[atkprimkey]');
     $linkname = Tools::atktext('link_select_' . Tools::getNodeType($this->m_destination), $this->getOwnerInstance()->getModule(), $this->getOwnerInstance()->getType(), '', '', true);
     if (!$linkname) {
         $linkname = Tools::atktext('link_select_' . Tools::getNodeType($this->m_destination), Tools::getNodeModule($this->m_destination), Tools::getNodeType($this->m_destination), '', '', true);
     }
     if (!$linkname) {
         $linkname = Tools::atktext('select_a');
     }
     $result .= Tools::href(Tools::dispatch_url($this->m_destination, 'select', ['atkfilter' => $filter, 'atktarget' => $atktarget]), $linkname, SessionManager::SESSION_NESTED, $this->m_autocomplete_saveform, 'class="atkmanytoonerelation atkmanytoonerelation-link"');
     return $result;
 }
开发者ID:sintattica,项目名称:atk,代码行数:25,代码来源:ManyToOneRelation.php

示例5: adminPage

 /**
  * Admin page displays records and the actions that can be performed on
  * them (edit, delete) in a Treeview.
  *
  * @param ActionHandler $handler The action handler object
  */
 public function adminPage($handler)
 {
     global $g_maxlevel;
     $ui = $this->getUi();
     $content = '';
     $adminHeader = $handler->invoke('adminHeader');
     if ($adminHeader != '') {
         $content .= $adminHeader . '<br><br>';
     }
     Tools::atkdebug('Entering treeview page.');
     $t = $this->buildTree();
     $this->m_tree[0]['level'] = 0;
     $this->m_tree[0]['id'] = '';
     $this->m_tree[0]['expand'] = $this->hasFlag(self::NF_TREE_AUTO_EXPAND) ? 1 : 0;
     $this->m_tree[0]['colapse'] = 0;
     $this->m_tree[0]['isleaf'] = 1;
     $this->m_tree[0]['label'] = '';
     $this->treeToArray($t->m_tree);
     $g_maxlevel = $g_maxlevel + 2;
     $width = $g_maxlevel * 16 + 600;
     $content .= '<table border="0" cellspacing=0 cellpadding=0 cols=' . ($g_maxlevel + 2) . ' width=' . $width . ">\n";
     if (!$this->hasFlag(self::NF_NO_ADD) && $this->hasFlag(self::NF_ADD_LINK) && $this->allowed('add')) {
         $addurl = Config::getGlobal('dispatcher') . '?atknodeuri=' . $this->atkNodeUri() . '&atkaction=add&atkfilter=' . rawurlencode($this->m_parent . '.' . $this->m_primaryKey[0] . "='0'");
         if (Tools::atktext('txt_link_' . Tools::getNodeType($this->m_type) . '_add', $this->m_module, '', '', '', true) != '') {
             // specific text
             $label = Tools::atktext('link_' . Tools::getNodeType($this->m_type) . '_add', $this->m_module);
         } else {
             // generic text
             $label = Tools::atktext(Tools::getNodeType($this->m_type), $this->m_module) . ' ' . Tools::atktext('add', 'atk');
         }
         $content .= Tools::href($addurl, $label, SessionManager::SESSION_NESTED) . '<br><br>';
     }
     $content .= $this->GraphTreeRender();
     $content .= '</table><br>';
     $adminFooter = $handler->invoke('adminFooter');
     if ($adminFooter != '') {
         $content .= '<br>' . $adminFooter;
     }
     Tools::atkdebug('Generated treeview');
     return $ui->renderBox(array('title' => Tools::atktext('title_' . $this->m_type . '_tree', $this->m_module), 'content' => $content));
 }
开发者ID:sintattica,项目名称:atk,代码行数:47,代码来源:TreeNode.php

示例6: getSelectedActions

 /**
  * Returns the currently selected actions.
  *
  * @param array $record The record
  *
  * @return array array with selected actions
  */
 public function getSelectedActions($record)
 {
     $selected = $record[$this->fieldName()];
     $result = [];
     foreach ($selected as $node => $actions) {
         $module = Tools::getNodeModule($node);
         $node = Tools::getNodeType($node);
         $result[$module][$node] = $actions;
     }
     return $result;
 }
开发者ID:sintattica,项目名称:atk,代码行数:18,代码来源:ProfileAttribute.php


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