function calcVesTeam($team_id) { include "config.php"; \go\DB\autoloadRegister(); $db = go\DB\DB::create($db_params, 'mysql'); $team = $db->query('SELECT `id`,`size`,`pol` FROM {peop} WHERE `team_id` = ?', array($team_id))->assoc(); $team_ves = 0; foreach ($team as $peop) { $team_ves = $team_ves + calcVes($peop['size'], $peop['pol']); } return $team_ves; }
<?php session_start(); include "config.php"; require_once 'goDB/autoload.php'; // path to goDB require_once 'asana-api-php-class/asana.php'; \go\DB\autoloadRegister(); $db = go\DB\DB::create($db_params, 'mysql'); if (isset($_SESSION['user_id'])) { $get_asana_data = $db->query('SELECT `apikey`, `asana_tag`, `workspace_id`, `asana_user_id` FROM {users} WHERE `id` = ?', array($_SESSION['user_id']))->row(); $asana = new Asana(array('apiKey' => $get_asana_data['apikey'])); } $global_options = array(); $global_options['title'] = "Асаначет"; $global_options['menu_label'] = "AC"; $report_types = array("by_user" => "По пользователю", "by_tag" => "По тегу"); function generateLoginCode($length = 6) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHI JKLMNOPRQSTUVWXYZ0123456789"; $code = ""; $clen = strlen($chars) - 1; while (strlen($code) < $length) { $code .= $chars[mt_rand(0, $clen)]; } return $code; } function get_a($text) { return preg_replace("#(https?|ftp)://\\S+[^\\s.,> )\\];'\"!?]#", '<a href="\\0">\\0</a>', htmlspecialchars($text)); }