本文整理匯總了PHP中Sintattica\Atk\Core\Tools::getNodeModule方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tools::getNodeModule方法的具體用法?PHP Tools::getNodeModule怎麽用?PHP Tools::getNodeModule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sintattica\Atk\Core\Tools
的用法示例。
在下文中一共展示了Tools::getNodeModule方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
}
示例2: _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;
}
示例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;
}
示例4: 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;
}