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


PHP JFactory::GetDbo方法代码示例

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


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

示例1: removeFromWaitingList

/**
 * Deletes users from waiting list
 *
 * @param object/objectArray $users_info 
 * @param object $course_info
 * @return bool
 */
function removeFromWaitingList($users_info, $course_info)
{
    $user_ids = array();
    if (is_array($users_info)) {
        foreach ($users_info as $user_info) {
            $user_ids[] = $user_info->user_id;
        }
    } else {
        $user_ids = array($users_info->user_id);
    }
    $dbo =& JFactory::GetDbo();
    //delete user from waiting list
    $query = "DELETE FROM #__lms_waiting_lists WHERE course_id={$course_info->course_id} AND user_id IN (" . implode(',', $user_ids) . ")";
    $dbo->setQuery($query);
    $dbo->query();
    return true;
}
开发者ID:parkmi,项目名称:dolschool14,代码行数:24,代码来源:waitinglist.php

示例2: botAssociateCEO

function botAssociateCEO($users_info)
{
    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
    $dbo =& JFactory::GetDbo();
    //---->get bot info
    if (!isset($_JLMS_PLUGINS->_user_bot_params['ceoassoc'])) {
        // load mambot params info
        $query = "SELECT params" . "\n FROM #__lms_plugins" . "\n WHERE element = 'ceoassoc'" . "\n AND folder = 'user'";
        $dbo->setQuery($query);
        $bot = $dbo->loadObject();
        // save query to class variable
        $_JLMS_PLUGINS->_user_bot_params['ceoassoc'] = $bot;
    }
    // pull query data from class variable
    $bot = $_JLMS_PLUGINS->_user_bot_params['ceoassoc'];
    $botParams = new jlmsPluginParameters($bot->params);
    $botParams->def('ceo_user_id', 0);
    //<----
    if ($parent_id = $botParams->get('ceo_user_id', 0)) {
        if (is_array($users_info)) {
            foreach ($users_info as $user_info) {
                //---->check if user already associated to CEO and add associate if not
                $query = "SELECT COUNT(*) FROM #__lms_user_parents WHERE parent_id = {$parent_id} AND user_id = {$user_info->user_id}";
                $dbo->setQuery($query);
                if (!$dbo->loadResult()) {
                    $query = "INSERT INTO #__lms_user_parents (`parent_id`, `user_id`) VALUES ({$parent_id}, {$user_info->user_id})";
                    $dbo->setQuery($query);
                    $dbo->query();
                }
                //<----
            }
        } else {
            $user_info = $users_info;
            //---->check if user already associated to CEO and add associate if not
            $query = "SELECT COUNT(*) FROM #__lms_user_parents WHERE parent_id = {$parent_id} AND user_id = {$user_info->user_id}";
            $dbo->setQuery($query);
            if (!$dbo->loadResult()) {
                $query = "INSERT INTO #__lms_user_parents (`parent_id`, `user_id`) VALUES ({$parent_id}, {$user_info->user_id})";
                $dbo->setQuery($query);
                $dbo->query();
            }
            //<----
        }
    }
    return;
}
开发者ID:parkmi,项目名称:dolschool14,代码行数:46,代码来源:ceoassoc.php

示例3: notifyCourseJoined

function notifyCourseJoined($users_info)
{
    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    //---->get bot info
    $dbo =& JFactory::GetDbo();
    if (!isset($_JLMS_PLUGINS->_nontify_bot_params['coursejoinnotify'])) {
        // load mambot params info
        $query = "SELECT params" . "\n FROM #__lms_plugins" . "\n WHERE element = 'coursejoinnotify'" . "\n AND folder = 'notifications'";
        $dbo->setQuery($query);
        $bot = $dbo->loadObject();
        // save query to class variable
        $_JLMS_PLUGINS->_notify_bot_params['coursejoinnotify'] = $bot;
    }
    // pull query data from class variable
    $bot = $_JLMS_PLUGINS->_notify_bot_params['coursejoinnotify'];
    $botParams = new jlmsPluginParameters($bot->params);
    $botParams->def('mail_template', 'Hello {user_name}, You have just been added to the course {course_name} attendees list.');
    $botParams->def('mail_subject', 'Course joining notification');
    //<----
    foreach ($users_info as $info_ids) {
        $query = "SELECT c.course_name AS course_name, u.name AS user_name, u.email AS mail_address FROM #__lms_courses AS c, #__users AS u" . "\n WHERE c.id={$info_ids->course_id} AND u.id={$info_ids->user_id}";
        $dbo->setQuery($query);
        $info_text = $dbo->loadObject();
        $mail_address = $dbo->getEscaped($info_text->mail_address);
        $mail_subject = $dbo->getEscaped($botParams->get('mail_subject'));
        $mail_text = $botParams->get('mail_template');
        $mail_text = str_replace('{user_name}', $info_text->user_name, $mail_text);
        $mail_text = str_replace('{course_name}', $info_text->course_name, $mail_text);
        $mail_text = str_replace('{site_URL}', $JLMS_CONFIG->get('live_site'), $mail_text);
        $mail_text = $dbo->getEscaped($mail_text);
        $query = "INSERT INTO #__lms_notifications (assigned, mail_address, mail_subject, mail_body, sent) VALUES" . "\n ({$info_ids->teacher_id}, '{$mail_address}', '{$mail_subject}', '{$mail_text}', 0)";
        $dbo->setQuery($query);
        $dbo->query();
    }
}
开发者ID:parkmi,项目名称:dolschool14,代码行数:36,代码来源:coursejoinnotify.php

