/**
 * Генерация графика
 * @param DataSet $DataSet
 * @param String $GraphTitle
 * @param String $safeToFile
 */
function createGraphToFile($DataSet, $GraphTitle, $safeToFile, $scaleFormat)
{
    // Rotrate
    $rotate = 30;
    // Initialise the graph
    $GraphImage = new pChart(594, 344);
    $GraphImage->setDateFormat($scaleFormat);
    // $GraphImage->loadColorPalette(DIR_FONT.'/tones-3.txt');
    $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 8);
    $GraphImage->setGraphArea(80, 50, 580, 300);
    $GraphImage->drawFilledRectangle(3, 3, 590, 340, 240, 240, 240);
    $GraphImage->drawRectangle(0, 0, 593, 343, 230, 230, 230);
    $GraphImage->drawGraphArea(255, 255, 255, TRUE);
    $GraphImage->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, $rotate, 0, FALSE);
    $GraphImage->drawGrid(4, TRUE, 230, 230, 230, 50);
    // Draw the 0 line
    $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 6);
    $GraphImage->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    // Просто пунктирная линия
    // Draw the cubic curve graph
    $GraphImage->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
    // Draw the line graph
    //$GraphImage->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
    $GraphImage->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
    // Finish the graph
    $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 12);
    $GraphImage->drawTitle(60, 32, $GraphTitle, 50, 50, 50, 600);
    //$GraphImage->Render(DIR_CACHE . './' . $safeToFile . '.png');
    $GraphImage->Stroke();
}
Example #2
0
 function dataset()
 {
     //dataset//
     $this->rapyd->load("dataset");
     $dataset = new DataSet($this->data);
     $dataset->per_page = 5;
     $dataset->build();
     $data["items"] = $dataset->data;
     $data["navigator"] = $dataset->navigator;
     //enddataset//
     $content["content"] = $this->load->view('rapyd/dataset', $data, true);
     $content["rapyd_head"] = "";
     $content["code"] = highlight_code_file(THISFILE, "//dataset//", "//enddataset//");
     $this->load->view('rapyd/template', $content);
 }
Example #3
0
 /**
  * @copydoc DataSet::createDataDescription
  */
 public function createDataDescription()
 {
     $result = parent::createDataDescription();
     $fieldDescr = $result->getFieldDescriptionByName('align');
     $fieldDescr->loadAvailableValues(array(array('id' => 'bottom', 'value' => $this->translate('TXT_ALIGN_BOTTOM')), array('id' => 'middle', 'value' => $this->translate('TXT_ALIGN_MIDDLE')), array('id' => 'top', 'value' => $this->translate('TXT_ALIGN_TOP')), array('id' => 'left', 'value' => $this->translate('TXT_ALIGN_LEFT')), array('id' => 'right', 'value' => $this->translate('TXT_ALIGN_RIGHT'))), 'id', 'value');
     return $result;
 }
Example #4
0
 function setMeta($content)
 {
     $data = DataSet::get_param('library_meta_setmeta');
     $title = isset($data['title']) ? $data['title'] : 'CLEAR Indonesia';
     $description = isset($data['description']) ? $data['description'] : '';
     $keyword = isset($data['keyword']) ? $data['keyword'] : '';
     $url = isset($data['url']) ? $data['url'] : '';
     $image = isset($data['image']) ? $data['image'] : '';
     if (!$description) {
         $description = $title;
     }
     if (!$keyword) {
         $keyword = $this->_generateKeyword($description);
     }
     $this->c->add_data_set('template_meta_title', $title);
     $this->c->add_data_set('template_meta_description', $description);
     $this->c->add_data_set('template_meta_keywords', $keyword);
     $this->c->add_data_set('template_meta_url', $url);
     $meta_common = $this->c->view('templates/meta_common', true);
     if (!$image) {
         $image = Config::get('base_url') . 'assets/img/logo.jpg';
     }
     $this->c->add_data_set('template_meta_image', $image);
     $meta_image = $this->c->view('templates/meta_image', true);
     $content = str_replace(array('{TEMPLATE_METACOMMON}', '{TEMPLATE_METAIMAGE}'), array($meta_common, $meta_image), $content);
     return $content;
 }
 public function getSet()
 {
     $set = DataSet::source(Article::with('author', 'categories'));
     $set->sortable('order', 0);
     $set->paginate(9);
     $set->build();
     return View::make('rapyd::demo.set', compact('set'));
 }
