本文整理汇总了PHP中iaLanguage::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP iaLanguage::getTable方法的具体用法?PHP iaLanguage::getTable怎么用?PHP iaLanguage::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iaLanguage
的用法示例。
在下文中一共展示了iaLanguage::getTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _assignValues
protected function _assignValues(&$iaView, array &$entryData)
{
if (isset($entryData['data'])) {
$entryData['data'] = unserialize($entryData['data']);
empty($entryData['data']['fields']) || ($entryData['data']['fields'] = array_reverse($entryData['data']['fields']));
} else {
$entryData['data'] = array();
}
// populating titles & descriptions
if (empty($_POST['title'])) {
$this->_iaDb->setTable(iaLanguage::getTable());
$stmt = "`key` = 'plan_title_" . $this->getEntryId() . "'";
$entryData['title'] = $this->_iaDb->keyvalue(array('code', 'value'), $stmt);
$stmt = "`key` = 'plan_description_" . $this->getEntryId() . "'";
$entryData['description'] = $this->_iaDb->keyvalue(array('code', 'value'), $stmt);
$this->_iaDb->resetTable();
} else {
list($entryData['title'], $entryData['description']) = array($_POST['title'], $_POST['description']);
}
//
$units = $this->_iaDb->getEnumValues($this->getTable(), 'unit');
$units = $units ? array_values($units['values']) : array();
$usergroups = $this->_iaCore->factory('users')->getUsergroups();
unset($usergroups[iaUsers::MEMBERSHIP_ADMINISTRATOR], $usergroups[iaUsers::MEMBERSHIP_GUEST]);
$iaView->assign('usergroups', $usergroups);
$iaView->assign('fields', $this->_fields);
$iaView->assign('items', $this->_items);
$iaView->assign('expiration_statuses', $this->_getItemsStatuses());
$iaView->assign('units', $units);
}
示例2: _getPages
private function _getPages()
{
$sql = 'SELECT DISTINCTROW p.*, IF(t.`value` is null, p.`name`, t.`value`) `title` ' . 'FROM `:prefixpages` p ' . 'LEFT JOIN `:prefix:table_language` t ' . "ON (`key` = CONCAT('page_title_', p.`name`) AND t.`code` = ':language') " . "WHERE p.`status` = ':status' AND p.`service` = 0 " . 'ORDER BY t.`value`';
$sql = iaDb::printf($sql, array('prefix' => $this->_iaDb->prefix, 'table_language' => iaLanguage::getTable(), 'language' => $this->_iaCore->iaView->language, 'status' => iaCore::STATUS_ACTIVE));
return $this->_iaDb->getAll($sql);
}
示例3: delete
public function delete($id, $log = true)
{
$iaDb =& $this->iaDb;
$row = $iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($id));
$title = self::LANG_PATTERN_TITLE . $id;
$title = iaLanguage::exists($title) ? iaLanguage::get($title) : $row['title'];
$this->iaCore->startHook('beforeBlockDelete', array('block' => &$row));
$result = parent::delete($id);
if ($result) {
$iaDb->delete('`object_type` = :object && `object` = :id', self::getPagesTable(), array('id' => $id, 'object' => 'blocks'));
$iaDb->delete('`key` = :title OR `key` = :content', iaLanguage::getTable(), array('title' => self::LANG_PATTERN_TITLE . $id, 'content' => self::LANG_PATTERN_CONTENT . $id));
if ($log) {
$this->iaCore->factory('log')->write(iaLog::ACTION_DELETE, array('item' => 'block', 'name' => $title, 'id' => $id));
}
}
$this->iaCore->startHook('afterBlockDelete', array('block' => &$row));
return $result;
}
示例4: _searchByPages
protected function _searchByPages()
{
$iaCore =& $this->iaCore;
$iaDb =& $this->iaDb;
$iaPage = $iaCore->factory('page', iaCore::FRONT);
$stmt = '`value` LIKE :query AND `category` = :category AND `code` = :language ORDER BY `key`';
$iaDb->bind($stmt, array('query' => '%' . iaSanitize::sql($this->_query) . '%', 'category' => iaLanguage::CATEGORY_PAGE, 'language' => $iaCore->iaView->language));
$result = array();
if ($rows = $iaDb->all(array('key', 'value'), $stmt, null, null, iaLanguage::getTable())) {
foreach ($rows as $row) {
$pageName = str_replace(array('page_title_', 'page_content_'), '', $row['key']);
$key = false === stripos($row['key'], 'page_content_') ? 'title' : 'content';
$value = iaSanitize::tags($row['value']);
isset($result[$pageName]) || ($result[$pageName] = array());
if ('content' == $key) {
$value = $this->_extractSnippet($value);
if (empty($result[$pageName]['title'])) {
$result[$pageName]['title'] = iaLanguage::get('page_title_' . $pageName);
}
}
$result[$pageName]['url'] = $iaPage->getUrlByName($pageName, false);
$result[$pageName][$key] = $value;
}
}
// blocks content will be printed out as a pages content
if ($blocks = $this->_searchByBlocks()) {
foreach ($blocks as $pageName => $blocksData) {
if (isset($result[$pageName])) {
$result[$pageName]['extraItems'] = $blocksData;
} else {
$result[$pageName] = array('url' => $iaPage->getUrlByName($pageName), 'title' => iaLanguage::get('page_title_' . $pageName), 'content' => '', 'extraItems' => $blocksData);
}
}
}
$count = count($result);
$html = $this->_render('search-list-pages' . iaView::TEMPLATE_FILENAME_EXT, array('pages' => $result));
return array($count, $html);
}
示例5: install
public function install()
{
$iaDb =& $this->iaDb;
$this->iaCore->startHook('phpExtrasInstallBefore', array('extra' => $this->itemData['name']));
$extrasList = array();
$array = $iaDb->all(array('id', 'name', 'version'), "`status` = 'active'", null, null, self::getTable());
foreach ($array as $item) {
$extrasList[$item['name']] = $item;
}
// TODO: check for relations and deactivate all needed extras
if ($this->itemData['requirements']) {
$messages = array();
foreach ($this->itemData['requirements'] as $requirement) {
if ($requirement['min'] || $requirement['max']) {
$min = $max = false;
if (isset($extrasList[$requirement['name']])) {
$info = $extrasList[$requirement['name']];
$min = $requirement['min'] ? version_compare($requirement['min'], $info['version'], '<=') : true;
$max = $requirement['max'] ? version_compare($requirement['max'], $info['version'], '>=') : true;
}
if (!$max || !$min) {
$ver = '';
if ($requirement['min']) {
$ver .= $requirement['min'];
}
if ($requirement['max']) {
if ($requirement['min']) {
$ver .= '-';
}
$ver .= $requirement['max'];
}
$values = array(':extra' => $requirement['type'], ':name' => $requirement['name'], ':version' => $ver);
$messages[] = iaLanguage::getf('required_extras_error', $values);
$this->error = true;
} else {
// TODO: add relations in database to deactivate when parent is uninstalled
}
}
}
if ($this->error) {
$this->setMessage(implode('<br />', $messages));
return false;
}
}
$this->uninstall($this->itemData['name']);
if (false !== stristr('update', $this->itemData['name'])) {
$this->isUpdate = true;
}
if ($this->itemData['groups']) {
$iaDb->setTable('admin_pages_groups');
$maxOrder = $iaDb->getMaxOrder();
foreach ($this->itemData['groups'] as $block) {
$iaDb->insert($block, array('order' => ++$maxOrder));
}
$iaDb->resetTable();
}
if ($this->itemData['pages']['admin']) {
$iaDb->setTable('admin_pages');
$order = (int) $iaDb->one('MAX(`order`)', "`menus` IN ('menu')");
$order = max($order, 1);
foreach ($this->itemData['pages']['admin'] as $page) {
if (is_null($page['order'])) {
$order += 5;
$page['order'] = $order;
}
if ($page['group']) {
$this->_menuGroups[] = $page['group'];
}
$page['group'] = $this->_lookupGroupId($page['group']);
$iaDb->insert($page);
}
$iaDb->resetTable();
}
if ($this->itemData['actions']) {
$iaDb->setTable('admin_actions');
foreach ($this->itemData['actions'] as $action) {
$action['name'] = strtolower(str_replace(' ', '_', $action['name']));
if ($action['name'] && !$iaDb->exists('`name` = :name', array('name' => $action['name']))) {
$action['order'] = empty($action['order']) || !is_numeric($action['order']) ? $iaDb->getMaxOrder() + 1 : $action['order'];
$iaDb->insert($action);
}
}
$iaDb->resetTable();
}
if ($this->itemData['phrases']) {
$this->_processPhrases($this->itemData['phrases']);
}
if ($this->itemData['config_groups']) {
$iaDb->setTable(iaCore::getConfigGroupsTable());
$maxOrder = $iaDb->getMaxOrder();
foreach ($this->itemData['config_groups'] as $config) {
$iaDb->insert($config, array('order' => ++$maxOrder));
}
$iaDb->resetTable();
}
if ($this->itemData['objects']) {
$iaDb->setTable('acl_objects');
foreach ($this->itemData['objects'] as $obj) {
if ($obj['title']) {
$key = ($obj['object'] == $obj['pre_object'] ? '' : $obj['pre_object'] . '-') . $obj['object'] . '--' . $obj['action'];
//.........这里部分代码省略.........
示例6: _savePhrases
private function _savePhrases(array &$data, $name, $item)
{
$this->_iaDb->setTable(iaLanguage::getTable());
$phraseKeyTitle = 'fieldgroup_' . $name;
$phraseKeyDescription = "fieldgroup_description_{$item}_{$name}";
foreach ($this->_iaCore->languages as $code => $language) {
$stmt = '`key` = :phrase AND `code` = :language';
$this->_iaDb->bind($stmt, array('phrase' => $phraseKeyTitle, 'language' => $code));
$this->_iaDb->exists($stmt) ? $this->_iaDb->update(array('value' => iaSanitize::html($data['titles'][$code])), $stmt) : iaLanguage::addPhrase($phraseKeyTitle, iaSanitize::html($data['titles'][$code]), $code);
$stmt = '`key` = :phrase && `code` = :language';
$this->_iaDb->bind($stmt, array('phrase' => $phraseKeyDescription, 'language' => $code));
$this->_iaDb->exists($stmt) ? $this->_iaDb->update(array('value' => iaSanitize::html($data['description'][$code])), $stmt) : iaLanguage::addPhrase($phraseKeyDescription, iaSanitize::html($data['description'][$code]), $code);
}
$this->_iaDb->resetTable();
}
示例7: trim
// check read permissions
$page['passw'] = trim($page['passw']);
if (isset($_POST['password']) && $page['passw'] && $passw != $page['passw']) {
$iaView->setMessages(iaLanguage::get('password_incorrect'), iaView::ERROR_NOT_FOUND);
}
if ($page['passw'] && $passw != $page['passw'] && !$previewMode) {
if (!$preview) {
$page = array('meta_description' => $page['meta_description'], 'meta_keywords' => $page['meta_keywords']);
$iaView->assign('protect', true);
}
}
if ($preview) {
$iaView->assign('page_protect', iaLanguage::get('page_preview'));
}
$iaView->assign('page', $page);
$iaDb->setTable(iaLanguage::getTable());
$jt_where = "`category` = 'page' AND `key` = 'page_{DATA_REPLACE}_{$name}' AND `code` = '";
if (!$previewMode) {
$page_title_check = iaLanguage::get('page_title_' . $name, $name);
$pageTitle = $page_title_check ? $page_title_check : $iaDb->one('`value`', str_replace('{DATA_REPLACE}', 'title', $jt_where) . $iaCore->get('lang') . "'");
$iaView->title($pageTitle);
}
if ($page && !$previewMode) {
$page_content_check = $iaDb->one('`value`', str_replace('{DATA_REPLACE}', 'content', $jt_where) . $iaView->language . "'");
$content = $page_content_check ? $page_content_check : $iaDb->one('`value`', str_replace('{DATA_REPLACE}', 'content', $jt_where) . $iaCore->get('lang') . "'");
}
$iaDb->resetTable();
if ($page['custom_tpl'] && $page['template_filename']) {
$content = $iaView->iaSmarty->fetch($page['template_filename']);
}
$iaView->assign('content', $content);
示例8: uninstall
public function uninstall($extraName)
{
if (empty($extraName)) {
$this->error = true;
$this->setMessage('Extra name is empty.');
return false;
}
$this->iaCore->startHook('phpExtrasUninstallBefore', array('extra' => $extraName));
if ($this->iaCore->get('default_package') == $extraName) {
$this->iaCore->set('default_package', '', true);
}
$this->checkValidity();
$extraName = iaSanitize::sql($extraName);
$iaDb =& $this->iaDb;
$code = $iaDb->row_bind(array('uninstall_code', 'uninstall_sql', 'rollback_data'), '`name` = :name', array('name' => $extraName), self::getTable());
$pagesList = $iaDb->onefield('`name`', "`extras` = '{$extraName}'", null, null, 'pages');
$iaDb->delete("`page_name` IN ('" . implode("','", $pagesList) . "')", 'menus');
if (in_array($this->iaCore->get('home_page'), $pagesList)) {
$this->iaCore->set('home_page', 'index', true);
}
if ($itemsList = $iaDb->onefield('item', "`package` = '{$extraName}'", null, null, 'items')) {
$stmt = "`item` IN ('" . implode("','", $itemsList) . "')";
$iaDb->cascadeDelete(array('items_pages', 'favorites', 'views_log'), $stmt);
}
if ($pagesList) {
$iaDb->cascadeDelete(array('objects_pages'), "`page_name` IN ('" . implode("','", $pagesList) . "')");
$iaDb->setTable(iaLanguage::getTable());
$iaDb->delete("`key` IN ('page_title_" . implode("','page_title_", $pagesList) . "')");
$iaDb->delete("`key` IN ('page_content_" . implode("','page_content_", $pagesList) . "')");
$iaDb->delete("`key` IN ('page_metakeyword_" . implode("','page_metakeyword_", $pagesList) . "')");
$iaDb->delete("`key` IN ('page_metadescr_" . implode("','page_metadescr_", $pagesList) . "')");
$iaDb->resetTable();
}
$tableList = array('admin_actions', 'admin_pages_groups', 'admin_pages', 'acl_privileges', iaLanguage::getTable(), iaCore::getConfigGroupsTable(), iaCore::getConfigTable(), iaCore::getCustomConfigTable(), 'pages', 'hooks', 'acl_objects', 'fields_groups', 'fields_pages', 'fields_relations', 'fields_tree_nodes', 'cron');
$iaDb->cascadeDelete($tableList, "`extras` = '{$extraName}'");
$this->iaCore->factory('field');
$iaDb->setTable(iaField::getTable());
$stmt = '`extras` LIKE :extras';
$this->iaDb->bind($stmt, array('extras' => '%' . $extraName . '%'));
if ($itemsList) {
$stmt .= " OR `item` IN ('" . implode("','", $itemsList) . "')";
}
if ($fields = $iaDb->all(array('id', 'extras'), $stmt)) {
foreach ($fields as $field) {
$pluginsList = explode(',', $field['extras']);
if (count($pluginsList) > 1) {
unset($pluginsList[array_search($extraName, $pluginsList)]);
$iaDb->update(array('extras' => implode(',', $pluginsList), 'id' => $field['id']));
} else {
$iaDb->delete(iaDb::convertIds($field['id']));
}
}
}
$iaDb->resetTable();
$iaBlock = $this->iaCore->factory('block', iaCore::ADMIN);
if ($blockIds = $iaDb->onefield(iaDb::ID_COLUMN_SELECTION, "`extras` = '{$extraName}'", null, null, iaBlock::getTable())) {
foreach ($blockIds as $blockId) {
$iaBlock->delete($blockId, false);
}
}
if ($code['uninstall_sql']) {
$code['uninstall_sql'] = unserialize($code['uninstall_sql']);
if ($code['uninstall_sql'] && is_array($code['uninstall_sql'])) {
foreach ($code['uninstall_sql'] as $sql) {
$iaDb->query(str_replace('{prefix}', $iaDb->prefix, $sql['query']));
}
}
}
$entry = $iaDb->row_bind(iaDb::ALL_COLUMNS_SELECTION, '`name` = :name', array('name' => $extraName), self::getTable());
$iaDb->delete('`name` = :plugin', self::getTable(), array('plugin' => $extraName));
$iaDb->delete('`package` = :plugin', 'items', array('plugin' => $extraName));
empty($entry) || $this->_processCategory($entry, self::ACTION_UNINSTALL);
if ($code['uninstall_code']) {
$this->_runPhpCode($code['uninstall_code']);
}
if ($code['rollback_data']) {
$rollbackData = unserialize($code['rollback_data']);
if (is_array($rollbackData)) {
$existPositions = $this->iaView->positions;
foreach ($rollbackData as $sectionName => $actions) {
foreach ($actions as $name => $itemData) {
if (isset($itemData['position'])) {
if (!in_array($itemData['position'], $existPositions)) {
$itemData['position'] = '';
$itemData['status'] = iaCore::STATUS_INACTIVE;
}
}
$stmt = iaDb::printf("`name` = ':name'", array('name' => $name));
$this->iaDb->update($itemData, $stmt, null, $sectionName);
}
}
}
}
// clear usergroups
if ($usergroups = $iaDb->all(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($extraName, 'extras'), 0, null, iaUsers::getUsergroupsTable())) {
$iaUsers = $this->iaCore->factory('users');
foreach ($usergroups as $usergroup) {
$iaUsers->deleteUsergroup($usergroup['id']);
}
}
//.........这里部分代码省略.........
示例9: _update
private function _update(array $fieldData, $id)
{
$iaDb =& $this->_iaDb;
$field = $iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($id));
if (empty($field) || $field['type'] != $fieldData['type']) {
return false;
}
// set correct relations
if (iaField::RELATION_REGULAR == $fieldData['relation']) {
$this->_resetRelations($field['name'], $field['item']);
} else {
if ($fieldData['parents']) {
$this->_setParents($field['name'], $fieldData['parents']);
}
if ($fieldData['children']) {
$this->_setChildren($field['name'], $field['item'], $fieldData['values'], $fieldData['children']);
}
$this->_setRelations();
}
unset($fieldData['parents'], $fieldData['children']);
$iaDb->setTable(iaLanguage::getTable());
$iaDb->delete("`key` LIKE 'field\\_" . $field['name'] . "\\_%'");
foreach ($this->_iaCore->languages as $code => $language) {
iaLanguage::addPhrase('field_' . $field['name'], $fieldData['title'][$code], $code, $field['extras']);
if (isset($fieldData['annotation'][$code]) && $fieldData['annotation'][$code]) {
iaLanguage::addPhrase('field_' . $field['name'] . '_annotation', $fieldData['annotation'][$code], $code, $field['extras']);
}
}
unset($fieldData['title'], $fieldData['annotation']);
$keys = array();
if (isset($fieldData['values']) && is_array($fieldData['values'])) {
$newKeys = array();
foreach ($fieldData['values'] as $key => $value) {
$key = $keys[$key] = isset($fieldData['keys'][$key]) ? $fieldData['keys'][$key] : $key;
iaLanguage::addPhrase('field_' . $field['name'] . '_' . $key, $value, null, $field['extras']);
$newKeys[] = $key;
}
$fieldData['values'] = implode(',', $newKeys);
} elseif (iaField::TREE != $fieldData['type']) {
unset($fieldData['values']);
} elseif (iaField::TREE == $fieldData['type']) {
$iaDb->setTable('fields_tree_nodes');
$iaDb->delete('`field` = :name && `item` = :item', null, array('name' => $field['name'], 'item' => $field['item']));
if ($fieldData['tree_nodes']) {
foreach ($fieldData['tree_nodes'] as $node) {
// insert default language
iaLanguage::addPhrase('field_' . $field['item'] . '_' . $field['name'] . '_' . $node['node_id'], $node['text'], $this->_iaCore->iaView->language, $field['extras']);
unset($node['text']);
$node['field'] = $field['name'];
$node['item'] = $field['item'];
$node['extras'] = $field['extras'];
$iaDb->insert($node);
}
}
$iaDb->resetTable();
unset($fieldData['tree_nodes']);
}
unset($fieldData['keys']);
if (isset($fieldData['lang_values']) && is_array($fieldData['lang_values'])) {
foreach ($fieldData['lang_values'] as $languageCode => $phrases) {
foreach ($phrases as $phraseKey => $phraseValue) {
iaLanguage::addPhrase('field_' . $field['name'] . '_' . $phraseKey, $phraseValue, $languageCode, $field['extras']);
}
}
}
if (isset($fieldData['lang_values'])) {
unset($fieldData['lang_values']);
}
if ($fieldData['searchable'] && $fieldData['type'] == iaField::NUMBER && isset($fieldData['_numberRangeForSearch']) && is_array($fieldData['_numberRangeForSearch']) && !empty($fieldData['_numberRangeForSearch'])) {
$iaDb->delete("`key` LIKE 'field\\_" . $field['name'] . "\\_range\\_%'");
foreach ($fieldData['_numberRangeForSearch'] as $value) {
iaLanguage::addPhrase('field_' . $field['name'] . '_range_' . $value, $value, null, $field['extras']);
}
unset($fieldData['_numberRangeForSearch']);
} else {
$iaDb->delete("`key` LIKE 'field\\_" . $field['name'] . "\\_range\\_%'");
}
$iaDb->resetTable();
$tableName = $this->_iaCore->factory('item')->getItemTable($fieldData['item']);
// avoid making fulltext second time
if (!$field['searchable'] && $fieldData['searchable'] && in_array($fieldData['type'], array(iaField::TEXT, iaField::TEXTAREA))) {
$indexes = $iaDb->getAll("SHOW INDEX FROM `{$iaDb->prefix}{$tableName}`");
$keyExists = false;
foreach ($indexes as $i) {
if ($i['Key_name'] == $field['name'] && $i['Index_type'] == 'FULLTEXT') {
$keyExists = true;
break;
}
}
if (!$keyExists) {
$iaDb->query("ALTER TABLE `{$iaDb->prefix}{$tableName}` ADD FULLTEXT (`{$field['name']}`)");
}
}
if ($field['searchable'] && !$fieldData['searchable'] && in_array($fieldData['type'], array(iaField::TEXT, iaField::TEXTAREA))) {
$indexes = $iaDb->getAll("SHOW INDEX FROM `{$iaDb->prefix}{$tableName}`");
$keyExists = false;
foreach ($indexes as $i) {
if ($i['Key_name'] == $field['name'] && $i['Index_type'] == 'FULLTEXT') {
$keyExists = true;
break;
//.........这里部分代码省略.........
示例10: _getPagesList
private function _getPagesList($languageCode)
{
$iaPage = $this->_iaCore->factory('page', iaCore::ADMIN);
$sql = 'SELECT DISTINCTROW p.*, IF(l.`value` IS NULL, p.`name`, l.`value`) `title` ' . 'FROM `:prefix:table_pages` p ' . 'LEFT JOIN `:prefix:table_phrases` l ' . "ON (`key` = CONCAT('page_title_', p.`name`) AND l.`code` = ':lang' AND l.`category` = ':category') " . "WHERE p.`status` = ':status' AND p.`service` = 0 " . 'GROUP BY p.`name` ' . 'ORDER BY l.`value`';
$sql = iaDb::printf($sql, array('prefix' => $this->_iaDb->prefix, 'table_pages' => $iaPage::getTable(), 'table_phrases' => iaLanguage::getTable(), 'status' => iaCore::STATUS_ACTIVE, 'lang' => $languageCode, 'category' => iaLanguage::CATEGORY_PAGE));
return $this->_iaDb->getAll($sql);
}
示例11: getNonServicePages
public function getNonServicePages(array $exclude)
{
$sql = "SELECT DISTINCTROW p.*, IF(t.`value` IS NULL, p.`name`, t.`value`) `title`\n\t\t\tFROM `" . self::getTable(true) . "` p\n\t\t\t\tLEFT JOIN `" . $this->iaDb->prefix . iaLanguage::getTable() . "` t\n\t\t\t\t\tON `key` = CONCAT('page_title_', p.`name`) AND t.`code` = '" . $this->iaView->language . "'\n\t\t\tWHERE p.`status` = 'active'\n\t\t\t\tAND p.`service` = 0 " . ($exclude ? "AND !FIND_IN_SET(p.`name`, '" . implode(',', $exclude) . "') " : ' ') . 'ORDER BY t.`value`';
return $this->iaDb->getAll($sql);
}
示例12: _assignValues
protected function _assignValues(&$iaView, array &$entryData)
{
if (isset($_POST['titles']) && isset($_POST['contents'])) {
$entryData['titles'] = $_POST['titles'];
$entryData['contents'] = $_POST['contents'];
} elseif (iaCore::ACTION_EDIT == $iaView->get('action')) {
$this->_iaDb->setTable(iaLanguage::getTable());
$entryData['titles'] = $this->_iaDb->keyvalue(array('code', 'value'), "`key` = 'page_title_{$entryData['name']}' AND `category` = 'page'");
$entryData['contents'] = $this->_iaDb->keyvalue(array('code', 'value'), "`key` = 'page_content_{$entryData['name']}' AND `category` = 'page'");
$this->_iaDb->resetTable();
}
$menus = array(array('title' => iaLanguage::get('core_menus', 'Core menus'), 'list' => array()), array('title' => iaLanguage::get('custom_menus', 'Custom menus'), 'list' => array()));
$iaAcl = $this->_iaCore->factory('acl');
if ($iaAcl->checkAccess('admin_page:add', 0, 0, 'menus')) {
$this->_iaCore->factory('block', iaCore::ADMIN);
$menusList = $this->_iaDb->all(array('id', 'title', 'removable'), "`type` = 'menu'", null, null, iaBlock::getTable());
foreach ($menusList as $menuEntry) {
$menus[$menuEntry['removable']]['list'][] = $menuEntry;
}
ksort($menus[0]['list']);
ksort($menus[1]['list']);
$selectedMenus = empty($_POST['menus']) ? $this->_iaDb->onefield('menu_id', iaDb::convertIds($entryData['name'], 'page_name'), null, null, iaBlock::getMenusTable()) : $_POST['menus'];
$iaView->assign('selectedMenus', $selectedMenus);
}
$parentAlias = '';
if ($entryData['parent']) {
$parentAlias = $this->getHelper()->getByName($entryData['parent'], false);
$parentAlias = empty($parentAlias['alias']) ? $parentAlias['name'] . IA_URL_DELIMITER : $parentAlias['alias'];
}
$entryData['extension'] = false === strpos($entryData['alias'], '.') ? '' : end(explode('.', $entryData['alias']));
$entryData['alias'] = substr($entryData['alias'], strlen($parentAlias), -1 - strlen($entryData['extension']));
if ($entryData['name'] == $entryData['alias']) {
$entryData['alias'] = '';
}
$parentPage = $this->getHelper()->getByName($entryData['parent'], false);
$groups = $this->getHelper()->getGroups(array($this->_iaCore->get('home_page'), $entryData['name']));
$isHomepage = $this->_iaCore->get('home_page', iaView::DEFAULT_HOMEPAGE) == $entryData['name'];
$iaView->assign('isHomePage', $isHomepage);
$iaView->assign('extensions', $this->getHelper()->extendedExtensions);
$iaView->assign('menus', $menus);
$iaView->assign('pages', $this->getHelper()->getNonServicePages(array('index')));
$iaView->assign('pagesGroup', $groups);
$iaView->assign('parentPageId', $parentPage['id']);
}
示例13: _assignValues
protected function _assignValues(&$iaView, array &$entryData)
{
$groupList = $this->_iaDb->onefield('`group`', '1 = 1 GROUP BY `group`', null, null, 'pages');
$this->_iaDb->setTable('admin_pages_groups');
$array = $this->_iaDb->all(array('id', 'name', 'title'));
$pagesGroups = array();
foreach ($array as $row) {
in_array($row['id'], $groupList) && ($pagesGroups[$row['id']] = $row);
}
$this->_iaDb->resetTable();
$menuPages = array();
$entryData['content'] = is_null($this->_multilingualContent) ? $entryData['contents'] : $this->_multilingualContent;
if (!isset($entryData['titles']) && iaCore::ACTION_EDIT == $iaView->get('action')) {
$this->_iaDb->setTable(iaLanguage::getTable());
$entryData['titles'] = $this->_iaDb->keyvalue(array('code', 'value'), "`key` = '" . iaBlock::LANG_PATTERN_TITLE . $this->getEntryId() . "'");
$entryData['contents'] = $this->_iaDb->keyvalue(array('code', 'value'), "`key` = '" . iaBlock::LANG_PATTERN_CONTENT . $this->getEntryId() . "'");
$entryData['languages'] = empty($entryData['contents']) ? array() : array_keys($entryData['contents']);
if ($entryData['multilingual'] && empty($entryData['contents']) && iaBlock::TYPE_PHP != $entryData['type']) {
foreach ($this->_iaCore->languages as $code => $language) {
$entryData['titles'][$code] = $entryData['title'];
$entryData['contents'][$code] = $entryData['content'];
}
}
$this->_iaDb->resetTable();
$menuPages = $this->_iaDb->onefield('`name`', "FIND_IN_SET('{$entryData['name']}', `menus`)", null, null, 'pages');
}
isset($entryData['header']) || ($entryData['header'] = true);
isset($entryData['collapsible']) || ($entryData['collapsible'] = true);
isset($entryData['multilingual']) || ($entryData['multilingual'] = true);
isset($entryData['sticky']) || ($entryData['sticky'] = true);
isset($entryData['external']) || ($entryData['external'] = false);
empty($entryData['subpages']) || ($entryData['subpages'] = unserialize($entryData['subpages']));
isset($entryData['pages']) || ($entryData['pages'] = $this->_iaDb->onefield('page_name', "`object_type` = 'blocks' && " . iaDb::convertIds($this->getEntryId(), 'object'), 0, null, iaBlock::getPagesTable()));
$iaView->assign('menuPages', $menuPages);
$iaView->assign('pagesGroup', $pagesGroups);
$iaView->assign('pages', $this->_getPagesList($iaView->language));
$iaView->assign('positions', $this->getHelper()->getPositions());
$iaView->assign('types', $this->getHelper()->getTypes());
}
示例14: getByName
public function getByName($pageName, $lookupThroughBackend = true)
{
$result = $this->iaDb->row_bind(iaDb::ALL_COLUMNS_SELECTION, '`name` = :name', array('name' => $pageName), $lookupThroughBackend ? self::getAdminTable() : self::getTable());
if (!$lookupThroughBackend && $result) {
$result['title'] = $this->iaDb->one_bind(array('value'), '`key` = :key AND `category` = :category AND `code` = :lang', array('key' => 'page_title_' . $pageName, 'category' => iaLanguage::CATEGORY_PAGE, 'lang' => $this->iaView->language), iaLanguage::getTable());
}
return $result;
}
示例15: _createJsFile
protected function _createJsFile($file, $type = 'config')
{
$this->iaCore->factory('util');
// required in order the class iaUtil to be loaded
$iaDb =& $this->iaCore->iaDb;
switch ($type) {
case 'lang':
case 'admin_lang':
// get phrases
$stmt = "`code` = :lang AND `category` NOT IN ('tooltip', 'page', :category)";
$iaDb->bind($stmt, array('lang' => $this->iaCore->iaView->language, 'category' => $type == 'admin_lang' ? 'frontend' : iaCore::ADMIN));
$phrases = $iaDb->keyvalue(array('key', 'value'), $stmt, iaLanguage::getTable());
// get list of languages
$languagesList = $iaDb->assoc(array('code', 'title', 'direction', 'flagicon', 'iso' => 'code'), 'admin_lang' == $type ? null : "`status` = 'active'", 'languages');
$fileContent = 'intelli.' . ('admin_lang' == $type ? 'admin.' : '') . 'lang = ' . iaUtil::jsonEncode($phrases) . ';' . 'intelli.languages = ' . iaUtil::jsonEncode($languagesList) . ';';
break;
case 'config':
$stmt = "`private` = 0 && `type` != 'divider' && `config_group` != 'email_templates'";
$config = $iaDb->keyvalue(array('name', 'value'), $stmt, iaCore::getConfigTable());
if (file_exists(IA_INCLUDES . 'custom.inc.php')) {
include IA_INCLUDES . 'custom.inc.php';
}
$config['ia_url'] = IA_CLEAR_URL;
$config['packages'] = $this->iaCore->setPackagesData();
$config['items'] = array();
$config['extras'] = array(array('core', iaLanguage::get('core', 'Core')));
$array = $iaDb->all(array('name', 'title'), "`status` = 'active' ORDER BY `type`", null, null, 'extras');
foreach ($array as $item) {
$config['extras'][] = array($item['name'], $item['title']);
}
$array = $iaDb->onefield('`item`', "`item` != 'transactions'", null, null, 'items');
foreach ($array as $item) {
$config['items'][] = array($item, iaLanguage::get($item, $item));
}
$fileContent = 'intelli.config = ' . iaUtil::jsonEncode($config) . ';';
}
if (isset($fileContent)) {
if ($fh = fopen($file, 'w')) {
fwrite($fh, $fileContent);
fclose($fh);
}
}
}