本文整理汇总了PHP中iaDb类的典型用法代码示例。如果您正苦于以下问题:PHP iaDb类的具体用法?PHP iaDb怎么用?PHP iaDb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了iaDb类的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: url
public function url($action, $data = array(), $generate = false)
{
$data['action'] = $action;
$data['alias'] = isset($data['album_alias']) ? $data['album_alias'] : $data['title_alias'];
if (!isset($this->patterns[$action])) {
$action = 'view';
}
$url = iaDb::printf($this->patterns[$action], $data);
return self::get('url') . $url;
}
示例4: url
public function url($action, $data = array())
{
$data['action'] = $action;
$data['alias'] = isset($data['genre_alias']) ? $data['genre_alias'] : $data['title_alias'];
if (!isset($this->_patterns[$action])) {
$action = 'view';
}
$url = iaDb::printf($this->_patterns[$action], $data);
return $this->iaCore->packagesData[self::PACKAGE_NAME]['url'] . $url;
}
示例5: _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;
}
示例6: _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;
}
示例7: _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);
}
示例8: _gridQuery
protected function _gridQuery($columns, $where, $order, $start, $limit)
{
foreach (array('amount', 'gateway', 'status') as $joinedColumnName) {
if (false !== stripos($order, $joinedColumnName)) {
$order = str_replace(' i.`', ' t.`', $order);
break;
}
}
$sql = 'SELECT SQL_CALC_FOUND_ROWS ' . 'i.`id`, i.`date_created`, i.`fullname`, ' . 't.`plan_id`, t.`operation`, ' . 't.`status`, CONCAT(t.`amount`, " ", t.`currency`) `amount`, t.`currency`, t.`gateway`, ' . "1 `pdf`, 1 `update`, IF(t.`status` != 'passed', 1, 0) `delete` " . 'FROM `:prefix:table_invoices` i ' . 'LEFT JOIN `:prefix:table_transactions` t ON (t.`id` = i.`transaction_id`) ' . 'LEFT JOIN `:prefix:table_members` m ON (m.`id` = t.`member_id`) ' . ($where ? 'WHERE ' . $where . ' ' : '') . $order . ' ' . 'LIMIT :start, :limit';
$sql = iaDb::printf($sql, array('prefix' => $this->_iaDb->prefix, 'table_invoices' => self::getTable(), 'table_members' => iaUsers::getTable(), 'table_transactions' => 'payment_transactions', 'start' => $start, 'limit' => $limit));
return $this->_iaDb->getAll($sql);
}
示例9: _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();
}
}
示例10: 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;
}
示例11: _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);
}
示例12: _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;
}
示例13: 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();
}
示例14: 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;
}
示例15: url
public function url($action, $data = array(), $generate = false)
{
$data['action'] = $action;
$data['alias'] = isset($data['genre_alias']) ? $data['genre_alias'] : $data['title_alias'];
if (!isset($this->patterns[$action])) {
$action = 'view';
}
if ($generate) {
iaCore::util();
if (!defined('IA_NOUTF')) {
iaUtf8::loadUTF8Core();
iaUtf8::loadUTF8Util('ascii', 'validation', 'bad', 'utf8_to_ascii');
}
if (!utf8_is_ascii($data['alias'])) {
$data['alias'] = $iaCore->convertStr(utf8_to_ascii($data['alias']));
}
}
$url = iaDb::printf($this->patterns[$action], $data);
return $this->iaCore->packagesData[self::PACKAGE_NAME]['url'] . $url;
}