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


PHP owa_coreAPI::entityFactory方法代码示例

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


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

示例1: notify

 /**
  * Notify Event Handler
  *
  * @param 	unknown_type $event
  * @access 	public
  */
 function notify($event)
 {
     // Make entity
     $f = owa_coreAPI::entityFactory('base.feed_request');
     $f->load($event->get('guid'));
     if (!$f->wasPersisted()) {
         $f->setProperties($event->getProperties());
         // Set Primary Key
         $f->set('id', $event->get('guid'));
         // Make ua id
         $f->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));
         // Make OS id
         $f->set('os_id', owa_lib::setStringGuid($event->get('os')));
         // Make document id
         $f->set('document_id', owa_lib::setStringGuid($event->get('page_url')));
         // Generate Host id
         $f->set('host_id', owa_lib::setStringGuid($event->get('host')));
         $f->set('subscription_id', $event->get('feed_subscription_id'));
         // Persist to database
         $ret = $f->create();
         if ($ret) {
             $eq = owa_coreAPI::getEventDispatch();
             $nevent = $eq->makeEvent($event->getEventType() . '_persisted');
             $nevent->setProperties($event->getProperties());
             $eq->notify($nevent);
             return OWA_EHS_EVENT_HANDLED;
         } else {
             return OWA_EHS_EVENT_FAILED;
         }
     } else {
         owa_coreAPI::debug('Not persisting. Feed request already exists.');
         return OWA_EHS_EVENT_HANDLED;
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:40,代码来源:feedRequestHandlers.php

示例2: action

 function action()
 {
     $site = owa_coreAPI::entityFactory('base.site');
     $site->delete($site->generateId($this->getParam('siteId')));
     $this->setRedirectAction('base.sites');
     $this->set('status_code', 3204);
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:7,代码来源:sitesDelete.php

示例3: createAdminUser

 function createAdminUser($email_address)
 {
     //create user entity
     $u = owa_coreAPI::entityFactory('base.user');
     // check to see if an admin user already exists
     $u->getByColumn('role', 'admin');
     $id_check = $u->get('id');
     // if not then proceed
     if (empty($id_check)) {
         //Check to see if user name already exists
         $u->getByColumn('user_id', 'admin');
         $id = $u->get('id');
         // Set user object Params
         if (empty($id)) {
             $password = $u->generateRandomPassword();
             $u->set('user_id', 'admin');
             $u->set('role', 'admin');
             $u->set('real_name', '');
             $u->set('email_address', $email_address);
             $u->set('password', owa_lib::encryptPassword($password));
             $u->set('creation_date', time());
             $u->set('last_update_date', time());
             $ret = $u->create();
             owa_coreAPI::debug("Admin user created successfully.");
             return $password;
         } else {
             owa_coreAPI::debug($this->getMsg(3306));
         }
     } else {
         owa_coreAPI::debug("Admin user already exists.");
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:32,代码来源:004.php

示例4: notify

 /**
  * Notify Handler
  *
  * @access 	public
  * @param 	object $event
  */
 function notify($event)
 {
     $r = owa_coreAPI::entityFactory('base.request');
     $r->load($event->get('guid'));
     if (!$r->wasPersisted()) {
         $r->setProperties($event->getProperties());
         // Set Primary Key
         $r->set('id', $event->get('guid'));
         // Make prior document id
         $r->set('prior_document_id', owa_lib::setStringGuid($event->get('prior_page')));
         // Generate Host id
         $r->set('num_prior_sessions', $event->get('num_prior_sessions'));
         $result = $r->create();
         if ($result == true) {
             $eq = owa_coreAPI::getEventDispatch();
             $nevent = $eq->makeEvent($event->getEventType() . '_logged');
             $nevent->setProperties($event->getProperties());
             $eq->asyncNotify($nevent);
             return OWA_EHS_EVENT_HANDLED;
         } else {
             return OWA_EHS_EVENT_FAILED;
         }
     } else {
         owa_coreAPI::debug('Not persisting. Request already exists.');
         return OWA_EHS_EVENT_HANDLED;
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:33,代码来源:requestHandlers.php

示例5: notify

 /**
  * Notify Event Handler
  *
  * @param 	unknown_type $event
  * @access 	public
  */
 function notify($event)
 {
     if ($event->get('source')) {
         $s = owa_coreAPI::entityFactory('base.source_dim');
         $new_id = $s->generateId(trim(strtolower($event->get('source'))));
         $s->getByPk('id', $new_id);
         $id = $s->get('id');
         if (!$id) {
             $s->set('id', $new_id);
             $s->set('source_domain', $event->get('source'));
             $ret = $s->create();
             if ($ret) {
                 return OWA_EHS_EVENT_HANDLED;
             } else {
                 return OWA_EHS_EVENT_FAILED;
             }
         } else {
             owa_coreAPI::debug('Not Persisting. Source already exists.');
             return OWA_EHS_EVENT_HANDLED;
         }
     } else {
         owa_coreAPI::debug('Noting to handle. No source properties found on event.');
         return OWA_EHS_EVENT_HANDLED;
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:31,代码来源:sourceHandlers.php

示例6: notify

 /**
  * Notify Event Handler
  *
  * @param 	unknown_type $event
  * @access 	public
  */
 function notify($event)
 {
     $v = owa_coreAPI::entityFactory('base.visitor');
     $v->load($event->get('visitor_id'));
     if (!$v->wasPersisted()) {
         $v->setProperties($event->getProperties());
         // Set Primary Key
         $v->set('id', $event->get('visitor_id'));
         $v->set('first_session_id', $event->get('session_id'));
         $v->set('first_session_year', $event->get('year'));
         $v->set('first_session_month', $event->get('month'));
         $v->set('first_session_day', $event->get('day'));
         $v->set('first_session_dayofyear', $event->get('dayofyear'));
         $v->set('first_session_timestamp', $event->get('timestamp'));
         $ret = $v->create();
         if ($ret) {
             return OWA_EHS_EVENT_HANDLED;
         } else {
             return OWA_EHS_EVENT_FAILED;
         }
     } else {
         owa_coreAPI::debug("Not persisting. Visitor already exists.");
         return OWA_EHS_EVENT_HANDLED;
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:31,代码来源:visitorHandlers.php

示例7: render

 function render()
 {
     $site = $this->get('site');
     if ($this->get('edit')) {
         $this->body->set('action', 'base.sitesEdit');
         $this->body->set('headline', 'Edit Site Profile for: ' . $site['domain']);
         $siteEntity = owa_coreAPI::entityFactory('base.site');
         $siteEntity->getByColumn('site_id', $this->get('siteId'));
         $this->body->set('siteEntity', $siteEntity);
     } else {
         $this->body->set('action', 'base.sitesAdd');
         $this->body->set('headline', 'Add a New Tracked Site Profile');
     }
     if (isset($site['domain'])) {
         $this->t->set('page_title', 'Site Profile for: ' . $site['domain']);
     } else {
         $this->t->set('page_title', 'Site Profile for new Site');
     }
     $this->body->set('users', $this->getAllUserRows());
     $this->body->set('site', $site);
     $this->body->set('edit', $this->get('edit'));
     $this->body->set('site_id', $this->get('siteId'));
     $this->body->set('config', $this->get('config'));
     //print_r($this->get('config'));
     $this->body->set_template('sites_addoredit.tpl');
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:26,代码来源:sitesProfile.php

示例8: action

 function action()
 {
     // Load the core API
     $api =& owa_coreAPI::singleton($this->params);
     if ($this->params['site_id']) {
         //get site labels
         $s = owa_coreAPI::entityFactory('base.site');
         $s->getByColumn('site_id', $this->getParam('site_id'));
         $this->set('site_name', $s->get('name'));
         $this->set('site_description', $s->get('description'));
     } else {
         $this->set('site_name', 'All Sites');
         $this->set('site_description', 'All Sites Tracked by OWA');
     }
     //setup Metrics
     $m = owa_coreApi::metricFactory('base.latestVisits');
     $m->setConstraint('site_id', $this->getParam('site_id'));
     $m->setPeriod($this->getPeriod());
     $m->setOrder(OWA_SQL_DESCENDING);
     $m->setLimit(15);
     $results = $m->generate();
     $this->set('latest_visits', $results);
     $this->setView('base.kmlVisitsGeolocation');
     return;
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:25,代码来源:kmlVisitsGeolocation.php

示例9: notify

 /**
  * Notify method
  *
  * @param 	object $event
  * @access 	public
  */
 function notify($event)
 {
     $ds = owa_coreAPI::entityFactory('base.domstream');
     $ds->load($event->get('guid'));
     if (!$ds->wasPersisted()) {
         $ds->setProperties($event->getProperties());
         $ds->set('id', $event->get('guid'));
         $ds->set('domstream_guid', $event->get('domstream_guid'));
         $ds->set('document_id', $ds->generateId($event->get('page_url')));
         $ds->set('page_url', $event->get('page_url'));
         $ds->set('events', $event->get('stream_events'));
         $ds->set('duration', $event->get('duration'));
         $ret = $ds->create();
         if ($ret) {
             // Tell others that "dom.stream" has been logged
             $eq = owa_coreAPI::getEventDispatch();
             $nevent = $eq->makeEvent($event->getEventType() . '_logged');
             $nevent->setProperties($event->getProperties());
             $eq->asyncNotify($nevent);
             return OWA_EHS_EVENT_HANDLED;
         } else {
             return OWA_EHS_EVENT_FAILED;
         }
     } else {
         owa_coreAPI::debug('No persisting. Domsteam  already exists.');
         return OWA_EHS_EVENT_HANDLED;
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:34,代码来源:domstreamHandlers.php

示例10: createDefaultSite

 function createDefaultSite($domain, $name = '', $description = '', $site_family = '', $site_id = '')
 {
     if (!$name) {
         $name = $domain;
     }
     $site = owa_coreAPI::entityFactory('base.site');
     if (!$site_id) {
         $site_id = $site->generateSiteId($domain);
     }
     // Check to see if default site already exists
     $this->e->notice('Checking for existence of default site.');
     // create site_id....how???
     $site->getByColumn('site_id', $site_id);
     $id = $site->get('id');
     if (empty($id)) {
         // Create default site
         $site->set('id', $site->generateId($site_id));
         $site->set('site_id', $site_id);
         $site->set('name', $name);
         $site->set('description', $description);
         $site->set('domain', $domain);
         $site->set('site_family', $site_family);
         $site_status = $site->create();
         if ($site_status == true) {
             $this->e->notice('Created default site.');
         } else {
             $this->e->notice('Creation of default site failed.');
         }
     } else {
         $this->e->notice(sprintf("Default site already exists (id = %s). nothing to do here.", $id));
     }
     return $site->get('site_id');
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:33,代码来源:installManager.php

示例11: action

 function action()
 {
     $d = owa_coreAPI::entityFactory('base.document');
     if ($this->getParam('pageUrl')) {
         $pageUrl = $this->getParam('pageUrl');
         $d->getByColumn('url', $pageUrl);
         $this->set('constraints', 'pageUrl==' . urlencode($pageUrl));
         $title_slug = $pageUrl;
     }
     if ($this->getParam('pagePath')) {
         $pagePath = $this->getParam('pagePath');
         $d->getByColumn('uri', $pagePath);
         $this->set('constraints', 'pagePath==' . urlencode($pagePath));
         $title_slug = $pagePath;
     }
     if ($this->getParam('document_id')) {
         $did = $this->getParam('document_id');
         $d->load($did);
         $pagePath = $d->get('uri');
         $this->set('constraints', 'pagePath==' . urlencode($pagePath));
         $title_slug = $pagePath;
     }
     $this->setTitle('Dom Clicks: ', $title_slug);
     $this->set('document', $d);
     $this->setSubview('base.reportDomClicks');
     $this->set('metrics', 'domClicks');
     $this->set('sort', 'domClicks');
     $this->set('resultsPerPage', 30);
     $this->set('trendChartMetric', 'domClicks');
     $this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.domClicks.formatted_value *> dom clicks for this web page.');
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:31,代码来源:reportDomClicks.php

示例12: notify

 /**
  * Notify Handler
  *
  * @access 	public
  * @param 	object $event
  */
 function notify($event)
 {
     $c = owa_coreAPI::entityFactory('base.click');
     $c->load($event->get('guid'));
     if (!$c->wasPersisted()) {
         $c->set('id', $event->get('guid'));
         $c->setProperties($event->getProperties());
         $c->set('visitor_id', $event->get('visitor_id'));
         $c->set('session_id', $event->get('session_id'));
         $c->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));
         // Make document id
         $c->set('document_id', owa_lib::setStringGuid($event->get('page_url')));
         // Make Target page id
         $c->set('target_id', owa_lib::setStringGuid($c->get('target_url')));
         // Make position id used for group bys
         $c->set('position', $c->get('click_x') . $c->get('click_y'));
         $ret = $c->create();
         if ($ret) {
             return OWA_EHS_EVENT_HANDLED;
         } else {
             return OWA_EHS_EVENT_FAILED;
         }
     } else {
         return OWA_EHS_EVENT_HANDLED;
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:32,代码来源:clickHandlers.php

示例13: notify

 /**
  * Notify Event Handler
  *
  * @param 	unknown_type $event
  * @access 	public
  */
 function notify($event)
 {
     // create entity
     $d = owa_coreAPI::entityFactory('base.document');
     // get document id from event
     $id = $event->get('document_id');
     // if no document_id present attempt to make one from the page_url property
     if (!$id) {
         $page_url = $event->get('page_url');
         if ($page_url) {
             $id = $d->generateId($page_url);
         } else {
             owa_coreAPI::debug('Not persisting Document, no page_url or document_id event property found.');
             return OWA_EHS_EVENT_HANDLED;
         }
     }
     $d->load($id);
     if (!$d->wasPersisted()) {
         $d->setProperties($event->getProperties());
         $d->set('url', $event->get('page_url'));
         $d->set('uri', $event->get('page_uri'));
         $d->set('id', $id);
         $ret = $d->create();
         if ($ret) {
             return OWA_EHS_EVENT_HANDLED;
         } else {
             return OWA_EHS_EVENT_FAILED;
         }
     } else {
         owa_coreAPI::debug('Not logging Document, already exists');
         return OWA_EHS_EVENT_HANDLED;
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:39,代码来源:documentHandlers.php

示例14: notify

 /**
  * Notify Handler
  *
  * @access 	public
  * @param 	object $event
  */
 function notify($event)
 {
     $c = owa_coreAPI::entityFactory('base.click');
     $c->load($event->get('guid'));
     if (!$c->wasPersisted()) {
         $c->set('id', $event->get('guid'));
         $c->setProperties($event->getProperties());
         $c->set('visitor_id', $event->get('visitor_id'));
         $c->set('session_id', $event->get('session_id'));
         $c->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));
         // Make document id
         $c->set('document_id', owa_lib::setStringGuid($event->get('page_url')));
         // Make Target page id
         $c->set('target_id', owa_lib::setStringGuid($c->get('target_url')));
         // Make position id used for group bys
         $c->set('position', $c->get('click_x') . $c->get('click_y'));
         $ret = $c->create();
         if ($ret) {
             // Tell others that "dom.click" has been logged
             $eq = owa_coreAPI::getEventDispatch();
             $nevent = $eq->makeEvent($event->getEventType() . '_logged');
             $nevent->setProperties($event->getProperties());
             $eq->asyncNotify($nevent);
             return OWA_EHS_EVENT_HANDLED;
         } else {
             return OWA_EHS_EVENT_FAILED;
         }
     } else {
         return OWA_EHS_EVENT_HANDLED;
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:37,代码来源:clickHandlers.php

示例15: action

 function action()
 {
     $document_id = '';
     // get period
     $p = $this->getPeriod();
     // check for limits
     if ($this->getParam('document_id') || $this->getParam('pageUrl') || $this->getParam('pagePath')) {
         $doc = owa_coreAPI::entityFactory('base.document');
         if ($this->getParam('pageUrl')) {
             $doc->getByColumn('url', $this->getParam('pageUrl'));
         } elseif ($this->getParam('pagePath')) {
             $doc->getByColumn('uri', $this->getParam('pagePath'));
         } else {
             $doc->load($this->getParam('document_id'));
         }
         $document_id = $doc->get('id');
         $this->setTitle('Domstream Recordings: ', $doc->get('url'));
         $this->set('document', $doc->_getProperties());
         $this->set('item_properties', $doc);
     } else {
         // latest domstream report
         $this->setTitle('Latest Domstreams');
     }
     $ds = owa_coreAPI::executeApiCommand(array('do' => 'getDomstreams', 'startDate' => $p->getStartDate()->getYyyymmdd(), 'endDate' => $p->getEndDate()->getYyyymmdd(), 'document_id' => $document_id, 'siteId' => $this->getParam('siteId'), 'page' => $this->getParam('page'), 'resultsPerPage' => 50, 'format' => $this->getParam('format')));
     $this->set('domstreams', $ds);
     //print_r($ds);
     // set view stuff
     $this->setSubview('base.reportDomstreams');
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:29,代码来源:reportDomstreams.php


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