本文整理汇总了PHP中SugarFolder::getCountUnread方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarFolder::getCountUnread方法的具体用法?PHP SugarFolder::getCountUnread怎么用?PHP SugarFolder::getCountUnread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarFolder
的用法示例。
在下文中一共展示了SugarFolder::getCountUnread方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCountNewItems
/**
* Returns the number of "new" items (based on passed criteria)
* @param string id ID of folder
* @param array criteria
* expected:
* array('field' => 'status',
* 'value' => 'unread');
* @param array
* @return int
*/
function getCountNewItems($id, $criteria, $folder)
{
global $current_user;
$sugarFolder = new SugarFolder();
return $sugarFolder->getCountUnread($id);
/*
$sugarFolder = new SugarFolder();
return $sugarFolder->getCountUnread($id);
/*
$count = 0;
// if dynamic query is for "My Drafts" run special count logic.
if(!empty($folder['dynamic_query'])) {
$folder['dynamic_query'] = from_html($folder['dynamic_query']);
if(strpos($folder['dynamic_query'], "type = 'draft'") !== false) {
$q = "SELECT COUNT(*) c " . substr($folder['dynamic_query'], strpos($folder['dynamic_query'], "FROM"));
$r = $this->db->query($q);
$a = $this->db->fetchByAssoc($r);
$count = $a['c'];
}
}
$q = "SELECT polymorphic_module, polymorphic_id FROM folders_rel fr JOIN folders f ON fr.folder_id = f.id WHERE f.id = '{$id}'";
$r = $this->db->query($q);
$ins = ""; // IN () scope clause
while($a = $this->db->fetchByAssoc($r)) {
$table = strtolower($a['polymorphic_module']);
if(!empty($ins)) {
$ins .= ", ";
}
$ins .= "'{$a['polymorphic_id']}'";
}
if(isset($table)) {
$qC = "SELECT count(*) c FROM {$table} WHERE deleted = 0 AND id IN ({$ins}) AND {$criteria['field']} = '{$criteria['value']}'";
$rC = $this->db->query($qC);
$aC = $this->db->fetchByAssoc($rC);
return ($count + $aC['c']);
}
return $count;;
*/
}
示例2: getCountNewItems
/**
* Returns the number of "new" items (based on passed criteria)
* @param string id ID of folder
* @param array criteria
* expected:
* array('field' => 'status',
* 'value' => 'unread');
* @param array
* @return int
*/
function getCountNewItems($id, $criteria, $folder)
{
global $current_user;
$sugarFolder = new SugarFolder();
return $sugarFolder->getCountUnread($id);
}