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


PHP Tools::getUniqueId方法代码示例

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


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

示例1: createTplField

 /**
  * Create template field array for the given edit field.
  *
  * @param array $fields all fields
  * @param int $index field index
  * @param string $mode mode (add/edit)
  * @param string $tab active tab
  *
  * @return array template field
  */
 public function createTplField(&$fields, $index, $mode, $tab)
 {
     $field =& $fields[$index];
     // visible sections, both the active sections and the tab names (attribute that are
     // part of the anonymous section of the tab)
     $visibleSections = array_merge($this->m_node->getActiveSections($tab, $mode), $this->m_node->getTabs($mode));
     $tplfield = [];
     $classes = [];
     if (isset($field['class'])) {
         $classes = is_array($field['class']) ? $field['class'] : explode(' ', $field['class']);
     }
     if ($field['sections'] == '*') {
         $classes[] = 'alltabs';
     } else {
         if (isset($field['html']) && $field['html'] == 'section') {
             // section should only have the tab section classes
             foreach ($field['tabs'] as $section) {
                 $classes[] = 'section_' . str_replace('.', '_', $section);
             }
             if ($this->isSectionInitialHidden($field['name'], $fields)) {
                 $classes[] = 'atkAttrRowHidden';
             }
         } else {
             if (is_array($field['sections'])) {
                 foreach ($field['sections'] as $section) {
                     $classes[] = 'section_' . str_replace('.', '_', $section);
                 }
             }
         }
     }
     if (isset($field['initial_hidden']) && $field['initial_hidden']) {
         $classes[] = 'atkAttrRowHidden';
     }
     $tplfield['class'] = implode(' ', $classes);
     $tplfield['tab'] = $tplfield['class'];
     // for backwards compatibility
     // Todo fixme: initial_on_tab kan er uit, als er gewoon bij het opstarten al 1 keer showTab aangeroepen wordt (is netter dan aparte initial_on_tab check)
     // maar, let op, die showTab kan pas worden aangeroepen aan het begin.
     $tplfield['initial_on_tab'] = ($field['tabs'] == '*' || in_array($tab, $field['tabs'])) && (!is_array($field['sections']) || count(array_intersect($field['sections'], $visibleSections)) > 0);
     // ar_ stands for 'attribrow'.
     $tplfield['rowid'] = 'ar_' . (!empty($field['id']) ? $field['id'] : Tools::getUniqueId('anonymousattribrows'));
     // The id of the containing row
     // check for separator
     if (isset($field['html']) && $field['html'] == '-' && $index > 0 && $fields[$index - 1]['html'] != '-') {
         $tplfield['type'] = 'line';
         $tplfield['line'] = '<hr>';
     } elseif (isset($field['html']) && $field['html'] == '-') {
     } elseif (isset($field['html']) && $field['html'] == 'section') {
         $tplfield['type'] = 'section';
         list($tab, $section) = explode('.', $field['name']);
         $tplfield['section_name'] = "section_{$tab}_{$section}";
         $tplfield['line'] = $this->getSectionControl($field, $mode);
     } elseif (isset($field['line'])) {
         $tplfield['type'] = 'custom';
         $tplfield['line'] = $field['line'];
     } else {
         $tplfield['type'] = 'attribute';
         if ($field['attribute']->m_ownerInstance->getNumbering()) {
             $this->_addNumbering($field, $tplfield, $index);
         }
         /* does the field have a label? */
         if (isset($field['label']) && $field['label'] !== 'AF_NO_LABEL' || !isset($field['label'])) {
             if (!isset($field['label']) || empty($field['label'])) {
                 $tplfield['label'] = '';
             } else {
                 $tplfield['label'] = $field['label'];
                 if ($field['error']) {
                     // TODO KEES
                     $tplfield['error'] = $field['error'];
                 }
             }
         } else {
             $tplfield['label'] = 'AF_NO_LABEL';
         }
         /* obligatory indicator */
         if ($field['obligatory']) {
             $tplfield['obligatory'] = true;
         }
         // Make the attribute and node names available in the template.
         $tplfield['attribute'] = $field['attribute']->fieldName();
         $tplfield['node'] = $field['attribute']->m_ownerInstance->atkNodeUri();
         /* html source */
         $tplfield['widget'] = $field['html'];
         $editsrc = $field['html'];
         $tplfield['id'] = str_replace('.', '_', $this->m_node->atkNodeUri() . '_' . $field['id']);
         $tplfield['htmlid'] = $field['id'];
         $tplfield['full'] = $editsrc;
         $column = $field['attribute']->getColumn();
         $tplfield['column'] = $column;
         $tplfield['readonly'] = $field['attribute']->isReadonlyEdit($mode);
//.........这里部分代码省略.........
开发者ID:sintattica,项目名称:atk,代码行数:101,代码来源:EditHandler.php

示例2: display

 /**
  * Display a tabbed pane with attributes.
  *
  * @param array $record Array with fields
  * @param string $mode The mode
  *
  * @return string html code
  */
 public function display($record, $mode)
 {
     // get active tab
     $active_tab = $this->getDefaultTab();
     $fields = [];
     $tab = '';
     $node = $this->m_ownerInstance;
     $ui = $node->getUi();
     // For all attributes we use the display() function to display the
     // attributes current value. This may be overridden by supplying
     // an <attributename>_display function in the derived classes.
     foreach ($this->m_attribsList as $name => $tab) {
         $p_attrib = $node->getAttribute($name);
         if (is_object($p_attrib)) {
             $tplfield = [];
             if (!$p_attrib->hasFlag(self::AF_HIDE_VIEW)) {
                 $fieldtab = $this->m_attribsList[$name];
                 $tplfield['class'] = "tabbedPaneAttr tabbedPaneTab{$fieldtab}";
                 $tplfield['rowid'] = 'tabbedPaneAttr_' . Tools::getUniqueId('anonymousattribrows');
                 // The id of the containing row
                 $tplfield['tab'] = $tplfield['class'];
                 // for backwards compatibility
                 $tplfield['initial_on_tab'] = $fieldtab == $active_tab;
                 // An <attributename>_display function may be provided in a derived
                 // class to display an attribute. If it exists we will use that method
                 // else we will just use the attribute's display method.
                 $funcname = $p_attrib->m_name . '_display';
                 if (method_exists($node, $funcname)) {
                     $editsrc = $node->{$funcname}($record, 'view');
                 } else {
                     $editsrc = $p_attrib->display($record, 'view');
                 }
                 $tplfield['full'] = $editsrc;
                 $tplfield['widget'] = $editsrc;
                 // in view mode, widget and full are equal
                 // The Label of the attribute (can be suppressed with self::AF_NOLABEL or self::AF_BLANKLABEL)
                 // For each attribute, a txt_<attributename> must be provided in the language files.
                 if (!$p_attrib->hasFlag(self::AF_NOLABEL) && !$this->isAttributeSingleOnTab($name)) {
                     if ($p_attrib->hasFlag(self::AF_BLANKLABEL)) {
                         $tplfield['label'] = '';
                     } else {
                         $tplfield['label'] = $p_attrib->label();
                     }
                 } else {
                     // Make the rest fill up the entire line
                     $tplfield['label'] = '';
                     $tplfield['line'] = $tplfield['full'];
                 }
                 $fields[] = $tplfield;
             }
         } else {
             Tools::atkerror("Attribute {$name} not found!");
         }
     }
     $innerform = $ui->render($node->getTemplate('view', $record, $tab), array('fields' => $fields));
     return $this->tabulate('view', $innerform);
 }
开发者ID:sintattica,项目名称:atk,代码行数:65,代码来源:TabbedPane.php

示例3: viewForm

 /**
  * Get the view page.
  *
  * @param array $record The record
  * @param string $mode The mode we're in (defaults to "view")
  * @param string $template The template to use for the view form
  *
  * @return string HTML code of the page
  */
 public function viewForm($record, $mode = 'view', $template = '')
 {
     $node = $this->m_node;
     // get data, transform into form, return
     $data = $node->viewArray($mode, $record);
     // get active tab
     $tab = $node->getActiveTab();
     // get all tabs of current mode
     $tabs = $node->getTabs($mode);
     $fields = [];
     $attributes = [];
     // For all attributes we use the display() function to display the
     // attributes current value. This may be overridden by supplying
     // an <attributename>_display function in the derived classes.
     for ($i = 0, $_i = count($data['fields']); $i < $_i; ++$i) {
         $field =& $data['fields'][$i];
         $tplfield = [];
         $classes = [];
         if ($field['sections'] == '*') {
             $classes[] = 'alltabs';
         } else {
             if ($field['html'] == 'section') {
                 // section should only have the tab section classes
                 foreach ($field['tabs'] as $section) {
                     $classes[] = 'section_' . str_replace('.', '_', $section);
                 }
             } else {
                 if (is_array($field['sections'])) {
                     foreach ($field['sections'] as $section) {
                         $classes[] = 'section_' . str_replace('.', '_', $section);
                     }
                 }
             }
         }
         $tplfield['class'] = implode(' ', $classes);
         $tplfield['tab'] = $tplfield['class'];
         // for backwards compatibility
         // visible sections, both the active sections and the tab names (attribute that are
         // part of the anonymous section of the tab)
         $visibleSections = array_merge($this->m_node->getActiveSections($tab, $mode), $tabs);
         // Todo fixme: initial_on_tab kan er uit, als er gewoon bij het opstarten al 1 keer showTab aangeroepen wordt (is netter dan aparte initial_on_tab check)
         // maar, let op, die showTab kan pas worden aangeroepen aan het begin.
         $tplfield['initial_on_tab'] = ($field['tabs'] == '*' || in_array($tab, $field['tabs'])) && (!is_array($field['sections']) || count(array_intersect($field['sections'], $visibleSections)) > 0);
         // Give the row an id if it doesn't have one yet
         if (!isset($field['id']) || empty($field['id'])) {
             $field['id'] = Tools::getUniqueId('anonymousattribrows');
         }
         // ar_ stands voor 'attribrow'.
         $tplfield['rowid'] = 'ar_' . $field['id'];
         // The id of the containing row
         /* check for separator */
         if ($field['html'] == '-' && $i > 0 && $data['fields'][$i - 1]['html'] != '-') {
             $tplfield['line'] = '<hr>';
         } elseif ($field['html'] == '-') {
         } elseif ($field['html'] == 'section') {
             $tplfield['line'] = $this->getSectionControl($field, $mode);
         } elseif (isset($field['line'])) {
             $tplfield['line'] = $field['line'];
         } else {
             if ($field['attribute']->m_ownerInstance->getNumbering()) {
                 $this->_addNumbering($field, $tplfield, $i);
             }
             /* does the field have a label? */
             if (isset($field['label']) && $field['label'] !== 'AF_NO_LABEL' || !isset($field['label'])) {
                 if ($field['label'] == '') {
                     $tplfield['label'] = '';
                 } else {
                     $tplfield['label'] = $field['label'];
                 }
             } else {
                 $tplfield['label'] = 'AF_NO_LABEL';
             }
             // Make the attribute and node names available in the template.
             $tplfield['attribute'] = $field['attribute']->fieldName();
             $tplfield['node'] = $field['attribute']->m_ownerInstance->atkNodeUri();
             /* html source */
             $tplfield['widget'] = $field['html'];
             $editsrc = $field['html'];
             $tplfield['id'] = str_replace('.', '_', $node->atkNodeUri() . '_' . $field['id']);
             $tplfield['full'] = $editsrc;
             $column = $field['attribute']->getColumn();
             $tplfield['column'] = $column;
         }
         $fields[] = $tplfield;
         // make field available in numeric array
         $params[$field['name']] = $tplfield;
         // make field available in associative array
         $attributes[$field['name']] = $tplfield;
         // make field available in associative array
     }
     $ui = $this->getUi();
//.........这里部分代码省略.........
开发者ID:sintattica,项目名称:atk,代码行数:101,代码来源:ViewHandler.php

示例4: getCache

 /**
  * Gets the cache of the recordlist and registers the appropriate javascript.
  *
  * @return string The cached recordlist
  */
 public function getCache()
 {
     $output = false;
     $this->_setCacheId();
     if (file_exists($this->m_cacheid) && filesize($this->m_cacheid) && !$this->noCaching()) {
         $page = Page::getInstance();
         $page->register_script(Config::getGlobal('assets_url') . 'javascript/formselect.js');
         $page->register_script(Config::getGlobal('assets_url') . 'javascript/recordlist.js');
         /*
          * RecordlistCache must call Tools::getUniqueId() too, or the counter will be off.
          */
         Tools::getUniqueId('normalRecordList');
         $sm = SessionManager::getInstance();
         $stackID = $sm->atkStackID();
         $page->register_loadscript(str_replace('*|REPLACESTACKID|*', $stackID, file_get_contents($this->m_cacheid . '_actionloader')));
         $output = str_replace('*|REPLACESTACKID|*', $stackID, file_get_contents($this->m_cacheid));
     }
     return $output;
 }
开发者ID:sintattica,项目名称:atk,代码行数:24,代码来源:RecordListCache.php


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