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


PHP Tools::dispatch_url方法代码示例

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


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

示例1: redirectToResults

 /**
  * Redirect to search results based on the given criteria.
  */
 public function redirectToResults()
 {
     $sm = SessionManager::getInstance();
     $url = Tools::dispatch_url($this->getPreviousNode(), $this->getPreviousAction(), $this->fetchCriteria());
     $url = $sm->sessionUrl($url, $sm->atkLevel() > 0 ? SessionManager::SESSION_BACK : SessionManager::SESSION_REPLACE);
     $this->m_node->redirect($url);
 }
开发者ID:sintattica,项目名称:atk,代码行数:10,代码来源:SearchHandler.php

示例2: action_editcopy

 /**
  * The action method.
  */
 public function action_editcopy()
 {
     Tools::atkdebug('node::action_editcopy()');
     $record = $this->getCopyRecord();
     // allowed to editcopy record?
     if (!$this->allowed($record)) {
         $this->renderAccessDeniedPage();
         return;
     }
     $db = $this->m_node->getDb();
     if (!$this->m_node->copyDb($record)) {
         $db->rollback();
         $location = $this->m_node->feedbackUrl('editcopy', self::ACTION_FAILED, $record, $db->getErrorMsg());
         $this->m_node->redirect($location);
     } else {
         $db->commit();
         $this->clearCache();
         $sm = SessionManager::getInstance();
         $location = $sm->sessionUrl(Tools::dispatch_url($this->m_node->atkNodeUri(), 'edit', array('atkselector' => $this->m_node->primaryKey($record))), SessionManager::SESSION_REPLACE);
         $this->m_node->redirect($location);
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:25,代码来源:EditCopyHandler.php

示例3: getExportLink

 /**
  * Get the exportlink to add to the admin header.
  *
  * @return string HTML code with link to the export action of the node (if allowed)
  */
 public function getExportLink()
 {
     $link = '';
     if ($this->m_node->allowed('view') && $this->m_node->allowed('export') && $this->m_node->hasFlag(Node::NF_EXPORT)) {
         $filter = '';
         if (count($this->m_node->m_fuzzyFilters) > 0) {
             $filter = implode(' AND ', str_replace('[table]', $this->m_node->getTable(), $this->m_node->m_fuzzyFilters));
         }
         $link .= Tools::href(Tools::dispatch_url($this->m_node->atkNodeUri(), 'export', array('atkfilter' => $filter)), Tools::atktext('export', 'atk', $this->m_node->m_type), SessionManager::SESSION_NESTED);
     }
     return $link;
 }
开发者ID:sintattica,项目名称:atk,代码行数:17,代码来源:AdminHandler.php

示例4: doProcess

 /**
  * This function checks if there is enough information to export the date
  * else it wil shows a form to set how the file wil be exported.
  */
 public function doProcess()
 {
     // Update selection
     if (array_key_exists('exportvalue', $this->m_postvars) && array_key_exists('save_export', $this->m_postvars) && '' != $this->m_postvars['export_selection_name']) {
         $this->updateSelection();
         $this->getNode()->redirect(Tools::dispatch_url($this->getNode(), 'export'));
     }
     // Save selection
     if (array_key_exists('export_selection_options', $this->m_postvars) && array_key_exists('export_selection_name', $this->m_postvars) && 'none' == $this->m_postvars['export_selection_options'] && '' != $this->m_postvars['export_selection_name']) {
         $this->saveSelection();
     }
     // Export CVS
     if (!array_key_exists('save_export', $this->m_postvars)) {
         return $this->doExport();
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:20,代码来源:ExportHandler.php

示例5: getForgetCriteria

 /**
  * Returns a link for removing the currently selected criteria. If
  * nothing (valid) is selected nothing is returned.
  *
  * @param string $current currently loaded criteria
  *
  * @return string forget url
  */
 public function getForgetCriteria($current)
 {
     if (empty($current) || $this->loadCriteria($current) == null) {
         return;
     } else {
         $sm = SessionManager::getInstance();
         return $sm->sessionUrl(Tools::dispatch_url($this->m_node->atkNodeUri(), $this->m_action, array('forget_criteria' => $current)), SessionManager::SESSION_REPLACE);
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:17,代码来源:AbstractSearchHandler.php

示例6: getAddURL

 protected function getAddURL($params = array())
 {
     return Tools::dispatch_url($this->m_destination, 'add', $params);
 }
开发者ID:sintattica,项目名称:atk,代码行数:4,代码来源:OneToManyRelation.php

示例7: 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

示例8: 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

示例9: getSaveCall

 /**
  * Returns a JavaScript call to save the current grid's contents when in edit mode.
  *
  * @return string JavaScript call (might need escaping when used in HTML code)
  */
 public function getSaveCall()
 {
     $sm = SessionManager::getInstance();
     $url = $sm->sessionUrl(Tools::dispatch_url($this->getNode()->atkNodeUri(), 'multiupdate', array('output' => 'json')), SessionManager::SESSION_PARTIAL);
     return 'ATK.DataGrid.save(' . Json::encode($this->getName()) . ', ' . Json::encode($url) . ');';
 }
开发者ID:sintattica,项目名称:atk,代码行数:11,代码来源:DataGrid.php

示例10: feedbackUrl

 /**
  * Determine the url for the feedbackpage.
  *
  * Output is dependent on the feedback configuration. If feedback is not
  * enabled for the action, this method returns an empty string, so the
  * result of this method can be passed directly to the redirect() method
  * after completing the action.
  *
  * The $record parameter is ignored by the default implementation, but
  * derived classes may override this method to perform record-specific
  * feedback.
  *
  * @param string $action The action that was performed
  * @param int $status The status of the action.
  * @param array $record The record on which the action was performed.
  * @param string $message An optional message to pass to the feedbackpage,
  *                          for example to explain the reason why an action
  *                          failed.
  * @param int $levelskip Number of levels to skip
  *
  * @return string The feedback url.
  */
 public function feedbackUrl($action, $status, $record = [], $message = '', $levelskip = null)
 {
     $sm = SessionManager::getInstance();
     $vars = [];
     $atkNodeUri = '';
     $sessionStatus = SessionManager::SESSION_BACK;
     if (isset($this->m_feedback[$action]) && Tools::hasFlag($this->m_feedback[$action], $status) || $status == ActionHandler::ACTION_FAILED) {
         $vars = array('atkaction' => 'feedback', 'atkfbaction' => $action, 'atkactionstatus' => $status, 'atkfbmessage' => $message);
         $atkNodeUri = $this->atkNodeUri();
         $sessionStatus = SessionManager::SESSION_REPLACE;
         // The level skip given is based on where we should end up after the
         // feedback action is shown to the user. This means that the feedback
         // action should be shown one level higher in the stack, hence the -1.
         // Default the feedback action is shown on the current level, so in that
         // case we have a simple SessionManager::SESSION_REPLACE with a level skip of null.
         $levelskip = $levelskip == null ? null : $levelskip - 1;
     }
     $dispatch_url = Tools::dispatch_url($atkNodeUri, Tools::atkArrayNvl($vars, 'atkaction', ''), $vars);
     return $sm->sessionUrl($dispatch_url, $sessionStatus, $levelskip);
 }
开发者ID:sintattica,项目名称:atk,代码行数:42,代码来源:Node.php

示例11: 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

示例12: smartSearchForm

 /**
  * This method returns a form that the user can use to search records.
  *
  * @param string $name
  * @param array $criteria
  *
  * @return string The searchform in html form.
  */
 public function smartSearchForm($name = '', $criteria = array())
 {
     $ui = $this->getUi();
     $sm = SessionManager::getInstance();
     $params = [];
     $params['label'] = $this->getLabels();
     $params['reset_criteria'] = $this->getResetCriteria();
     // $params['load_criteria']        = $this->getLoadCriteria($name);
     // $params['forget_criteria']      = $this->getForgetCriteria($name);
     // $params['toggle_save_criteria'] = $this->getToggleSaveCriteria();
     // $params['save_criteria']        = $this->getSaveCriteria($name);
     $params['saved_criteria'] = $this->getSavedCriteria($name);
     $params['criteria'] = [];
     Tools::atkdebug('criteria smartSearchForm: ' . print_r($criteria, true));
     foreach ($criteria as $i => $criterium) {
         $params['criteria'][] = $this->getCriterium($i, $criterium);
     }
     $url = $sm->sessionUrl(Tools::dispatch_url($this->m_node->atkNodeUri(), 'smartsearch', array('atkpartial' => 'criterium')), SessionManager::SESSION_NEW);
     $params['action_add'] = "ATK.SmartSearchHandler.addCriterium('" . addslashes($url) . "')";
     return $ui->render($this->getTemplate('form'), $params);
 }
开发者ID:sintattica,项目名称:atk,代码行数:29,代码来源:SmartSearchHandler.php

示例13: recordActions

 /**
  * This function sets the actions of the items in the list.
  *
  * @param string $record Identifier for the record
  * @param array $actions Result array containing the options
  * @param mixed $mraactions
  */
 public function recordActions($record, &$actions, &$mraactions)
 {
     $this->m_dir = $this->stripDir($this->m_dir);
     if (is_dir($this->m_dir . '/' . $record['filename'])) {
         $actions['view'] = Tools::dispatch_url($this->atkNodeUri(), 'dirchange', array('atkselector' => $this->m_dir . $record['filename']));
         unset($actions['edit']);
         unset($actions['delete']);
         return;
     }
     // Remove edit/delete actions when a file is not writeable.
     if (!is_writeable($this->m_dir . '/' . $record['filename'])) {
         unset($actions['edit']);
         unset($actions['delete']);
     }
 }
开发者ID:sintattica,项目名称:atk,代码行数:22,代码来源:FileEditor.php

示例14: 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

示例15: handleUpdateSuccess

 /**
  * Handle update success. Normally redirects the user either back to the edit form
  * (when the user only saved) or back to the previous action if the user choose save
  * and close.
  *
  * This method can be overriden inside your node.
  *
  * @param array $record the record
  */
 public function handleUpdateSuccess($record)
 {
     if (isset($this->m_postvars['atknoclose'])) {
         // 'save' was clicked
         $params = array('atkselector' => $this->m_node->primaryKey($record), 'atktab' => $this->m_node->getActiveTab());
         $sm = SessionManager::getInstance();
         $location = $sm->sessionUrl(Tools::dispatch_url($this->m_node->atkNodeUri(), $this->getEditAction(), $params), SessionManager::SESSION_REPLACE, 1);
     } else {
         // 'save and close' was clicked
         $location = $this->m_node->feedbackUrl('update', self::ACTION_SUCCESS, $record, '', 2);
     }
     $this->m_node->redirect($location, $record);
 }
开发者ID:sintattica,项目名称:atk,代码行数:22,代码来源:UpdateHandler.php


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