本文整理汇总了PHP中Resources::getTables方法的典型用法代码示例。如果您正苦于以下问题:PHP Resources::getTables方法的具体用法?PHP Resources::getTables怎么用?PHP Resources::getTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resources
的用法示例。
在下文中一共展示了Resources::getTables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initQuery
function initQuery($params)
{
$tables = Resources::getTables();
$rltable = $tables['resource_labels']['columns'];
$this->addSelectField($rltable['id'], 'id');
$this->addSelectField($rltable['res_prefix'], 'prefix');
$this->addSelectField($rltable['res_label'], 'label');
$this->addSelectField($rltable['res_text'], 'def_value');
$this->addSelectField('_ml_.value', 'value');
$this->setMultiLangAlias('_ml_', 'resource_labels', $rltable['res_text'], $rltable['id'], 'Resources', '', true, $params['lng']);
// filter conditions
$where = array();
if (isset($params['label'])) {
if (isset($params['label']['exactly']) && $params['label']['exactly'] == 'Y') {
$where[] = array($rltable['res_label'], DB_EQ, '\'' . $this->DBAddSlashes($params['label']['value']) . '\'');
} else {
$where[] = array($rltable['res_label'], DB_LIKE, '\'%' . str_replace('_', '\\_', $this->DBAddSlashes($params['label']['value'])) . '%\'');
}
}
if (isset($params['pattern'])) {
if (isset($params['pattern']['exactly']) && $params['pattern']['exactly'] == 'Y') {
$where[] = array('(', $rltable['res_text'], DB_EQ, '\'' . $this->DBAddSlashes($params['pattern']['value']) . '\'', DB_OR, '_ml_.value', DB_EQ, '\'' . $this->DBAddSlashes($params['pattern']['value']) . '\'', ')');
} else {
$where[] = array('(', $rltable['res_text'], DB_LIKE, '\'%' . str_replace('_', '\\_', $this->DBAddSlashes($params['pattern']['value'])) . '%\'', DB_OR, '_ml_.value', DB_LIKE, '\'%' . str_replace('_', '\\_', $this->DBAddSlashes($params['pattern']['value'])) . '%\'', ')');
}
}
if (isset($params['type'])) {
switch ($params['type']) {
case 'all':
break;
case 'storefront':
$where[] = array($rltable['res_prefix'], DB_EQ, '\'CZ\'');
break;
case 'storefront_cz':
$where[] = array($rltable['res_prefix'], DB_EQ, '\'CZ\'');
$where[] = array($rltable['res_label'], DB_NLIKE, '\'CUSTOM\\_%\'');
break;
case 'admin':
$where[] = array($rltable['res_prefix'], DB_NEQ, '\'CZ\'');
break;
case 'CZ_CUSTOM':
$where[] = array($rltable['res_prefix'], DB_EQ, '\'CZ\'');
$where[] = array($rltable['res_label'], DB_LIKE, '\'CUSTOM\\_%\'');
break;
default:
$where[] = array($rltable['res_prefix'], DB_EQ, '\'' . $params['type'] . '\'');
break;
}
}
if (isset($params['status'])) {
if ($params['status'] == 'translated') {
$where[] = array('_ml_.ml_id', DB_NNULL);
} elseif ($params['status'] == 'nontranslated') {
$where[] = array('_ml_.ml_id', DB_IS_NULL);
}
}
if (isset($params['label_id'])) {
$where[] = array($rltable['id'], DB_EQ, '\'' . $params['label_id'] . '\'');
}
// building the where condition
if (!empty($where)) {
foreach ($where as $k => $v) {
if ($k != 0) {
array_push($this->WhereList, DB_AND);
}
foreach ($v as $vv) {
array_push($this->WhereList, $vv);
}
}
}
$this->SelectOrder($rltable['res_label']);
if (isset($params['paginator']) && is_array($params['paginator'])) {
list($offset, $count) = $params['paginator'];
$this->SelectLimit($offset, $count);
} elseif (isset($params['limit']) && is_array($params['limit'])) {
list($offset, $count) = $params['limit'];
$this->SelectLimit($offset, $count);
}
}
示例2: addLabelsArrayToDB
function addLabelsArrayToDB($data, $prefix)
{
global $application;
if (empty($data)) {
return false;
}
loadCoreFile('db_multiple_insert.php');
$tables = Resources::getTables();
$table = "resource_labels";
$columns = $tables[$table]['columns'];
$fields = array($columns['res_prefix'], $columns['res_label'], $columns['res_text']);
$query = new DB_Multiple_Insert($table);
$query->setInsertFields($fields);
foreach ($data as $key => $value) {
$params = array($columns['res_prefix'] => $prefix, $columns['res_label'] => $key, $columns['res_text'] => $value);
$query->addInsertValuesArray($params);
}
$application->db->PrepareSQL($query);
$application->db->DB_Exec();
return true;
}
示例3: initQuery
function initQuery($params)
{
$tables = Resources::getTables();
$p = $tables['resource_labels']['columns'];
$this->addSelectField($p['res_prefix'], 'res_prefix');
$this->addSelectField($p['res_label'], 'res_label');
$this->setMultiLangAlias('_ml', 'resource_labels', $p['res_text'], $p['id'], 'Resources', 0, true, $params['res_lng']);
$this->addSelectField($this->getMultiLangAlias('_ml'), 'res_text');
$this->WhereValue($p['res_prefix'], DB_EQ, $params['prefix']);
$this->WhereAnd();
$this->WhereValue($p['res_label'], DB_EQ, $params['label']);
}