示例4: _replaceRequest

 private function _replaceRequest($msg)
 {
     $db = JFactory::GetDbo();
     $request = JRequest::get('request');
     foreach ($request as $key => $val) {
         if (is_string($val)) {
             // $$$ hugh - escape the key so preg_replace won't puke if key contains /
             $key = str_replace('/', '\\/', $key);
             $msg = preg_replace("/\\{{$key}\\}/", $db->Quote(urldecode($val)), $msg);
         }
     }
     return $msg;
 }
开发者ID:rhotog,项目名称:fabrik,代码行数:13,代码来源:fusionchart.php

示例5: editCourse

    function editCourse(&$row, &$lists, $option, $params = '', $levels = array())
    {
        global $JLMS_CONFIG;
        JHTML::_('behavior.tooltip');
        mosCommonHTML::loadCalendar();
        $db =& JFactory::GetDbo();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 6) == 'level_') {
                    $multicat[] = $lists['level_' . $i];
                    $i++;
                }
            }
        }
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;

			if (pressbutton == 'cancel_course') {
				submitform( pressbutton );
				return;
			}
			if (pressbutton == 'save_course' || pressbutton == 'apply_course' ) {
				submitform( pressbutton );
				return;
			}
		}
		
		<?php 
        if (JLMS_J16version()) {
            ?>
		Joomla.submitbutton = submitbutton;
		<?php 
        }
        ?>
	
		<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            ?>
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($levels);
            ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['level_id_'+i] != null){
					old_filters[i] = form['level_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($levels);
            ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['level_id_'+i+''] != null && form['level_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['level_id_'+i] != null){
						form['level_id_'+i].value = 0;	
					}
				}
			}
		}
		<?php 
        }
        ?>
		//-->
		</script>

