Ejemplo n.º 1
0
 public function run()
 {
     $data = $this->dataProvider->getData();
     $series = $this->options['series'];
     if (count($data) > 0) {
         foreach ($series as $i => $batch) {
             if (isset($batch['time']) && isset($batch['data']) && !is_array($batch['time'])) {
                 $dateSeries = array();
                 foreach ($data as $row) {
                     if ($this->shouldRemoveNullValues($series[$i], $row)) {
                         continue;
                     }
                     $dateSeries[] = $this->processRow($row, $batch);
                 }
                 // we'll work on the actual item, this may be PHP 5.3+ specific
                 $this->sortDateSeries($dateSeries);
                 // clean up our time item so we don't accidentally conflict with Highstock
                 unset($this->options['series'][$i]['time']);
                 // and then reset our data column with our data series
                 $this->options['series'][$i]['data'] = $dateSeries;
             }
         }
     }
     parent::run();
 }
 /**
  * Constructor.
  * @param CDataProvider $dataProvider the data provider to iterate over
  * @param integer       $pageSize     pageSize to use for iteration. This is the number of objects loaded into memory at the same time.
  */
 public function __construct(CDataProvider $dataProvider, $pageSize = null)
 {
     $this->_dataProvider = $dataProvider;
     $this->_totalItemCount = $dataProvider->getTotalItemCount();
     if (($pagination = $this->_dataProvider->getPagination()) === false) {
         $this->_dataProvider->setPagination($pagination = new CPagination());
     }
     if ($pageSize !== null) {
         $pagination->setPageSize($pageSize);
     }
 }
 public function __construct($controllerId, $moduleId, RedBeanModel $listModel, $moduleName, CDataProvider $dataProvider, $activeActionElementType = null)
 {
     assert('is_string($controllerId)');
     assert('is_string($moduleId)');
     assert('$activeActionElementType == null || is_string($activeActionElementType)');
     parent::__construct(2, 1);
     $listView = new LeaderboardListView($controllerId, $moduleId, get_class($listModel), $dataProvider, array());
     $actionBarView = new LeaderboardActionBarForListView($controllerId, $moduleId, $listModel, $listView->getGridViewId(), $dataProvider->getPagination()->pageVar, $listView->getRowsAreSelectable(), $activeActionElementType);
     $this->setView($actionBarView, 0, 0);
     $this->setView($listView, 1, 0);
 }
Ejemplo n.º 4
0
 public function __construct($controllerId, $moduleId, ModelForm $searchModel, RedBeanModel $listModel, $moduleName, CDataProvider $dataProvider, $selectedIds, $actionBarViewClassName)
 {
     assert('is_string($controllerId)');
     assert('is_string($moduleId)');
     assert('is_string($actionBarViewClassName)');
     parent::__construct(3, 1);
     $searchViewClassName = $moduleName . 'SearchView';
     $searchView = new $searchViewClassName($searchModel, get_class($listModel));
     $listViewClassName = $moduleName . 'ListView';
     $listView = new $listViewClassName($controllerId, $moduleId, get_class($listModel), $dataProvider, $selectedIds, null, array(), $searchModel->getListAttributesSelector());
     $actionBarView = new $actionBarViewClassName($controllerId, $moduleId, $listModel, $listView->getGridViewId(), $dataProvider->getPagination()->pageVar, $listView->getRowsAreSelectable());
     $this->setView($actionBarView, 0, 0);
     $this->setView($searchView, 1, 0);
     $this->setView($listView, 2, 0);
 }
 /**
  * @return CSort the sorting object. If this is false, it means the sorting is disabled.
  */
 public function getSort()
 {
     if (($sort = parent::getSort()) !== false) {
         $sort->modelClass = $this->modelClass;
     }
     return $sort;
 }
Ejemplo n.º 6
0
 /**
  * Returns the sorting object.
  *
  * @param string $className
  *            the sorting object class name. Parameter is available since version 1.1.13.
  * @return CSort the sorting object. If this is false, it means the sorting is disabled.
  */
 public function getSort($className = 'CSort')
 {
     if (($sort = parent::getSort($className)) !== false) {
         $sort->modelClass = $this->modelClass;
     }
     return $sort;
 }
 public function __set($name, $value)
 {
     if ($name == 'criteria') {
         $this->_criteria = $value;
     } else {
         parent::__set($name, $value);
     }
 }
 /**
  * Override so when refresh is true it resets _rowsData
  */
 public function getData($refresh = false)
 {
     if ($refresh) {
         $this->_rowsData = null;
     }
     return parent::getData($refresh);
 }
Ejemplo n.º 9
0
 /**
  * Returns the pagination object.
  * @param string $className the pagination object class name. Parameter is available since version 1.1.13.
  * @return Pagination|bool the pagination object. If this is false, it means the pagination is disabled.
  */
 public function getPagination($className = 'Restyii\\Client\\Resource\\Pagination')
 {
     return parent::getPagination($className);
 }
Ejemplo n.º 10
0
 /**
  * @param CDataProvider $dataProvider
  * @param int $offset
  * @param $headerData
  * @param $data
  * @param bool $resolveForHeader
  * @return bool
  */
 protected function processExportPage(CDataProvider $dataProvider, $offset, &$headerData, &$data, $resolveForHeader)
 {
     assert('is_int($offset)');
     assert('is_bool($resolveForHeader)');
     $dataProvider->setOffset($offset);
     $models = $dataProvider->getData(true);
     $modelCount = count($models);
     $this->totalModelsProcessed = $this->totalModelsProcessed + $modelCount;
     $this->processExportModels($models, $headerData, $data, $resolveForHeader);
     $this->getMessageLogger()->addInfoMessage(Zurmo::t('ExportModule', 'processExportPage: models processed: {count} ' . 'with asynchronousPageSize of {pageSize}', array('{count}' => $modelCount, '{pageSize}' => $this->getAsynchronousPageSize())));
     if ($modelCount >= $this->getAsynchronousPageSize()) {
         return true;
     }
     return false;
 }
Ejemplo n.º 11
0
 public function getTotalItemCount()
 {
     return $this->_dataProvider->getTotalItemCount();
 }
Ejemplo n.º 12
0
 /**
  * @param CDataProvider $dataProvider
  * @return string
  */
 public static function getSerializedDataForExport(CDataProvider $dataProvider)
 {
     $totalItems = intval($dataProvider->calculateTotalItemCount());
     $dataProvider->getPagination()->setPageSize($totalItems);
     return serialize($dataProvider);
 }