本文整理汇总了PHP中DBUtil::selectObjectCount方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::selectObjectCount方法的具体用法?PHP DBUtil::selectObjectCount怎么用?PHP DBUtil::selectObjectCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::selectObjectCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDeletedPagesCount
public function getDeletedPagesCount($args)
{
$tables = DBUtil::getTables();
$historyColumn = $tables['content_history_column'];
$pageColumn = $tables['content_page_column'];
$where = "{$historyColumn['pageId']} not in (select {$pageColumn['id']} from {$tables['content_page']}) and {$historyColumn['action']} = '_CONTENT_HISTORYPAGEDELETED'";
/* related to delayed translation */
return DBUtil::selectObjectCount('content_history', $where, 'pageId');
// TODO: distinct
}
示例2: pendingContent
public static function pendingContent(Zikula_Event $event)
{
$dom = ZLanguage::getModuleDomain('News');
ModUtil::dbInfoLoad('News');
$dbtables = DBUtil::getTables();
$columns = $dbtables['news_column'];
$count = DBUtil::selectObjectCount('news', "WHERE $columns[published_status]=2");
if ($count > 0) {
$collection = new Zikula_Collection_Container('News');
$collection->add(new Zikula_Provider_AggregateItem('submission', _n('News article', 'News articles', $count, $dom), $count, 'admin', 'view', array('news_status'=>2)));
$event->getSubject()->add($collection);
}
}
示例3: countitemsselect
public function countitemsselect($args) {
$table = DBUtil::getTables();
$c = $table['IWbooks_column'];
extract($args);
$sql_eta = "";
if ($etapa != "TOT")
$sql_eta = " and " . $c['etapa'] . " LIKE '%$etapa%' ";
$sql_mat = "";
if ($materia != "TOT")
$sql_mat = " and " . $c['codi_mat'] . " = '$materia' ";
$sql_lect = "";
if ($lectura == 1) {
$sql_lect = "";
} else {
$sql_lect = " and " . $c['lectura'] . " != 1 ";
}
if (isset($flag) && $flag == 'admin')
$sql_lect = "";
$sql_niv = "";
if ($nivell != "")
$sql_niv = " and " . $c['nivell'] . " = '$nivell'";
$sql = " " . $c['any'] . " = '$any' "
. $sql_eta . $sql_niv . $sql_mat . $sql_lect;
$where = $sql;
//echo $sql;
return DBUtil::selectObjectCount('IWbooks', $where);
}
示例4: es_membre
public function es_membre($args) {
//Comprovem que el paràmetre identitat hagi arribat
if (!isset($args['gid'])) {
return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
}
// Security check
if (!SecurityUtil::checkPermission('IWgroups::', '::', ACCESS_ADMIN)) {
throw new Zikula_Exception_Forbidden();
}
$table = DBUtil::getTables();
$c = $table['group_membership_column'];
$where = "$c[gid] = $args[gid] AND $c[uid] = $args[uid]";
$nombre = DBUtil::selectObjectCount('group_membership', $where);
if ($nombre > 0) {
return true;
} else {
return false;
}
}
示例5: countitems
/**
* Utility function to count the number of items held by this module.
*
* @return integer Number of items held by this module.
*/
public function countitems()
{
// Return the number of items
return DBUtil::selectObjectCount('user_property');
}
示例6: countitems
/**
* utility function to count the url of items held by this module
*
* @return integer count of items held by this module
*/
public function countitems($args)
{
$args['catFilter'] = array();
if (isset($args['category']) && !empty($args['category'])){
if (is_array($args['category'])) {
$args['catFilter'] = $args['category'];
} elseif (isset($args['property'])) {
$property = $args['property'];
$args['catFilter'][$property] = $args['category'];
}
$args['catFilter']['__META__'] = array('module' => 'Feeds');
}
return DBUtil::selectObjectCount('feeds', '', 'fid', false, $args['catFilter']);
}
示例7: countitems
/**
* Count Quotes
* @author The Zikula Development Team
* @author Greg Allan
* @return int count of items
*/
public function countitems($args)
{
// optional arguments.
if (isset($args['category']) && !empty($args['category'])) {
if (is_array($args['category'])) {
$args['catFilter'] = $args['category'];
} elseif (isset($args['property'])) {
$property = $args['property'];
$args['catFilter'][$property] = $args['category'];
}
}
if (!isset($args['catFilter'])) {
$args['catFilter'] = array();
}
$where = $this->_process_args($args);
return DBUtil::selectObjectCount('quotes', $where, 'qid', false, $args['catFilter']);
}
示例8: referenced
public function referenced($args) {
// Security check
if (!SecurityUtil::checkPermission('IWtimeframes::', "::", ACCESS_ADMIN)) {
return LogUtil::registerError($this->__('Not authorized to manage timeFrames.'), 403);
}
if (ModUtil::apifunc('IWtimeframes', 'admin', 'installed', 'IWbookings')) {
$mdid = FormUtil::getPassedValue('mdid', isset($args['mdid']) ? $args['mdid'] : null, 'POST');
$tablename = 'IWbookings_spaces';
$where = 'mdid = ' . $mdid;
return (DBUtil::selectObjectCount($tablename, $where) > 0);
//$n = DBUtil::selectObjectCount($tablename, $where);
} else {
return false;
//$n = 0;
}
/* $modid = ModUtil::getIdFromName('IWbookings');
$modinfo = ModUtil::getInfo($modid);
if ($modinfo['state'] > 1) {
$mdid = FormUtil::getPassedValue('mdid', isset($args['mdid']) ? $args['mdid'] : null, 'POST');
$tablename = 'IWbookings_spaces';
$where = 'mdid = ' . $mdid;
return (DBUtil::selectObjectCount($tablename, $where) > 0);
} else {
return false;
}
*
*/
}
示例9: isHooked
/**
* Determine if a module is hooked by another module.
*
* @param string $tmodule The target module.
* @param string $smodule The source module - default the current top most module.
*
* @deprecated since 1.3.0
*
* @return boolean True if the current module is hooked by the target module, false otherwise.
*/
public static function isHooked($tmodule, $smodule)
{
if (!isset(self::$cache['ishooked'])) {
self::$cache['ishooked'] = array();
}
if (isset(self::$cache['ishooked'][$tmodule][$smodule])) {
return self::$cache['ishooked'][$tmodule][$smodule];
}
// define input, all numbers and booleans to strings
$tmodule = isset($tmodule) ? (string) $tmodule : '';
$smodule = isset($smodule) ? (string) $smodule : '';
// validate
if (!System::varValidate($tmodule, 'mod') || !System::varValidate($smodule, 'mod')) {
return false;
}
// Get database info
$tables = DBUtil::getTables();
$hookscolumn = $tables['hooks_column'];
// Get applicable hooks
$where = "WHERE {$hookscolumn['smodule']} = '" . DataUtil::formatForStore($smodule) . "'\n AND {$hookscolumn['tmodule']} = '" . DataUtil::formatForStore($tmodule) . "'";
self::$cache['ishooked'][$tmodule][$smodule] = $numitems = DBUtil::selectObjectCount('hooks', $where);
self::$cache['ishooked'][$tmodule][$smodule] = $numitems > 0;
return self::$cache['ishooked'][$tmodule][$smodule];
}
示例10: getCount
/**
* Return the record count for the given object set.
*
* @param string $where The where-clause to use.
* @param boolean $doJoin Whether or not to use the auto-join for the count.
*
* @return array The object's data set count.
*/
public function getCount($where = '', $doJoin = null)
{
if ($doJoin === null) {
$doJoin = (bool) $this->_objJoin;
} else {
$doJoin = (bool) $doJoin;
}
if ($this->_objJoin && $doJoin) {
$this->_objData = DBUtil::selectExpandedObjectCount($this->_objType, $this->_objJoin, $where, false, $this->_objCategoryFilter);
} else {
$this->_objData = DBUtil::selectObjectCount($this->_objType, $where, '1', false, $this->_objCategoryFilter);
}
return $this->_objData;
}
示例11: countitems
/**
* Utility function to count the number of items held by this module
*
* Credits to Lee Eason from http://pnflashgames.com for giving the idea
* to allow a module to find the number of comments that have been added
* to the module as a whole or to an individual item.
*
* @param $args['mod'] name of the module to get the number of comments for
* @param $args['objectid'] the objectid to get the number of comments for
* @param $args['status'] Status of the comments to get (default: all)
* @param $args['owneruid'] (optional) UID of owner
* @param $args['uid'] (optional) UID of poster
* @param $args['admin'] (optional) set to 1 if called from admin mode
* @return integer number of items held by this module
*/
public function countitems($args = array())
{
if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_OVERVIEW)) {
return false;
}
// get parameters
$owneruid = isset($args['owneruid']) ? (int)$args['owneruid'] : 0;
$uid = isset($args['uid']) ? (int)$args['uid'] : 0;
// Get database column names
$tables = DBUtil::getTables();
$columns = $tables['EZComments_column'];
// build the where clause
$queryargs = array();
if (isset($args['addwhere'])) {
$queryargs[] = $args['addwhere'];
}
if ($owneruid > 1 && $uid > 1) {
$queryargs[] = "$columns[owneruid] = '$args[owneruid]' OR $columns[uid] = '$args[uid]'";
} else if ($uid > 1) {
$queryargs[] = "$columns[uid] = '$args[uid]'";
} else if ($owneruid > 1) {
$queryargs[] = "$columns[owneruid] = '$args[owneruid]'";
}
if (isset($args['mod'])) {
// Count comments for a specific module
$mod = DataUtil::formatForStore($args['mod']);
$queryargs[] = "$columns[modname] = '$mod'";
if (isset($args['objectid'])) {
// Count comments for a specific item in a specific mod
$objectid = DataUtil::formatForStore($args['objectid']);
$queryargs[] = "$columns[objectid] = '$objectid'";
}
}
if (isset($args['status']) && is_numeric($args['status']) && $args['status'] >= 0 && $args['status'] <= 2) {
$queryargs[] = $columns['status'] . ' = \'' . DataUtil::formatForStore($args['status']) . '\'';
}
// admin mode: only count comments for modules considering permission checks
$admin = isset($args['admin']) ? (bool)$args['admin'] : false;
if ($admin) {
// get list of modules
$modlist = ModUtil::getAllMods();
$permclause = array();
foreach ($modlist as $module) {
// simple permission check
$inst = "$module[name]:".(isset($args['objectid']) ? $args['objectid'] : '').":";
if (SecurityUtil::checkPermission('EZComments::', $inst, ACCESS_EDIT)) {
$permclause[] = "$columns[modname] = '$module[name]'";
}
}
$queryargs[] = implode(' OR ', $permclause);
}
$where = '';
if (!empty($queryargs)) {
$where = implode(' AND ', $queryargs);
}
return DBUtil::selectObjectCount('EZComments', $where);
}
示例12: isuserpending
/**
* Check if user is pending.
*
* @param int $args['uid'] user id.
* @param int $args['gid'] group id.
*
* @return boolean
*/
public function isuserpending($args)
{
if (!isset($args['gid']) || !isset($args['uid'])) {
return LogUtil::registerArgsError();
}
$dbtable = DBUtil::getTables();
$col = $dbtable['group_applications_column'];
// Check in case the user already applied
$where = " WHERE $col[gid] = '" . (int)DataUtil::formatForStore($args['gid']) . "'
AND $col[uid] = '" . (int)DataUtil::formatForStore($args['uid']) . "'";
$result = DBUtil::selectObjectCount('group_applications', $where);
if ($result >= 1) {
return true;
}
return false;
}
示例13: importGtafEntities
/**
* Importa les taules de entitats-gtaf i grups d'entitats a partir d'un csv a la base de dades de Sirius
*
* Esborra el contingut previ de les taules i importa el contingut del fitxer
*
* @return void Retorna a la funció *gtafEntitiesGest* amb els missatges d'execució
*/
public function importGtafEntities() {
if (!SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// get input values. Check for direct function call first because calling function might be either get or post
if (isset($args) && is_array($args) && !empty($args)) {
$confirmed = isset($args['confirmed']) ? $args['confirmed'] : false;
$case = isset($args['case']) ? $args['case'] : false;
} elseif (isset($args) && !is_array($args)) {
throw new Zikula_Exception_Fatal(LogUtil::getErrorMsgArgs());
} elseif ($this->request->isGet()) {
$confirmed = 1;
} elseif ($this->request->isPost()) {
$this->checkCsrfToken();
$confirmed = $this->request->request->get('confirmed', false);
$case = $this->request->request->get('case',false);
}
if ($confirmed == 2) {
if ($case == 'entities') {
$caps = array(
'gtafEntityId' => 'gtafEntityId',
'nom' => 'nom',
'tipus' => 'tipus',
'gtafGroupId' => 'gtafGroupId'
);
$caps_man = $caps;
$taula = 'cataleg_gtafEntities';
$mes = "Importació d'entitats-gtaf";
$field_id = 'gtafEntityId';
} else {
$caps = array(
'gtafGroupId' => 'gtafGroupId',
'nom' => 'nom',
'resp_uid' => 'resp_uid'
);
$caps_man = array(
'gtafGroupId' => 'gtafGroupId',
'nom' => 'nom'
);
$taula = 'cataleg_gtafGroups';
$mes = "Importació de grups d'entitats-gtaf";
$field_id = 'gtafGroupId';
}
// get other import values
$importFile = $this->request->files->get('importFile', isset($args['importFile']) ? $args['importFile'] : null);
$fileName = $importFile['name'];
$importResults = '';
if ($fileName == '') {
$importResults = $this->__("No heu triat cap fitxer.");
} elseif (FileUtil::getExtension($fileName) != 'csv') {
$importResults = $this->__("L'extensió del fitxer ha de ser csv.");
} elseif (!$file_handle = fopen($importFile['tmp_name'], 'r')) {
$importResults = $this->__("No s'ha pogut llegir el fitxer csv.");
} else {
while (!feof($file_handle)) {
$line = fgetcsv($file_handle, 1024, ';', '"');
if ($line != '') {
$lines[] = $line;
}
}
fclose($file_handle);
//
foreach ($lines as $line_num => $line) {
if ($line_num != 0) {
if (count($lines[0]) != count($line)) {
$importResults .= $this->__("<div>Hi ha registres amb un número de camps incorrecte.</div>");
} else {
$import[] = array_combine($lines[0], $line);
$import_id[] = $line[0];
}
} else {
$difs = array_diff($line, $caps);
$difs2 = array_diff($caps_man,$line);
if (count($line) != count(array_unique($line))) {
$importResults .= $this->__("<div>La capçalera del csv té columnes repetides.</div>");
} elseif (!in_array($field_id, $line)) {
$importResults .= $this->__("<div>Falta el camp obligatori de la clau primària (id).</div>");
} elseif ($line[0] != $field_id) {
$importResults .= $this->__("<div>El camp obligatori de la clau primària (id) ha d'ocupar el primer lloc.</div>");
} elseif (!empty($difs2)) {
$importResults .= $this->__("<div>Falten camps obligatoris.</div>");
} elseif (!empty($difs)) {
$importResults .= $this->__("div>El csv té camps incorrectes.</div>");
}
}
}
if (count($import_id) != count(array_unique($import_id))) $importResults .= $this->__("<div>El fitxer té alguna id repetida.</div>");
}
if ($importResults == '') {
$old_reg = DBUtil::selectObjectCount($taula);
DBUtil::deleteWhere($taula);
//.........这里部分代码省略.........
示例14: countDocuments
public function countDocuments($args) {
$table = DBUtil::getTables();
$c = $table['IWdocmanager_column'];
$where = "$c[categoryId] = $args[categoryId] AND $c[validated] = 1 AND $c[versioned] <= 0";
$number = DBUtil::selectObjectCount('IWdocmanager', $where);
$where = "$c[categoryId] = $args[categoryId] AND $c[validated] = 0 AND $c[versioned] <= 0";
$number1 = DBUtil::selectObjectCount('IWdocmanager', $where);
$c = $table['IWdocmanager_categories_column'];
$where = "$c[categoryId] = $args[categoryId]";
$item = array('nDocuments' => $number,
'nDocumentsNV' => $number1
);
DBUtil::updateObject($item, 'IWdocmanager_categories', $where);
return true;
}
示例15: Admin_Messages_userapi_countitems
/**
* utility function to count the number of items held by this module
* @author Mark West
* @return int number of items held by this module
*/
function Admin_Messages_userapi_countitems()
{
return DBUtil::selectObjectCount('message', '');
}