private function saveForStorage() { $tmp = Configuration::getValue('project_' . $this->projectId); $tmp['b24connect'] = $this->resource; if (isset($tmp['info']['USERINFO'])) { $tmp['info']['USERINFO'] = array('access_token' => $this->resource['access_token'], 'refresh_token' => $this->resource['refresh_token'], 'expires_in' => $this->resource['expires_in'], 'domain' => $tmp['info']['USERINFO']['domain'], 'member_id' => $tmp['info']['USERINFO']['member_id']); } else { $tmp['info']['USERINFO'] = array('access_token' => $this->resource['access_token'], 'refresh_token' => $this->resource['refresh_token'], 'expires_in' => $this->resource['expires_in'], 'domain' => 'null', 'member_id' => 'null'); } Configuration::setValue('project_' . $this->projectId, $tmp); }
public static function insertTest($projectId) { $lead = array('TITLE' => 'test'); $projectId = intval($projectId); $project = Configuration::getValue('project_' . $projectId); $arResult = self::add($lead); if (isset($arResult['result'])) { $leadId = intval($arResult['result']); } else { $leadId = 0; } @self::sendMailForAdmin($lead, $project, false, array(), $leadId); return $arResult; }
function initQuery($params) { $visitor_id = $params['visitor_id']; $time_period = $params['time_period']; $tables = Reports::getTables(); $c_seances = $tables['reports_visitor_seances']['columns']; $c_seance_info = $tables['reports_visitor_seance_info']['columns']; $c_page_info = $tables['reports_page_urls']['columns']; $time_shift_hours = Configuration::getValue(SYSCONFIG_STORE_TIME_SHIFT); $this->addSelectField($c_seance_info['seance_id'], 'seance_id'); $this->addSelectField($c_page_info['page_url'], 'page_url'); $this->addSelectTable('reports_visitor_seances'); $this->addInnerJoin('reports_page_urls', $c_seance_info['page_url'], DB_EQ, $c_page_info['id']); $this->WhereField($c_seances['seance_id'], DB_EQ, $c_seance_info['seance_id']); $this->WhereAND(); $this->Where($c_seance_info['visit_time'], DB_GTE, 'DATE_ADD(DATE_ADD(NOW(), INTERVAL ' . $time_shift_hours . ' HOUR), INTERVAL -' . $time_period . ' MINUTE)'); $this->WhereAND(); $this->WhereValue($c_seances['visitor_id'], DB_EQ, $visitor_id); $this->SelectOrder($c_seance_info['visit_time'], 'DESC'); $this->SelectLimit(0, 1); }
function __getOnlineStatus($seance_id) { $last_time = null; foreach ($this->click_path_by_seance_id_list as $key => $info) { if ($info['seance_id'] == $seance_id) { $last_time = $info['visit_time']; } } if ($last_time == null) { return false; } else { $t = strtotime($last_time) + $this->session_duration * 60 - Configuration::getValue(SYSCONFIG_STORE_TIME_SHIFT) * 3600; if ($t >= time()) { return true; } else { return false; } } }