Example #6
0
 /**
  * Returns an array containing all the layouts particulars
  * @param int $layoutId The layout ID
  */
 public function LayoutInformation($layoutId)
 {
     Debug::LogEntry('audit', '[IN]', 'layout', 'LayoutInformation');
     // The array to ultimately return
     $info = array();
     $info['regions'] = array();
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT * FROM `layout` WHERE layoutid = :layout_id');
         $sth->execute(array('layout_id' => $layoutId));
         $rows = $sth->fetchAll();
         if (count($rows) <= 0) {
             $this->ThrowError(__('Unable to find layout'));
         }
         $row = $rows[0];
         $info['layout'] = Kit::ValidateParam($row['layout'], _STRING);
         $modifiedDt = new DateTime($row['modifiedDT']);
         $info['updated'] = $modifiedDt->getTimestamp();
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
     // Get the width and height
     $xml = new DOMDocument();
     $xml->loadXML($row['xml']);
     // get the width and the height
     $info['width'] = $xml->documentElement->getAttribute('width');
     $info['height'] = $xml->documentElement->getAttribute('height');
     // Use the Region class to help
     Kit::ClassLoader('region');
     // Dummy User Object
     $user = new User($this->db);
     $user->userid = 0;
     $user->usertypeid = 1;
     // Take the layout, loop through its regions, check them and call LayoutInformation on all media in them.
     $info['regions'] = $this->GetRegionList($layoutId);
     if (count($info['regions']) <= 0) {
         return $info;
     }
     // Loop through each and build an array
     foreach ($info['regions'] as &$region) {
         $region['media'] = array();
         Debug::LogEntry('audit', 'Assessing Region: ' . $region['regionid'], 'layout', 'LayoutInformation');
         // Create a layout object
         $regionObject = new Region($this->db);
         $mediaNodes = $regionObject->GetMediaNodeList($layoutId, $region['regionid']);
         // Create a data set to see if there are any requirements to serve an updated date time
         Kit::ClassLoader('dataset');
         $dataSetObject = new DataSet($this->db);
         foreach ($mediaNodes as $mediaNode) {
             $node = array('mediaid' => $mediaNode->getAttribute('id'), 'lkid' => $mediaNode->getAttribute('lkid'), 'mediatype' => $mediaNode->getAttribute('type'), 'render' => $mediaNode->getAttribute('render'), 'userid' => $mediaNode->getAttribute('userid'), 'updated' => $info['updated']);
             // DataSets are a special case. We want to get the last updated time from the dataset.
             $dataSet = $dataSetObject->GetDataSetFromLayout($layoutId, $region['regionid'], $mediaNode->getAttribute('id'));
             if (count($dataSet) == 1) {
                 $node['updated'] = $dataSet[0]['LastDataEdit'];
             }
             // Put this node vertically in the region time-line
             $region['media'][] = $node;
         }
         Debug::LogEntry('audit', 'Finished with Region', 'layout', 'LayoutInformation');
     }
     return $info;
 }
Example #7
0
 /**
  * @dataProvider pathStrings
  */
 public function testIsPath($path, $isPath)
 {
     $this->assertEquals($isPath, DataSet::isPath($path));
 }
 /**
  * Fetch start to max records. start is at Record 0
  *
  * @param  int $start
  * @param  int $max
  * @return TableDataSet This object.
  * @throws SQLException
  * @throws DataSetException
  */
 public function fetchRecords($p1 = 0, $p2 = null)
 {
     $this->buildSelectString();
     return parent::fetchRecords($p1, $p2);
 }
