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


PHP Tools::href方法代码示例

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


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

示例1: _getNestedAddLink

 /**
  * Internal function to get the add link for a atkOneToManyRelation.
  *
  * @param array $myrecords The load of all attributes (see comment in edit() code)
  * @param array $record The record that holds the value for this attribute.
  * @param bool $saveform Save the values of the form?
  * @param string $fieldprefix
  * @param array $params
  *
  * @return string The link to add records to the onetomany
  */
 public function _getNestedAddLink($myrecords, $record, $saveform = true, $fieldprefix = '', $params = [])
 {
     $url = '';
     if ((int) $this->m_maxRecords !== 0 && $this->m_maxRecords <= count($myrecords)) {
         return $url;
     }
     if (!$this->createDestination()) {
         return $url;
     }
     if ($this->m_destInstance->hasFlag(Node::NF_NO_ADD)) {
         return $url;
     }
     $filter = $this->getAddFilterString($record);
     if (!empty($filter)) {
         $params['atkfilter'] = $filter;
     }
     $onchange = '';
     if (count($this->m_onchangecode)) {
         $onchange = 'onChange="' . $this->fieldName() . '_onChange(this);"';
         $this->_renderChangeHandler($fieldprefix);
     }
     $add_url = $this->getAddURL($params);
     $label = $this->getAddLabel();
     return Tools::href($add_url, $label, SessionManager::SESSION_NESTED, $saveform, $onchange . ' class="atkonetomanyrelation"');
 }
开发者ID:sintattica,项目名称:atk,代码行数:36,代码来源:OneToManyRelation.php

示例2: getAddLink

 /**
  * Get the add link to add to the admin header.
  *
  * @return string HTML code with link to the add action of the node (if allowed)
  */
 public function getAddLink()
 {
     $atk = Atk::getInstance();
     $node = $atk->atkGetNode($this->invoke('getAddNodeType'));
     if (!$node->hasFlag(Node::NF_NO_ADD) && $node->allowed('add')) {
         $label = $node->text('link_' . $node->m_type . '_add', null, '', '', true);
         if (empty($label)) {
             // generic text
             $label = Tools::atktext('add', 'atk');
         }
         if ($node->hasFlag(Node::NF_ADD_LINK)) {
             $addurl = $this->invoke('getAddUrl', $node);
             return Tools::href($addurl, $label, SessionManager::SESSION_NESTED);
         }
     }
     return '';
 }
开发者ID:sintattica,项目名称:atk,代码行数:22,代码来源:AdminHandler.php

示例3: GraphTreeRender


