本文整理汇总了PHP中Jfactory::getDBO方法的典型用法代码示例。如果您正苦于以下问题:PHP Jfactory::getDBO方法的具体用法?PHP Jfactory::getDBO怎么用?PHP Jfactory::getDBO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jfactory
的用法示例。
在下文中一共展示了Jfactory::getDBO方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->_table_prefix = '#__' . TABLE_PREFIX . '_';
$this->_db = Jfactory::getDBO();
$this->_session = JFactory::getSession();
$this->_order_functions = new order_functions();
$this->_extra_field = new extra_field();
$this->_extraFieldFront = new extraField();
$this->_redhelper = new redhelper();
$this->_producthelper = new producthelper();
$this->_shippinghelper = new shipping();
}
示例2: onContentSearch
/**
* Example Search method
*
* The sql must return the following fields that are used in a common display
* routine:
- title;
- href: link associated with the title;
- browsernav if 1, link opens in a new window, otherwise in the same window;
- section in parenthesis below the title;
- text;
- created;
* @param string Target search string
* @param string matching option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if the search it to be restricted to areas, null if search all
*
* @return array Search results
*/
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$result = array();
// jelenleg semmilyen paramétert nem veszek figyelembe és hozzáférés ellenörzés sincs.
$db = Jfactory::getDBO();
// témakorok
$db->setQuery('select t.megnevezes as title,
t.id,
"2" as browsernav,
"' . JText::_('TEMAKOROK') . '" as section,
"" as `text`,
t.letrehozva as created
from #__temakorok t
where t.megnevezes like "%' . $text . '%"
order by t.id DESC');
$res = $db->loadObjectList();
foreach ($res as $res1) {
$res1->href = 'index.php?option=com_szavazasok&view=szavazasoklist&temakor=' . $res1->id;
$result[] = $res1;
}
// szavazások
$db->setQuery('select sz.megnevezes as title,
sz.id,
"2" as browsernav,
"' . JText::_('SZAVAZASOK') . '" as section,
"" as `text`,
sz.letrehozva as created
from #__szavazasok sz
where sz.megnevezes like "%' . $text . '%"
order by sz.id DESC');
$res = $db->loadObjectList();
foreach ($res as $res1) {
$res1->href = 'index.php?option=com_alternativak&view=alternativaklist&szavazas=' . $res1->id;
$result[] = $res1;
}
// alternativák
$db->setQuery('select sz.megnevezes as title,
sz.id,
"2" as browsernav,
"' . JText::_('ALTERNATIVAK') . '" as section,
"" as `text`,
sz.letrehozva as created
from #__szavazasok sz, #__alternativak a
where a.szavazas_id = sz.id and a.megnevezes like "%' . $text . '%"
order by sz.id DESC');
$res = $db->loadObjectList();
foreach ($res as $res1) {
$res1->href = 'index.php?option=com_alternativak&view=alternativaklist&szavazas=' . $res1->id;
$result[] = $res1;
}
return $result;
}
示例3: __construct
public function __construct($params)
{
$this->_params = $params;
$this->_db = Jfactory::getDBO();
if (JRequest::getCmd('option') == 'com_joomleague') {
$p = JRequest::getInt('p', $params->get('default_project_id'));
} else {
$p = $params->get('default_project_id');
}
$this->_project_id = intval($p);
$this->_project = $this->getProject();
$this->_round_id = JRequest::getInt('r');
$this->_division_id = JRequest::getInt('division', 0);
$this->_team_id = JRequest::getInt('tid', 0);
}
示例4: _checkVersionTable
/**
* make sure the version table has the proper structure (1.0 import !)
* if not, update it
*/
function _checkVersionTable()
{
$db = Jfactory::getDBO();
$res = $db->getTableFields('#__joomleague_version');
$cols = array_keys(reset($res));
if (!in_array('major', $cols)) {
$query = ' ALTER TABLE #__joomleague_version ADD `major` INT NOT NULL ,
ADD `minor` INT NOT NULL ,
ADD `build` INT NOT NULL ,
ADD `count` INT NOT NULL ,
ADD `revision` VARCHAR(128) NOT NULL ,
ADD `file` VARCHAR(255) NOT NULL';
$db->setQuery($query);
if (!$db->query()) {
echo JText::_('Failed updating version table');
}
}
}
示例5: getItems
/**
* rekord sorozat beolvasása az adatbázisból
* @JRequest filter, order, limit, limitstart
* @return array of records
*/
public function getItems($state)
{
$db = Jfactory::getDBO();
$query = $this->getListQuery($state);
$limit = 100000;
$limitstart = $state->limitstart;
if ($limit == '') {
$limit = 20;
}
if ($limit == 0) {
$limit = 20;
}
if ($limitstart == '') {
$limitstart = 0;
}
$db->setQuery($query, $limitstart, $limit);
return $db->loadObjectList();
}
示例6: getItems
/**
* rekord sorozat beolvasása az adatbázisból
* @JRequest filter, order, limit, limitstart
* @return array of records
*/
public function getItems($state)
{
$db = Jfactory::getDBO();
$query = $this->getListQuery($state);
$limit = JRequest::getvar('limit', 20);
$limitstart = JRequest::getvar('limitstart', 0);
if ($limit == '') {
$limit = 20;
}
if ($limit == 0) {
$limit = 20;
}
if ($limitstart == '') {
$limitstart = 0;
}
$db->setQuery($query, $limitstart, $limit);
return $db->loadObjectList();
}
示例7: postflight
/**
* Post-flight extension installer method.
*
* This method runs after all other installation code.
*
* @param $type
* @param $parent
*
* @return void
* @since 1.0.3
*/
function postflight($type, $parent)
{
// Display a move files and folders to parent.
jimport('joomla.filesystem.folder');
$srcBase = JPATH_PLUGINS . '/editors/arkeditor/layouts/joomla/';
$dstBase = JPATH_SITE . '/layouts/joomla/';
$folders = JFolder::folders($srcBase);
$manifest = $parent->getParent()->getManifest();
$attributes = $manifest->attributes();
$method = $attributes->method ? (string) $attributes->method : false;
foreach ($folders as $folder) {
if ($method != 'upgrade') {
if (JFolder::exists($dstBase . $folder)) {
JFolder::delete($dstBase . $folder);
}
}
JFolder::copy($srcBase . $folder, $dstBase . $folder, null, true);
}
if ($type == 'install') {
//update $db
$db = Jfactory::getDBO();
$toolbars = base64_encode('{"back":[[ "Templates" ],[ "Cut","Copy","Paste","PasteText","PasteFromWord" ] ,["SelectAll","SpellChecker", "Scayt" ] ,["Bold","Italic","Underline","Strike","Subscript","Superscript","-","RemoveFormat" ] ,[ "NumberedList","BulletedList","Outdent","Indent","-","Blockquote","CreateDiv","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock","BidiLtr","BidiRtl" ],[ "Link","Document","Unlink","Anchor" ], [ "Image","Flash","Table","Smiley","SpecialChar","PageBreak","Iframe" ],[ "Styles","Format","Font","FontSize" ],[ "TextColor","BGColor" ],[ "Maximize", "ShowBlocks","-","About" ]],"front":[[ "Templates" ],[ "Cut","Copy","Paste","PasteText","PasteFromWord"] ,["Bold","Italic","Underline","Strike","RemoveFormat" ], [ "NumberedList","BulletedList","Outdent","Indent","Blockquote"],[ "Link","Document","Unlink","Anchor" ],[ "Image","Table","SpecialChar","PageBreak","Iframe"],["Styles","Format" ],[ "Maximize", "ShowBlocks","About" ]],"inline" :[["Sourcedialog","Bold","NumberedList","BulletedList"],["PasteText","Image","Link","Document"],["Format"],["Readmore"],["Save"],["Versions"],["Close"] ],"title":[["Save"],["Cut","Copy","PasteText"],["Undo"],["Close"]],"image":[["Save"],["Image"],["Link","Document"],["Close"]],"mobile":[["Bold"],["Link"],["Image"],["Save"],["Versions"],["Close"]]}');
$query = $db->getQuery(true);
$query->select('params')->from('#__extensions')->where('folder = ' . $db->quote('editors'))->where('element = ' . $db->quote('arkeditor'));
$db->setQuery($query);
$params = $db->loadResult();
if ($params === false) {
throw new Exception('Failed to retrieve parameters from Editor');
}
if (!$params) {
$params = '{}';
}
$params = new JRegistry($params);
$params->set('toolbars', $toolbars);
$query->clear()->update('#__extensions')->set('params= ' . $db->quote($params->toString()))->where('folder = ' . $db->quote('editors'))->where('element = ' . $db->quote('arkeditor'));
$db->setQuery($query);
if (!$db->query()) {
throw new Exception('Failed to update parameters for Editor');
}
}
}
示例8: getProgram
function getProgram()
{
$database = Jfactory::getDBO();
if (empty($this->_attribute)) {
$this->_attribute = $this->getTable("guruPrograms");
$this->_attribute->load($this->_id);
}
$data = JRequest::get('post');
if (!$this->_attribute->bind($data)) {
$this->setError($item->getErrorMsg());
return false;
}
if (!$this->_attribute->check()) {
$this->setError($item->getErrorMsg());
return false;
}
$sql = "SELECT sum(lt.time) AS course_time \r\n\t\t\t FROM `#__guru_task` as lt \r\n\t\t\t LEFT JOIN `#__guru_mediarel` lm on lt.id=lm.media_id \r\n\t\t\t LEFT JOIN `#__guru_days` as ld on lm.type_id=ld.id\r\n\t\t\t WHERE type='dtask' and ld.pid=" . $this->_id;
$database->setQuery($sql);
$database->query();
$result = $database->loadResult();
$hours = intval($result / 60);
$minutes = $result % 60;
$this->_attribute->duration = $hours . ":" . $minutes;
switch ($this->_attribute->level) {
case "0":
$this->_attribute->level = JText::_('GURU_LEVEL_BEGINER');
break;
case "1":
$this->_attribute->level = JText::_('GURU_LEVEL_INTERMEDIATE');
break;
case "2":
$this->_attribute->level = JText::_('GURU_LEVEL_ADVANCED');
break;
}
return $this->_attribute;
}
示例9: Joom_CompleteBreadcrumbs
function Joom_CompleteBreadcrumbs($catid, $id, $func = '')
{
$config = Joom_getConfig();
$mainframe =& JFactory::getApplication('site');
$database =& Jfactory::getDBO();
$user =& JFactory::getUser();
$pathway =& $mainframe->getPathway();
// Sonderfaelle zuerst
switch ($func) {
case 'userpanel':
$pathway->addItem(JText::_('JGS_USER_PANEL'));
break;
case 'uploadhandler':
case 'showupload':
$pathway->addItem(JText::_('JGS_USER_PANEL'), 'index.php?option=com_joomgallery&func=userpanel' . _JOOM_ITEMID);
$pathway->addItem(JText::_('JGS_NEW_PICTURE'));
break;
case 'showusercats':
$pathway->addItem(JText::_('JGS_USER_PANEL'), 'index.php?option=com_joomgallery&func=userpanel' . _JOOM_ITEMID);
$pathway->addItem(JText::_('JGS_CATEGORIES'));
break;
case 'newusercat':
$pathway->addItem(JText::_('JGS_USER_PANEL'), 'index.php?option=com_joomgallery&func=userpanel' . _JOOM_ITEMID);
$pathway->addItem(JText::_('JGS_NEW_CATEGORY'));
break;
case 'showfavourites':
if ($user->get('id') && $config->jg_usefavouritesforzip != 1) {
$pathway->addItem(JText::_('JGS_FAV_MY'));
} else {
$pathway->addItem(JText::_('JGS_ZIP_MY'));
}
break;
case 'createzip':
$pathway->addItem(JText::_('JGS_ZIP_DOWNLOAD'));
break;
}
if ($func != '' && $func != 'viewcategory' && $func != 'detail') {
return;
}
// falls keine catid vorhanden
if ($catid == 0 || $func == 'detail') {
if ($id != 0) {
$database->setQuery(" SELECT \n a.id,\n a.imgtitle,\n a.catid\n FROM \n #__joomgallery AS a, \n #__joomgallery_catg AS cc\n WHERE \n a.catid = cc.cid \n AND a.id = '{$id}' \n AND cc.access <= '" . $user->get('aid') . "'\n ");
if (!($row = $database->loadObject())) {
return false;
}
$catid = $row->catid;
} else {
return false;
}
}
// catid ist hier auf jeden Fall gesetzt
// id's und Namen aller uebergeordneten Kategorien aus der Datenbank holen
$cat_ids = array($catid);
$cat_names = array();
while ($catid != 0) {
$database->setQuery(" SELECT \n name,\n parent,\n cid \n FROM \n #__joomgallery_catg\n WHERE \n cid = '{$catid}' \n AND published = '1' \n AND access <= '" . $user->get('aid') . "'\n ");
if (!($cat_row = $database->loadObject())) {
$catid = 0;
} else {
$catid = $cat_row->parent;
}
if ($catid != 0) {
array_unshift($cat_ids, $catid);
}
array_unshift($cat_names, $cat_row->name);
}
// Breadcrumbs mit Kategorien vervollstaendigen
for ($i = 0; $i < count($cat_names); $i++) {
$pathway->addItem($cat_names[$i], 'index.php?option=com_joomgallery&func=viewcategory&catid=' . $cat_ids[$i] . _JOOM_ITEMID);
}
// eventuell Bildnamen hinzufuegen
if (isset($row->id)) {
$pathway->addItem($row->imgtitle, 'index.php?option=com_joomgallery&func=detail&id=' . $row->id . _JOOM_ITEMID);
}
}
示例10: getAttendeesNumbers
/**
* Adds attendees numbers to rows
*
* @param $data reference to event rows
* @return false on error, $data on success
*/
static function getAttendeesNumbers(&$data)
{
// Make sure this is an array and it is not empty
if (!is_array($data) || !count($data)) {
return false;
}
// Get the ids of events
$ids = array();
foreach ($data as $event) {
$ids[] = $event->id;
}
$ids = implode(",", $ids);
$db = Jfactory::getDBO();
$query = $db->getQuery(true);
$query->select('COUNT(id) as total, SUM(waiting) as waitinglist, event');
$query->from('#__jem_register');
$query->where('event IN (' . $ids . ')');
$query->group('event');
$db->setQuery($query);
$res = $db->loadObjectList('event');
foreach ($data as $k => $event) {
if (isset($res[$event->id])) {
$data[$k]->waiting = $res[$event->id]->waitinglist;
$data[$k]->regCount = $res[$event->id]->total - $res[$event->id]->waitinglist;
} else {
$data[$k]->waiting = 0;
$data[$k]->regCount = 0;
}
$data[$k]->available = $data[$k]->maxplaces - $data[$k]->regCount;
}
return $data;
}
示例11: onAfterProcess
function onAfterProcess($params, &$formModel)
{
if ($params->get('notification_ajax', 0) == 1) {
return;
}
$user =& JFactory::getUser();
$userid = $user->get('id');
$notify = JRequest::getInt('fabrik_notification', 0);
if ($userid == 0) {
return;
}
$label = '';
foreach ($formModel->_data as $k => $v) {
if (strstr($k, 'title')) {
$label = $v;
break;
}
}
$why = JRequest::getInt('rowid') == 0 ? 'author' : 'editor';
$this->process($notify, $why, $label);
// add entry indicating the form has been updated this record will then be used by the cron plugin to
// see which new events have been generated and notify subscribers of said events.
$db =& Jfactory::getDBO();
$event = JRequest::getInt('rowid') == 0 ? $db->Quote(JText::_('RECORD_ADDED')) : $db->Quote(JText::_('RECORD_UPDATED'));
$date = JFactory::getDate();
$date = $db->Quote($date->toMySQL());
$ref = $this->getRef();
$msg = $notify ? JText::_('PLG_CRON_NOTIFICATION_ADDED') : JText::_('PLG_CRON_NOTIFICATION_REMOVED');
$app =& JFactory::getApplication();
$app->enqueueMessage($msg);
$db->setQuery("INSERT INTO #__fabrik_notification_event (`reference`, `event`, `user_id`, `date_time`) VALUES ({$ref}, {$event}, {$userid}, {$date})");
$db->query();
}
示例12: plgRedform_integrationRedevent
public function plgRedform_integrationRedevent(&$subject, $config = array())
{
parent::__construct($subject, $config);
$this->loadLanguage();
$this->_db =& Jfactory::getDBO();
}
示例13: save
/**
* @param array (form array) CSAK MÓDOSÍTÁS felvitel nincs
* user_id, user_name, user_username, user_email, user_psw, user_psw2
* fcsop_1, terszerv_fcsop1_1, terszerv_fcsop1_2,......
* fcsop_2, terszerv_fcsop2_1, terszerv_fcsop2_2,......
*
* fcsop_1, fcsop_2 ... tartalma felhcsop_id
* terszerv_###_1, terszerv_###_2 ... tartalma tervesz_id (### fcsop_id)
* hilrlevelemail_#### (### fcsop_id)
* @return true vagy false
*/
public function save($data) {
//DBG echo 'model save rutin ';
//DBG echo '<pre>'; print_r($data); echo '</pre>';
$manager = false;
$hirlevelKezelo = false;
$db = Jfactory::getDBO();
// user_terhat rekordok törlése
$db->setQuery('delete from #__tny_felh_terhat where felh_id='.$db->quote($data['user_id']));
if ($db->query()) {
// user terhat rekordok tárolása
for ($fcsi = 1; $fcsi < 20; $fcsi++) {
// van "fcsop_$fcsi" adat a $data -ban?
if (isset($data["fcsop_$fcsi"])) {
$fcsop = $data["fcsop_$fcsi"];
// fcsop rekord beolvasása
$db->setQuery('select * from #__tny_felhcsoportok where fcsop_id='.$db->quote($fcsop));
$felhCsop = $db->loadObject();
if ($felhCsop->jog_felhasznalok == 1) $manager = true;
if ($felhCsop->jog_hirlevel == 1) $hirlevelKezelo = true;
//DBG echo '<p>Van fcsop '.$fcsi.' fcsop='.$fcsop.'</p>';
for ($fthi = 1; $fthi < 200; $fthi++) {
// ha van "terszerv_$fcsop_$thi" adat a tömbben akkor rekord kiirás
if (isset($data['terszerv_'.$fcsop.'_'.$fthi])) {
//DBG echo '<p>van terszerv adat </p>';
$db->setQuery('insert into #__tny_felh_terhat
values ('.$db->quote($data['user_id']).',
'.$db->quote($fcsop).',
'.$db->quote($data['terszerv_'.$fcsop.'_'.$fthi]).',
'.$db->quote($data['commentemail_'.$fcsop]).'
)');
//DBG echo '<p>'.$db->getQuery().'</p>';
if (!$db->query()) {
$this->setError($db->getErrorMsg());
return false;
}
}
}
}
}
} else {
$this->setError($db->getErrorMsg());
return false;
}
// Joomla usergroup besorolás kezelése
// 10 usergroupba mindenképpen tartozik
// ha hírlevél kezelõ akkor 11 usergroupba is tartozik
// ha felhasználó kezelõ akkor 6 usergroupba is tartozik
$db->setQuery('delete from #__user_usergroup_map where user_id='.$db->quote($data['user_id']).' and (group_id=6 or group_id=11 or group_id=10)');
$db->query();
$db->setQuery('insert into #__user_usergroup_map values ('.$db->quote($data['user_id']).',10)');
$db->query();
if ($manager) {
$db->setQuery('insert into #__user_usergroup_map values ('.$db->quote($data['user_id']).',6)');
$db->query();
}
if ($hirlevelKezelo) {
$db->setQuery('insert into #__user_usergroup_map values ('.$db->quote($data['user_id']).',11)');
$db->query();
}
return true;
}
示例14: _getRoundcode
/**
* return round roundcode
*
* @param int $round_id
* @return int roundcode
*/
function _getRoundcode($round_id)
{
if (empty($this->_roundcodes)) {
$db = Jfactory::getDBO();
$query = ' SELECT r.roundcode, r.id ' . ' FROM #__joomleague_round AS r ' . ' WHERE r.project_id = ' . $this->_projectid;
$db->setQuery($query);
$this->_roundcodes = $db->loadAssocList('id');
}
if (!isset($this->_roundcodes[$round_id])) {
JError::raiseWarning(0, JText::_('COM_JOOMLEAGUE_RANKING_ERROR_UNKOWN_ROUND_ID') . ': ' . $round_id);
return false;
}
return $this->_roundcodes[$round_id];
}
示例15: function
<?php
// itt most rejtett divisionokba létre kell hozni a lehetséges popup listboxokat
// div.id="helpMezonev", select.id=""
// - területi szervezetek
// - kategoriák
// - cimkék
// - nem
// főmenüből is van inditva JSession::checkToken() or die( 'Invalid Token' );
$db = Jfactory::getDBO();
if (JRequest::getVar('task') == 'szures') {
echo '<h2>Kapcsolatok szűrés</h2>';
}
if (JRequest::getVar('task') == 'groupedit') {
echo '<h2>Csoportos módosítás - szűrés</h2>
<p>Alakitsa ki azt a listát amit modósítani akar!</p>';
}
if (JRequest::getVar('task') == 'szurtexport') {
echo '<h2>Exportálás CSV fájlba - szűrés</h2>
<p>Alakitsa ki azt a listát amit exportálni akar!</p>';
}
if (JRequest::getVar('task') == 'hirlevel') {
echo '<h2>Hírlevél küldés - szűrés</h2>
<p>Alakitsa ki azt a listát akinek hírlevelet akar küldeni!</p>';
}
?>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(task) {