public function applyPaper()
 {
     /**
      * 整理参数
      * 母卷主键,用户主键,挑战卷主键
      */
     //接收参数
     $paperid = I('post.paperid', 0, 'int');
     $userid = intval(get_sessions('userid'));
     $gameuid = I('post.gameuid', 0, 'int');
     $gamepid = I('post.gamepid', 0, 'int');
     $gamemsg = I('post.gamemsg', '');
     if ($userid == 0) {
         $json['status'] = 0;
         $json['info'] = '请输入内测《邀请码》..';
         $this->ajaxReturn($json);
     }
     if ($paperid == 0) {
         $json['status'] = 0;
         $json['info'] = '请输入内测《邀请码》..';
         $this->ajaxReturn($json);
     }
     //母卷
     $paper = D('Paper');
     $pinfo = $paper->info($paperid, 'id, title, dataview, status, topscore, loglist, applys');
     if (!$pinfo || $pinfo['status'] == 0) {
         $this->error('申请的试卷不存在..', '/index.php/Paper/Index/', 3);
     }
     $upaper = D('UserPaper', 'Logic');
     $params = array('gameinfo' => array('gameuid' => $gameuid, 'gamepid' => $gamepid, 'gamemsg' => $gamemsg));
     //开启事务
     $paper->startTrans();
     //生成答卷
     $results = $upaper->apply($pinfo['id'], $userid, $pinfo['dataview'], $pinfo['title'], $params);
     //给母卷记录日志[最近5条]
     $topnums = 5;
     $loglist = $pinfo['loglist'] ? json_decode($pinfo['loglist'], true) : array();
     if (count($loglist) >= $topnums) {
         array_splice($loglist, 0, 1);
     }
     $loginfo = array('userid' => $userid, 'upaperid' => $results['paperid'], 'time' => time(), 'typeid' => 1);
     if ($gameuid > 0 && $gamepid > 0) {
         $loginfo['gameinfo'] = $params['gameinfo'];
     }
     $loglist[] = $loginfo;
     //更新母卷
     $pdata = array('applys' => $pinfo['applys'] + 1, 'loglist' => json_encode($loglist));
     $result1 = $paper->where('id=' . $pinfo['id'])->save($pdata);
     if ($results['paperid'] > 0 && $result1) {
         $paper->commit();
         $json = array();
         $json['status'] = 1;
         $json['info'] = '恭喜,试卷申请成功..';
         $json['url'] = '';
         $json['paperid'] = $results['paperid'];
         //成功
         $this->ajaxReturn($json);
     }
     $paper->rollback();
     $this->error('试卷申请失败,' . $results['msg'] . '...', '/index.php/Paper/Index/', 3);
 }
Exemplo n.º 2
0
        $_SESSION["enemy_connected"] = false;
        $_SESSION["turn"] = false;
        switch (check_session($_SESSION["name"])) {
            case "no_session":
                register_session($req_mess["name"]);
                fill_users_file($_SESSION["id"], false, $req_mess["want_side"]);
                die("session created");
                break;
            case "good_session":
                fill_users_file($_SESSION["id"], false, $req_mess["want_side"]);
                die("entered to session");
                break;
            case "too_many_users":
                die("too_many_users");
                break;
            default:
                die("switch default");
        }
        break;
    case "get_sessions":
        clear_sessions();
        get_sessions();
        break;
    case "move":
        move();
        die("moved");
        break;
    default:
        die("f**k the sistem");
}
@mysql_close($dbc) or die(mysql_error());
Exemplo n.º 3
0
<?php

