本文整理汇总了PHP中iaDb::convertIds方法的典型用法代码示例。如果您正苦于以下问题:PHP iaDb::convertIds方法的具体用法?PHP iaDb::convertIds怎么用?PHP iaDb::convertIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iaDb
的用法示例。
在下文中一共展示了iaDb::convertIds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getExtraType
private function _getExtraType($extraName)
{
if (is_null(self::$_extraTypes)) {
$iaCore = iaCore::instance();
$iaCore->factory('item');
self::$_extraTypes = $iaCore->iaDb->keyvalue(array('name', 'type'), iaDb::convertIds(iaCore::STATUS_ACTIVE, 'status'), iaItem::getExtrasTable());
}
return isset(self::$_extraTypes[$extraName]) ? self::$_extraTypes[$extraName] : null;
}
示例2: deleteCorrespondingInvoice
public function deleteCorrespondingInvoice($transactionId)
{
if ($invoice = $this->getBy('transaction_id', $transactionId)) {
$result1 = (bool) $this->iaDb->delete(iaDb::convertIds($invoice['id']), self::getTable());
$result2 = (bool) $this->iaDb->delete(iaDb::convertIds($invoice['id'], 'invoice_id'), self::$_tableItems);
return $result1 && $result2;
}
return true;
}
示例3: _entryDelete
protected function _entryDelete($entryId)
{
$row = $this->_iaDb->row(array('name', 'item'), iaDb::convertIds($entryId));
$result = parent::_entryDelete($entryId);
if ($result && $row) {
$stmt = iaDb::printf("`key` = 'fieldgroup_:name' OR `key` = 'fieldgroup_description_:item_:name'", $row);
$this->_iaDb->delete($stmt, iaLanguage::getTable());
}
return $result;
}
示例4: _deleteFile
private function _deleteFile($params)
{
$result = array('error' => true, 'message' => iaLanguage::get('invalid_parameters'));
$item = isset($params['item']) ? iaSanitize::sql($params['item']) : null;
$field = isset($params['field']) ? iaSanitize::sql($params['field']) : null;
$path = isset($params['path']) ? iaSanitize::sql($params['path']) : null;
$itemId = isset($params['itemid']) ? (int) $params['itemid'] : null;
if ($itemId && $item && $field && $path) {
$tableName = $this->_iaCore->factory('item')->getItemTable($item);
$itemValue = $this->_iaDb->one($field, iaDb::convertIds($itemId), $tableName);
$iaAcl = $this->_iaCore->factory('acl');
if ($iaAcl->isAdmin() && $itemValue) {
$pictures = $itemValue[1] == ':' ? unserialize($itemValue) : $itemValue;
$key = null;
if (is_array($pictures)) {
if ($primitive = !is_array($pictures[key($pictures)])) {
$pictures = array($pictures);
}
foreach ($pictures as $k => $v) {
if ($path == $v['path']) {
$key = $k;
break;
}
}
if (!is_null($key)) {
unset($pictures[$key]);
}
$newItemValue = $primitive ? '' : serialize($pictures);
} else {
// single image
$newItemValue = '';
if ($pictures == $path) {
$key = true;
}
}
if (!is_null($key)) {
if ($this->_iaCore->factory('picture')->delete($path)) {
if ($this->_iaDb->update(array($field => $newItemValue), iaDb::convertIds($itemId), null, $tableName)) {
if (iaUsers::getItemName() == $item) {
// update current profile data
if ($itemId == iaUsers::getIdentity()->id) {
iaUsers::reloadIdentity();
}
}
}
$result['error'] = false;
$result['message'] = iaLanguage::get('deleted');
} else {
$result['message'] = iaLanguage::get('error');
}
}
}
}
return $result;
}
示例5: _gridUpdate
protected function _gridUpdate($params)
{
$template = $params['id'];
$this->_iaCore->set($template . '_subject', $params['subject'], true);
$this->_iaCore->set($template . '_body', $params['body'], true);
$this->_iaCore->set($template, (int) $params['enable_template'], true);
$signature = $params['enable_signature'] ? '1' : '';
$this->_iaDb->update(array('show' => $signature), iaDb::convertIds($template, 'name'));
$result = 0 == $this->_iaDb->getErrorNumber();
return array('result' => $result);
}
示例6: _approveClaim
private function _approveClaim(array $data)
{
$claim = $this->getById($data['id']);
$iaItem = $this->_iaCore->factory('item');
$result = (bool) $this->_iaDb->update(array('member_id' => $claim['member_id']), iaDb::convertIds($claim['item_id']), null, $iaItem->getItemTable($claim['item']));
$this->_iaDb->update(array('status' => 'approved'), iaDb::convertIds($claim['id']));
if ($result && $this->_iaCore->get('claim_approved')) {
$iaMailer = $this->_iaCore->factory('mailer');
$iaMailer->loadTemplate('claim_approved');
$iaMailer->addAddress($claim['email'], $claim['name']);
$iaMailer->setReplacements(array('listing_title' => $claim['item_title'], 'listing_url' => $claim['item_url']));
$iaMailer->send();
}
}
示例7: updateTrackingRecords
public function updateTrackingRecords($trackingSalt, $memberId, $productId, $visitorReferrer)
{
// set cookie for 10 years
setcookie('IA_AFF_TRACKING', $trackingSalt, time() + 315360000, '', $visitorReferrer, 0);
$tracking = array('salt' => $trackingSalt, 'member_id' => $memberId, 'product_id' => $productId, 'referrer' => $visitorReferrer);
// log visitor
$this->iaDb->setTable(self::getTable());
if ($this->iaDb->exists('`salt` = :salt', array('salt' => $trackingSalt))) {
$this->iaDb->update($tracking, iaDb::convertIds($trackingSalt, 'salt'), array('datetime' => iaDb::FUNCTION_NOW));
} else {
$this->iaDb->insert($tracking, array('datetime' => iaDb::FUNCTION_NOW));
}
$this->iaDb->resetTable();
return true;
}
示例8: _gridRead
protected function _gridRead($params)
{
if (isset($_POST['action'])) {
$output = array();
switch ($_POST['action']) {
case 'get':
$output['code'] = $this->_iaDb->one_bind('`code`', iaDb::convertIds((int) $_POST['id']));
break;
case 'set':
$output['result'] = (bool) $this->_iaDb->update(array('code' => $_POST['code']), iaDb::convertIds($_POST['id']));
$output['message'] = iaLanguage::get($output['result'] ? 'saved' : 'db_error');
}
return $output;
}
return parent::_gridRead($params);
}
示例9: _gridRead
protected function _gridRead($params)
{
$output = array();
switch ($this->_iaCore->requestPath[0]) {
case 'get':
$output['code'] = $this->_iaDb->one_bind('`code`', iaDb::convertIds((int) $_GET['id']));
break;
case 'set':
$this->_iaDb->update(array('code' => $_POST['code']), iaDb::convertIds($_POST['id']));
$output['result'] = 0 == $this->_iaDb->getErrorNumber();
$output['message'] = iaLanguage::get($output['result'] ? 'saved' : 'db_error');
break;
default:
$output = parent::_gridRead($params);
}
return $output;
}
示例10: run
/**
* Execute cron job with the given id (optional)
*
* @param int $jobId job id
*
* @return array
*/
public function run($jobId = null)
{
$this->iaDb->setTable(self::getTable());
$stmt = is_null($jobId) ? '`active` = 1 AND `date_next_launch` <= UNIX_TIMESTAMP() ORDER BY `date_next_launch`' : iaDb::convertIds($jobId);
$job = $this->iaDb->row(iaDb::ALL_COLUMNS_SELECTION, $stmt);
if (!$job) {
return;
}
$data = $this->_parse($job['data']);
if (is_file(IA_HOME . $data[self::C_CMD])) {
if ($this->iaDb->update(array('date_next_launch' => $data['lastScheduled']), iaDb::convertIds($job['id']), array('date_prev_launch' => 'UNIX_TIMESTAMP()'))) {
$this->_launchFile($data[self::C_CMD]);
}
} else {
$this->iaDb->update(array('active' => false), iaDb::convertIds($job['id']));
}
$this->iaDb->resetTable();
}
示例11: delete
public function delete($id)
{
$result = false;
$this->iaDb->setTable(self::getTable());
// if item exists, then remove it
if ($row = $this->iaDb->row_bind(array('title', 'image'), '`id` = :id', array('id' => $id))) {
$result = (bool) $this->iaDb->delete(iaDb::convertIds($id), self::getTable());
if ($row['image'] && $result) {
$iaPicture = $this->iaCore->factory('picture');
$iaPicture->delete($row['image']);
}
if ($result) {
$this->iaCore->factory('log')->write(iaLog::ACTION_DELETE, array('module' => 'portfolio', 'item' => 'portfolio', 'name' => $row['title'], 'id' => (int) $id));
}
}
$this->iaDb->resetTable();
return $result;
}
示例12: _getSettings
private function _getSettings()
{
$settings = array('target' => 'all', 'id' => 0, 'action' => 2, 'user' => 0, 'group' => 0, 'item' => null);
if (isset($_GET['user'])) {
$settings['action'] = 0;
$settings['target'] = iaAcl::USER;
$settings['user'] = $settings['id'] = isset($_GET[$settings['target']]) ? (int) $_GET[$settings['target']] : 0;
$settings['item'] = $this->_iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($settings['id']), iaUsers::getTable());
if (!empty($settings['item']['usergroup_id'])) {
$settings['group'] = (int) $settings['item']['usergroup_id'];
}
} elseif (isset($_GET['group'])) {
$settings['action'] = 1;
$settings['target'] = iaAcl::GROUP;
$settings['group'] = $settings['id'] = isset($_GET[$settings['target']]) ? (int) $_GET[$settings['target']] : 0;
$settings['item'] = $this->_iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($settings['id']), iaUsers::getUsergroupsTable());
}
return $settings;
}
示例13: delete
public function delete($id)
{
$result = false;
$this->iaDb->setTable(self::getTable());
// if item exists, then remove it
if ($row = $this->iaDb->row_bind(array('title', 'image'), '`id` = :id', array('id' => $id))) {
$result[] = (bool) $this->iaDb->delete(iaDb::convertIds($id), self::getTable());
if ($row['image'] && $result) {
$iaPicture = $this->iaCore->factory('picture');
$iaPicture->delete($row['image']);
}
$result[] = (bool) $this->iaDb->delete(iaDb::convertIds($id, 'blog_id'), $this->_tableBlogEntriesTags);
$sql = 'DELETE ' . 'FROM `:prefix:table_blog_tags` ' . 'WHERE `id` NOT IN (' . 'SELECT DISTINCT `tag_id` ' . 'FROM `:prefix:table_blog_entries_tags`)';
$sql = iaDb::printf($sql, array('prefix' => $this->_iaDb->prefix, 'table_blog_entries_tags' => $this->_tableBlogEntriesTags, 'table_blog_tags' => $this->_tableBlogTags));
$result[] = (bool) $this->iaDb->query($sql);
if ($result) {
$this->iaCore->factory('log')->write(iaLog::ACTION_DELETE, array('module' => 'blog', 'item' => 'blog', 'name' => $row['title'], 'id' => (int) $id));
}
}
$this->iaDb->resetTable();
return $result;
}
示例14: getBy
public function getBy($key, $id)
{
return $this->iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($id, $key), self::getTable());
}
示例15: array
} else {
$messages[] = iaLanguage::get('db_error');
}
}
$iaView->setMessages($messages);
}
$tags = iaCore::ACTION_ADD == $pageAction ? '' : $iaBlog->getTagsString($id);
$iaView->assign('item', $entry);
$iaView->assign('tags', $tags);
break;
case iaCore::ACTION_DELETE:
if (1 != count($iaCore->requestPath)) {
return iaView::errorPage(iaView::ERROR_NOT_FOUND);
}
$id = (int) $iaCore->requestPath[0];
$entry = $iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($id));
if (!$entry) {
return iaView::errorPage(iaView::ERROR_NOT_FOUND);
}
$result = $iaBlog->delete($id);
$iaView->setMessages(iaLanguage::get($result ? 'deleted' : 'db_error'), $result ? iaView::SUCCESS : iaView::ERROR);
iaUtil::go_to($baseUrl);
break;
default:
$iaView->display('index');
$pageActions = array();
if (isset($iaCore->requestPath[0])) {
$id = (int) $iaCore->requestPath[0];
if (!$id) {
return iaView::errorPage(iaView::ERROR_NOT_FOUND);
}