public function addOption($name, $value)
 {
     BTApp::importModel('CampaignOptionModel');
     $opt = CampaignOptionModel::model();
     $opt->name = $name;
     $opt->value = $value;
     $opt->campaign_id = $this->id();
     $opt->useRuleSet('new');
     return $opt->save();
 }
 public function delete($bit = 0)
 {
     if (!$bit || $bit == DELETE_BIT_SELF) {
         $this->deleted = 1;
         $this->useRuleSet('delete');
         $this->save();
         BTApp::importModel('CampaignModel');
         CampaignModel::model()->deleteAll(array('traffic_source_id' => $this->id()), DELETE_BIT_TRAFFIC_SOURCE);
     }
     return true;
 }
 public function clearDataAction()
 {
     BTApp::importModel("ClickModel");
     BTApp::importModel("ClickSiteModel");
     BTApp::importModel("ClickAdvancedModel");
     BTApp::importModel("ClickPassthroughModel");
     ClickSiteModel::model()->deleteOldData();
     ClickAdvancedModel::model()->deleteOldData();
     ClickModel::model()->deleteOldData();
     ClickPassthroughModel::model()->deleteOldData();
 }
Exemplo n.º 4
0
 public function beforeSave()
 {
     parent::beforeSave();
     if ($this->isNew()) {
         $this->time = time();
         BTApp::importModel("ClickCounterModel");
         $cnt = ClickCounterModel::model()->getRow();
         $cnt->inc();
         $this->click_id = $cnt->click_count;
     }
 }
Exemplo n.º 5
0
 public function doJoin($name)
 {
     $rel = $this->relations();
     $relationship = $rel[$name];
     $model = $relationship[0];
     $column = $relationship[1];
     $type = $relationship[2];
     $index = getArrayVar($relationship, 3);
     //only for one_many
     $pre_join_callback = getArrayVar($relationship, 4);
     //for one_many
     BTApp::importModel($model);
     if ($type == self::REL_ONE_ONE) {
         $mod = new $model();
         $row = $mod->getRow(array('conditions' => array($column => $this->{$column})));
         $this->addJoinedModel($name, $row);
     } else {
         if ($type == self::REL_ONE_MANY) {
             $conditions = array($column => $this->{$column});
             $mod = new $model();
             $rows = $mod->getRows(array('conditions' => $conditions));
             if ($pre_join_callback) {
                 $rows = call_user_func($pre_join_callback, $conditions, $rows);
             }
             if ($index) {
                 $real = array();
                 foreach ($rows as $row) {
                     $real[$row->{$index}] = $row;
                 }
                 $rows = $real;
             }
             $this->addJoinedModel($name, $rows);
         }
     }
 }
Exemplo n.º 6
0
<?php

BTApp::importModel('UserPrefModel');
class UserModel extends BTModel
{
    public function tableName()
    {
        return 'bt_u_users';
    }
    public function pk()
    {
        return 'user_id';
    }
    public function relations()
    {
        return array('prefs' => array('UserPrefModel', 'user_id', self::REL_ONE_MANY, 'name', array(UserPrefModel::model(), 'setDefaultPreferences')));
    }
    public function rules()
    {
        return array(array('user_name', 'required', array('message' => 'Please enter an account name', 'for' => array('admin_edit', 'admin_new'))), array('user_name', 'length', array('min' => 1, 'max' => 50, 'message' => 'Invalid account name', 'for' => array('admin_edit', 'admin_new'))), array('user_name', 'callback', array('func' => array('UserModel', 'usernameFree'), 'message' => 'That username is taken')), array('email', 'required', array('message' => 'Please enter your email', 'for' => array('user_profile', 'admin_edit', 'admin_new'))), array('email', 'email', array('message' => 'Invalid email', 'for' => array('user_profile', 'admin_edit', 'admin_new'))), array('email', 'callback', array('func' => array('UserModel', 'emailFree'), 'message' => 'That email is taken')), array('timezone', 'required', array('for' => 'user_profile')), array('old_pass', 'callback', array('for' => array('user_profile_password'), 'func' => array($this, 'checkUserPass'), 'message' => 'Please enter your current password')), array('pass', 'required', array('for' => array('user_profile_password', 'admin_new'), 'message' => "Please enter a password")), array('pass_confirm', 'required', array('for' => array('user_profile_password', 'admin_new'), 'message' => "Please confirm your password")), array('pass', 'optional', array('for' => array('admin_edit'))), array('pass_confirm', 'compare', array('to' => 'pass', 'for' => array('user_profile_password', 'admin_edit', 'admin_new'), 'message' => "Please confirm your password")), array('privilege', 'required', array('for' => array('admin_edit', 'admin_new'))));
    }
    public function filters()
    {
        return array('deleted' => 0);
    }
    public function deletedColumn()
    {
        return "deleted";
    }
    public function delete($flag = 0)
    {
Exemplo n.º 7
0
require_once BT_ROOT . '/private/includes/browser.php';
require_once BT_ROOT . '/private/includes/reporting/breakdown.php';
require_once BT_ROOT . '/private/includes/reporting/general.php';
require_once BT_ROOT . '/private/includes/traffic/filter.php';
require_once BT_ROOT . '/private/includes/reporting/dayparting.php';
require_once BT_ROOT . '/private/includes/reporting/weekparting.php';
require_once BT_ROOT . '/private/includes/navmenu.php';
require_once BT_ROOT . '/private/libs/FirePHPCore/fb.php';
require_once BT_ROOT . '/private/includes/BTCache.php';
require_once BT_ROOT . '/private/includes/BTDialog.php';
require_once BT_ROOT . '/private/includes/BTHtml.php';
require_once BT_ROOT . '/private/includes/BTForm.php';
require_once BT_ROOT . '/private/includes/BTValidator.php';
//Since these are core to the system - just import them now.
BTApp::importModel('UserModel');
BTApp::importModel('CampaignModel');
function bt_geo_enabled()
{
    return true;
}
function bt_mobile_enabled()
{
    return true;
}
function bt_cloaker_enabled()
{
    return true;
}
if (!defined('HAS_SSL')) {
    define('HAS_SSL', false);
}
Exemplo n.º 8
0
 public function loadModel($model)
 {
     BTApp::importModel($model);
 }