Example #9
0
 /**
  * build , main build method
  *
  * @access   public
  * @return   string  datagrid output
  */
 function build()
 {
     parent::build();
     if ($this->systemError != "") {
         //gestire l'errore in CI
     }
     return $this->output = $this->_buildGrid();
 }
 public function getCustomfilter()
 {
     $filter = \DataFilter::source(Article::with('author', 'categories'));
     $filter->text('src', 'Search')->scope('freesearch');
     $filter->build();
     $set = \DataSet::source($filter);
     $set->paginate(9);
     $set->build();
     return view('rapyd::demo.customfilter', compact('filter', 'set'));
 }
Example #11
0
/**
 * Load dataset definitions from the database if necessary.
 *
 * @return an array of all available datasets
**/
function &wdGetDataSets() {

	static $datasets, $wgGroupPermissions;
	if ( empty( $datasets ) ) {
		// Load defs from the DB
		$dbs = wfGetDB( DB_SLAVE );
		$res = $dbs->select( 'wikidata_sets', array( 'set_prefix' ) );

		while ( $row = $dbs->fetchObject( $res ) ) {

			$dc = new DataSet();
			$dc->setPrefix( $row->set_prefix );
			if ( $dc->isValidPrefix() ) {
				$datasets[$row->set_prefix] = $dc;
				wfDebug( "Imported data set: " . $dc->fetchName() . "\n" );
			} else {
				wfDebug( $row->set_prefix . " does not appear to be a valid dataset!\n" );
			}
		}
	}
	return $datasets;
}
Example #12
0
 private function GetDataSetItems($displayId, $isPreview, $text)
 {
     $db =& $this->db;
     // Extra fields for data sets
     $dataSetId = $this->GetOption('datasetid');
     $upperLimit = $this->GetOption('upperLimit');
     $lowerLimit = $this->GetOption('lowerLimit');
     $filter = $this->GetOption('filter');
     $ordering = $this->GetOption('ordering');
     Debug::LogEntry('audit', 'Then template for each row is: ' . $text);
     // Set an expiry time for the media
     $media = new Media();
     $layout = new Layout();
     $expires = time() + $this->GetOption('updateInterval', 3600) * 60;
     // Combine the column id's with the dataset data
     $matches = '';
     preg_match_all('/\\[(.*?)\\]/', $text, $matches);
     $columnIds = array();
     foreach ($matches[1] as $match) {
         // Get the column id's we are interested in
         Debug::LogEntry('audit', 'Matched column: ' . $match);
         $col = explode('|', $match);
         $columnIds[] = $col[1];
     }
     // Get the dataset results
     $dataSet = new DataSet($db);
     if (!($dataSetResults = $dataSet->DataSetResults($dataSetId, implode(',', $columnIds), $filter, $ordering, $lowerLimit, $upperLimit, $displayId))) {
         return;
     }
     // Create an array of header|datatypeid pairs
     $columnMap = array();
     foreach ($dataSetResults['Columns'] as $col) {
         $columnMap[$col['Text']] = $col;
     }
     Debug::Audit(var_export($columnMap, true));
     $items = array();
     foreach ($dataSetResults['Rows'] as $row) {
         // For each row, substitute into our template
         $rowString = $text;
         foreach ($matches[1] as $sub) {
             // Pick the appropriate column out
             $subs = explode('|', $sub);
             // The column header
             $header = $subs[0];
             $replace = $row[$header];
             // Check in the columns array to see if this is a special one
             if ($columnMap[$header]['DataTypeID'] == 4) {
                 // Download the image, alter the replace to wrap in an image tag
                 $file = $media->addModuleFileFromUrl(str_replace(' ', '%20', htmlspecialchars_decode($replace)), 'ticker_dataset_' . md5($dataSetId . $columnMap[$header]['DataSetColumnID'] . $replace), $expires);
                 // Tag this layout with this file
                 $layout->AddLk($this->layoutid, 'module', $file['mediaId']);
                 $replace = $isPreview ? '<img src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $file['mediaId'] . '" />' : '<img src="' . $file['storedAs'] . '" />';
             }
             $rowString = str_replace('[' . $sub . ']', $replace, $rowString);
         }
         $items[] = $rowString;
     }
     return $items;
 }
