本文整理汇总了PHP中Sintattica\Atk\Core\Tools::atk_value_in_array方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::atk_value_in_array方法的具体用法?PHP Tools::atk_value_in_array怎么用?PHP Tools::atk_value_in_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sintattica\Atk\Core\Tools
的用法示例。
在下文中一共展示了Tools::atk_value_in_array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getErrors
/**
* Transforms the $importerrors array into displayable HTML.
*
* @todo make this use templates
*
* @param array $importerrors A special array with arrays in it
* $importerrors[0] are general errors, other than that
* the numbers stand for recordnumbers
*
* @return string HTML table with the errors
*/
public function _getErrors($importerrors)
{
if (is_array($importerrors)) {
$content = "\n<table>";
$errorCount = 0;
foreach ($importerrors as $record => $errors) {
++$errorCount;
if ($errorCount > Config::getGlobal('showmaximporterrors', 50)) {
break;
}
if ($record == 0 && Tools::atk_value_in_array($errors)) {
$content .= '<tr><td colSpan=2>';
foreach ($errors as $error) {
if (!empty($error)) {
$content .= '<span class="error">' . Tools::atktext($error['msg']) . $error['spec'] . '</span><br />';
}
}
$content .= '</td></tr>';
} else {
if (Tools::atk_value_in_array($errors)) {
$content .= '<tr><td valign="top" class="error">';
$content .= "<b>Record {$record}:</b> ";
$content .= '</td><td valign="top" class="error">';
$counter = 0;
for ($counter = 0; $counter < count($errors) && $counter < Config::getGlobal('showmaximporterrors', 50); ++$counter) {
$content .= $this->m_node->text($errors[$counter]['msg']) . $errors[$counter]['spec'] . '<br />';
}
$content .= '</td></tr>';
}
}
}
$content .= '</tr></table><br />';
}
return $content;
}
示例2: 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;
}
示例3: noCaching
/**
* Wether or not to use caching
* We don't cache when we are ordering or searching on a recordlist.
*
* @return bool Wether or not to use caching
*/
public function noCaching()
{
return $this->m_postvars['atkorderby'] || $this->m_postvars['atksearch'] && Tools::atk_value_in_array($this->m_postvars['atksearch']) || $this->m_postvars['atksmartsearch'] && Tools::atk_value_in_array($this->m_postvars['atksmartsearch']);
}