本文整理汇总了PHP中JFactory::getDBO方法的典型用法代码示例。如果您正苦于以下问题:PHP JFactory::getDBO方法的具体用法?PHP JFactory::getDBO怎么用?PHP JFactory::getDBO使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFactory
的用法示例。
在下文中一共展示了JFactory::getDBO方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
}
$parameters = NNParameters::getInstance();
$params = $parameters->getPluginParams('nnframework');
$this->max_list_count = $params->max_list_count;
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
if ($group == 'categories') {
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
}
$attr = '';
$attr .= ' size="' . (int) $size . '"';
$attr .= $multiple ? ' multiple="multiple"' : '';
return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
示例2: hikashopSubscriptionType
function hikashopSubscriptionType()
{
if (!HIKASHOP_PHP5) {
$acl =& JFactory::getACL();
} else {
$acl = JFactory::getACL();
}
if (!HIKASHOP_J16) {
$this->groups = $acl->get_group_children_tree(null, 'USERS', false);
} else {
$db = JFactory::getDBO();
$db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC');
$this->groups = $db->loadObjectList('id');
foreach ($this->groups as $id => $group) {
if (isset($this->groups[$group->parent_id])) {
$this->groups[$id]->level = intval(@$this->groups[$group->parent_id]->level) + 1;
$this->groups[$id]->text = str_repeat('- - ', $this->groups[$id]->level) . $this->groups[$id]->text;
}
}
}
$this->choice = array();
$this->choice[] = JHTML::_('select.option', 'none', JText::_('HIKA_NONE'));
$this->choice[] = JHTML::_('select.option', 'special', JText::_('HIKA_CUSTOM'));
$js = "function updateSubscription(map){\r\n\t\t\tchoice = document.adminForm['choice_'+map];\r\n\t\t\tchoiceValue = 'special';\r\n\t\t\tfor (var i=0; i < choice.length; i++){\r\n\t\t\t\tif (choice[i].checked){\r\n\t\t\t\t\tchoiceValue = choice[i].value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\thiddenVar = document.getElementById('hidden_'+map);\r\n\t\t\tif(choiceValue != 'special'){\r\n\t\t\t\thiddenVar.value = choiceValue;\r\n\t\t\t\tif(hiddenVar.value == 'none') hiddenVar.value = '';\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = 'none';\r\n\t\t\t}else{\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = '';\r\n\t\t\t\tspecialVar = eval('document.adminForm.special_'+map);\r\n\t\t\t\tfinalValue = '';\r\n\t\t\t\tfor (var i=0; i < specialVar.length; i++){\r\n\t\t\t\t\tif (specialVar[i].checked){\r\n\t\t\t\t\t\tfinalValue += specialVar[i].value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\thiddenVar.value = finalValue;\r\n\t\t\t}\r\n\t\t}";
if (!HIKASHOP_PHP5) {
$doc =& JFactory::getDocument();
} else {
$doc = JFactory::getDocument();
}
$doc->addScriptDeclaration($js);
}
示例3: com_akeeba_postinstall_backuponupdate_action
/**
* Enable the backup on update feature
*/
function com_akeeba_postinstall_backuponupdate_action()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('1'))->where($db->qn('element') . ' = ' . $db->q('backuponupdate'))->where($db->qn('folder') . ' = ' . $db->q('system'));
$db->setQuery($query);
$db->execute();
}
示例4: sendMemberDaytimeToAdmin
function sendMemberDaytimeToAdmin($member_id, $service_id, $daytime_id)
{
define("BodyMemberDaytimeToAdmin", "<h1>Nouvelle inscription à une tranche horaire</h1><p>Un bénévole s'est inscrit à un secteur / tranche horaire.</p><p><strong>Nom :</strong> %s <br /><strong>Secteur :</strong> %s<br /><strong>Date :</strong> %s<br /><strong>Tranche horaire :</strong> %s</p><p><a href=\"" . JURI::root() . "/administrator/index.php?option=com_estivole&view=member&layout=edit&member_id=%s\">Cliquez ici</a> pour valider l'inscription et/ou recontacter le bénévole.</p>");
define("SubjectMemberDaytimeToAdmin", "Nouvelle inscription à une tranche horaire");
$db = JFactory::getDBO();
$query = $db->getQuery(TRUE);
$this->user = JFactory::getUser();
// Get the dispatcher and load the user's plugins.
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('user');
$data = new JObject();
$data->id = $this->user->id;
// Trigger the data preparation event.
$dispatcher->trigger('onContentPrepareData', array('com_users.profilestivole', &$data));
$userProfilEstivole = $data;
$userName = $userProfilEstivole->profilestivole['firstname'] . ' ' . $userProfilEstivole->profilestivole['lastname'];
$query->select('*');
$query->from('#__estivole_members as b, #__estivole_services as s, #__estivole_daytimes as d');
$query->where('b.member_id = ' . (int) $member_id);
$query->where('s.service_id = ' . (int) $service_id);
$query->where('d.daytime_id = ' . (int) $daytime_id);
$db->setQuery($query);
$mailModel = $db->loadObject();
$mail = JFactory::getMailer();
$mail->setBody(sprintf(constant("BodyMemberDaytimeToAdmin"), $userName, $mailModel->service_name, date('d-m-Y', strtotime($mailModel->daytime_day)), date('H:i', strtotime($mailModel->daytime_hour_start)) . ' - ' . date('H:i', strtotime($mailModel->daytime_hour_end)), $mailModel->member_id));
$mail->setSubject(constant("SubjectMemberDaytimeToAdmin"));
$mail->isHtml();
$recipient = array('benevoles@estivale.ch', $mailModel->email_responsable);
$mail->addRecipient($recipient);
$mail->Send('estivole@estivale.ch');
}
示例5: rebuild
function rebuild()
{
$class = hikashop_get('class.category');
$database = JFactory::getDBO();
$query = 'SELECT category_left,category_right,category_depth,category_id,category_parent_id FROM #__hikashop_category ORDER BY category_left ASC';
$database->setQuery($query);
$root = null;
$categories = $database->loadObjectList();
$class->categories = array();
foreach ($categories as $cat) {
$class->categories[$cat->category_parent_id][] = $cat;
if (empty($cat->category_parent_id)) {
$root = $cat;
}
}
if (!empty($root)) {
$query = 'UPDATE `#__hikashop_category` SET category_parent_id = ' . (int) $root->category_id . ' WHERE category_parent_id = 0 AND category_id != ' . (int) $root->category_id . '';
$database->setQuery($query);
$database->query();
}
$class->rebuildTree($root, 0, 1);
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('CATEGORY_TREE_REBUILT'));
$this->listing();
}
示例6: getInput
function getInput($name, $id, $value, $params, $children, $j15 = 0)
{
$this->params = $params;
JHTML::_('behavior.modal', 'a.modal');
$_size = $this->def('size');
$_multiple = $this->def('multiple', 1);
$_doc =& JFactory::getDocument();
$_js = "\n\t\t\tfunction jSelectArticle( id, title, object )\n\t\t\t{\n\t\t\t\tif ( document.getElementById(object+'_name') ) {\n\t\t\t\t\tdocument.getElementById(object+'_id').value = id;\n\t\t\t\t\tdocument.getElementById(object+'_name').value = title;\n\t\t\t\t} else {\n\t\t\t\t\t// multiple\n\t\t\t\t\tdocument.getElementById(object+'_id').value = document.getElementById(object+'_id').value.trim();\n\t\t\t\t\tif ( document.getElementById(object+'_id').value ) {\n\t\t\t\t\t\t document.getElementById(object+'_id').value += ',';\n\t\t\t\t\t}\n\t\t\t\t\tdocument.getElementById(object+'_id').value += id;\n\t\t\t\t}\n\t\t\t\tdocument.getElementById('sbox-window').close();\n\t\t\t}";
$_doc->addScriptDeclaration($_js);
$_link = 'index.php?option=com_content&task=element&tmpl=component&object=' . $id;
$html = "\n" . '<div style="float: left;">';
if (!$_multiple) {
$val_name = $value;
if ($value) {
$db =& JFactory::getDBO();
// load the list of menu types
$query = 'SELECT title' . ' FROM #__content' . ' WHERE id = ' . $value . ' LIMIT 1';
$db->setQuery($query);
$val_name = $db->loadResult();
$val_name .= ' [' . $value . ']';
}
$html .= '<input type="text" id="' . $id . '_name" value="' . $val_name . '" class="inputbox" size="' . $_size . '" disabled="disabled" />';
$html .= '<input type="hidden" name="' . $name . '" id="' . $id . '_id" value="' . $value . '" />';
} else {
$html .= '<input type="text" name="' . $name . '" id="' . $id . '_id" value="' . $value . '" class="inputbox" size="' . $_size . '" />';
}
$html .= '</div>';
$html .= '<div class="button2-left"><div class="blank"><a class="modal" title="' . JText::_('NN_SELECT_AN_ARTICLE') . '" href="' . $_link . '" rel="{handler: \'iframe\', size: {x: 650, y: 375}}">' . JText::_('NN_SELECT') . '</a></div></div>' . "\n";
return $html;
}
示例7: getOptions
protected function getOptions()
{
// Initialize variables.
$session = JFactory::getSession();
$attr = '';
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
$attr .= ' disabled="disabled"';
}
$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
$attr .= $this->multiple ? ' multiple="multiple"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
$db = JFactory::getDBO();
// generating query
$db->setQuery("SELECT c.title AS name, c.id AS id, c.parent_id AS parent FROM #__categories AS c WHERE published = 1 AND extension = 'com_solidres' ORDER BY c.title, c.parent_id ASC");
// getting results
$results = $db->loadObjectList();
if (count($results)) {
// iterating
$temp_options = array();
foreach ($results as $item) {
array_push($temp_options, array($item->id, $item->name, $item->parent));
}
foreach ($temp_options as $option) {
if ($option[2] == 1) {
$this->options[] = JHtml::_('select.option', $option[0], $option[1]);
$this->recursive_options($temp_options, 1, $option[0]);
}
}
}
}
示例8: displayAnnouncement
function displayAnnouncement($tpl = null) {
if (KunenaFactory::getConfig()->showannouncement > 0) {
$moderator = intval($this->me->isModerator('global'));
$cache = JFactory::getCache('com_kunena', 'output');
if ($cache->start("{$this->template->name}.common.announcement.{$moderator}", 'com_kunena.template')) return;
// User needs to be global moderator to edit announcements
if ($moderator) {
$this->canEdit = true;
} else {
$this->canEdit = false;
}
// FIXME: move into model
$db = JFactory::getDBO();
$query = "SELECT * FROM #__kunena_announcement WHERE published='1' ORDER BY created DESC";
$db->setQuery ( $query, 0, 1 );
$this->announcement = $db->loadObject ();
if (KunenaError::checkDatabaseError()) return;
if ($this->announcement) {
$this->annTitle = KunenaHtmlParser::parseText($this->announcement->title);
$this->annDescription = $this->announcement->sdescription ? KunenaHtmlParser::parseBBCode($this->announcement->sdescription) : KunenaHtmlParser::parseBBCode($this->announcement->description, 300);
$this->annDate = KunenaDate::getInstance($this->announcement->created);
$this->annListURL = KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=list");
$this->annMoreURL = !empty($this->announcement->description) ? KunenaRoute::_("index.php?option=com_kunena&view=announcement&id={$this->announcement->id}") : null;
$result = $this->loadTemplate($tpl);
if (JError::isError($result)) {
return $result;
}
echo $result;
} else {
echo ' ';
}
$cache->end();
} else echo ' ';
}
示例9: getListQuery
protected function getListQuery()
{
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true)->select($this->fields)->from($this->table_name . ' as h')->leftJoin('#__fleet_entity as c ON entity_id=c.id')->leftJoin('#__fleet_entity as b ON b.id=c.parent_entity_id');
return $query;
}
示例10: onPromoteData
function onPromoteData($id)
{
$db = JFactory::getDBO();
$Itemid = JRequest::getInt('Itemid');
$jschk = $this->_chkextension();
if (!empty($jschk)) {
$query = "SELECT cf.id FROM #__community_fields as cf\n\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cf.name like '%About me%' AND cfv.user_id=" . $id;
$db->setQuery($query);
$fieldid = $db->loadresult();
$query = "SELECT u.name AS title, cu.avatar AS image, cfv.value AS bodytext\n\t\t\t\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_users AS cu ON u.id=cu.userid\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cu.userid=cfv.user_id\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields AS cf ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cu.userid =" . $id;
if ($fieldid) {
$query .= " AND cfv.field_id=" . $fieldid;
}
$db->setQuery($query);
$previewdata = $db->loadObjectlist();
if (!$fieldid) {
$previewdata[0]->bodytext = '';
}
// Include Jomsocial core
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
include_once $jspath . DS . 'libraries' . DS . 'core.php';
$previewdata[0]->url = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $id), strlen(JUri::base(true)) + 1);
if ($previewdata[0]->image == '') {
$previewdata[0]->image = 'components/com_community/assets/user-Male.png';
}
return $previewdata;
} else {
return '';
}
}
示例11: _getContactQuery
/**
* Builds the query to select contact items
* @param array
* @return string
* @access protected
*/
function _getContactQuery(&$options)
{
// TODO: Cache on the fingerprint of the arguments
$db =& JFactory::getDBO();
$aid = @$options['aid'];
$id = @$options['id'];
$groupBy = @$options['group by'];
$orderBy = @$options['order by'];
$select = 'a.*, cc.title as category_name';
$from = '#__contact_details AS a';
$joins[] = 'INNER JOIN #__categories AS cc on cc.id = a.catid';
$wheres[] = 'a.id = ' . (int) $id;
$wheres[] = 'a.published = 1';
$wheres[] = 'cc.published = 1';
if ($aid !== null) {
$wheres[] = 'a.access <= ' . (int) $aid;
$wheres[] = 'cc.access <= ' . (int) $aid;
}
/*
* Query to retrieve all categories that belong under the contacts
* section and that are published.
*/
$query = 'SELECT ' . $select . ' FROM ' . $from . ' ' . implode(' ', $joins) . ' WHERE ' . implode(' AND ', $wheres);
return $query;
}
示例12: JSNISData
/**
* Contructor
*
*/
public function JSNISData()
{
$this->_setRootTag('database');
$this->_xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><' . $this->_rootTag . '></' . $this->_rootTag . '>');
$this->_setAttributteRootTag();
$this->_db = JFactory::getDBO();
}
示例13: getObjectOwner
function getObjectOwner($id)
{
$db =& JFactory::getDBO();
$db->setQuery("SELECT created_by, id FROM #__zoo_core_item WHERE id = " . $id);
$userid = $db->loadResult();
return intval($userid);
}
示例14: __construct
function __construct($name = null, $extensions = false)
{
jimport('legacy.component.helper');
JLoader::import('helpers.jupgradepro', JPATH_COMPONENT_ADMINISTRATOR);
// Creating dabatase instance for this installation
$this->_db = JFactory::getDBO();
// Set step table
if ($extensions == false) {
$this->_table = '#__jupgradepro_steps';
} else {
if ($extensions === 'tables') {
$this->_table = '#__jupgradepro_extensions_tables';
} else {
if ($extensions == true) {
$this->_table = '#__jupgradepro_extensions';
}
}
}
// Get the old version
$this->old_ver = JUpgradeproHelper::getVersion('old');
// Load the last step from database
if ($name !== false) {
$this->_load($name);
}
}
示例15: getGroups
/**
* Method to get the list of template style options
* grouped by template.
* Use the client attribute to specify a specific client.
* Use the template attribute to specify a specific template
*
* @return array The field option objects as a nested array in groups.
*
* @since 11.1
*/
protected function getGroups()
{
// Initialize variables.
$groups = array();
$lang = JFactory::getLanguage();
// Get the client and client_id.
$clientName = $this->element['client'] ? (string) $this->element['client'] : 'site';
$client = JApplicationHelper::getClientInfo($clientName, true);
// Get the template.
$template = (string) $this->element['template'];
// Get the database object and a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Build the query.
$query->select('s.id, s.title, e.name as name, s.template');
$query->from('#__template_styles as s');
$query->where('s.client_id = ' . (int) $client->id);
$query->order('template');
$query->order('title');
if ($template)
{
$query->where('s.template = ' . $db->quote($template));
}
$query->join('LEFT', '#__extensions as e on e.element=s.template');
$query->where('e.enabled=1');
// Set the query and load the styles.
$db->setQuery($query);
$styles = $db->loadObjectList();
// Build the grouped list array.
if ($styles)
{
foreach ($styles as $style)
{
$template = $style->template;
$lang->load('tpl_' . $template . '.sys', $client->path, null, false, false)
|| $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, null, false, false)
|| $lang->load('tpl_' . $template . '.sys', $client->path, $lang->getDefault(), false, false)
|| $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, $lang->getDefault(), false, false);
$name = JText::_($style->name);
// Initialize the group if necessary.
if (!isset($groups[$name]))
{
$groups[$name] = array();
}
$groups[$name][] = JHtml::_('select.option', $style->id, $style->title);
}
}
// Merge any additional groups in the XML definition.
$groups = array_merge(parent::getGroups(), $groups);
return $groups;
}