Example #13
0
 public function DataSetColumnTypeList()
 {
     // Auth
     if (!$this->user->PageAuth('dataset')) {
         return $this->Error(1, 'Access Denied');
     }
     Kit::ClassLoader('dataset');
     $dataSet = new DataSet();
     return $this->Respond($this->NodeListFromArray($dataSet->GetDataSetColumnTypes(), 'datasetcolumntype'));
 }
Example #14
0
 public function DataSetTableHtml($displayId = 0, $isPreview = true)
 {
     $db =& $this->db;
     // Show a preview of the data set table output.
     $dataSetId = $this->GetOption('datasetid');
     $upperLimit = $this->GetOption('upperLimit');
     $lowerLimit = $this->GetOption('lowerLimit');
     $filter = $this->GetOption('filter');
     $ordering = $this->GetOption('ordering');
     $columnIds = $this->GetOption('columns');
     $showHeadings = $this->GetOption('showHeadings');
     $rowsPerPage = $this->GetOption('rowsPerPage');
     if ($columnIds == '') {
         return 'No columns';
     }
     // Set an expiry time for the media
     $media = new Media();
     $layout = new Layout();
     $expires = time() + $this->GetOption('updateInterval', 3600) * 60;
     // Create a data set view object, to get the results.
     $dataSet = new DataSet($db);
     if (!($dataSetResults = $dataSet->DataSetResults($dataSetId, $columnIds, $filter, $ordering, $lowerLimit, $upperLimit, $displayId))) {
         return;
     }
     $rowCount = 1;
     $rowCountThisPage = 1;
     $totalRows = count($dataSetResults['Rows']);
     if ($rowsPerPage > 0) {
         $totalPages = $totalRows / $rowsPerPage;
     } else {
         $totalPages = 1;
     }
     $table = '<div id="DataSetTableContainer" totalRows="' . $totalRows . '" totalPages="' . $totalPages . '">';
     foreach ($dataSetResults['Rows'] as $row) {
         if ($rowsPerPage > 0 && $rowCountThisPage >= $rowsPerPage || $rowCount == 1) {
             // Reset the row count on this page
             $rowCountThisPage = 0;
             if ($rowCount > 1) {
                 $table .= '</tbody>';
                 $table .= '</table>';
             }
             // Output the table header
             $table .= '<table class="DataSetTable">';
             if ($showHeadings == 1) {
                 $table .= '<thead>';
                 $table .= ' <tr class="HeaderRow">';
                 foreach ($dataSetResults['Columns'] as $col) {
                     $table .= '<th class="DataSetColumnHeaderCell">' . $col['Text'] . '</th>';
                 }
                 $table .= ' </tr>';
                 $table .= '</thead>';
             }
             $table .= '<tbody>';
         }
         $table .= '<tr class="DataSetRow DataSetRow' . ($rowCount % 2 ? 'Odd' : 'Even') . '" id="row_' . $rowCount . '">';
         // Output each cell for these results
         for ($i = 0; $i < count($dataSetResults['Columns']); $i++) {
             // Pull out the cell for this row / column
             $replace = $row[$i];
             // What if this column is an image column type?
             if ($dataSetResults['Columns'][$i]['DataTypeID'] == 4) {
                 // Download the image, alter the replace to wrap in an image tag
                 $file = $media->addModuleFileFromUrl(str_replace(' ', '%20', htmlspecialchars_decode($replace)), 'datasetview_' . md5($dataSetId . $dataSetResults['Columns'][$i]['DataSetColumnID'] . $replace), $expires);
                 // Tag this layout with this file
                 $layout->AddLk($this->layoutid, 'module', $file['mediaId']);
                 $replace = $isPreview ? '<img src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $file['mediaId'] . '" />' : '<img src="' . $file['storedAs'] . '" />';
             }
             $table .= '<td class="DataSetColumn" id="column_' . ($i + 1) . '"><span class="DataSetCellSpan" id="span_' . $rowCount . '_' . ($i + 1) . '">' . $replace . '</span></td>';
         }
         $table .= '</tr>';
         $rowCount++;
         $rowCountThisPage++;
     }
     $table .= '</tbody>';
     $table .= '</table>';
     $table .= '</div>';
     return $table;
 }
