本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
}
}