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


PHP table::loadById方法代码示例

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


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

示例1: getStatistics

 public function getStatistics()
 {
     global $sessionId;
     $data = array("total" => 0, "bymonth" => array());
     $masterTable = new table('master');
     $master = $masterTable->loadById($sessionId);
     $permittedCities = $master['city'];
     $permittedStreets = $master['street'];
     $permittedGroups = $master['usergroup'];
     foreach ($this->getCoveredMonths() as $month) {
         $monthAsText = $month->format('Y-m');
         $cacheFilename = 'paymentstats-' . $monthAsText;
         if (pluginExists('grouprestrict') && $permittedGroups) {
             $cacheFilename .= '-group(' . join($permittedGroups, '_') . ')';
         }
         $cacheFilename .= '.txt';
         $cache = new StatisticsCache($cacheFilename);
         $cache->month = $month;
         $monthData = json_decode($cache->get(), true);
         $data['total'] += $monthData['total'];
         $data['bymonth'][$monthAsText] = $monthData;
     }
     return $data;
 }
开发者ID:carriercomm,项目名称:Nuance,代码行数:24,代码来源:statistics.php

示例2: getSelectedTariff

 function getSelectedTariff()
 {
     $tariffId = $this->data['tariff'];
     if ($tariffId) {
         $tariffTable = new table('tariff');
         $row = $tariffTable->loadById($tariffId);
         return $row;
     }
 }
开发者ID:carriercomm,项目名称:Nuance,代码行数:9,代码来源:ucp.php

示例3: getData

 public function getData()
 {
     global $mysqlTimeDateFormat, $sessionId;
     $data = array("total" => 0, "scratchcard" => 0, "adminpay" => array("total" => 0, "byadmin" => array()));
     $masterTable = new table('master');
     $master = $masterTable->loadById($sessionId);
     $permittedCities = $master['city'];
     $permittedStreets = $master['street'];
     $permittedGroups = $master['usergroup'];
     $admins = $masterTable->load();
     for ($i = 0; $i < count($admins); $i++) {
         $data['adminpay']['byadmin'][$admins[$i]['id']] = 0;
     }
     $currentTime = new DateTime();
     $moneyflowTable = new table('moneyflow');
     $startDate = clone $this->month;
     $endDate = clone $this->month;
     $endDate->modify('1 month');
     $endDate->modify('-1 second');
     $offsetDays = configgetvalue('system', 'statistics', null, 'paymentsOffset');
     $startDate->modify($offsetDays . ' day');
     $endDate->modify($offsetDays . ' day');
     $condition = "WHERE `date`>='" . $startDate->format($mysqlTimeDateFormat) . "' AND `date`<='" . $endDate->format($mysqlTimeDateFormat) . "' AND (`detailsname`='adminpay' OR `detailsname`='scratchcard') AND `sum`>0";
     if (pluginExists('grouprestrict') && $permittedGroups) {
         $condition .= " AND ( `user` IN (SELECT `id` FROM `user` WHERE `usergroup` IN (" . join($permittedGroups, ",") . ") ) )";
     }
     $rows = $moneyflowTable->load($condition);
     foreach ($rows as $row) {
         $sum = $row['sum'];
         $data['total'] += $sum;
         if ($row['detailsname'] === 'adminpay') {
             $data['adminpay']['total'] += $sum;
             if (!isset($data['adminpay']['byadmin'][$row['detailsid']])) {
                 $data['adminpay']['byadmin'][$row['detailsid']] = 0;
             }
             $data['adminpay']['byadmin'][$row['detailsid']] += $sum;
         } else {
             $data['scratchcard'] += $sum;
         }
     }
     $lastRow = end($rows);
     configsetvalue('var', 'cache', null, 'int', $this->fileName, $lastRow['id']);
     return json_encode($data);
 }
开发者ID:carriercomm,项目名称:Nuance,代码行数:44,代码来源:core.php

示例4: controllerRouter

             controllerRouter($row['id'], 'export', false);
         }
         $response->success = true;
     }
     break;
 case 'configlist':
     $response->default = $default;
     $response->data = configlist();
     $response->success = true;
     break;
 case 'getacl':
     $masterTable = new table('master');
     $master = $masterTable->loadById($sessionId);
     $userGroupId = $master['group'];
     $groupTable = new table('group');
     $group = $groupTable->loadById($userGroupId);
     $userAcl = json_decode($group['acl'], true);
     $response = $userAcl;
     break;
 case 'getstatimage':
     if (checkPermission($sessionId, array('statistics'))) {
         $routerId = $_GET['router'];
         $path = str_replace(' ', '%20', $_GET['path']);
         $routerTable = new table('router');
         $res = $routerTable->load("WHERE id={$routerId}");
         if ($row = $res[0]) {
             $address = $row['ip'];
             $port = configgetvalue('router', 'main', $routerId, 'statPort');
             $url = "http://{$address}:{$port}/{$path}.gif";
             header("Content-Type:image/gif");
             $img = file_get_contents($url);
开发者ID:carriercomm,项目名称:Nuance,代码行数:31,代码来源:ajax.php

示例5: intval

     $request = "WHERE ((`sender`=" . $user->getId() . " AND `sender_is_admin`=0) OR ";
     $request .= "(`recipient`=" . $user->getId() . " AND `recipient_is_admin`=0)) ";
     if (isset($_GET['id'])) {
         $request .= "AND `id`=" . intval($_GET['id']);
     }
     $request = "UPDATE " . DB_TABLE_PREFIX . "`message` SET `is_new`=0, `readdate`='" . date($mysqlTimeDateFormat) . "' " . $request;
     $db->query($request);
     // Check for another unread messages
     $request = "WHERE `recipient`=" . $user->getId() . " AND `recipient_is_admin`=0 AND `is_new`=1";
     $newMessages = $messageTable->load($request);
     if (count($newMessages)) {
         $nextMessage = $newMessages[0];
         redirect('message.php?action=show&id=' . $nextMessage['id']);
     } else {
         $usersTable = new table('user');
         $row = $usersTable->loadById($user->getId());
         controllerRouterQueue($row['router'], "hidemessage", $user->getId());
         redirect('message.php?action=finish');
     }
     break;
 case 'send':
     if (isset($_POST['text']) && $_POST['text']) {
         $messageText = htmlspecialchars($_POST['text']);
         $messageTable->add(array("text" => $messageText, "sender" => $user->getId(), "sender_is_admin" => 0, "recipient" => 0, "is_new" => 1, "recipient_is_admin" => 1, "date" => date($mysqlTimeDateFormat)));
     }
     redirect('message.php?action=messagehasbeensent');
     break;
 case 'messagehasbeensent':
     $fenom->display($theme->getTemplateLocation('header.tpl'), $headerData);
     $fenom->display($theme->getTemplateLocation('messagehasbeensent.tpl'));
     $fenom->display($theme->getTemplateLocation('footer.tpl'));
开发者ID:carriercomm,项目名称:Nuance,代码行数:31,代码来源:message.php


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