Ejemplo n.º 1
0
 /**
  * Handle all necessary operations when new agency is created
  *
  * @see DB_DataObject::insert()
  */
 function insert()
 {
     // Create account first
     $result = $this->createAccount(OA_ACCOUNT_MANAGER, $this->name);
     if (!$result) {
         return $result;
     }
     // Store data to create a user
     if (!empty($this->username) && !empty($this->password)) {
         $aUser = array('contact_name' => $this->contact, 'email_address' => $this->email, 'username' => $this->username, 'password' => $this->password, 'default_account_id' => $this->account_id);
     }
     $agencyid = parent::insert();
     if (!$agencyid) {
         return $agencyid;
     }
     // Create user if needed
     // Is this even required anymore?
     if (!empty($aUser)) {
         $this->createUser($aUser);
     }
     // Execute any components which have registered at the afterAgencyCreate hook
     $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterAgencyCreate');
     foreach ($aPlugins as $i => $id) {
         if ($obj = OX_Component::factoryByComponentIdentifier($id)) {
             $obj->afterAgencyCreate($agencyid);
         }
     }
     return $agencyid;
 }
Ejemplo n.º 2
0
 /**
  * Handle all necessary operations when a new account is created
  *
  * @see DB_DataObject::insert()
  */
 function insert()
 {
     $result = parent::insert();
     if ($this->account_type == OA_ACCOUNT_ADMIN && $result) {
         OA_Dal_ApplicationVariables::set('admin_account_id', $result);
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Handle all necessary operations when a user is inserted
  *
  * @see DB_DataObject::insert()
  */
 function insert()
 {
     if (isset($this->username)) {
         $this->username = strtolower($this->username);
     }
     if (empty($this->date_created)) {
         $this->date_created = $this->formatDate(new Date());
     }
     if (empty($this->email_updated)) {
         $this->email_updated = $this->formatDate(new Date());
     }
     return parent::insert();
 }
Ejemplo n.º 4
0
 /**
  * Handle all necessary operations when new agency is created
  *
  * @see DB_DataObject::insert()
  */
 function insert()
 {
     // Create account first
     $result = $this->createAccount(OA_ACCOUNT_MANAGER, $this->name);
     if (!$result) {
         return $result;
     }
     // Store data to create a user
     if (!empty($this->username) && !empty($this->password)) {
         $aUser = array('contact_name' => $this->contact, 'email_address' => $this->email, 'username' => $this->username, 'password' => $this->password, 'default_account_id' => $this->account_id);
     }
     $agencyid = parent::insert();
     if (!$agencyid) {
         return $agencyid;
     }
     // Create user if needed
     // Is this even required anymore?
     if (!empty($aUser)) {
         $this->createUser($aUser);
     }
     return $agencyid;
 }
Ejemplo n.º 5
0
 function insert($autoLinkMatchingZones = true)
 {
     $this->_rebuildCache();
     $id = parent::insert();
     if ($id) {
         // add default zone
         $aVariables = array('ad_id' => $id, 'zone_id' => 0);
         Admin_DA::addAdZone($aVariables);
         if ($autoLinkMatchingZones) {
             MAX_addDefaultPlacementZones($id, $this->campaignid);
         }
     }
     return $id;
 }
Ejemplo n.º 6
0
 function insert()
 {
     return parent::insert();
 }
Ejemplo n.º 7
0
 function insert()
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     //        $this->setEcpmEnabled();
     if ($this->priority == self::PRIORITY_ECPM || $this->ecpm_enabled) {
         $this->ecpm = $this->calculateEcpm();
     }
     // Set the correct campaign status
     $this->recalculateStatus();
     // Set deafult connection windows if not supplied
     if (!isset($this->viewwindow) && !empty($aConf['logging']['defaultImpressionConnectionWindow'])) {
         $this->viewwindow = $aConf['logging']['defaultImpressionConnectionWindow'];
     }
     if (!isset($this->clickwindow) && !empty($aConf['logging']['defaultClickConnectionWindow'])) {
         $this->clickwindow = $aConf['logging']['defaultClickConnectionWindow'];
     }
     $id = parent::insert();
     if (!$id) {
         return $id;
     }
     // Initalise any tracker based plugins
     $plugins = array();
     require_once LIB_PATH . '/Plugin/Component.php';
     $invocationPlugins =& OX_Component::getComponents('invocationTags');
     foreach ($invocationPlugins as $pluginKey => $plugin) {
         if (!empty($plugin->trackerEvent)) {
             $plugins[] = $plugin;
         }
     }
     // Link automatically any trackers which are marked as "link with any new campaigns"
     $doTrackers = $this->factory('trackers');
     $doTrackers->clientid = $this->clientid;
     $doTrackers->linkcampaigns = 't';
     $doTrackers->find();
     while ($doTrackers->fetch()) {
         $doCampaigns_trackers = $this->factory('campaigns_trackers');
         $doCampaigns_trackers->init();
         $doCampaigns_trackers->trackerid = $doTrackers->trackerid;
         $doCampaigns_trackers->campaignid = $this->campaignid;
         $doCampaigns_trackers->clickwindow = $doTrackers->clickwindow;
         $doCampaigns_trackers->viewwindow = $doTrackers->viewwindow;
         $doCampaigns_trackers->status = $doTrackers->status;
         foreach ($plugins as $oPlugin) {
             $fieldName = strtolower($oPlugin->trackerEvent);
             $doCampaigns_trackers->{$fieldName} = $doTrackers->{$fieldName};
         }
         $doCampaigns_trackers->insert();
     }
     return $id;
 }
Ejemplo n.º 8
0
 /**
  * Handle all necessary operations when new trafficker is created
  *
  * @see DB_DataObject::insert()
  */
 function insert()
 {
     // Create account first
     $result = $this->createAccount(OA_ACCOUNT_TRAFFICKER, $this->name);
     if (!$result) {
         return $result;
     }
     // Store data to create a user
     if (!empty($this->username) && !empty($this->password)) {
         $aUser = array('contact_name' => $this->contact, 'email_address' => $this->email, 'username' => $this->username, 'password' => $this->password, 'default_account_id' => $this->account_id);
     }
     $affiliateId = parent::insert();
     if (!$affiliateId) {
         return $affiliateId;
     }
     // Create user if needed
     if (!empty($aUser)) {
         $this->createUser($aUser);
     }
     return $affiliateId;
 }
Ejemplo n.º 9
0
 function insert()
 {
     //        $this->setEcpmEnabled();
     if ($this->priority == self::PRIORITY_ECPM || $this->ecpm_enabled) {
         $this->ecpm = $this->calculateEcpm();
     }
     // Set the correct campaign status
     $this->setStatus();
     $id = parent::insert();
     if (!$id) {
         return $id;
     }
     // Initalise any tracker based plugins
     $plugins = array();
     require_once LIB_PATH . '/Plugin/Component.php';
     $invocationPlugins =& OX_Component::getComponents('invocationTags');
     foreach ($invocationPlugins as $pluginKey => $plugin) {
         if (!empty($plugin->trackerEvent)) {
             $plugins[] = $plugin;
         }
     }
     // Link automatically any trackers which are marked as "link with any new campaigns"
     $doTrackers = $this->factory('trackers');
     $doTrackers->clientid = $this->clientid;
     $doTrackers->linkcampaigns = 't';
     $doTrackers->find();
     while ($doTrackers->fetch()) {
         $doCampaigns_trackers = $this->factory('campaigns_trackers');
         $doCampaigns_trackers->init();
         $doCampaigns_trackers->trackerid = $doTrackers->trackerid;
         $doCampaigns_trackers->campaignid = $this->campaignid;
         $doCampaigns_trackers->clickwindow = $doTrackers->clickwindow;
         $doCampaigns_trackers->viewwindow = $doTrackers->viewwindow;
         $doCampaigns_trackers->status = $doTrackers->status;
         foreach ($plugins as $oPlugin) {
             $fieldName = strtolower($oPlugin->trackerEvent);
             $doCampaigns_trackers->{$fieldName} = $doTrackers->{$fieldName};
         }
         $doCampaigns_trackers->insert();
     }
     return $id;
 }
 function insert()
 {
     $this->linked = date('Y-m-d H:i:s');
     return parent::insert();
 }