當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tools::atk_array_merge方法代碼示例

本文整理匯總了PHP中Sintattica\Atk\Core\Tools::atk_array_merge方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tools::atk_array_merge方法的具體用法?PHP Tools::atk_array_merge怎麽用?PHP Tools::atk_array_merge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sintattica\Atk\Core\Tools的用法示例。


在下文中一共展示了Tools::atk_array_merge方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: search

 public function search($record, $extended = false, $fieldprefix = '', DataGrid $grid = null)
 {
     $this->createDestination();
     if ($this->m_destinationFilter != '') {
         $sp = new StringParser($this->m_destinationFilter);
         $this->m_destInstance->addFilter($sp->parse($record));
     }
     $recordset = $this->m_destInstance->select()->includes(Tools::atk_array_merge($this->m_destInstance->descriptorFields(), $this->m_destInstance->m_primaryKey))->getAllRows();
     $result = '<select class="form-control" name="atksearch[' . $this->fieldName() . ']">';
     $result .= '<option value="">' . Tools::atktext('search_all', 'atk');
     $result .= $this->createdd($recordset);
     $result .= '</select>';
     return $result;
 }
開發者ID:sintattica,項目名稱:atk,代碼行數:14,代碼來源:ManyToOneTreeRelation.php

示例2: getSelectableRecordsSelector

 public function getSelectableRecordsSelector($record = [], $mode = '')
 {
     $this->createDestination();
     $selector = $this->createFilter($record, $mode);
     $result = $this->m_destInstance->select($selector)->orderBy($this->getDestination()->getOrder())->includes(Tools::atk_array_merge($this->m_destInstance->descriptorFields(), $this->m_destInstance->m_primaryKey));
     return $result;
 }
開發者ID:sintattica,項目名稱:atk,代碼行數:7,代碼來源:ManyToOneRelation.php

示例3: addAllowedAction

 /**
  * Disable privilege checking for an action.
  *
  * This method disables privilege checks for the specified action, for the
  * duration of the current http request.
  *
  * @param string $action The name of the action for which security is
  *                       disabled.
  */
 public function addAllowedAction($action)
 {
     if (is_array($action)) {
         $this->m_unsecuredActions = Tools::atk_array_merge($this->m_unsecuredActions, $action);
     } else {
         $this->m_unsecuredActions[] = $action;
     }
 }
開發者ID:sintattica,項目名稱:atk,代碼行數:17,代碼來源:Node.php

示例4: search

 /**
  * Returns a piece of html code that can be used in a form to search.
  *
  * @param array $record Array with values
  * @param bool $extended if set to false, a simple search input is
  *                            returned for use in the searchbar of the
  *                            recordlist. If set to true, a more extended
  *                            search may be returned for the 'extended'
  *                            search page. The Attribute does not
  *                            make a difference for $extended is true, but
  *                            derived attributes may reimplement this.
  * @param string $fieldprefix The fieldprefix of this attribute's HTML element.
  * @param DataGrid $grid
  *
  * @return string Piece of html code
  */
 public function search($record, $extended = false, $fieldprefix = '', DataGrid $grid = null)
 {
     $this->createDestination();
     $id = $this->getHtmlId($fieldprefix);
     $name = $this->getSearchFieldName($fieldprefix);
     $selectOptions = [];
     $selectOptions['enable-select2'] = true;
     $selectOptions['dropdown-auto-width'] = true;
     $selectOptions['minimum-results-for-search'] = 10;
     if ($extended) {
         $selectOptions['placeholder'] = Tools::atktext('search_all');
     }
     //width always auto
     $selectOptions['width'] = 'auto';
     $selectOptions = array_merge($selectOptions, $this->m_select2Options['search']);
     $data = '';
     foreach ($selectOptions as $k => $v) {
         $data .= ' data-' . $k . '="' . htmlspecialchars($v) . '"';
     }
     // now select all records
     $recordset = $this->m_destInstance->select()->includes(Tools::atk_array_merge($this->m_destInstance->descriptorFields(), $this->m_destInstance->m_primaryKey))->getAllRows();
     $result = '<select class="form-control"' . $data;
     if ($extended) {
         $result .= 'multiple="multiple" size="' . min(5, count($recordset) + 1) . '"';
     }
     $result .= 'id="' . $id . '" name="' . $name . '[]">';
     $pkfield = $this->m_destInstance->primaryKeyField();
     if (!$extended) {
         $result .= '<option value="">' . Tools::atktext('search_all', 'atk') . '</option>';
     }
     for ($i = 0; $i < count($recordset); ++$i) {
         $pk = $recordset[$i][$pkfield];
         if (!empty($record[$this->fieldName()]) && Tools::atk_in_array($pk, $record[$this->fieldName()])) {
             $sel = ' selected="selected"';
         } else {
             $sel = '';
         }
         $result .= '<option value="' . $pk . '"' . $sel . '>' . $this->m_destInstance->descriptor($recordset[$i]) . '</option>';
     }
     $result .= '</select>';
     $result .= "<script>ATK.enableSelect2ForSelect('#{$id}');</script>";
     return $result;
 }
開發者ID:sintattica,項目名稱:atk,代碼行數:59,代碼來源:ManyToManyRelation.php

示例5: addToQuery

 public function addToQuery($query, $tablename = '', $fieldaliasprefix = '', &$record, $level = 0, $mode = '')
 {
     if ($mode !== 'add' && $mode != 'edit') {
         $allfields = Tools::atk_array_merge($this->m_displayfields, $this->m_searchfields);
         $alias = $fieldaliasprefix . $this->fieldName() . '_AE_';
         foreach ($allfields as $field) {
             /** @var Attribute $p_attrib */
             $p_attrib = $this->m_ownerInstance->m_attribList[$field];
             $p_attrib->addToQuery($query, $tablename, $alias, $record, $level, $mode);
         }
     }
 }
開發者ID:sintattica,項目名稱:atk,代碼行數:12,代碼來源:AggregatedColumn.php


注:本文中的Sintattica\Atk\Core\Tools::atk_array_merge方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。