当前位置: 首页>>代码示例>>PHP>>正文


PHP JFactory::getDBo方法代码示例

本文整理汇总了PHP中JFactory::getDBo方法的典型用法代码示例。如果您正苦于以下问题:PHP JFactory::getDBo方法的具体用法?PHP JFactory::getDBo怎么用?PHP JFactory::getDBo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JFactory的用法示例。


在下文中一共展示了JFactory::getDBo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getRecord

 /**
  * Get record by user id and discount id
  *
  * @param $uid
  * @param $did
  * @return mixed
  */
 public function getRecord($uid, $did)
 {
     // get database
     $db = JFactory::getDBo();
     $query = $db->getQuery(true);
     $query->select('*')->from($this->name)->where(array('user_id=' . (int) $uid, 'discount_id=' . (int) $did))->limit(1);
     $db->setQuery($query);
     return $db->loadObject();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:user_discount.php

示例2: getRelatedSubscription

 /**
  * Get subscription by order and item
  *
  * @param   int Order
  * @param   int Item
  *
  * @return mixed
  */
 public function getRelatedSubscription($order_id, $item_id)
 {
     $db = JFactory::getDBo();
     $query = $db->getQuery(true);
     $query->select('*')->from($this->name)->where(array('order_id=' . (int) $order_id, 'item_id=' . (int) $item_id));
     $db->setQuery($query, 0, 1);
     $subscription = $db->loadObject($this->class, 'id');
     return $subscription;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:17,代码来源:subscriptions.php

示例3: getByType

 /**
  * Get email template by it's type
  *
  * @param   string
  * @param   language
  *
  * @return  mixed
  */
 public function getByType($type, $language = null)
 {
     $db = JFactory::getDBo();
     $conditions = array("`type`='" . $db->escape($type) . "'");
     if (!empty($language)) {
         $conditions[] = '`language`=' . $db->quote($language);
     }
     $query = $db->getQuery(true);
     $query->select('*')->from($this->name)->where($conditions);
     $db->setQuery($query, 0, 1);
     return $db->loadObjectList();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:20,代码来源:emails.php

示例4: countOwn

 /**
  * Count addresses, related to current user:
  */
 public function countOwn()
 {
     $count = 0;
     $user = $this->app->user->get();
     if ($user->id) {
         $db = JFactory::getDBo();
         $query = $db->getQuery(true);
         $query->select("COUNT(id)")->from($this->name)->where(array("user_id=" . (int) $user->id));
         $db->setQuery($query);
         $count = (int) $db->loadResult();
     }
     return $count;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:addresses.php

示例5: hit

 /**
  * Increase used field of the chosen discount
  *
  * @param $id
  */
 public function hit($id)
 {
     $db = JFactory::getDBo();
     $query = $db->getQuery(true);
     $query->update($this->name)->set(array('`used`=`used`+1'))->where(array('`id`=' . (int) $id));
     $db->setQuery($query);
     $db->execute();
     $discount = $this->get($id);
     if ($discount->hits_per_user) {
         $hitrow = $this->app->table->user_discount->getRecord($this->app->user->get()->id, $id);
         if (empty($hitrow)) {
             $hitrow = new stdClass();
             $hitrow->user_id = (int) $this->app->user->get()->id;
             $hitrow->discount_id = (int) $id;
             $hitrow->hits = 0;
         }
         $hitrow->hits += 1;
         $this->app->table->user_discount->save($hitrow);
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:25,代码来源:discounts.php

示例6: getList

 /**
  *
  * Get parameters from backend, prepare and execute the database queries,
  * and fill an array for later output in template
  * @param $params
  * @param $debugmode   boolean true to output the database query and the
  *                             database error text if existent
  */
 public static function getList(&$params, &$debugmode)
 {
     // Array for storing the e.g. results and db query clauses
     $elems = array();
     // Retreive parameters and fill the array
     // Get parameters for images and fill array element
     $elems['allpics'] = new stdClass();
     $elems['allpics']->enabled = intval($params->get('all_pics', false));
     if ($elems['allpics']->enabled) {
         $elems['allpics']->outputtext = $params->get('all_picstext', '');
         $elems['allpics']->queryselect = 'COUNT(id)';
         $elems['allpics']->queryfrom = '#__joomgallery';
     }
     // Get parameters for categories and fill array element
     $elems['allcats'] = new stdClass();
     $elems['allcats']->enabled = intval($params->get('all_cats'));
     if ($elems['allcats']->enabled) {
         $elems['allcats']->outputtext = $params->get('all_catstext');
         $elems['allcats']->queryselect = 'COUNT(cid)';
         $elems['allcats']->queryfrom = '#__joomgallery_catg';
     }
     // Get parameters for hits and fill array element
     $elems['allhits'] = new stdClass();
     $elems['allhits']->enabled = intval($params->get('all_hits', false));
     if ($elems['allhits']->enabled) {
         $elems['allhits']->outputtext = $params->get('all_hitstext', '');
         $elems['allhits']->queryselect = 'sum(hits)';
         $elems['allhits']->queryfrom = '#__joomgallery';
     }
     // Get parameters for comments and fill array element
     $elems['allcomments'] = new stdClass();
     $elems['allcomments']->enabled = intval($params->get('all_comments'), false);
     if ($elems['allcomments']->enabled) {
         $elems['allcomments']->outputtext = $params->get('all_commentstext', '');
         $elems['allcomments']->queryselect = 'COUNT(cmtid)';
         $elems['allcomments']->queryfrom = '#__joomgallery_comments';
     }
     // Get parameters for votes and fill array element
     $elems['allvotes'] = new stdClass();
     $elems['allvotes']->enabled = intval($params->get('all_votes', false));
     if ($elems['allvotes']->enabled) {
         $elems['allvotes']->outputtext = $params->get('all_votestext', '');
         $elems['allvotes']->queryselect = 'COUNT(voteid)';
         $elems['allvotes']->queryfrom = '#__joomgallery_votes';
     }
     // Get parameters for nametags and fill array element
     $elems['allnametags'] = new stdClass();
     $elems['allnametags']->enabled = intval($params->get('all_nametags', false));
     if ($elems['allnametags']->enabled) {
         $elems['allnametags']->outputtext = $params->get('all_nametagstext', '');
         $elems['allnametags']->queryselect = 'COUNT(nid)';
         $elems['allnametags']->queryfrom = '#__joomgallery_nameshields';
     }
     // Get instance of database object ans set debug mode if enabled
     $database = JFactory::getDBo();
     // Get an instance of JDatabaseQuery object and clear them initially
     $query = $database->getQuery(true);
     // Set debug mode of database to fill the log array of database object
     // if debug mode enabled
     if ($debugmode) {
         $database->setdebug(true);
     }
     // Iterate through array
     // reference to element for adding the results (possible since PHP5)
     foreach ($elems as &$elem) {
         if ($elem->enabled) {
             // Fill the select and from clause of query
             $query->select($elem->queryselect);
             $query->from($elem->queryfrom);
             // Set the query and get the result from database
             $database->setQuery($query);
             $elem->outputresult = $database->loadResult();
         }
         // Clear the query for next element
         $query->clear();
     }
     if ($debugmode) {
         // Get the database log array
         $log = $database->getLog();
         // And add the text to elements
         $logcount = 0;
         foreach ($elems as &$elem) {
             if ($elem->enabled) {
                 $elem->dbquerylog = '&#8226;' . nl2br($log[$logcount], true) . '&#8226;<br />';
                 $logcount++;
             }
         }
         $database->debug(0);
     }
     return $elems;
 }
开发者ID:JoomGallery,项目名称:JoomStats,代码行数:99,代码来源:helper.php

示例7: getLastComments

 /**
  * Read the last comment of images and complete the image objects
  *
  * @param array $objects
  */
 function getLastComments($objects)
 {
     if (count($objects)) {
         $db = JFactory::getDBo();
         $query = $db->getQuery(true);
         $picidsarr = array_keys($objects);
         $picids = '(' . implode(',', $picidsarr) . ')';
         $query->select('co.cmtpic AS cocmtpic');
         if ($this->getConfig('showcmttext')) {
             $query->select('co.cmttext');
         }
         $query->select('co.cmtdate as cmtdate, co.userid AS cmtuserid, co.cmtname AS cmtname');
         $query->from(_JOOM_TABLE_COMMENTS . ' AS co');
         $query->join('LEFT', _JOOM_TABLE_COMMENTS . ' AS co2' . ' ON co.cmtpic = co2.cmtpic AND co.cmtdate < co2.cmtdate' . ' WHERE' . '   co2.cmtpic IS NULL' . '   AND' . '     co.cmtpic IN ' . $picids . '   AND ((co.published=1 AND co.approved=1) OR co.published IS NULL)');
         $db->setQuery($query);
         $commobjects = $db->loadObjectList('cocmtpic');
         // And complete objects with data of last comment
         foreach ($objects as $key => &$object) {
             $object->cmttext = isset($commobjects[$key]->cmttext) ? $commobjects[$key]->cmttext : null;
             $object->cmtdate = isset($commobjects[$key]->cmtdate) ? $commobjects[$key]->cmtdate : null;
             $object->cmtuserid = isset($commobjects[$key]->cmtuserid) ? $commobjects[$key]->cmtuserid : null;
             $object->cmtname = isset($commobjects[$key]->cmtname) ? $commobjects[$key]->cmtname : null;
         }
     }
 }
开发者ID:kenyonjohnston,项目名称:hott_theater,代码行数:30,代码来源:helper.php

示例8: getTagsByListingId

 public static function getTagsByListingId($listing_id, $select = 't.*', $checkPublished = true, $checkAccess = true, $checkLanguage = true, $order = 'txref.ordering', $dir = 'ASC')
 {
     if (!$listing_id) {
         return array();
     }
     if (strpos(",", $select) !== false) {
         $selectColumnArr = explode(",", $select);
         sort($selectColumnArr);
         $select = implode(",", $selectColumnArr);
     }
     $storeId = md5(__METHOD__ . "::{$listing_id}::{$select}::" . (int) $checkPublished . "::" . (int) $checkAccess . "::" . (int) $checkLanguage . "::{$order}::{$dir}");
     if (!isset(self::$cache[$storeId])) {
         $db = JFactory::getDBo();
         $nullDate = $db->getNullDate();
         $nowDate = JFactory::getDate()->toSql();
         $query = $db->getQuery(true);
         $query->select($select);
         $query->from("#__judirectory_tags AS t");
         $query->join("", "#__judirectory_tags_xref txref ON t.id = txref.tag_id");
         $query->where("txref.listing_id = " . $listing_id);
         if ($checkPublished) {
             $query->where('t.published = 1');
             $query->where('(t.publish_up = ' . $db->quote($nullDate) . ' OR t.publish_up <= ' . $db->quote($nowDate) . ')');
             $query->where('(t.publish_down = ' . $db->quote($nullDate) . ' OR t.publish_down >= ' . $db->quote($nowDate) . ')');
         }
         if ($checkAccess) {
             $user = JFactory::getUser();
             $levels = $user->getAuthorisedViewLevels();
             $levelsStr = implode(',', $levels);
             $query->where('t.access IN (' . $levelsStr . ')');
         }
         $app = JFactory::getApplication();
         if ($app->isSite() && $checkLanguage) {
             $languageTag = JFactory::getLanguage()->getTag();
             if ($app->getLanguageFilter()) {
                 $query->where('t.language IN (' . $db->quote($languageTag) . ',' . $db->quote('*') . ',' . $db->quote('') . ')');
             }
         }
         $query->order($order . ' ' . $dir);
         $db->setQuery($query);
         self::$cache[$storeId] = $db->loadObjectList();
     }
     return self::$cache[$storeId];
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:44,代码来源:helper.php

示例9: switch

?>

<?php 
$registration = 'registration';
if ($regp[0] != 'joomla') {
    $registration .= '/' . $regp[0];
}
switch ($regp[0]) {
    case 'joomla':
        $lang->load('plg_user_profile', JPATH_ADMINISTRATOR);
        break;
    case 'virtuemart':
        $lang->load('com_virtuemart');
        break;
}
$db = JFactory::getDBo();
$db->setQuery(defined('DEMO') ? "SELECT fields, props FROM #__offlajn_forms WHERE id = {$params->get('regform', 1)}" : "SELECT fields, props FROM #__offlajn_forms WHERE state=1 AND type='{$registration}'");
$res = $db->loadObject();
$fields = json_decode($res->fields);
foreach ($fields->page[0]->elem as $elem) {
    foreach ($elem as $name => $prop) {
        if ($name == 'jform[elem_name]') {
            $prop->value = $prop->value ? $prop->value : $prop->placeholder;
        }
        if ($name == 'jform[elem_type]') {
            $prop->value = $prop->value ? $prop->value : $prop->placeholder;
        }
        if (!isset($prop->value) || $name == 'jform[elem_pattern]' || $name == 'jform[elem_name]' || $name == 'jform[elem_type]') {
            continue;
        }
        if (!$prop->value) {
开发者ID:pguilford,项目名称:vcomcc,代码行数:31,代码来源:reg25.php

示例10: convertToJSON

        }
    }
}
function convertToJSON($items)
{
    global $chartmapvlaue;
    for ($va = 0; $va < sizeof($items); $va++) {
        $item = $items[$va];
        $chartmapvlaue .= '{"driver_name":"' . $item->driver_name . '" , "total_score":' . $item->total_score . ',"aggressive_score":"' . $item->aggressive_score . '","distraction_score":"' . $item->distraction_score . '"},';
    }
    return $chartmapvlaue;
}
require JPATH_BASE . DS . "components" . DS . "com_fleetmatrix" . DS . "models" . DS . "calculator.php";
$calculator = new ScoreCalculator();
$user =& JFactory::getUser();
$db =& JFactory::getDBo();
if ($user) {
    $query = $db->getQuery(true)->select('entity_type, entity_id')->from('#__fleet_user')->where('id = "' . $user->id . '"');
    $db->setQuery($query);
    $row = $db->loadObject();
    if ($row) {
        $query = $db->getQuery(true)->select('id')->from("#__fleet_entity")->where('parent_entity_id = ' . $row->entity_id);
        $db->setQuery($query);
        $results = $db->loadResultArray();
        switch ($row->entity_type) {
            case 1:
                // reseller
                foreach ($results as $id) {
                    $GLOBALS['user_companies'][] = $id;
                    $query = $db->getQuery(true)->select('id')->from("#__fleet_entity")->where('parent_entity_id = ' . $id);
                    $db->setQuery($query);
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:31,代码来源:dangerous_drivers.php

示例11: display

 function display()
 {
     /* Allow modifying of the view */
     $view_type = JRequest::getCmd('view', 'fleetmatrix');
     $model_type = JRequest::getCmd('model', $view_type);
     $GLOBALS['user_companies'] = array();
     $GLOBALS['user_groups'] = array();
     $user =& JFactory::getUser();
     $db =& JFactory::getDBo();
     if ($user) {
         $query = $db->getQuery(true)->select('entity_type, entity_id')->from('#__fleet_user')->where('id = "' . $user->id . '"');
         $db->setQuery($query);
         $row = $db->loadObject();
         if ($row) {
             $query = $db->getQuery(true)->select('id')->from("#__fleet_entity")->where('parent_entity_id = ' . $row->entity_id);
             $db->setQuery($query);
             $results = $db->loadResultArray();
             switch ($row->entity_type) {
                 case 1:
                     // reseller
                     foreach ($results as $id) {
                         $GLOBALS['user_companies'][] = $id;
                         $query = $db->getQuery(true)->select('id')->from("#__fleet_entity")->where('parent_entity_id = ' . $id);
                         $db->setQuery($query);
                         $groups = $db->loadResultArray();
                         foreach ($groups as $gid) {
                             $GLOBALS['user_groups'][] = $gid;
                         }
                     }
                     break;
                 case 2:
                     // company
                     $GLOBALS['user_companies'][] = $row->entity_id;
                     foreach ($results as $id) {
                         $GLOBALS['user_groups'][] = $id;
                     }
                     break;
                 case 3:
                     // group
                     $GLOBALS['user_groups'][] = $row->entity_id;
                     break;
                 default:
                     // ?? shouldn't happen
                     break;
             }
         }
     }
     if (!array_intersect($user->authorisedLevels(), array(2, 3, 4, 8, 16))) {
         return;
     }
     //var_dump($GLOBALS['user_companies']);
     //var_dump($GLOBALS['user_groups']);
     $layout = JRequest::getCmd('layout', 'html');
     $view =& $this->getView($view_type, $layout);
     $model = $this->getModel($model_type);
     $view->setModel($model, true);
     $edit_model = $this->getModel($model_type . 'edit');
     if ($edit_model) {
         $view->setEditModel($edit_model);
     }
     $list_model = $this->getModel($model_type . 'list');
     if ($list_model) {
         $view->setListModel($list_model);
     }
     $view->display();
 }
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:66,代码来源:controller.php


注:本文中的JFactory::getDBo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。