本文整理汇总了PHP中Sintattica\Atk\Core\Tools::atkurlencode方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::atkurlencode方法的具体用法?PHP Tools::atkurlencode怎么用?PHP Tools::atkurlencode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sintattica\Atk\Core\Tools
的用法示例。
在下文中一共展示了Tools::atkurlencode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRelationAutolink
/**
* Creates and returns the auto edit/view links.
*
* @param string $id The field html id
* @param string $name The field html name
* @param string $filter Filter that we want to apply on the destination node
*
* @return array The HTML code for the autolink links
*/
public function getRelationAutolink($id, $name, $filter)
{
$autolink = [];
if ($this->hasFlag(self::AF_RELATION_AUTOLINK)) {
// auto edit/view link
$page = Page::getInstance();
$page->register_script(Config::getGlobal('assets_url') . 'javascript/class.atkmanytoonerelation.js');
$sm = SessionManager::getInstance();
if ($this->m_destInstance->allowed('edit')) {
$editlink = $sm->sessionUrl(Tools::dispatch_url($this->getAutoLinkDestination(), 'edit', array('atkselector' => 'REPLACEME')), SessionManager::SESSION_NESTED);
$autolink['edit'] = "<a href='javascript:atkSubmit(mto_parse(\"" . Tools::atkurlencode($editlink) . '", document.entryform.' . $id . ".value),true)' class='atkmanytoonerelation atkmanytoonerelation-link'>" . Tools::atktext('edit') . '</a>';
}
if ($this->m_destInstance->allowed('add')) {
$autolink['add'] = ' ' . Tools::href(Tools::dispatch_url($this->getAutoLinkDestination(), 'add', array('atkpkret' => $name, 'atkfilter' => $this->m_useFilterForAddLink && $filter != '' ? $filter : '')), Tools::atktext('new'), SessionManager::SESSION_NESTED, true, 'class="atkmanytoonerelation atkmanytoonerelation-link"');
}
}
return $autolink;
}
示例2: buildTabs
/**
* Builds a list of tabs.
*
* This doesn't generate the actual HTML code, but returns the data for
* the tabs (title, selected, urls that should be loaded upon click of the
* tab etc).
*
* @param string $action The action for which the tabs should be generated.
*
* @return array List of tabs
*
* @todo Make translation of tabs module aware
*/
public function buildTabs($action = '')
{
if ($action == '') {
// assume active action
$action = $this->m_action;
}
$result = [];
// which tab is currently selected
$tab = $this->getActiveTab();
// build navigator
$list = $this->getTabs($action);
if (is_array($list)) {
$sm = SessionManager::getInstance();
$newtab['total'] = count($list);
foreach ($list as $t) {
$newtab['title'] = $this->text(array("tab_{$t}", $t));
$newtab['tab'] = $t;
$url = Config::getGlobal('dispatcher') . '?atknodeuri=' . $this->atkNodeUri() . '&atkaction=' . $this->m_action . '&atktab=' . $t;
if ($this->m_action == 'view') {
$newtab['link'] = $sm->sessionUrl($url, SessionManager::SESSION_DEFAULT);
} else {
$newtab['link'] = "javascript:atkSubmit('" . Tools::atkurlencode($sm->sessionUrl($url, SessionManager::SESSION_DEFAULT)) . "')";
}
$newtab['selected'] = $t == $tab;
$result[] = $newtab;
}
}
return $result;
}
示例3: GraphTreeRender
//.........这里部分代码省略.........
if ($nextlevel > $currentlevel) {
/* * ************************************* */
/* Create expand/collapse parameters */
/* * ************************************* */
if ($foldable) {
$i = 0;
$params = 'atktree=';
while ($i < count($expand)) {
if ($expand[$i] == 1 && $cnt != $i || $expand[$i] == 0 && $cnt == $i) {
$params = $params . $this->m_tree[$i]['id'];
$params = $params . '|';
}
++$i;
}
if (isset($this->extraparams)) {
$params = $params . $this->extraparams;
}
if ($expand[$cnt] == 0) {
$res .= '<td>' . Tools::href(Config::getGlobal('dispatcher') . '?' . $params, '<img src="' . $img_expand . '" border=0>') . "</td>\n";
} else {
$res .= '<td>' . Tools::href(Config::getGlobal('dispatcher') . '?' . $params, '<img src="' . $img_collapse . '" border=0>') . "</td>\n";
}
} else {
$res .= '<td><img src="' . $img_collapse . "\" border=0></td>\n";
}
} else {
/* * ********************** */
/* Tree Leaf */
/* * ********************** */
$img = $img_leaf;
// the image is a leaf image by default, but it can be overridden
// by putting img to something else
if ($this->m_tree[$cnt]['img'] != '') {
$imgname = $this->m_tree[$cnt]['img'];
$img = ${$imgname};
}
$res .= '<td><img src="' . $img . "\"></td>\n";
}
/* * ************************************* */
/* output item text */
/* * ************************************* */
// If there's an array inside the 'label' thingee, we have an entire record.
// Else, it's probably just a textual label.
if (is_array($this->m_tree[$cnt]['label'])) {
$label = $this->descriptor($this->m_tree[$cnt]['label']);
} else {
$label = $this->m_tree[$cnt]['label'];
}
$res .= '<td colspan=' . ($g_maxlevel - $this->m_tree[$cnt]['level']) . ' nowrap><font size=2>' . $label . "</font></td>\n";
/* * ************************************* */
/* end row with the functions */
/* * ************************************* */
if ($showactions) {
$res .= '<td nowrap> ';
$actions = [];
if (!$this->hasFlag(self::NF_NO_ADD) && !($this->hasFlag(self::NF_TREE_NO_ROOT_ADD) && $this->m_tree[$cnt]['level'] == 0)) {
$actions['add'] = Config::getGlobal('dispatcher') . '?atknodeuri=' . $this->atkNodeUri() . '&atkaction=add&atkfilter=' . $this->m_parent . '.' . $this->m_primaryKey[0] . rawurlencode("='" . $this->m_tree[$cnt]['id'] . "'");
}
if ($cnt > 0) {
if (!$this->hasFlag(self::NF_NO_EDIT)) {
$actions['edit'] = Config::getGlobal('dispatcher') . '?atknodeuri=' . $this->atkNodeUri() . '&atkaction=edit&atkselector=' . $this->m_table . '.' . $this->m_primaryKey[0] . '=' . $this->m_tree[$cnt]['id'];
}
if ($this->hasFlag(self::NF_COPY) && $this->allowed('add') && !$this->hasFlag(self::NF_TREE_NO_ROOT_COPY) || $this->m_tree[$cnt]['level'] != 1 && $this->hasFlag(self::NF_COPY) && $this->allowed('add')) {
$actions['copy'] = Config::getGlobal('dispatcher') . '?atknodeuri=' . $this->atkNodeUri() . '&atkaction=copy&atkselector=' . $this->m_table . '.' . $this->m_primaryKey[0] . '=' . $this->m_tree[$cnt]['id'];
}
if ($this->hasFlag(self::NF_NO_DELETE) || $this->hasFlag(self::NF_TREE_NO_ROOT_DELETE) && $this->m_tree[$cnt]['level'] == 1) {
// Do nothing
} else {
$actions['delete'] = Config::getGlobal('dispatcher') . '?atknodeuri=' . $this->atkNodeUri() . '&atkaction=delete&atkselector=' . $this->m_table . '.' . $this->m_primaryKey[0] . '=' . $this->m_tree[$cnt]['id'];
}
}
// Look for custom record actions.
$recordactions = $actions;
$this->collectRecordActions($this->m_tree[$cnt]['label'], $recordactions, $dummy);
foreach ($recordactions as $name => $url) {
if (!empty($url)) {
/* dirty hack */
$atkencoded = strpos($url, '_1') > 0;
$url = str_replace('%5B', '[', $url);
$url = str_replace('%5D', ']', $url);
$url = str_replace('_1' . '5B', '[', $url);
$url = str_replace('_1' . '5D', ']', $url);
if ($atkencoded) {
$url = str_replace('[pk]', Tools::atkurlencode(rawurlencode($this->primaryKey($this->m_tree[$cnt]['label'])), false), $url);
} else {
$url = str_replace('[pk]', rawurlencode($this->primaryKey($this->m_tree[$cnt]['label'])), $url);
}
$stringparser = new StringParser($url);
$url = $stringparser->parse($this->m_tree[$cnt]['label'], true);
$res .= Tools::href($url, Tools::atktext($name), SessionManager::SESSION_NESTED) . ' ';
}
}
$res .= '</td>';
}
$res .= "</tr>\n";
}
++$cnt;
}
return $res;
}
示例4: listArray
/**
* Function outputs an array with all information necessary to output a recordlist.
*
* @param array $recordset List of records that need to be displayed
* @param string $prefix Prefix for each column name (used for subcalls)
* @param array $actions List of default actions for each record
* @param array $suppress An array of fields that you want to hide
*
* The result array contains the following information:
* "name" => the name of the recordlist
* "heading" => for each visible column an array containing: "title" {, "url"}
* "search" => for each visible column HTML input field(s) for searching
* "rows" => list of rows, per row: "data", "actions", "mra", "record"
* "totalraw" => for each totalisable column the sum value field(s) (raw)
* "total" => for each totalisable column the sum value (display)
* "mra" => list of all multi-record actions
*
* @return array see above
*/
private function listArray(&$recordset, $prefix = '', $actions = [], $suppress = array())
{
$grid = $this->getGrid();
$flags = $this->convertDataGridFlags();
if (!is_array($suppress)) {
$suppress = [];
}
$result = array('name' => $grid->getName(), 'heading' => [], 'search' => [], 'rows' => [], 'totalraw' => [], 'total' => [], 'mra' => []);
$columnConfig = $grid->getNode()->getColumnConfig($grid->getName());
if (!Tools::hasFlag($flags, RecordList::RL_NO_SEARCH) || $grid->isEditing()) {
$grid->getNode()->setAttribSizes();
}
$this->_addListArrayHeader($result, $prefix, $suppress, $flags, $columnConfig);
/* actions array can contain multi-record-actions */
if (count($actions) == 2 && count(array_diff(array_keys($actions), array('actions', 'mra'))) == 0) {
$mra = $actions['mra'];
$actions = $actions['actions'];
} else {
$mra = $grid->getNode()->hasFlag(Node::NF_NO_DELETE) ? [] : array('delete');
}
/* get the rows */
for ($i = 0, $_i = count($recordset); $i < $_i; ++$i) {
$result['rows'][$i] = array('columns' => [], 'actions' => $actions, 'mra' => $mra, 'record' => &$recordset[$i], 'data' => []);
$result['rows'][$i]['selector'] = $grid->getNode()->primaryKey($recordset[$i]);
$result['rows'][$i]['type'] = 'data';
$row =& $result['rows'][$i];
/* actions / mra */
$grid->getNode()->collectRecordActions($row['record'], $row['actions'], $row['mra']);
// filter actions we are allowed to execute
foreach ($row['actions'] as $name => $url) {
if (!empty($url) && $grid->getNode()->allowed($name, $row['record'])) {
/* dirty hack */
$atkencoded = strpos($url, '_15B') > 0;
$url = str_replace('%5B', '[', $url);
$url = str_replace('%5D', ']', $url);
$url = str_replace('_1' . '5B', '[', $url);
$url = str_replace('_1' . '5D', ']', $url);
if ($atkencoded) {
$url = str_replace('[pk]', Tools::atkurlencode(rawurlencode($row['selector']), false), $url);
} else {
$url = str_replace('[pk]', rawurlencode($row['selector']), $url);
}
$parser = new StringParser($url);
$url = $parser->parse($row['record'], true, false);
$row['actions'][$name] = $url;
} else {
unset($row['actions'][$name]);
}
}
// filter multi-record-actions we are allowed to execute
foreach ($row['mra'] as $j => $name) {
if (!$grid->getNode()->allowed($name, $row['record'])) {
unset($row['mra'][$j]);
}
}
$row['mra'] = array_values($row['mra']);
$result['mra'] = array_merge($result['mra'], $row['mra']);
/* columns */
$editAllowed = $grid->getPostvar('atkgridedit', false) && $grid->getNode()->allowed('edit', $result['rows'][$i]['record']);
$result['rows'][$i]['edit'] = $editAllowed;
$this->_addListArrayRow($result, $prefix, $suppress, $flags, $i, $editAllowed);
}
// override totals
if (is_array($result['total']) && count($result['total']) > 0) {
$selector = $grid->getNode()->select()->ignoreDefaultFilters();
foreach ($grid->getFilters() as $filter) {
$selector->where($filter['filter'], $filter['params']);
}
$result['totalraw'] = $selector->getTotals(array_keys($result['total']));
foreach ($result['totalraw'] as $attrName => $value) {
$result['total'][$attrName] = $grid->getNode()->getAttribute($attrName)->getView('list', $result['totalraw']);
}
}
if (Tools::hasFlag($flags, RecordList::RL_EXT_SORT) && $columnConfig->hasSubTotals()) {
$totalizer = new Totalizer($grid->getNode(), $columnConfig);
$result['rows'] = $totalizer->totalize($result['rows']);
}
if (Tools::hasFlag($flags, RecordList::RL_MRA)) {
$result['mra'] = array_values(array_unique($result['mra']));
}
return $result;
//.........这里部分代码省略.........