$php_root_path = "..";
$privilege_root_path = "/admin";
require_once "includes/include_all_fns.inc";
session_start();
$err_message = " Unable to process your request due to the following problems: <br>\n";
do_html_header("Conference Program", &$err_message);
$sessions = get_sessions("StartTime", false);
$settingsInfo = get_Conference_Settings();
$days = array();
if (areSessionTracksEnabled()) {
    $tracks = get_SessionTracks();
    for ($i = 0; $i < count($tracks); $i++) {
        $tracks[$i]->TrackID = $tracks[$i]->SessionTrackID;
        $tracks[$i]->TrackName = $tracks[$i]->SessionTrackName;
    }
} else {
    $tracks = get_tracks();
}
$rooms = get_rooms_array();
foreach ($sessions as $session) {
    $date = format_date('Y-m-d', $session->StartTime);
    $days[$date][$session->RoomID][] = $session;
}
?>
<table width="100%" style="border-collapse: collapse" >
<?php 
$colspan = count($rooms);
foreach ($days as $date => $room_sessions) {
    ?>
Exemplo n.º 4
0
<?php

$php_root_path = "..";
$privilege_root_path = "/admin";
require_once "includes/include_all_fns.inc";
session_start();
$err_message = " Unable to process your request due to the following problems: <br>\n";
$sessions = get_sessions($_GET["sortby"], $_GET["desc"]);
$settingsInfo = get_Conference_Settings();
do_html_header("Conference Sessions", &$err_message);
if (array_key_exists("autoschedule", $_GET)) {
    autoschedule_waiting_papers();
    echo '<strong style="color:lime;">All waiting papers were autoscheduled</strong><br><br>';
}
if (array_key_exists("clearschedule", $_GET)) {
    // loop over all papers
    //~ $db = adodb_connect();
    //~ if (!$db){
    //~ echo '<strong style="color:red;">Could not connect to database server - please try later.</strong>';
    //~ return;
    //~ }
    //~ $sql = "SELECT SL.PaperID, S.PresentationTypeID FROM " . $GLOBALS["DB_PREFIX"] . "SessionSlot SL, " . $GLOBALS["DB_PREFIX"] . "Session S";
    //~ $sql .= " WHERE SL.SessionID = S.SessionID";
    //~ $result = $db -> Execute($sql);
    //~ while ($result && ($info = $result->FetchNextObj())) {
    //~ $PaperID = $info->PaperID;
    //~ $db->Execute( "DELETE FROM SessionSlot WHERE PaperID = $PaperID" );
    //~ assign_paper_presentation_type( $PaperID, $info->PresentationTypeID );
    //~ }
    if (!clearSchedule($err_message = "")) {
        echo '<strong style="color:red;">Error: schedules could not be cleared</strong><br><br>';
Exemplo n.º 5
0
// Important notices.
if ($notice = get_notice($activefilters['customfields'])) {
    echo $OUTPUT->box_start();
    echo format_text($notice, FORMAT_HTML);
    echo $OUTPUT->box_end();
}

// Display settings
$courses = true; // display all courses
$groups = false; // don't show group events
$users = $USER->id; // show current user events
$courseid = SITEID;
$displayinfo = get_display_info($day, $month, $year);

get_sessions($displayinfo, $groups, $users, $courses, $activefilters, $events, $sessionids);
$waitlistedsessions = get_matching_waitlisted_sessions($activefilters);

$sessionlist_baseurl = new moodle_url('/blocks/facetoface/calendar.php#sessionlist', $baseparams);

// List of all available sessions
echo $OUTPUT->box_start('generalbox clearfix');
$m_url = new moodle_url($sessionlist_baseurl);
$m_url->param('tab', 'm');
$row[] = new tabobject('m', $m_url, get_string('tab:calendar','block_facetoface'));
$c_url = new moodle_url($sessionlist_baseurl);
$c_url->param('tab', 'c');
$row[] = new tabobject('c', $c_url, get_string('tab:bycourse','block_facetoface'));
$d_url = new moodle_url($sessionlist_baseurl);
$d_url->param('tab', 'd');
$row[] = new tabobject('d', $d_url, get_string('tab:bydate','block_facetoface'));
Exemplo n.º 6
0
<?php

$sessions = get_sessions("StartTime");
$pageNumberOf = array_flip(get_paper_pages());
$days = array();
foreach ($sessions as $session) {
    $date = format_date("Y-m-d", $session->StartTime);
    if (!$days[$date]) {
        $days[$date] = array();
    }
    $days[$date][] = get_session_slots_info($session->SessionID);
}
?>
<html>
<head>
<title>
Technical Program
</title>
<style type="text/css">
  div { padding-top: 3 ; padding-bottom: 3 }
  .PageTitle { text-align: center ; font: bolder xx-large "Comic Sans MS" ; color: teal}
  .Day { font-style: italic }
  .Session { font-weight: bold ; font-family: "Comic Sans MS" }
  .Indent {float:left; width:2%}
  .LeftColumn {float:left; width:78%;}
  .RightColumn {float:left; width:20%; text-align: right;}
  .Info{ font-weight: normal ; font-family: "Comic Sans MS" }
  .Abstract { font-style: italic ; font-size: smaller }
  .Bio { font-size: smaller }
  .PaperName {}
  .Authors {}
 public function index()
 {
     //接收参数
     $paperid = I('paperid', 0, 'int');
     $getinfo = I('getinfo', 0, 'int');
     $userid = intval(get_sessions('userid'));
     if ($userid == 0) {
         $this->error('请先登录..', '/index.php/Paper/Index/', 3);
     }
     if ($paperid == 0) {
         $this->error('答卷不存在..', '/index.php/Paper/Index/', 3);
     }
     $upaper = D('UserPaper')->table($userid);
     $chart_field = ',ranking,addtime,subtime,score,analysis';
     $click_field = ',marks,collects,notes,bugs';
     $upinfo = $upaper->info($paperid, $userid, 'id,title,paperid,userid,status,totals,dataview,qnums,speed,totaltime,usetime' . $chart_field . $click_field);
     if (!$upinfo) {
         $this->error('答卷不存在..', '/index.php/Paper/Index/', 3);
     }
     //试卷数据格式化
     $dataview = json_decode($upinfo['dataview'], true);
     if (!$dataview) {
         $this->error('答卷存在异常,请重新申请..', '/index.php/Paper/Index/', 3);
     }
     //异步加载答题卡
     if ($getinfo == 1) {
         $this->getPaperInfo($upinfo);
     }
     //异步加载试题
     if ($getinfo == 2) {
         $this->getPaperQuestion($upinfo, $dataview);
     }
     //异步保存试卷作答
     if ($getinfo == 3) {
         $this->savePaperAnswer($upinfo, $dataview);
     }
     //异步交卷
     if ($getinfo == 4) {
         $this->submitPaperAnswer($upinfo, $dataview);
     }
     //重点标记,收藏,笔记,纠错
     if ($getinfo == 100) {
         $this->setValuesCollects($upinfo);
     }
     //笔记
     if ($getinfo == 102) {
         $this->setNotes($upinfo);
     }
     //如果是交卷状态[查看解析]
     if ($getinfo == 5 && $upinfo['status'] == 1) {
         $this->showPaperBack($upinfo, $dataview);
     }
     //如果是交卷状态
     if ($upinfo['status'] == 1) {
         $this->showPaperChart($upinfo, $dataview);
     }
     $this->navs = $dataview['navs'];
     $this->speed = $upinfo['qnums'] - $upinfo['speed'];
     $this->upinfo = $upinfo;
     $this->display('index');
 }
Exemplo n.º 8
0
    // DELETE /v1/orgs/<org id>/subscriptions/<subscriptionId>
    $url = $endpoint . $api_root->_links->subscriptions->href . '/' . $subscriptionId;
    $response = Requests::delete($url, $header);
    return json_decode($response->body);
}
// Recover an access token
$grant = get_access_token($api_key, $api_key_secret);
// Refresh an access token before grant['expires_in'] has expired.
$grant = refresh_access_token($api_key, $api_key_secret, $grant->refresh_token);
// Get the root of the api
$api_root = get_api_root($grant->access_token);
// Create a new subscription for one of your users
$subscription_ref = Uuid::uuid4();
$subscription = create_subscription($grant->access_token, $api_root, array('ref' => $subscription_ref->toString(), 'name' => 'Dr. Jane Who', 'email' => '*****@*****.**'));
// Get a page of sessions for
$sessions = get_sessions($grant->access_token, $api_root);
// Get the first page of subscriptions
$subscriptions = get_subscriptions($grant->access_token, $api_root);
//var_dump(count($subscriptions->content));
// Delete the entire set of subscriptions traversing forward
for ($i = 0, $c = count($subscriptions->content); $i < $c; $i++) {
    delete_subscription($grant->access_token, $subscriptions->content[$i]);
}
/*
// Get the entire set of subscriptions traversing backward
while ($subscriptions->_links->previous) {
  $subscriptions = get_link( $grant->access_token, $subscriptions->_links->previous );
}
*/
// delete the subscription we created. Don't do this if you want your user to access coviu.
delete_subscription($grant->access_token, $subscription);
 public function index()
 {
     $userid = get_sessions('userid');
     $upaperid = I('upaperid', 0, 'int');
     $papertitle = I('papertitle', '');
     $pageurl = urldecode(I('pageurl', ''));
     if ($userid == 0 || $upaperid == 0 || $papertitle == '' || $pageurl == '') {
         //var_dump($userid, $upaperid, $papertitle);
         //print '缺少参数..';
         //exit;
     }
     $sessionid = session_id();
     $session = $_SESSION;
     $salt = rand(1000, 9999);
     $randcode = md5($sessionid . $salt . $userid);
     //生成二维码
     import('Lib.Com.QRcode');
     $PNG_TEMP_DIR = TEMP_PATH . DIRECTORY_SEPARATOR;
     $PNG_WEB_DIR = RUNTIME_PATH . 'Temp/';
     //二维码数据
     $urldata = 'http://www.zoobao.com/index.php/QRcode/Index/qrcodeurl?randcode=' . $randcode;
     $qrcodeurl = $PNG_TEMP_DIR . md5($userid . $upaperid) . '.png';
     \QRcode::png($urldata, $qrcodeurl, 'H', 8, 2);
     //彩色水印
     $logo = '.' . C('TMPL_PARSE_STRING.__IMG__') . 'app_logo.gif';
     $QR = $PNG_WEB_DIR . basename($qrcodeurl);
     //已经生成的原始二维码图
     if ($logo !== FALSE) {
         $QR = imagecreatefromstring(file_get_contents($QR));
         $logo = imagecreatefromstring(file_get_contents($logo));
         $QR_width = imagesx($QR);
         //二维码图片宽度
         $QR_height = imagesy($QR);
         //二维码图片高度
         $logo_width = imagesx($logo);
         //logo图片宽度
         $logo_height = imagesy($logo);
         //logo图片高度
         $logo_qr_width = $QR_width / 5;
         $scale = $logo_width / $logo_qr_width;
         $logo_qr_height = $logo_height / $scale;
         $from_width = ($QR_width - $logo_qr_width) / 2;
         //重新组合图片并调整大小
         imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
     }
     //输出图片
     if (file_exists($qrcodeurl)) {
         @unlink($qrcodeurl);
     }
     $qrcodeurl = $PNG_WEB_DIR . md5($userid . $upaperid) . '1.png';
     imagepng($QR, $qrcodeurl);
     $qrdata = array('userid' => $userid, 'username' => get_sessions('username'), 'upaperid' => $upaperid, 'papertitle' => $papertitle, 'sessionid' => $sessionid, 'sessiondata' => serialize($session), 'qrcodeurl' => basename($qrcodeurl), 'salt' => $salt, 'addtime' => time(), 'nums' => 1, 'pageurl' => serialize($pageurl));
     //写入数据库
     $qrcode = D('QRcode/QRcode');
     $result = $qrcode->data($qrdata)->add();
     $returndata = array('status' => 0, 'info' => '生成失败,请重新生成二维码!');
     if ($result) {
         //写入缓存
         $qrdata['dataid'] = $result;
         $mcwirte = S($randcode, $qrdata, 3600);
         if ($mcwirte) {
             //返回客户端
             $imgurl = '/' . $PNG_WEB_DIR . basename($qrcodeurl);
             $returndata['imgurl'] = $imgurl;
             $returndata['status'] = 1;
             $returndata['info'] = '扫描二维码,马上切换到手机版!';
         }
     }
     $this->ajaxReturn($returndata);
 }