<form action="index.php" method="post" name="adminForm">
<table width="100%" >
	<tr>
		<td valign="top" width="220">
		<div>
			<?php 
        echo joomla_lms_adm_html::JLMS_menu();
        ?>
		</div>
		</td>
		<td valign="top">
		<div class="width-100">
		<fieldset class="adminform">
		<?php 
        if (!class_exists('JToolBarHelper')) {
            ?>
		<table class="adminheading">
		<tr>
			<th class="user">
			<?php 
//.........这里部分代码省略.........
开发者ID:parkmi,项目名称:dolschool14,代码行数:101,代码来源:admin.joomla_lms.html.php

示例6: saveToDb

 function saveToDb(&$db)
 {
     $dbo =& JFactory::GetDbo();
     $query = "DELETE FROM `#__lms_config` WHERE lms_config_var != 'jlms_version' ";
     $dbo->setQuery($query);
     $dbo->query();
     $this->attendance_days = serialize($this->attendance_days);
     $vars = $this->getPublicVars();
     foreach ($vars as $v) {
         if ($v == 'maxConfClients') {
             $this->{$v} = intval($this->{$v});
         } elseif ($v == 'backend_access_gid' && is_array($this->{$v})) {
             $this->{$v} = implode(',', $this->{$v});
         }
         $query = "INSERT INTO `#__lms_config` (lms_config_var, lms_config_value) " . "VALUES (" . $dbo->Quote($v) . ", " . $dbo->Quote($this->{$v}) . ")";
         $dbo->setQuery($query);
         $dbo->query();
     }
 }
开发者ID:parkmi,项目名称:dolschool14,代码行数:19,代码来源:joomla_lms.class.php

示例7: foreach

}
foreach (H5PCore::$scripts as $script) {
    $doc->addScript(JURI::root(true) . '/libraries/h5pcore/core/' . $script . $h5p_file_suffix);
}
$doc->addScript(JURI::root(true) . '/libraries/h5pcore/js/h5pjoomla.js' . $h5p_file_suffix);
$doc->addScript(JURI::root(true) . '/libraries/h5pcore/js/jquery.ba-resize.min.js' . $h5p_file_suffix);
$user = JFactory::getUser();
$script = 'H5PIntegration = H5PIntegration || {};';
$script .= 'H5PIntegration.content = H5PIntegration.content || {};';
$script .= 'H5PIntegration.jsonContentPath = "' . $h5p_path . 'content/";';
$script .= 'H5PIntegration.libraryPath = "' . $h5p_path . 'libraries/";';
$script .= 'H5P.ajaxPath = "' . JURI::root(true) . '/index.php?option=com_h5p&format=raw&task=";';
$script .= 'H5P.postUserStatistics = ' . ($user->get('id') === 0 ? 'false' : 'true') . ';';
$input = JFactory::getApplication()->input;
$h5pId = $input->getCmd('cid');
$db = JFactory::GetDbo();
$db->setQuery(sprintf("SELECT h.json_content, hl.machine_name, hl.fullscreen, hl.semantics\n\t  FROM #__h5p as h, #__h5p_libraries as hl\n\t  WHERE h.h5p_id = %s\n\t    AND hl.library_id = h.main_library_id", $db->quote($h5pId)));
$h5p = $db->loadObject();
// Add dependent lib javascripts
$db->setQuery(sprintf("SELECT hl.library_id, hl.machine_name as machineName, hl.major_version as majorVersion,\n\t        hl.minor_version as minorVersion, hl.patch_version as patchVersion, preloaded_css, preloaded_js, hnl.drop_css\n\t  FROM #__h5p_library_dependencies hnl\n\t  JOIN #__h5p_libraries hl\n\t    ON hnl.library_id = hl.library_id\n\t  WHERE hnl.h5p_id = %s\n\t    AND hnl.preloaded = 1", $db->quote($h5pId)));
$res = $db->loadAssocList();
foreach ($res as $library_data) {
    $libname = $h5p_core->libraryToString($library_data, TRUE);
    if (!empty($library_data['preloaded_js'])) {
        foreach (explode(',', $library_data['preloaded_js']) as $value) {
            $doc->addScript($h5p_path . 'libraries/' . $libname . '/' . trim($value) . '?pv=' . $library_data['patchVersion']);
        }
    }
    if (!empty($library_data['preloaded_css']) && $library_data['drop_css'] != 1) {
        foreach (explode(',', $library_data['preloaded_css']) as $value) {
            $doc->addStyleSheet($h5p_path . 'libraries/' . $libname . '/' . trim($value) . '?pv=' . $library_data['patchVersion']);
开发者ID:h5p,项目名称:h5p-joomla-extension,代码行数:31,代码来源:view.php

示例8: ALU_saveItem

function ALU_saveItem($option, $page)
{
    $db =& JFactory::GetDbo();
    $redirect = JRequest::getCmd('redirect');
    $edit_manager = JRequest::getCmd('edit_manager');
    $old_group_id = JRequest::getCmd('old_group_id');
    $user_id = JRequest::getInt('user_id');
    $group_id = JRequest::getInt('group_id');
    $query = "SELECT count(*) FROM #__lms_user_assign_groups WHERE user_id = {$user_id} AND group_id = {$group_id}";
    $db->setQuery($query);
    $count_yet = $db->LoadResult();
    if ($count_yet) {
        $msg = _JLMS_USERS_USR_EXISTS;
    } else {
        if ($edit_manager) {
            $query = "UPDATE #__lms_user_assign_groups SET group_id = {$group_id} WHERE user_id = {$user_id} AND group_id = {$old_group_id}";
        } else {
            $query = "INSERT INTO #__lms_user_assign_groups (user_id, group_id) VALUES ({$user_id}, {$group_id})";
        }
        $db->setQuery($query);
        if (!$db->query()) {
            echo "<script> alert('" . $db->getErrorMsg() . "'); window.history.go(-1); </script>\n";
        }
        $msg = _JLMS_USERS_MSG_USR_ADDED;
    }
    $app =& JFactory::getApplication('administrator');
    if ($redirect) {
        $app->redirect("index.php?option={$option}&task=classes", $msg);
    } else {
        $app->redirect("index.php?option={$option}&task=group_managers", $msg);
    }
}
开发者ID:parkmi,项目名称:dolschool14,代码行数:32,代码来源:admin.group_managers.php


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