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


PHP JModelLegacy::getDbo方法代码示例

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


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

示例1: testSetDbo

 /**
  * Tests the setDbo method.
  *
  * @since   12.3
  *
  * @return  void
  */
 public function testSetDbo()
 {
     $this->fixture->setDbo(new stdClass());
     $this->assertTrue($this->fixture->getDbo() instanceof stdClass);
 }
开发者ID:karimzg,项目名称:joomla,代码行数:12,代码来源:JModelLegacyTest.php

示例2: postSaveHook

 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param   JModelLegacy  $model      The data model object.
  * @param   array         $validData  The validated data.
  *
  * @return	void
  *
  * @since	3.1
  */
 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     require_once JPATH_COMPONENT . '/helpers/sibdiet.php';
     $db = $model->getDbo();
     // Construct the query
     $query = $db->getQuery(true)->select('s.room1, s.room2, s.room3, s.room4, s.room5, p.id, p.fname, p.lname, p.mobile, u.email, u.username')->from('#__sibdiet_setdiets s')->join('INNER', '#__sibdiet_profiles p ON (s.profiles_id = p.id)')->join('INNER', '#__users u ON (p.users_id = u.id)')->where('s.id = ' . $validData['id']);
     // Setup the query
     $db->setQuery($query);
     // Return the result
     $result = $db->loadObject();
     if ($result->email && !strpos($result->email, 'sibdiet') && $result->room1 && $result->room2 && $result->room3 && $result->room4 && $result->room5) {
         $siteLink = JUri::root();
         $subject = JText::_('COM_SIBDIET_DIET_READY_EMAIL_SUBJECT');
         $password = $result->username == $result->id + 200000 ? $result->mobile : JText::_('COM_SIBDIET_YOU_SET_PASSWORD');
         // Prepare email body
         $body = JText::sprintf('COM_SIBDIET_DIET_READY_EMAIL_BODY', $result->fname . ' ' . $result->lname, $siteLink, $result->username, $password);
         if (SibdietHelper::sendEmail($result->email, $subject, $body)) {
             // Create an object for the record we are going to update.
             $object = new stdClass();
             // Must be a valid primary key value.
             $object->id = $validData['id'];
             $object->room6 = JFactory::getUser()->id;
             // Update their details in the users table using id as the primary key.
             $result = JFactory::getDbo()->updateObject('#__sibdiet_setdiets', $object, 'id');
         }
     }
     $app = JFactory::getApplication();
     $filter = $app->getUserState('com_sibdiet.setdiets.filter');
     $filter->profiles_id = '';
     $app->setUserState('com_sibdiet.setdiets.filter', $filter);
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:41,代码来源:setdiet.php


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