Example #15
0
 public function DeleteDataSet()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $dataSetId = Kit::GetParam('datasetid', _POST, _INT);
     $auth = $user->DataSetAuth($dataSetId, true);
     if (!$auth->del) {
         trigger_error(__('Access Denied'));
     }
     $dataSetObject = new DataSet($db);
     if (!$dataSetObject->Delete($dataSetId)) {
         trigger_error($dataSetObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('DataSet Deleted'));
     $response->Respond();
 }
Example #16
0
 public function DeleteDataSet()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $dataSetId = Kit::GetParam('datasetid', _POST, _INT);
     $auth = $user->DataSetAuth($dataSetId, true);
     if (!$auth->del) {
         trigger_error(__('Access Denied'));
     }
     $dataSetObject = new DataSet($db);
     if ($dataSetObject->hasData($dataSetId) && Kit::GetParam('deleteData', _POST, _CHECKBOX) == 0) {
         trigger_error(__('There is data assigned to this data set, cannot delete.'), E_USER_ERROR);
     }
     // Proceed with the delete
     if (!$dataSetObject->Delete($dataSetId)) {
         trigger_error($dataSetObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('DataSet Deleted'));
     $response->Respond();
 }
Example #17
0
 /**
  * build , main build method
  *
  * @access   public
  * @return   string  datagrid output
  */
 function build($mivista = 'datagrid')
 {
     parent::build();
     if ($this->systemError != '') {
         //gestire l'errore in CI
     }
     return $this->output = $this->_buildGrid($mivista);
 }
Example #18
0
 public function DataSetTableHtml($displayId = 0)
 {
     $db =& $this->db;
     // Show a preview of the data set table output.
     $dataSetId = $this->GetOption('datasetid');
     $upperLimit = $this->GetOption('upperLimit');
     $lowerLimit = $this->GetOption('lowerLimit');
     $filter = $this->GetOption('filter');
     $ordering = $this->GetOption('ordering');
     $columnIds = $this->GetOption('columns');
     $showHeadings = $this->GetOption('showHeadings');
     $rowsPerPage = $this->GetOption('rowsPerPage');
     if ($columnIds == '') {
         return 'No columns';
     }
     // Create a data set view object, to get the results.
     Kit::ClassLoader('dataset');
     $dataSet = new DataSet($db);
     $dataSetResults = $dataSet->DataSetResults($dataSetId, $columnIds, $filter, $ordering, $lowerLimit, $upperLimit, $displayId);
     $rowCount = 1;
     $rowCountThisPage = 1;
     $totalRows = count($dataSetResults['Rows']);
     if ($rowsPerPage > 0) {
         $totalPages = $totalRows / $rowsPerPage;
     } else {
         $totalPages = 1;
     }
     $table = '<div id="DataSetTableContainer" totalRows="' . $totalRows . '" totalPages="' . $totalPages . '">';
     foreach ($dataSetResults['Rows'] as $row) {
         if ($rowsPerPage > 0 && $rowCountThisPage >= $rowsPerPage || $rowCount == 1) {
             // Reset the row count on this page
             $rowCountThisPage = 0;
             if ($rowCount > 1) {
                 $table .= '</tbody>';
                 $table .= '</table>';
             }
             // Output the table header
             $table .= '<table class="DataSetTable">';
             if ($showHeadings == 1) {
                 $table .= '<thead>';
                 $table .= ' <tr class="HeaderRow">';
                 foreach ($dataSetResults['Columns'] as $col) {
                     $table .= '<th class="DataSetColumnHeaderCell">' . $col . '</th>';
                 }
                 $table .= ' </tr>';
                 $table .= '</thead>';
             }
             $table .= '<tbody>';
         }
         $table .= '<tr class="DataSetRow DataSetRow' . ($rowCount % 2 ? 'Odd' : 'Even') . '" id="row_' . $rowCount . '">';
         for ($i = 0; $i < count($dataSetResults['Columns']); $i++) {
             $table .= '<td class="DataSetColumn" id="column_' . ($i + 1) . '"><span class="DataSetCellSpan" id="span_' . $rowCount . '_' . ($i + 1) . '">' . $row[$i] . '</span></td>';
         }
         $table .= '</tr>';
         $rowCount++;
         $rowCountThisPage++;
     }
     $table .= '</tbody>';
     $table .= '</table>';
     $table .= '</div>';
     return $table;
 }
