Example #1
0
    protected function renderInits()
    {
        $this->_isClientAlreadyInit = true;
        return $this->client_id() . ' = new EntitiesManager(' . $this->_ajax_buf->client_id() . ',
				\'' . $this->actionvar->client_id() . '\',
				\'' . $this->confirmvar->client_id() . '\',
				\'' . $this->itemvar->client_id() . '\');';
    }
Example #2
0
 /**
  * Renders the ajax grid
  * @param ajax_grid_pager $pager
  */
 public function render($pager = null)
 {
     $sortdir_name = $this->sortdir->client_id();
     if (!$this->_isExternalBuffer) {
         $this->buffer->start();
     }
     if (!is_null($this->pager) && $this->_renderPagerTop) {
         echo $this->pager->render();
     }
     echo parent::render(array('buffer' => $this->buffer->client_id(), 'sortdir_name' => $this->sortdir->client_id(), 'sorting_name' => $this->sorting->client_id()));
     if (!is_null($this->pager)) {
         echo $this->pager->render();
     }
     if (!$this->_isExternalBuffer) {
         $this->buffer->end();
     }
 }
Example #3
0
        return count(self::$mydata);
    }
    // функция получения определённой страницы отсортированных данных
    // cортировка указывается третьим параметром (true=ASC,false=DESC)
    public static function get_page($pagesize, $page, $asc = true)
    {
        return array_slice($asc ? self::$mydata : array_reverse(self::$mydata), ($page - 1) * $pagesize, $pagesize);
    }
    // так же допустим есть функция удаления строки
    public static function delete($num)
    {
        unset(self::$mydata[$num]);
    }
}
// Инициализируем буфер и менеджер сущностей
$ajaxbuffer = new ajax_buffer("ajax_buffer");
$ajaxbuffer->show_progress(true);
$emanager = new ajax_entities_manager('entities_manager', $ajaxbuffer);
// Если нужно выполнить какие-то действия над данными по постбэку
if ($ajaxbuffer->is_post_back() && $emanager->isAnyAction()) {
    switch ($emanager->getAction()) {
        // необходимо удалить строку
        case $emanager->action->DEL:
            mydata::delete($emanager->getItem());
            break;
    }
    // сбрасываем действие (в противном случае оно будет активно при каждом ajax запросе)
    $emanager->eraseAction();
}
// Форматтер для отображения данных грида
class my_grid_formatter extends grid_formatter
Example #4
0
<?php

session_start();
require_once "../../classes.php";
require_once "./SMPHPToolkit/SMAjax.php";
$ajaxbuf = new ajax_buffer("update_buffer");
$ajaxbuf->set_method(ajax_buffer_method::APPEND_AFTER);
$ind_count = new ajax_var('ind_count', 0);
$ajaxbuf->register_var($ind_count);
error_reporting(E_PARSE);
?>
<html>
<head>
<style type="text/css">
	@IMPORT url("../../skins/smadbis/css/ajax.css");
	.indicator{
		background-color: red; 
		position: absolute;
		bottom: 0px;
		width: 10px; 
		border: 1px solid black;
	}
      #chart{
        position:relative;
        height:200px;
        width:300px;
        overflow-x:auto; 
        overflow-y:hidden;
      }	
</style>
  <script type="text/javascript" src="../../js/scriptaculous/prototype.old.js"></script>
<?php

if ((!check_auth() || $CURRENT_USER['level'] < 7) && $BILLEVEL != 2) {
    die("Access denied!");
}
require_once dirname(__FILE__) . "/SMPHPToolkit/SMAjax.php";
require_once dirname(__FILE__) . "/CADBiS/PacketsTodayLimits.php";
CADBiSNew::instance()->script_src('js/ajax/buffer.js');
$ajaxbuf = new ajax_buffer("update_buffer");
$ajaxbuf->show_progress(true);
$ajaxbuf->set_postback_url($_SERVER['REQUEST_URI']);
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
require_once dirname(__FILE__) . "/CADBiS/cadbis_statistic_backend.php";
$packets = $BILL->GetTarifs();
$config = $BILL->GetCADBiSConfig();
$packets_confs = array();
foreach ($packets as &$packet) {
    $accts = $BILL->GetTarifTodayAccts($packet['gid']);
    $packet['accts']['traffic'] = $accts['traffic'];
    $packet['accts']['time'] = $accts['time'];
    $packets_confs[$packet['gid']]['rang'] = new ajax_var('rng' . $packet['gid'], $packet['rang']);
    $packets_confs[$packet['gid']]['exceed_times'] = new ajax_var('et' . $packet['gid'], $packet['exceed_times']);
    $ajaxbuf->register_vars($packets_confs[$packet['gid']]);
}
$max_month_traffic = new ajax_var('max_month_traffic', $config['max_month_traffic'] / 1024 / 1024);
$ajaxbuf->register_var($max_month_traffic);
if ($ajaxbuf->is_post_back()) {
    foreach ($packets as &$packet) {
        $packet['rang'] = $packets_confs[$packet['gid']]['rang']->get_value();
        $packet['exceed_times'] = $packets_confs[$packet['gid']]['exceed_times']->get_value();
        $BILL->UpdateTarif($packet['gid'], $packet);
Example #6
0
 /**
  * End of the buffer area
  */
 public function end()
 {
     if ($this->_isEnded) {
         return;
     }
     $this->_isEnded = true;
     $this->content .= ob_get_contents();
     ob_end_flush();
     if ($this->is_post_back) {
         while (@ob_end_clean()) {
         }
         self::$_post_back_ok = true;
         die($this->content);
     }
     echo '</div>';
 }