本文整理汇总了PHP中DiscussHelper::getDbo方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::getDbo方法的具体用法?PHP DiscussHelper::getDbo怎么用?PHP DiscussHelper::getDbo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::getDbo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJoomlaTemplate
public static function getJoomlaTemplate($client = 'site')
{
static $template = array();
if (!array_key_exists($client, $template)) {
$clientId = $client == 'site' ? 0 : 1;
$db = DiscussHelper::getDbo();
if (DiscussHelper::isJoomla15()) {
$query = 'SELECT template FROM `#__templates_menu`' . ' WHERE client_id = ' . $db->quote($clientId) . ' AND menuid = 0';
} else {
$query = 'SELECT template FROM `#__template_styles` AS s' . ' LEFT JOIN `#__extensions` AS e ON e.type = `template` AND e.element=s.template AND e.client_id=s.client_id' . ' WHERE s.client_id = ' . $db->quote($clientId) . ' AND home = 1';
}
$db->setQuery($query);
// Fallback template
if (!($result = $db->loadResult())) {
$result = $client == 'site' ? 'beez_20' : 'bluestork';
}
$template[$client] = $result;
}
return $template[$client];
}
示例2: diplayRole
public function diplayRole()
{
// Initialise variables
$mainframe = JFactory::getApplication();
$roleId = JRequest::getVar('role_id', '');
$role = DiscussHelper::getTable('Role');
$role->load($roleId);
$role->title = JString::trim($role->title);
$this->role = $role;
// Set default values for new entries.
if (empty($role->created_time)) {
$date = DiscussHelper::getHelper('Date')->dateWithOffSet();
$role->created_time = $date->toFormat();
$role->published = true;
}
$groups = DiscussHelper::getJoomlaUserGroups();
// Remove the selected usergroups
$db = DiscussHelper::getDbo();
$query = 'SELECT `usergroup_id` FROM `#__discuss_roles`';
$db->setQuery($query);
$result = $db->loadResultArray();
if (!empty($result)) {
foreach ($groups as $key => $group) {
if (in_array($group->id, $result) && $group->id != $role->usergroup_id) {
unset($groups[$key]);
}
}
}
$usergroupList = JHTML::_('select.genericlist', $groups, 'usergroup_id', 'class="full-width"', 'id', 'name', $role->usergroup_id);
$this->assignRef('role', $role);
$this->assignRef('usergroupList', $usergroupList);
$colors = array();
$colors[] = JHTML::_('select.option', 'success', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_SUCCESS'));
$colors[] = JHTML::_('select.option', 'warning', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_WARNING'));
$colors[] = JHTML::_('select.option', 'important', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_IMPORTANT'));
$colors[] = JHTML::_('select.option', 'info', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_INFO'));
$colors[] = JHTML::_('select.option', 'inverse', JText::_('COM_EASYDISCUSS_LABEL_COLORCODE_INVERSE'));
$colorList = JHTML::_('select.genericlist', $colors, 'colorcode', 'class="full-width"', 'value', 'text', $role->colorcode);
$this->assignRef('colorList', $colorList);
parent::display('edit');
}
示例3: removeACL
public function removeACL()
{
$db = DiscussHelper::getDbo();
$query = 'DELETE FROM `#__discuss_category_acl_map`' . ' WHERE `category_id` = ' . $db->quote($this->id) . ' AND `type` = ' . $db->quote('group');
$db->setQuery($query);
$db->query();
return true;
}
示例4: getSubscribers
/**
* Get subscribers according to type
*/
public static function getSubscribers($type, $cid, $categoryId, $params = array(), $excludes = array())
{
$db = DiscussHelper::getDbo();
$query = 'SELECT `content_id` FROM `#__discuss_category_acl_map`';
$query .= ' WHERE `category_id` = ' . $db->Quote($categoryId);
$query .= ' AND `acl_id` = ' . $db->Quote(DISCUSS_CATEGORY_ACL_ACTION_VIEW);
$query .= ' AND `type` = ' . $db->Quote('group');
$db->setQuery($query);
$categoryGrps = $db->loadResultArray();
if (!empty($categoryGrps)) {
$result = array();
$aclItems = array();
$nonAclItems = array();
// Site members
$queryCatIds = implode(',', $categoryGrps);
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
$query = 'SELECT ds.* FROM `#__discuss_subscription` AS ds';
$query .= ' INNER JOIN `#__user_usergroup_map` as um on um.`user_id` = ds.`userid`';
$query .= ' WHERE ds.`interval` = ' . $db->Quote('instant');
$query .= ' AND ds.`type` = ' . $db->Quote($type);
$query .= ' AND ds.`cid` = ' . $db->Quote($cid);
$query .= ' AND um.`group_id` IN (' . $queryCatIds . ')';
} else {
$query = 'SELECT ds.* FROM `#__discuss_subscription` AS ds';
$query .= ' INNER JOIN `#__core_acl_aro` as caa on caa.`value` = ds.`userid`';
$query .= ' INNER JOIN `#__core_acl_groups_aro_map` as cagam on cagam.`aro_id` = caa.`id`';
$query .= ' WHERE ds.`interval` = ' . $db->Quote('instant');
$query .= ' AND ds.`type` = ' . $db->Quote($type);
$query .= ' AND ds.`cid` = ' . $db->Quote($cid);
$query .= ' AND cagam.`group_id` IN (' . $queryCatIds . ')';
}
$db->setQuery($query);
$aclItems = $db->loadObjectList();
// Now get the guest subscribers
if (in_array('1', $categoryGrps) || in_array('0', $categoryGrps)) {
$query = 'SELECT * FROM `#__discuss_subscription` AS ds';
$query .= ' WHERE ds.`interval` = ' . $db->Quote('instant');
$query .= ' AND ds.`type` = ' . $db->Quote($type);
$query .= ' AND ds.`cid` = ' . $db->Quote($cid);
$query .= ' AND ds.`userid` = ' . $db->Quote('0');
$db->setQuery($query);
$nonAclItems = $db->loadObjectList();
}
$result = array_merge($aclItems, $nonAclItems);
} else {
$query = 'SELECT * FROM `#__discuss_subscription` ' . ' WHERE `type` = ' . $db->Quote($type) . ' AND `cid` = ' . $db->Quote($cid) . ' AND `interval` = ' . $db->Quote('instant');
// Add email exclusions if there are any exclusions
if (!empty($excludes)) {
$excludes = !is_array($excludes) ? array($excludes) : $excludes;
$query .= 'AND ' . $db->nameQuote('email') . ' NOT IN(';
for ($i = 0; $i < count($excludes); $i++) {
$query .= $db->Quote($excludes[$i]);
if (next($excludes) !== false) {
$query .= ',';
}
}
$query .= ')';
}
$db->setQuery($query);
$result = $db->loadObjectList();
}
//lets run another checking to ensure the emails doesnt exists in exclude array
$finalResult = array();
if (count($excludes) > 0 && count($result) > 0) {
foreach ($result as $item) {
$email = $item->email;
if (!in_array($email, $excludes)) {
$finalResult[] = $item;
}
}
}
if (empty($excludes)) {
$finalResult = $result;
}
return $finalResult;
}