//.........这里部分代码省略.........
                 } else {
                     $res .= '<td><img src="' . $img_spc . "\" border=0></td>\n";
                 }
                 ++$i;
             }
             /***************************************/
             /* corner at end of subtree or t-split */
             /***************************************/
             if ($this->m_tree[$cnt]['isleaf'] == 1 && $nextlevel < $currentlevel) {
                 if ($cnt != 0) {
                     $res .= '<td><img src="' . $img_end . "\" border=0></td>\n";
                 }
                 $levels[$this->m_tree[$cnt]['level'] - 1] = 0;
             } else {
                 if ($expand[$cnt] == 0) {
                     if ($nextlevel > $currentlevel) {
                         /*                             * ************************************* */
                         /* Create expand/collapse parameters    */
                         /*                             * ************************************* */
                         $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 ($this->extraparams) {
                             $params = $params . $this->extraparams;
                         }
                         if ($this->m_tree[$cnt]['isleaf'] == 1) {
                             if ($cnt != 0) {
                                 $res .= '<td>' . Tools::href(Config::getGlobal('dispatcher') . '?atknodeuri=' . $this->atkNodeUri() . '&atkaction=' . $this->m_action . '&' . $params, '<img src="' . $img_end_plus . '" border=0>') . "</td>\n";
                             }
                         } else {
                             if ($cnt != 0) {
                                 $res .= '<td>' . Tools::href(Config::getGlobal('dispatcher') . '?atknodeuri=' . $this->atkNodeUri() . '&atkaction=' . $this->m_action . '&' . $params, '<img src="' . $img_plus . '" border=0>') . "</td>\n";
                             }
                         }
                     } else {
                         $res .= '<td><img src="' . $img_split . "\" border=0></td>\n";
                     }
                 } else {
                     if ($nextlevel > $currentlevel) {
                         /*                             * ************************************* */
                         /* Create expand/collapse parameters    */
                         /*                             * ************************************* */
                         $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 ($this->m_tree[$cnt]['isleaf'] == 1) {
                             if ($cnt != 0) {
                                 if ($foldable) {
                                     $res .= '<td>' . Tools::href(Config::getGlobal('dispatcher') . '?atknodeuri=' . $this->atkNodeUri() . '&atkaction=' . $this->m_action . '&' . $params, '<img src="' . $img_end_minus . '" border=0>') . "</td>\n";
                                 } else {
                                     $res .= '<td><img src="' . $img_end . "\" border=0></td>\n";
开发者ID:sintattica,项目名称:atk,代码行数:67,代码来源:TreeNode.php

示例4: 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;
 }
开发者ID:sintattica,项目名称:atk,代码行数:27,代码来源:ManyToOneRelation.php

示例5: display

 /**
  * Returns a displayable string for this value.
  *
  * @param array $record The record that holds the value for this attribute
  * @param string $mode The display mode ("view" for viewpages, or "list"
  *                       for displaying in recordlists, "edit" for
  *                       displaying in editscreens, "add" for displaying in
  *                       add screens. "csv" for csv files. Applications can
  *                       use additional modes.
  *
  * @return string a displayable string for this value
  */
 public function display($record, $mode)
 {
     $result = '';
     if ($this->createDestination() && Tools::atk_value_in_array($record[$this->fieldName()])) {
         $recordset = [];
         $remotekey = $this->getRemoteKey();
         for ($i = 0; $i < count($record[$this->fieldName()]); ++$i) {
             $rec = $record[$this->fieldName()][$i][$remotekey];
             if (!is_array($rec)) {
                 $selector = $this->m_destInstance->m_table . '.' . $this->m_destInstance->primaryKeyField() . "= '{$rec}'";
                 $rec = $this->m_destInstance->select($selector)->includes($this->m_destInstance->descriptorFields())->getFirstRow();
                 $descr = $this->m_destInstance->descriptor($rec);
             } else {
                 $descr = $this->m_destInstance->descriptor($rec);
             }
             if ($this->hasFlag(self::AF_MANYTOMANY_DETAILVIEW) && $this->m_destInstance->allowed('view')) {
                 $descr = Tools::href(Tools::dispatch_url($this->m_destination, 'view', array('atkselector' => $this->getDestination()->primaryKey($rec))), $descr, SessionManager::SESSION_NESTED);
             }
             $recordset[] = $descr;
         }
         if (!in_array($mode, array('csv', 'plain'))) {
             $result = '<ul><li>' . implode('<li>', $recordset) . '</ul>';
         } else {
             $result = implode(', ', $recordset);
         }
     } else {
         if (!in_array($mode, array('csv', 'plain'))) {
             $result = $this->text('none');
         }
     }
     return $result;
 }
开发者ID:sintattica,项目名称:atk,代码行数:44,代码来源:ManyToManyRelation.php

示例6: edit

 /**
  * Return a piece of html code to edit the attribute.
  *
  * @param array $record Current record
  * @param string $fieldprefix The fieldprefix to put in front of the name
  *                            of any html form element for this attribute.
  * @param string $mode The mode we're in ('add' or 'edit')
  *
  * @return string piece of html code
  */
 public function edit($record, $fieldprefix, $mode)
 {
     $this->createDestination();
     $this->createLink();
     $result = '';
     $selectedPk = $this->getSelectedRecords($record);
     $recordset = $this->_getSelectableRecords($record, $mode);
     $total_records = count($recordset);
     if ($total_records > 0) {
         $page = Page::getInstance();
         $page->register_script(Config::getGlobal('assets_url') . 'javascript/class.atkprofileattribute.js');
         if (!$this->hasFlag(self::AF_MANYBOOL_NO_TOOLBAR)) {
             $result .= '<div align="left">
                   [<a href="javascript:void(0)" onclick="profile_checkAll(\'' . $this->getHtmlId($fieldprefix) . '\'); return false;">' . Tools::atktext('check_all', 'atk') . '</a> <a href="javascript:void(0)" onclick="profile_checkNone(\'' . $this->getHtmlId($fieldprefix) . '\'); return false;">' . Tools::atktext('check_none', 'atk') . '</a> <a href="javascript:void(0)" onclick="profile_checkInvert(\'' . $this->getHtmlId($fieldprefix) . '\'); return false;">' . Tools::atktext('invert_selection', 'atk') . '</a>]</div>';
         }
         $result .= '<div>';
         for ($i = 0; $i < $total_records; ++$i) {
             $detailLink = '';
             $sel = '';
             $onchange = '';
             $inputId = $this->getHtmlId($fieldprefix) . '_' . $i;
             if (in_array($this->m_destInstance->primaryKey($recordset[$i]), $selectedPk)) {
                 $sel = 'checked';
                 if ($this->getShowDetailsLink() && !$this->m_linkInstance->hasFlag(Node::NF_NO_EDIT) && $this->m_linkInstance->allowed('edit')) {
                     $localPkAttr = $this->getOwnerInstance()->getAttribute($this->getOwnerInstance()->primaryKeyField());
                     $localValue = $localPkAttr->value2db($record);
                     $remotePkAttr = $this->getDestination()->getAttribute($this->getDestination()->primaryKeyField());
                     $remoteValue = $remotePkAttr->value2db($recordset[$i]);
                     $selector = $this->m_linkInstance->m_table . '.' . $this->getLocalKey() . '=' . $localValue . '' . ' AND ' . $this->m_linkInstance->m_table . '.' . $this->getRemoteKey() . "='" . $remoteValue . "'";
                     $detailLink = Tools::href(Tools::dispatch_url($this->m_link, 'edit', array('atkselector' => $selector)), '[' . Tools::atktext('edit', 'atk') . ']', SessionManager::SESSION_NESTED, true);
                 }
             }
             if (count($this->m_onchangecode)) {
                 $onchange = ' onChange="' . $inputId . '_onChange(this);"';
                 $this->_renderChangeHandler($fieldprefix, '_' . $i);
             }
             $value = $recordset[$i][$this->m_destInstance->primaryKeyField()];
             $css = $this->getCSSClassAttribute('atkcheckbox');
             $label = $this->m_destInstance->descriptor($recordset[$i]);
             $result .= '<div>';
             $result .= '  <input type="checkbox" id="' . $inputId . '" name="' . $this->getHtmlName($fieldprefix) . '[][' . $this->getRemoteKey() . ']" value="' . $value . '" ' . $css . ' ' . $sel . $onchange . ' />';
             $result .= '  <label for="' . $inputId . '">' . $label . '</label>';
             if ($detailLink != '') {
                 $result .= ' ' . $detailLink;
             }
             $result .= '</div>';
         }
         $result .= '</div>';
     } else {
         $nodename = $this->m_destInstance->m_type;
         $modulename = $this->m_destInstance->m_module;
         $result .= Tools::atktext('select_none', $modulename, $nodename) . ' ';
     }
     if ($this->hasFlag(self::AF_MANYBOOL_AUTOLINK) && $this->m_destInstance->allowed('add')) {
         $result .= Tools::href(Tools::dispatch_url($this->m_destination, 'add'), $this->getAddLabel(), SessionManager::SESSION_NESTED) . "\n";
     }
     return $result;
 }
开发者ID:sintattica,项目名称:atk,代码行数:68,代码来源:ManyBoolRelation.php

示例7: getRecordlistData


//.........这里部分代码省略.........
     $sortcols = [];
     $sortstart = '';
     $sortend = '';
     if ($grid->hasFlag(DataGrid::EXTENDED_SORT)) {
         $call = htmlentities($grid->getUpdateCall(array('atkstartat' => 0), [], 'ATK.DataGrid.extractExtendedSortOverrides'));
         $button = '<input type="button" value="' . Tools::atktext('sort') . '" onclick="' . $call . '">';
         if (!$edit && ($hasMRA || $grid->hasFlag(DataGrid::MULTI_RECORD_PRIORITY_ACTIONS))) {
             $sortcols[] = array('content' => '');
             // Empty leader on top of mra action list.
         }
         if ($orientation == 'left' || $orientation == 'both') {
             $sortcols[] = array('content' => $button);
         }
         foreach (array_keys($list['heading']) as $key) {
             if (isset($list['sort'][$key])) {
                 $sortcols[] = array('content' => $list['sort'][$key]);
             }
         }
         if ($orientation == 'right' || $orientation == 'both') {
             $sortcols[] = array('content' => $button);
         }
     }
     /*         * *********** */
     /* SEARCH ROW */
     /*         * *********** */
     $searchcols = [];
     $searchstart = '';
     $searchend = '';
     if ($hasSearch) {
         $call = htmlentities($grid->getUpdateCall(array('atkstartat' => 0), [], 'ATK.DataGrid.extractSearchOverrides'));
         $buttonType = $grid->isEmbedded() ? 'button' : 'submit';
         $button = '<input type="' . $buttonType . '" class="btn btn-default btn_search" value="' . Tools::atktext('search') . '" onclick="' . $call . ' return false;">';
         if ($grid->hasFlag(DataGrid::EXTENDED_SEARCH)) {
             $button .= ' ' . Tools::href(Config::getGlobal('dispatcher') . '?atknodeuri=' . $grid->getActionNode()->atkNodeUri() . '&atkaction=' . $grid->getActionNode()->getExtendedSearchAction(), '(' . Tools::atktext('search_extended') . ')', SessionManager::SESSION_NESTED);
         }
         $button = '<div class="search-buttons">' . $button . '</div>';
         // $searchstart = '<a name="searchform"></a>';
         $searchstart = '';
         if (!$edit && ($hasMRA || $grid->hasFlag(DataGrid::MULTI_RECORD_PRIORITY_ACTIONS))) {
             $searchcols[] = array('content' => '');
         }
         if ($orientation == 'left' || $orientation == 'both') {
             $searchcols[] = array('content' => $button);
         }
         foreach (array_keys($list['heading']) as $key) {
             if (isset($list['search'][$key])) {
                 $searchcols[] = array('content' => $list['search'][$key]);
             } else {
                 $searchcols[] = array('content' => '');
             }
         }
         if ($orientation == 'right' || $orientation == 'both') {
             $searchcols[] = array('content' => $button);
         }
     }
     /*         * **************************************** */
     /* MULTI-RECORD-(PRIORITY-)ACTIONS FORM DATA */
     /*         * **************************************** */
     $liststart = '';
     $listend = '';
     if (!$edit && ($hasMRA || $grid->hasFlag(DataGrid::MULTI_RECORD_PRIORITY_ACTIONS))) {
         $page->register_script(Config::getGlobal('assets_url') . 'javascript/formselect.js');
         if ($hasMRA) {
             $liststart .= '<script language="javascript" type="text/javascript">var ' . $listName . ' = new Object();</script>';
         }
     }
开发者ID:sintattica,项目名称:atk,代码行数:67,代码来源:DataGridList.php

示例8: sortOrder

 /**
  * Sets the sortorder options for this attribute which is used in recordlists
  * and search actions.
  *
  * @param ColumnConfig $columnConfig The config that contains options for
  *                                   extended sorting and grouping to a
  *                                   recordlist.
  * @param string $fieldprefix The prefix of the attribute on HTML forms
  * @param DataGrid $grid The grid that this attribute lives on.
  *
  * @return string HTML
  */
 public function sortOrder($columnConfig, $fieldprefix = '', $grid = null)
 {
     $fieldname = $this->fieldName();
     $currentOrder = $columnConfig->getOrder($fieldname);
     $res = '';
     if ($currentOrder > 0) {
         $direction = $columnConfig->getSortDirection($this->fieldName()) == 'desc' ? 'asc' : 'desc';
         if ($grid == null) {
             $res = Tools::href(Config::getGlobal('dispatcher') . '?' . $columnConfig->getUrlCommand($fieldname, $direction), Tools::atktext('column_' . $direction)) . ' ';
         } else {
             $call = $grid->getUpdateCall($columnConfig->getUrlCommandParams($fieldname, $direction));
             $res = '<a href="javascript:void(0)" onclick="' . htmlentities($call) . '">' . $this->text('column_' . $direction) . '</a>';
         }
     }
     $res .= '<select class="form-control select-standard" name="atkcolcmd[][setorder][' . $fieldprefix . $fieldname . ']">';
     $res .= '<option value="">';
     for ($i = 1; $i < 6; ++$i) {
         $selected = $currentOrder == $i ? 'selected' : '';
         $res .= '<option value="' . $i . '" ' . $selected . '>' . $i;
     }
     $res .= '</select>';
     return $res;
 }
开发者ID:sintattica,项目名称:atk,代码行数:35,代码来源:Attribute.php

示例9: getViewActionLink

 /**
  * The default view link.
  *
  * @param array $record
  *
  * @return string
  */
 protected function getViewActionLink($record)
 {
     return Tools::href(Tools::dispatch_url($this->getDestination()->atkNodeUri(), 'view', array('atkselector' => $this->getDestination()->primaryKey($record))), $this->text('view'), SessionManager::SESSION_NESTED, true, 'class="atkmanytomanyselectrelation-link"');
 }
开发者ID:sintattica,项目名称:atk,代码行数:11,代码来源:ManyToManySelectRelation.php


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