本文整理汇总了PHP中LMSDB类的典型用法代码示例。如果您正苦于以下问题:PHP LMSDB类的具体用法?PHP LMSDB怎么用?PHP LMSDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LMSDB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: GetReceipt
function GetReceipt($id)
{
$db = LMSDB::getInstance();
if ($receipt = $db->GetRow('SELECT d.*, u.name AS user, n.template,
ds.name AS d_name, ds.address AS d_address,
ds.zip AS d_zip, ds.city AS d_city
FROM documents d
LEFT JOIN vusers u ON (d.userid = u.id)
LEFT JOIN numberplans n ON (d.numberplanid = n.id)
LEFT JOIN customers c ON (d.customerid = c.id)
LEFT JOIN divisions ds ON (ds.id = c.divisionid)
WHERE d.type = 2 AND d.id = ?', array($id))) {
$receipt['contents'] = $db->GetAll('SELECT * FROM receiptcontents WHERE docid = ? ORDER BY itemid', array($id));
$receipt['total'] = 0;
foreach ($receipt['contents'] as $row) {
$receipt['total'] += $row['value'];
}
$receipt['number'] = docnumber(array('number' => $receipt['number'], 'template' => $receipt['template'], 'cdate' => $receipt['cdate'], 'ext_num' => $receipt['extnumber'], 'customerid' => $receipt['customerid']));
if ($receipt['total'] < 0) {
$receipt['type'] = 'out';
// change values sign
foreach ($receipt['contents'] as $idx => $row) {
$receipt['contents'][$idx]['value'] *= -1;
}
$receipt['total'] *= -1;
} else {
$receipt['type'] = 'in';
}
$receipt['totalg'] = round($receipt['total'] * 100 - (int) $receipt['total'] * 100);
return $receipt;
}
}
开发者ID:prezeskk,项目名称:lms,代码行数:32,代码来源:receipt.php
示例2: IncomePerMonth
function IncomePerMonth($only_year)
{
global $LMS, $SMARTY, $SESSION;
$db = LMSDB::getInstance();
$income = $db->GetAll('SELECT MONTH(FROM_UNIXTIME(time)) as month, SUM(value) AS suma FROM cash WHERE value>0 AND YEAR(FROM_UNIXTIME(time))=' . $only_year . ' GROUP BY month(FROM_UNIXTIME(time))');
return $income;
}
开发者ID:kyob,项目名称:lms-plugins,代码行数:7,代码来源:income.php
示例3: select_customer
function select_customer($id)
{
$JSResponse = new xajaxResponse();
$nodes_location = LMSDB::getInstance()->GetAll('SELECT n.id, n.name, location FROM vnodes n WHERE ownerid = ? ORDER BY n.name ASC', array($id));
$JSResponse->call('update_nodes_location', (array) $nodes_location);
return $JSResponse;
}
开发者ID:pjona,项目名称:lms,代码行数:7,代码来源:eventedit.php
示例4: __construct
public function __construct($load_policy = null)
{
$this->DB = LMSDB::getInstance();
if ($load_policy !== null) {
$this->setLoadPolicy($load_policy);
}
}
开发者ID:prezeskk,项目名称:lms,代码行数:7,代码来源:class.LocationCache.php
示例5: getEventsToClose
function getEventsToClose($userid)
{
global $LMS, $SMARTY, $SESSION;
$db = LMSDB::getInstance();
$events = $db->GetAll('SELECT from_unixtime(e.date, \'%Y-%m-%d\') AS startdate, e.title, e.id
FROM events e, eventassignments ea WHERE e.closed=0 AND ea.userid=' . $userid . ' AND e.id=ea.eventid');
return $events;
}
开发者ID:kyob,项目名称:lms-plugins,代码行数:8,代码来源:eventstoclose.php
示例6: GetEventList
function GetEventList($year = NULL, $month = NULL, $day = NULL, $forward = 0, $customerid = 0, $userid = 0, $type = 0, $privacy = 0, $closed = '')
{
global $AUTH;
$DB = LMSDB::getInstance();
if (!$year) {
$year = date('Y', time());
}
if (!$month) {
$month = date('n', time());
}
if (!$day) {
$day = date('j', time());
}
$startdate = mktime(0, 0, 0, $month, $day, $year);
$enddate = mktime(0, 0, 0, $month, $day + $forward, $year);
$list = $DB->GetAll('SELECT events.id AS id, title, note, description, date, begintime, enddate, endtime, customerid, closed, events.type, ' . $DB->Concat('UPPER(c.lastname)', "' '", 'c.name') . ' AS customername,
userid, users.name AS username, ' . $DB->Concat('c.city', "', '", 'c.address') . ' AS customerlocation, nodeid, nodes.location AS location
FROM events
LEFT JOIN nodes ON (nodeid = nodes.id)
LEFT JOIN customerview c ON (customerid = c.id)
LEFT JOIN users ON (userid = users.id)
WHERE ((date >= ? AND date < ?) OR (enddate <> 0 AND date < ? AND enddate >= ?))
AND (private = 0 OR (private = 1 AND userid = ?)) ' . ($customerid ? ' AND customerid = ' . intval($customerid) : '') . ($userid ? ' AND EXISTS (
SELECT 1 FROM eventassignments
WHERE eventid = events.id AND userid = ' . intval($userid) . '
)' : '') . ($type ? ' AND events.type = ' . intval($type) : '') . ($privacy == 1 ? ' AND private = 0' : ($privacy == 2 ? ' AND private = 1' : '')) . ($closed != '' ? ' AND closed = ' . intval($closed) : '') . ' ORDER BY date, begintime', array($startdate, $enddate, $enddate, $startdate, $AUTH->id));
$list2 = array();
if ($list) {
foreach ($list as $idx => $row) {
$row['userlist'] = $DB->GetAll('SELECT userid AS id, users.name
FROM eventassignments, users
WHERE userid = users.id AND eventid = ? ', array($row['id']));
$endtime = $row['endtime'];
if ($row['enddate'] && $row['enddate'] - $row['date']) {
$days = round(($row['enddate'] - $row['date']) / 86400);
$row['enddate'] = $row['date'] + 86400;
$row['endtime'] = 0;
$list2[] = $row;
while ($days) {
if ($days == 1) {
$row['endtime'] = $endtime;
}
$row['date'] += 86400;
list($year, $month, $day) = explode('/', date('Y/n/j', $row['date']));
$row['date'] = mktime(0, 0, 0, $month, $day, $year);
$row['enddate'] = $row['date'] + 86400;
if ($days > 1 || $endtime) {
$list2[] = $row;
}
$days--;
}
} else {
$list2[] = $row;
}
}
}
return $list2;
}
开发者ID:jarecky,项目名称:lms,代码行数:58,代码来源:eventlist.php
示例7: upgradeDb
/**
* Loads plugin database schema updates
*/
protected function upgradeDb()
{
$constant = get_class($this) . '::PLUGIN_DBVERSION';
if (defined($constant)) {
$libdir = $this->dirname . DIRECTORY_SEPARATOR . 'lib';
$docdir = $this->dirname . DIRECTORY_SEPARATOR . 'doc';
$this->dbschversion = LMSDB::getInstance()->UpgradeDb(constant($constant), get_class($this), $libdir, $docdir);
}
}
开发者ID:krzysztofpuchala,项目名称:lms-1,代码行数:12,代码来源:LMSPlugin.php
示例8: load
/**
* Return user rights mask
*
* @param array $options Associative array of options
* @return array
*/
public function load(array $options = array())
{
if (!isset($options['user_id'])) {
throw new Exception('User id not set. Cannot find user rights config!');
}
$id = $options['user_id'];
$db = LMSDB::getInstance();
return array($db->GetOne('SELECT rights FROM users WHERE id = ?', array($id)));
}
开发者ID:oswida,项目名称:lms,代码行数:15,代码来源:UserRightsConfigProvider.php
示例9: select_producer
function select_producer($id)
{
$JSResponse = new xajaxResponse();
$models = LMSDB::getInstance()->GetAll('
SELECT id, name
FROM netdevicemodels
WHERE netdeviceproducerid = ?
ORDER BY name', array($id));
$JSResponse->call('update_models', (array) $models);
return $JSResponse;
}
开发者ID:kornelek,项目名称:lms,代码行数:11,代码来源:choosenetdevmodel.php
示例10: deletedCustomers
function deletedCustomers($year)
{
global $LMS, $SMARTY, $SESSION;
$db = LMSDB::getInstance();
$deletedcustomers = $db->GetAll('
SELECT COUNT(id) AS customers, MONTH(FROM_UNIXTIME(moddate)) as month
FROM customers
WHERE deleted=1 AND YEAR(FROM_UNIXTIME(moddate))=' . $year . '
GROUP BY MONTH(FROM_UNIXTIME(moddate))
');
return $deletedcustomers;
}
开发者ID:kyob,项目名称:lms-plugins,代码行数:12,代码来源:balanceconnections.php
示例11: getSummary
function getSummary()
{
global $LMS, $SMARTY, $SESSION;
$db = LMSDB::getInstance();
$summary = $db->GetAll('SELECT u.id, u.name, COUNT(e.closed) AS wszystkie, SUM(IF(e.closed, 1, 0)) AS zamkniete, SUM(IF(e.closed, 0, 1)) AS otwarte
FROM eventassignments ea
LEFT JOIN users u ON (u.id = ea.userid)
LEFT JOIN events e ON (e.id = ea.eventid)
WHERE u.deleted=0
GROUP BY ea.userid');
return $summary;
}
开发者ID:kyob,项目名称:lms-plugins,代码行数:12,代码来源:eventssummary.php
示例12: findAlreadyExists
function findAlreadyExists(&$prefixList)
{
$DB = LMSDB::getInstance();
$prefixHelperArray = $DB->GetAllByKey("SELECT id, prefix FROM voip_prefixes", "prefix");
$exists = array();
foreach ($prefixList as $v => $k) {
if (isset($prefixHelperArray[$v])) {
$exists[] = $v;
}
}
return $exists ? $exists : NULL;
}
开发者ID:jarecky,项目名称:lms,代码行数:12,代码来源:tariffinfo.php
示例13: getUsersForGroup
function getUsersForGroup($groupid)
{
$JSResponse = new xajaxResponse();
if (empty($groupid)) {
$users = null;
} else {
$users = LMSDB::getInstance()->GetCol('SELECT u.id FROM users u
JOIN userassignments ua ON ua.userid = u.id
WHERE u.deleted = 0 AND u.access = 1 AND ua.usergroupid = ?', array($groupid));
}
$JSResponse->call('update_user_selection', $users);
return $JSResponse;
}
开发者ID:prezeskk,项目名称:lms,代码行数:13,代码来源:eventadd.php
示例14: GetEvents
function GetEvents($date = NULL, $userid = 0, $customerid = 0, $privacy = 0, $closed = '')
{
global $AUTH;
$DB = LMSDB::getInstance();
switch ($privacy) {
case 0:
$privacy_condition = '(private = 0 OR (private = 1 AND userid = ' . intval($AUTH->id) . '))';
break;
case 1:
$privacy_condition = 'private = 0';
break;
case 2:
$privacy_condition = 'private = 1 AND userid = ' . intval($AUTH->id);
break;
}
$enddate = $date + 86400;
$list = $DB->GetAll('SELECT events.id AS id, title, note, description, date, begintime, enddate, endtime, closed, events.type,' . $DB->Concat('UPPER(c.lastname)', "' '", 'c.name') . ' AS customername, ' . $DB->Concat('c.city', "', '", 'c.address') . ' AS customerlocation,
nodes.location AS nodelocation,
(SELECT contact FROM customercontacts WHERE customerid = c.id
AND (customercontacts.type & ?) > 0 AND (customercontacts.type & ?) <> ? ORDER BY id LIMIT 1) AS customerphone
FROM events LEFT JOIN customerview c ON (customerid = c.id) LEFT JOIN nodes ON (nodeid = nodes.id)
WHERE ((date >= ? AND date < ?) OR (enddate <> 0 AND date < ? AND enddate >= ?)) AND ' . $privacy_condition . ($customerid ? 'AND customerid = ' . intval($customerid) : '') . ($closed != '' ? ' AND closed = ' . intval($closed) : '') . ' ORDER BY date, begintime', array(CONTACT_MOBILE | CONTACT_FAX | CONTACT_LANDLINE, CONTACT_DISABLED, CONTACT_DISABLED, $date, $enddate, $enddate, $date));
$list2 = array();
if ($list) {
foreach ($list as $idx => $row) {
$row['userlist'] = $DB->GetAll('SELECT userid AS id, vusers.name
FROM eventassignments, vusers
WHERE userid = vusers.id AND eventid = ? ', array($row['id']));
$endtime = $row['endtime'];
if ($row['enddate'] && $row['enddate'] - $row['date']) {
$days = round(($row['enddate'] - $row['date']) / 86400);
$row['enddate'] = $row['date'] + 86400;
$row['endtime'] = 0;
$list2[] = $row;
} else {
$list2[] = $row;
}
}
}
return $list2;
}
开发者ID:prezeskk,项目名称:lms,代码行数:41,代码来源:eventprint.php
示例15: __construct
public function __construct()
{
$this->DB = LMSDB::getInstance();
}
开发者ID:prezeskk,项目名称:lms,代码行数:4,代码来源:SYSLOG.class.php
示例16: getUserRightsConfig
/**
* Returns user rights configuration
*
* Avaliable options are:
* force - forces to reload whole ini config
* user_id - user id
*
* @param array $options Associative array of options
* @return ConfigContainer User rights configuration
* @throws Exception Throws exception when required parameters are not set
*/
public static function getUserRightsConfig(array $options = array())
{
if (!LMSDB::checkIfInstanceExists()) {
throw new Exception('Cannot load uiconfig while database connection does not exist!');
}
if (!isset($options['user_id'])) {
throw new Exception('Cannot load user rights config without user id!');
}
$force = isset($options['force']) ? $options['force'] : false;
if ($force || self::$user_rights_config === null) {
$options['provider'] = UserRightsConfigProvider::NAME;
$options['parser'] = UserRightsConfigParser::NAME;
$config_loader = new ConfigLoader();
self::$user_rights_config = $config_loader->loadConfig($options);
}
return self::$user_rights_config;
}
开发者ID:kornelek,项目名称:lms,代码行数:28,代码来源:LMSConfig.php
示例17: valid_pool
function valid_pool($p, $id = 0)
{
$error = array();
$DB = LMSDB::getInstance();
$id = (int) $id;
$pool_list = $DB->GetAllByKey("SELECT id, name, poolstart, poolend FROM voip_pool_numbers;", 'name');
$name = !empty($p['name']) ? trim($p['name']) : null;
$pstart = !empty($p['poolstart']) ? trim($p['poolstart']) : null;
$pend = !empty($p['poolend']) ? trim($p['poolend']) : null;
$type = !empty($p['pooltype']) ? trim($p['pooltype']) : null;
if (empty($name)) {
$error['name'] = trans('Name is required!');
} else {
if (preg_match('/[^a-zA-Z0-9\\s]+/', $name)) {
$error['name'] = trans('Name contains forbidden characters!');
} else {
if (isset($pool_list[$name]) && $pool_list[$name]['id'] != $id) {
$error['name'] = trans('Name is already in use!');
}
}
}
if (empty($pstart)) {
$error['poolstart'] = trans('Pool start is required!');
} else {
if (strlen($pstart) > 20) {
$error['poolstart'] = trans('Value is too long (max. $a characters)!', 20);
} else {
if (preg_match('/[^0-9]/i', $pstart)) {
$error['poolstart'] = trans('Incorrect format! Only values 0 to 9.');
}
}
}
if (empty($pend)) {
$error['poolend'] = trans('Pool end is required!');
} else {
if (strlen($pend) > 20) {
$error['poolend'] = trans('Value is too long (max. $a characters)!', 20);
} else {
if (preg_match('/[^0-9]/i', $pend)) {
$error['poolend'] = trans('Incorrect format! Only values 0 to 9.');
}
}
}
if (gmp_cmp($pstart, $pend) == 0 || gmp_cmp($pstart, $pend) == 1) {
$error['poolstart'] = trans('Pool start must be lower that end!');
}
if (!getPoolTypeNameByNumber($type)) {
$error['pooltype'] = trans("Incorrect pool type!");
}
foreach ($pool_list as $v) {
if ($id == $v['id'] || !$id) {
continue;
}
$check1 = gmp_cmp($pstart, $v['poolstart']);
$check2 = gmp_cmp($pstart, $v['poolend']);
if (($check1 == 1 || $check1 == 0) && ($check2 == -1 || $check2 == 0)) {
$error['poolstart'] = trans('Number coincides with pool `$a` !', $v['name']);
}
$check1 = gmp_cmp($pend, $v['poolstart']);
$check2 = gmp_cmp($pend, $v['poolend']);
if (($check1 == 1 || $check1 == 0) && ($check2 == -1 || $check2 == 0)) {
$error['poolend'] = trans('Number coincides with pool `$a` !', $v['name']);
}
if ($check1 == -1 && $check2 == 1) {
$error['poolstart'] = trans('Number range coincides with pool `$a` !', $v['name']);
}
}
return $error ? $error : 0;
}
开发者ID:prezeskk,项目名称:lms,代码行数:69,代码来源:voippoolnumberlist.php
示例18: catch
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* $Id$
*/
// Load autloader
require_once LIB_DIR . '/autoloader.php';
$_MAILDBTYPE = ConfigHelper::getConfig('database.mail_db_type');
$_MAILDBHOST = ConfigHelper::getConfig('database.mail_db_host');
$_MAILDBUSER = ConfigHelper::getConfig('database.mail_db_user');
$_MAILDBPASS = ConfigHelper::getConfig('database.mail_db_password');
$_MAILDBNAME = ConfigHelper::getConfig('database.mail_db_database');
// Initialize mail database
$DB_MAIL = null;
try {
$DB_MAIL = LMSDB::getDB($_MAILDBTYPE, $_MAILDBHOST, $_MAILDBUSER, $_MAILDBPASS, $_MAILDBNAME);
} catch (Exception $ex) {
trigger_error($ex->getMessage(), E_USER_WARNING);
// can't working without database
die("Fatal error: cannot connect to database!\n");
}
if (defined('USERPANEL_SETUPMODE')) {
function module_setup()
{
global $SMARTY, $LMS;
$SMARTY->assign('mail_limit', ConfigHelper::getConfig('userpanel.mail_limit'));
$SMARTY->assign('mail_allowed_domains', ConfigHelper::getConfig('userpanel.mail_allowed_domains'));
$SMARTY->display('module:accounts:setup.html');
}
function module_submit_setup()
{
开发者ID:kornelek,项目名称:lms,代码行数:31,代码来源:functions.php
示例19: module_submit_setup
function module_submit_setup()
{
$DB = LMSDB::getInstance();
$DB->Execute('UPDATE uiconfig SET value = ? WHERE section = ? AND var = ?', array(isset($_POST['hide_nodesbox']) ? 1 : 0, 'userpanel', 'hide_nodesbox'));
$DB->Execute('UPDATE uiconfig SET value = ? WHERE section = ? AND var = ?', array($_POST['consent_text'], 'userpanel', 'data_consent_text'));
$DB->Execute('UPDATE uiconfig SET value = ? WHERE section = ? AND var = ?', array(isset($_POST['show_confirmed_documents_only']) ? 'true' : 'false', 'userpanel', 'show_confirmed_documents_only'));
header('Location: ?m=userpanel&module=info');
}
开发者ID:prezeskk,项目名称:lms,代码行数:8,代码来源:functions.php
示例20: getFirstFreeAddress
function getFirstFreeAddress($netid, $elemid)
{
global $LMS;
$DB = LMSDB::getInstance();
$result = new xajaxResponse();
$reservedaddresses = intval(ConfigHelper::getConfig('phpui.first_reserved_addresses', 0, true));
$net = $LMS->GetNetworkRecord($netid);
$ip = '';
foreach ($net['nodes']['id'] as $idx => $nodeid) {
if ($idx < $reservedaddresses) {
continue;
}
if ($nodeid) {
$firstnodeid = $idx;
$ip = '';
}
if (!$nodeid && !isset($net['nodes']['name'][$idx]) && empty($ip)) {
$ip = $net['nodes']['address'][$idx];
if (isset($firstnodeid)) {
break;
}
}
}
if (!empty($ip)) {
$result->assign($elemid, 'value', $ip);
}
return $result;
}
开发者ID:prezeskk,项目名称:lms,代码行数:28,代码来源:nodexajax.inc.php
注:本文中的LMSDB类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论