function getDomstream($domstream_guid) { if (!$domstream_guid) { return; } // Fetch document object $d = owa_coreAPI::entityFactory('base.domstream'); //$d->load($this->getParam('domstream_id')); //$json = new Services_JSON(); //$d->set('events', $json->decode($d->get('events'))); $db = owa_coreAPI::dbSingleton(); $db->select('*'); $db->from($d->getTableName()); $db->where('domstream_guid', $domstream_guid); $db->orderBy('timestamp', 'ASC'); $ret = $db->getAllRows(); //print_r($ret); $combined = ''; foreach ($ret as $row) { $combined = $this->mergeStreamEvents($row['events'], $combined); } $row['events'] = json_decode($combined); $t = new owa_template(); $t->set_template('json.php'); //$json = new Services_JSON(); // set // if not found look on the request scope. $callback = owa_coreAPI::getRequestParam('jsonpCallback'); if (!$callback) { $t->set('json', json_encode($row)); } else { $body = sprintf("%s(%s);", $callback, json_encode($row)); $t->set('json', $body); } return $t->fetch(); }
public static function getJsTrackerTag($site_id, $options = array()) { if (!class_exists('owa_template')) { require_once OWA_BASE_CLASSES_DIR . 'owa_template.php'; } $t = new owa_template(); //check to see if we shuld log clicks. if (!owa_coreAPI::getSetting('base', 'log_dom_clicks')) { $options['do_not_log_clicks'] = true; } if (!owa_coreAPI::getSetting('base', 'log_dom_streams')) { $options['do_not_log_domstream'] = true; } if (owa_coreAPI::getSetting('base', 'is_embedded')) { // needed to override the endpoint used by the js tracker $options['apiEndpoint'] = owa_coreAPI::getSetting('base', 'api_url'); } $t->set('site_id', $site_id); $t->set('options', $options); $t->set_template('js_log_tag.tpl'); return $t->fetch(); }
function renderDimension($template, $properties) { $t = new owa_template(); $t->set('properties', $properties); $t->set_template($template); return $t->fetch(); }
/** * Assembles the view using passed model objects * * @param unknown_type $data * @return unknown */ function assembleView($data) { $this->e->debug('Assembling view: ' . get_class($this)); // set view name in template class. used for navigation. if (array_key_exists('view', $this->data)) { $this->body->caller_params['view'] = $this->data['view']; } if (array_key_exists('params', $this->data)) { $this->body->set('params', $this->data['params']); } if (array_key_exists('subview', $this->data)) { $this->body->caller_params['subview'] = $this->data['subview']; } // Assign status msg if (array_key_exists('status_msg', $this->data)) { $this->t->set('status_msg', $this->data['status_msg']); } // get status msg from code passed on the query string from a redirect. if (array_key_exists('status_code', $this->data)) { $this->t->set('status_msg', $this->getMsg($this->data['status_code'])); } // set error msg directly if passed from constructor if (array_key_exists('error_msg', $this->data)) { $this->t->set('error_msg', $this->data['error_msg']); } // authentication status if (array_key_exists('auth_status', $this->data)) { $this->t->set('authStatus', $this->data['auth_status']); } // get error msg from error code passed on the query string from a redirect. if (array_key_exists('error_code', $this->data)) { $this->t->set('error_msg', $this->getMsg($this->data['error_code'])); } // load subview if (!empty($this->data['subview']) || !empty($this->default_subview)) { // Load subview $this->loadSubView($this->data['subview']); } // construct main view. This might set some properties of the subview. if (method_exists($this, 'render')) { $this->render($this->data); } else { // old style $this->construct($this->data); } //array of errors usually used for field validations if (array_key_exists('validation_errors', $this->data)) { $this->body->set('validation_errors', $this->data['validation_errors']); } // pagination if (array_key_exists('pagination', $this->data)) { $this->body->set('pagination', $this->data['pagination']); } $this->_setLinkState(); // assemble subview if (!empty($this->data['subview'])) { // set view name in template. used for navigation. $this->subview->body->caller_params['view'] = $this->data['subview']; // Set validation errors $this->subview->body->set('validation_errors', $this->get('validation_errors')); // pagination if (array_key_exists('pagination', $this->data)) { $this->subview->body->set('pagination', $this->data['pagination']); } if (array_key_exists('params', $this->data)) { $this->subview->body->set('params', $this->data['params']); $this->subview->body->set('do', $this->data['params']['do']); } // Load subview $this->renderSubView($this->data); // assign subview to body template $this->body->set('subview', $this->subview_rendered); } // assign validation errors if (!empty($this->data['validation_errors'])) { $ves = new owa_template('base'); $ves->set_template('error_validation_summary.tpl'); $ves->set('validation_errors', $this->data['validation_errors']); $validation_errors_summary = $ves->fetch(); $this->t->set('error_msg', $validation_errors_summary); } // fire post method $this->post(); // assign css and js ellements if the view is not a subview. // subview css/js have been merged/pulls from subview and assigned here. if ($this->is_subview != true) { if (!empty($this->css)) { $this->t->set('css', $this->css); } if (!empty($this->js)) { $this->t->set('js', $this->js); } } //Assign body to main template $this->t->set('config', $this->config); //Assign body to main template $this->t->set('body', $this->body); if ($this->postProcessView === true) { return $this->postProcess(); } else { // Return fully asembled View return $this->t->fetch(); } }
/** * Returns a configured javascript tracker for inclusion in your web page. * You can pass an options array to control what the tracker will log. * The options array is a key/value pair format like: * * $options = array('do_not_log_pageview' => true); * * Option keys include: 'do_not_log_pageview', 'do_not_log_clicks', 'do_not_log_domstream' * * @param $echo bool if true the function will echo. if false the tracker is returned asa string. * @param $options array an key value pair option array * @return $tag string the tracker javascript. */ function placeHelperPageTags($echo = true, $options = array()) { if (!owa_coreAPI::getRequestParam('is_robot')) { // check to see if first hit tag is needed if (isset($options['delay_first_hit']) || owa_coreAPI::getSetting('base', 'delay_first_hit')) { $service =& owa_coreAPI::serviceSingleton(); //check for persistant cookie $v = $service->request->getOwaCookie('v'); if (empty($v)) { $options['first_hit_tag'] = true; } } if (!class_exists('owa_template')) { require_once OWA_BASE_CLASSES_DIR . 'owa_template.php'; } $t = new owa_template(); $t->set_template('js_helper_tags.tpl'); $tracking_code = owa_coreAPI::getJsTrackerTag($this->getSiteId(), $options); $t->set('tracking_code', $tracking_code); $tag = $t->fetch(); if ($echo == false) { return $tag; } else { echo $tag; } } }
function getLatestActions($startDate, $endDate, $siteId, $visitorId = '', $sessionId = '', $width = '300px', $resultsPerPage = 25, $page = 1) { $la = owa_coreAPI::executeApiCommand(array('do' => 'getLatestActions', 'siteId' => $siteId, 'page' => $page, 'startDate' => $startDate, 'endDate' => $endDate, 'visitorId' => $visitorId, 'sessionId' => $sessionId, 'resultsPerPage' => $resultsPerPage)); $items = $la->getResultsRows(); $t = new owa_template(); $t->set('items', $items); $t->set('width', $width); $t->set_template('widget_latestActions.php'); return $t->fetch(); }
function resultSetToHtml($class = 'dimensionalResultSet') { $t = new owa_template(); $t->set_template('resultSetHtml.php'); $t->set('rs', $this); $t->set('class', $class); return $t->fetch(); }