本文整理汇总了PHP中DBUtil::incrementObjectFieldByID方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::incrementObjectFieldByID方法的具体用法?PHP DBUtil::incrementObjectFieldByID怎么用?PHP DBUtil::incrementObjectFieldByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::incrementObjectFieldByID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: incrementreadcount
/**
* increment the item read count
* @author Mark West
* @return bool true on success, false on failiure
*/
public function incrementreadcount($args)
{
if ((!isset($args['pageid']) || !is_numeric($args['pageid'])) &&
!isset($args['title'])) {
return LogUtil::registerArgsError();
}
if (isset($args['pageid'])) {
return DBUtil::incrementObjectFieldByID('pages', 'counter', $args['pageid'], 'pageid');
} else {
return DBUtil::incrementObjectFieldByID('pages', 'counter', $args['title'], 'urltitle');
}
}
示例2: display
function display()
{
// security check
if (!SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_READ)) {
return LogUtil::registerPermissionError();
}
$ot = FormUtil::getPassedValue('ot', 'address', 'GET');
$id = (int) FormUtil::getPassedValue('id', 0, 'GET');
$startnum = FormUtil::getPassedValue('startnum', 1, 'GET');
$letter = FormUtil::getPassedValue('letter', 0);
$sort = FormUtil::getPassedValue('sort', ModUtil::getVar('AddressBook', 'addressbooktype') == 1 ? 'sortname ASC' : 'sortcompany ASC');
$search = FormUtil::getPassedValue('search', 0);
$category = FormUtil::getPassedValue('category', 0);
$private = FormUtil::getPassedValue('private', 0);
if (!$id) {
return z_exit($this->__f('Error! Invalid id [%s] received.', $id));
}
// Get user id
if (UserUtil::isLoggedIn()) {
$user_id = UserUtil::getVar('uid');
} else {
$user_id = 0;
}
$this->view->setCacheId('display|id_' . $id . '|uid_' . $user_id);
$template = 'user_display.tpl';
if ($this->view->is_cached($template)) {
return $this->view->fetch($template);
}
$object = new AddressBook_DBObject_Address();
$data = $object->get($id);
// get the custom fields
$cus_where = "";
$cus_sort = "cus_pos ASC";
$cus_Array = new AddressBook_DBObject_CustomfieldArray();
$customfields = $cus_Array->get($cus_where, $cus_sort);
foreach ($customfields as $key => $customfield) {
if (isset($customfield['name1']) && $customfield['name1'] && $lang != 'en') {
$customfields[$key]['name'] = $customfield['name1'];
}
}
DBUtil::incrementObjectFieldByID('addressbook_address', 'counter', $id, 'id');
// count clicks
$this->view->assign('address', $data);
$this->view->assign('customfields', $customfields);
$this->view->assign('user_id', $user_id);
$this->view->assign('ot', $ot);
// assign the criteria from the view modus
$this->view->assign('startnum', $startnum);
$this->view->assign('letter', $letter);
$this->view->assign('category', $category);
$this->view->assign('private', $private);
$this->view->assign('sort', $sort);
$this->view->assign('search', $search);
$where = "fav_adr_id={$id} AND fav_user_id={$user_id}";
$fav = new AddressBook_DBObject_FavouriteArray();
$favData = $fav->getWhere($where);
$this->view->assign('isFavourite', $favData ? 1 : 0);
unset($fav);
unset($favData);
unset($where);
$lang = ZLanguage::getLanguageCode();
// Labels
$addressbook_labels = DBUtil::selectObjectArray('addressbook_labels');
$ablabels = array();
foreach ($addressbook_labels as $addressbook_label) {
if (isset($addressbook_label['name1']) && $addressbook_label['name1'] && $lang != 'en') {
$addressbook_label['name'] = $addressbook_label['name1'];
}
$ablabels[$addressbook_label['id']] = $addressbook_label;
}
// Google Maps
$this->view->assign('preferences', ModUtil::getVar('AddressBook'));
$this->view->assign('lang', $lang);
$this->view->assign('ablabels', $ablabels);
return $this->view->fetch($template);
}
示例3: decrease_weight
/**
* Decrease weight of a dud item on the sorted list.
*
* Parameters passed via GET:
* --------------------------
* int dudid The id of the item to be updated.
*
* @return boolean True if update successful, false otherwise.
*/
public function decrease_weight()
{
$dudid = (int)$this->request->getGet()->get('dudid', null);
$item = ModUtil::apiFunc('Profile', 'user', 'get', array('propid' => $dudid));
if ($item == false) {
return LogUtil::registerError($this->__('Error! No such personal info item found.'), 404);
}
// Security check
if (!SecurityUtil::checkPermission('Profile::item', "$item[prop_label]::$item[prop_id]", ACCESS_EDIT)) {
return LogUtil::registerPermissionError();
}
if ($item['prop_weight'] <= 1) {
return LogUtil::registerError($this->__('Error! You cannot decrease the weight of this account property.'), 404);
}
$res = DBUtil::incrementObjectFieldByID('user_property', 'prop_weight', $dudid, 'prop_id', -1);
// The return value of the function is checked here
if ($res) {
// Success
LogUtil::registerStatus($this->__('Done! Saved your changes.'));
}
return System::redirect(ModUtil::url('Profile', 'admin', 'view'));
}
示例4: view
//.........这里部分代码省略.........
* @return Renderer output
*/
public function view($args)
{
$pageId = isset($args['pid']) ? $args['pid'] : FormUtil::getPassedValue('pid');
$versionId = isset($args['vid']) ? $args['vid'] : FormUtil::getPassedValue('vid');
$urlname = isset($args['name']) ? $args['name'] : FormUtil::getPassedValue('name');
$preview = isset($args['preview']) ? $args['preview'] : FormUtil::getPassedValue('preview');
$editmode = isset($args['editmode']) ? $args['editmode'] : FormUtil::getPassedValue('editmode', null, 'GET');
if ($pageId === null && !empty($urlname)) {
$pageId = ModUtil::apiFunc('Content', 'Page', 'solveURLPath', compact('urlname'));
System::queryStringSetVar('pid', $pageId);
}
if ((bool) $this->getVar('inheritPermissions', false) === true) {
$this->throwForbiddenUnless(ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $pageId, 'level' => ACCESS_READ)), LogUtil::getErrorMsgPermission());
} else {
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Content:page:', $pageId . '::', ACCESS_READ), LogUtil::getErrorMsgPermission());
}
$versionHtml = '';
$hasEditAccess = false;
if ((bool) $this->getVar('inheritPermissions', false) === true) {
$hasEditAccess = ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $pageId, 'level' => ACCESS_EDIT));
} else {
$hasEditAccess = SecurityUtil::checkPermission('Content:page:', $pageId . '::', ACCESS_EDIT);
}
if ($versionId !== null && $hasEditAccess) {
$preview = true;
$version = ModUtil::apiFunc('Content', 'History', 'getPageVersion', array('id' => $versionId, 'preview' => $preview, 'includeContent' => true));
$versionData =& $version['data'];
$page =& $versionData['page'];
$pageId = $page['id'];
$action = ModUtil::apiFunc('Content', 'History', 'contentHistoryActionTranslate', $version['action']);
$translatable = array('revisionNo' => $version['revisionNo'], 'date' => $version['date'], 'action' => $action, 'userName' => $version['userName'], 'ipno' => $version['ipno']);
$iconSrc = 'images/icons/extrasmall/clock.png';
$versionHtml = "<p class=\"content-versionpreview\"><img alt=\"\" src=\"{$iconSrc}\"/> " . $this->__f('Version #%1$s - %2$s - %3$s by %4$s from %5$s', $translatable) . "</p>";
}
// now get the page up for display
if ($pageId !== null && $versionId === null) {
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $pageId, 'preview' => $preview, 'includeContent' => true, 'filter' => array('checkActive' => !($preview && $hasEditAccess))));
} else {
if ($versionId === null) {
return LogUtil::registerArgsError();
}
}
if ($page === false) {
return false;
}
if ($editmode !== null) {
SessionUtil::setVar('ContentEditMode', $editmode);
} else {
$editmode = SessionUtil::getVar('ContentEditMode', null);
}
if ($editmode) {
$this->view->setCaching(false);
}
$this->view->setCacheId("{$pageId}|{$versionId}");
if ($this->view->is_cached('user/page.tpl')) {
return $this->view->fetch('user/page.tpl');
}
// Register a page variable breadcrumbs with the Content page hierarchy as array of array(url, title)
if ((bool) $this->getVar('registerBreadcrumbs', false) === true) {
// first include self, then loop over parents until root is reached
$breadcrumbs[] = array('url' => ModUtil::url('Content', 'user', 'view', array('pid' => $page['id'])), 'title' => $page['title']);
$loopPageid = $page['parentPageId'];
while ($loopPageid > 0) {
$loopPage = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $loopPageid, 'includeContent' => false, 'includeLayout' => false, 'translate' => $this->translateTitles));
array_unshift($breadcrumbs, array('url' => ModUtil::url('Content', 'user', 'view', array('pid' => $loopPage['id'])), 'title' => $loopPage['title']));
$loopPageid = $loopPage['parentPageId'];
}
PageUtil::registerVar('breadcrumbs', false, $breadcrumbs);
}
$multilingual = ModUtil::getVar(ModUtil::CONFIG_MODULE, 'multilingual');
if ($page['language'] == ZLanguage::getLanguageCode()) {
$multilingual = false;
}
// override the PageVar title if configued in the settings
if ($this->getVar('overrideTitle')) {
$pageTitle = html_entity_decode($page['title']);
PageUtil::setVar('title', $preview ? $this->__("Preview") . ' - ' . $pageTitle : $pageTitle);
}
$this->view->assign('page', $page);
$this->view->assign('preview', $preview);
$this->view->assign('editmode', $editmode);
$this->view->assign('multilingual', $multilingual);
$this->view->assign('enableVersioning', $this->getVar('enableVersioning'));
// add layout type and column count as page variables to the template
// columncount can be used via plugin contentcolumncount, since it holds regular expressions that slow down
$this->view->assign('contentLayoutType', $page['layout']);
// add access parameters
Content_Util::contentAddAccess($this->view, $pageId);
// exclude writers from statistics
if (!$hasEditAccess && !$preview && !$editmode && $this->getVar('countViews')) {
// Check against session to see if user was already counted
if (!SessionUtil::getVar("ContentRead" . $pageId)) {
SessionUtil::setVar("ContentRead" . $pageId, $pageId);
DBUtil::incrementObjectFieldByID('content_page', 'views', $pageId);
}
}
return $versionHtml . $this->view->fetch('user/page.tpl');
}
示例5: mediashare_invitationapi_updateViewCount
function mediashare_invitationapi_updateViewCount($args)
{
$dom = ZLanguage::getModuleDomain('mediashare');
if (!DBUtil::incrementObjectFieldByID('mediashare_invitation', 'viewCount', $args['key'], 'key')) {
return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('invitationapi.updateViewCount', 'Could not update the counter.'), $dom));
}
return true;
}