Example #19
0
 /**
  * @copydoc DataSet::__construct
  */
 public function __construct($name, array $params = null)
 {
     parent::__construct($name, $params);
     $this->addWYSIWYGTranslations();
     $this->setProperty('exttype', 'grid');
 }
$format_object->exportable = "on";
$format_object->header = "on";
$format_object->table_width = 100;
$format_object->font_size = "Default";
$format_object->output_default = "table";
$format_object->prespace_y = "off";
$format_object->use_prev_header = "off";
$format_object->table_width_type = "%";
$format_object->custom_layout = "Enabled";
$format_object->team_id = 1;
$format_object->header_back_color = "blue";
$format_object->body_back_color = "white";
$format_object->header_text_color = "white";
$format_object->body_text_color = "blue";
/////////////Second Data Set
$format_object2 = new DataSet();
$format_object2->name = $mod_strings['LBL_OPP'] . "2";
$format_object2->description = $mod_strings['LBL_OPP2_DESC'];
$format_object2->report_id = $report_id;
$format_object2->query_id = $query_id2;
$format_object2->list_order_y = 1;
$format_object2->exportable = "on";
$format_object2->header = "on";
$format_object2->table_width = 100;
$format_object2->font_size = "Default";
$format_object2->output_default = "table";
$format_object2->prespace_y = "on";
$format_object2->use_prev_header = "on";
$format_object2->table_width_type = "%";
$format_object2->custom_layout = "Enabled";
$format_object2->team_id = 1;
Example #21
0
 /**
  * @covers Binary\DataSet::setValueByPath
  */
 public function testNestedSetValueByPath()
 {
     $dataSet = new DataSet();
     $dataSet->setValueByPath(array('level1', 'foo'), 'bar');
     $this->assertEquals('bar', $dataSet->getValueByPath(array('level1', 'foo'), true));
 }
Example #22
0
 /**
  * build , main build method
  *
  * @access   public
  * @return   string  datatable output
  */
 function build()
 {
     parent::build();
     if ($this->systemError != "") {
         // ci logerror
     }
     $mypointer = 0;
     $output = "";
     $data["title"] = "";
     $data["container_tr"] = "";
     $data["container_bl"] = "";
     $data["container_br"] = "";
     $data["pager"] = "";
     $data["trs"] = array();
     $trs = array();
     $this->rapyd->set_view_path();
     //title
     $data["title"] = $this->_title;
     //buttons
     if (count($this->_button_container["TR"]) > 0) {
         $data["container_tr"] = join("&nbsp;", $this->_button_container["TR"]);
     }
     if (count($this->_button_container["BL"]) > 0) {
         $data["container_bl"] = join("&nbsp;", $this->_button_container["BL"]);
     }
     if (count($this->_button_container["BR"]) > 0) {
         $data["container_br"] = join("&nbsp;", $this->_button_container["BR"]);
     }
     $dataset = $this->data;
     $numRows = ceil(count($dataset) / $this->per_row);
     $itrations = $this->per_row;
     //table rows
     for ($i = 0; $i < $numRows; $i++) {
         unset($tds);
         //table-cells
         for ($j = 1; $j <= $itrations; $j++) {
             if (isset($dataset[0])) {
                 if (!is_array($dataset[0])) {
                     $this->cell_template = "&nbsp;";
                 }
             } else {
                 $this->cell_template = "&nbsp;";
             }
             $cell = new DataTableCell($this->cell_template);
             if (isset($dataset[0])) {
                 $cell->setValue($dataset[0]);
             } else {
                 $cell->setValue("");
             }
             $td["attributes"] = $this->cell_attributes;
             $td["content"] = $cell->getValue();
             $tds[] = $td;
             array_shift($dataset);
         }
         $trs[] = $tds;
     }
     $data["trs"] = $trs;
     //pager
     if ($this->paged) {
         $data["pager"] = $this->navigator;
     }
     $this->output = $this->ci->load->view('datatable', $data, true);
     $this->rapyd->reset_view_path();
     return $this->output;
 }
Example #23
0
 public function __construct(array $data)
 {
     parent::__construct($data);
 }
Example #24
0
 /**
  * Update the Water Mark to indicate the last data edit
  * @param int $dataSetId The Data Set ID to Update
  */
 private function UpdateWatermark($dataSetId)
 {
     if ($dataSetId == 0 || $dataSetId == '') {
         return $this->SetError(25001, __('Missing dataSetId'));
     }
     if (!$this->updateWatermark) {
         return;
     }
     Debug::LogEntry('audit', sprintf('Updating water mark on DataSetId: %d', $dataSetId), 'DataSetData', 'UpdateWatermark');
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('UPDATE `dataset` SET LastDataEdit = :last_data_edit WHERE DataSetID = :dataset_id');
         $sth->execute(array('last_data_edit' => time(), 'dataset_id' => $dataSetId));
         // Get affected Campaigns
         Kit::ClassLoader('dataset');
         $dataSet = new DataSet($this->db);
         $campaigns = $dataSet->GetCampaignsForDataSet($dataSetId);
         Kit::ClassLoader('display');
         $display = new Display($this->db);
         foreach ($campaigns as $campaignId) {
             // Assess all displays
             $campaigns = $display->NotifyDisplays($campaignId);
         }
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
 }
Example #25
0
 private function GetDataSetItems($displayId, $text)
 {
     $db =& $this->db;
     // Extra fields for data sets
     $dataSetId = $this->GetOption('datasetid');
     $upperLimit = $this->GetOption('upperLimit');
     $lowerLimit = $this->GetOption('lowerLimit');
     $filter = $this->GetOption('filter');
     $ordering = $this->GetOption('ordering');
     Debug::LogEntry('audit', 'Then template for each row is: ' . $text);
     // Combine the column id's with the dataset data
     $matches = '';
     preg_match_all('/\\[(.*?)\\]/', $text, $matches);
     $columnIds = array();
     foreach ($matches[1] as $match) {
         // Get the column id's we are interested in
         Debug::LogEntry('audit', 'Matched column: ' . $match);
         $col = explode('|', $match);
         $columnIds[] = $col[1];
     }
     // Get the dataset results
     Kit::ClassLoader('dataset');
     $dataSet = new DataSet($db);
     $dataSetResults = $dataSet->DataSetResults($dataSetId, implode(',', $columnIds), $filter, $ordering, $lowerLimit, $upperLimit, $displayId, true);
     $items = array();
     foreach ($dataSetResults['Rows'] as $row) {
         // For each row, substitute into our template
         $rowString = $text;
         foreach ($matches[1] as $sub) {
             // Pick the appropriate column out
             $subs = explode('|', $sub);
             $rowString = str_replace('[' . $sub . ']', $row[$subs[0]], $rowString);
         }
         $items[] = $rowString;
     }
     return $items;
 }
Example #26
0
 function __construct(DataSet $ds)
 {
     $this->ds = $ds;
     $this->size = $ds->size();
 }