Пример #1
0
 public function _initialize($agentid)
 {
     import('Org.Nexstep.qywechatclass', '', '.php');
     import('Org.Nexstep.qyerrCode', '', '.php');
     $this->agentid = $agentid;
     $this->getObj();
     $code = I('code');
     if ($code) {
         if (!cookie('USERID')) {
             $userid = $this->weObj->getUserId($code);
             cookie('USERID', $userid['UserId']);
         }
     }
     $this->userid = cookie('USERID');
     //查看session 积分等级
     $grade = session('gradename');
     if (!$grade) {
         getGrade();
     }
 }
Пример #2
0
 function echoGradeImage()
 {
     echo "<img src=\"images/grade_" . getGrade($this->grade) . ".png\" />";
 }
Пример #3
0
<?php

$subjectID = $_REQUEST['subjectID'];
$scoreType = $_REQUEST['scoreType'];
$addStatus = $_REQUEST['addStatus'];
$instructorID = $confUserID;
$term = getTerm();
$year = getYear();
$scoreID = $_REQUEST['scoreID'];
$objQuery = getStuRegList($subjectID, $instructorID, $year, $term);
if ($objQuery && mysql_num_rows($objQuery) > 0) {
    while ($row = mysql_fetch_array($objQuery)) {
        if ($scoreType == 'GRADE') {
            $grade = getGrade($row['studentID'], $subjectID, $term, $year);
            $select = '<select name="score" style="width: 80px;">';
            $select .= '<option value="">--</option>';
            $select .= '<option value="4"' . selected($grade, '4') . '>4.0</option>';
            $select .= '<option value="3.5"' . selected($grade, '3.5') . '>3.5</option>';
            $select .= '<option value="3"' . selected($grade, '3') . '>3.0</option>';
            $select .= '<option value="2.5"' . selected($grade, '2.5') . '>2.5</option>';
            $select .= '<option value="2"' . selected($grade, '2') . '>2.0</option>';
            $select .= '<option value="1.5"' . selected($grade, '1.5') . '>1.5</option>';
            $select .= '<option value="1"' . selected($grade, '1') . '>1.0</option>';
            $select .= '<option value="0"' . selected($grade, '0') . '>0</option>';
            $select .= '<option value="W"' . selected($grade, 'W') . '>W</option>';
            $select .= '</select>';
            $data['data'][] = array('cardID' => '<span style="display:none;">' . $row['cardID'] . '</span>', 'secondCardID' => '<span style="display:none;">' . $row['secondCardID'] . '</span>', 'studentID' => $row['studentID'], 'firstName' => $row['firstName'], 'lastName' => $row['lastName'], 'score' => '<input type="hidden" name="studentID" value="' . $row['studentID'] . '">' . $select);
        } else {
            $dataScore = $addStatus == '1' ? '' : getScore($scoreID, $row['studentID']);
            $data['data'][] = array('cardID' => '<span style="display:none;">' . $row['cardID'] . '</span>', 'secondCardID' => '<span style="display:none;">' . $row['secondCardID'] . '</span>', 'studentID' => $row['studentID'], 'firstName' => $row['firstName'], 'lastName' => $row['lastName'], 'score' => '<input type="hidden" name="studentID" value="' . $row['studentID'] . '"><input type="text" name="score" value="' . $dataScore . '" />');
        }
Пример #4
0
/**
 * 积分操作
 * @param $score 积分
 * @param $type 积分类型:1表示A积分;2表示B积分
 * @param $opt 操作:1表示加积分;2表示减积分
 * @param $userid 用户
 * @param $create_by 1:管理员;2:系统
 * @param $remark 备注
 * @return bool
 */
function doScore($score, $type, $opt, $userid, $create_by = 2, $remark = '')
{
    if (!$userid) {
        return false;
    }
    if (!$type) {
        return false;
    }
    //详细表数据添加
    $scoremodel = M('addmin_score');
    //开启事务
    $scoremodel->startTrans();
    $score_arr = array('userid' => $userid, 'score' => $score, 'addormin' => $opt, 'remark' => $remark, 'type' => $type, 'create_by' => $create_by, 'create_time' => time());
    $id = $scoremodel->add($score_arr);
    if (!$id) {
        $scoremodel->rollback();
        return false;
    }
    $model = M('Member');
    $info = $model->where(array('userid' => $userid))->find();
    //加积分
    $total = $info['total_score'];
    $bscore = $info['current_score'];
    $ascore = $info['money_score'];
    if ($type == 1) {
        //A积分
        //B积分加减随同A,A积分加,总积分加,A积分减,总积分不变
        //判断加减
        if ($opt == 1) {
            $data['total_score'] = $total + $score;
            $data['current_score'] = $bscore + $score;
            $data['money_score'] = $ascore + $score;
        }
        if ($opt == 2) {
            //减积分
            $data['current_score'] = $bscore - $score;
            $data['money_score'] = $ascore - $score;
        }
        $res = $model->where(array('userid' => $userid))->save($data);
        if ($res === false) {
            $scoremodel->rollback();
            return false;
        }
    }
    if ($type == 2) {
        //B积分
        //B积分加减与A无关,B积分加,总积分加,B积分减,总积分不变
        if ($opt == 1) {
            //加积分
            $data['total_score'] = $total + $score;
            $data['current_score'] = $bscore + $score;
        }
        if ($opt == 2) {
            //减积分
            $data['current_score'] = $bscore - $score;
        }
        $res = $model->where(array('userid' => $userid))->save($data);
        if ($res === false) {
            $scoremodel->rollback();
            return false;
        }
    }
    $scoremodel->commit();
    getGrade($userid);
    return true;
}
Пример #5
0
?>
                </div>
                <!-- Score aggregate -->
                <div class="row">
                    <div class="card green-border">
                        <div class="card-content">
                            <div class="row no-margin">
                                <!-- Final Score -->
                                <div class="col s12 m4 border-right-grey">
                                    <div class="center">
                                        <!-- -->
                                        <div class="card-panel white-border">
                                            <span>Grade Equivalent:</span>
                                            <h2 class="green-text text-accent-3 ">
                                                <?php 
echo getGrade($project['grade']);
?>
/4.0
                                            </h2>
                                        </div>
                                    </div>
                                </div>
                                <!-- Summary -->
                                <div class="col s12 m8">
                                    <p>
                                        <b>
                                            Summary:
                                            <br>
                                            <br>
                                        </b>
                                        <?php 
Пример #6
0
    $undone_num = $task_num - $complete_num;
    //与插件设置的任务数量进行比较
} else {
    //不做任务用户组,直接标记为已完成全部.
    $undone_num = 0;
}
if ($undone_num > 0) {
    showmessage('您今天还没完成任务哦,先完成每日任务再来"每日摇摇乐"吧');
}
//连续摇奖记录处理
/* 取今日凌晨时间,与最后一次摇奖的时间进行对比,超过24小时则是没有连续,反之则是连续摇奖+1 */
$interval_time = $midnight_timestamp - $zzza_lasttime_dateline;
if ($interval_time < 86400) {
    $continuous_day = $zzzadata['continuous_day'] + 1;
} else {
    $continuous_day = 0;
}
updatemembercount($_G['uid'], array($set['extcredit'] => $zzzadata['today_extcredit']), '', '', '', '每日摇摇乐奖励', '每日摇摇乐', '参与"每日摇摇乐",完成任务摇奖,即可获得奖励');
//增加积分
//更新当前等级
$total_counts = intval($zzzadata['total_counts'] + $zzzadata['today_extcredit']);
$userGrade = getGrade($total_counts);
DB::query("UPDATE " . DB::table('yinxingfei_zzza_rank') . " SET total_extcredit = total_extcredit + '" . $zzzadata['today_extcredit'] . "' , total_counts = total_counts + 1, dateline = '" . $_G['timestamp'] . "', continuous_day = '" . $continuous_day . "', grade = '" . $userGrade['id'] . "', grouptitle = '" . $userGrade['grouptitle'] . "' WHERE uid= '" . $_G['uid'] . "'", 'UNBUFFERED');
DB::query("UPDATE " . DB::table('yinxingfei_zzza_mark') . " SET value = '0' WHERE uid= '" . $_G['uid'] . "'", 'UNBUFFERED');
//运气榜处理
$luck = array('uid' => $_G['uid'], 'total_extcredit' => $zzzadata['total_extcredit'], 'dateline' => $_G['timestamp']);
DB::insert('yinxingfei_zzza_luck', $luck, false, true);
//日历统计处理
$calendar = array('date' => dgmdate($_G['timestamp'], 'Ymd', $_G['setting']['timeoffset']), 'uid' => $_G['uid'], 'today_extcredit' => $zzzadata['today_extcredit'], 'extcredit_title' => $extcredit_title, 'dateline' => $_G['timestamp']);
DB::insert('yinxingfei_zzza_day', $calendar);
dheader("Location: " . $set['zzza_link'] . "&over=yes");
Пример #7
0
                                $j++;
                            }
                            $j = 0;
                            foreach ($subjek_kv as $rsa) {
                                $aMarkS = !empty($aModuleTakenMarksAk[$rsa->mod_id . 'S']) ? $aModuleTakenMarksAk[$rsa->mod_id . 'S'] : "";
                                $aMarkP = !empty($aModuleTakenMarksAk[$rsa->mod_id . 'P']) ? $aModuleTakenMarksAk[$rsa->mod_id . 'P'] : "";
                                if ($aMarkS != "") {
                                    $aMark = $aMarkS;
                                } elseif ($aMarkP != "") {
                                    $aMark = $aMarkP;
                                }
                                if ($jum_markah[$j] == "-") {
                                    $sgred_cur[$rsa->mod_id] = "-";
                                } else {
                                    if (sizeof($aMark) > 0) {
                                        $sgred_cur[$rsa->mod_id] = getGrade($jum_markah[$j], $aMark["marks_assess_type"], 'grade_type');
                                    } else {
                                        $sgred_cur[$rsa->mod_id] = "-";
                                    }
                                }
                                ?>
                    <td align="center" bgcolor="#00FFCC"><span id="cur_gred" style="text-align:center;"><?php 
                                echo $sgred_cur[$rsa->mod_id];
                                ?>
</span>
							<?php 
                                $j++;
                            }
                        }
                        ?>
                </tr>
Пример #8
0
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>What's Your Grade?</title>
		<?php 
/*
	Brandon Ramirez
	RCC PHP Class
	Version 1.2
	Purpose: ternary Operator Examples
*/
?>
	</head>
	<body>
		<?php 
//Create a line of code using nested ternary operators that takes a number 0-100 and returns a string value with a letter grade.
$score = 100;
$grade = $score < 60 ? "an F" : ($score < 70 ? "a D" : ($score < 80 ? "a C" : ($score < 90 ? "a B" : "an A")));
echo "<p> Your grade is " . $grade . ".</p>";
//Function Version
function getGrade($score)
{
    $grade = $score < 60 ? "an F" : ($score < 70 ? "a D" : ($score < 80 ? "a C" : ($score < 90 ? "a B" : "an A")));
    echo "<p> Your grade is {$grade}.</p>";
}
getGrade(74);
?>
	</body>
</html>
Пример #9
0
 case 'getRole':
     $query = "SELECT role FROM LU.users WHERE idusers='{$userid}';";
     $statement = $DB->prepare($query);
     $statement->execute();
     $result = $statement->fetch();
     $role = $result[0];
     echo json_encode($result[0]);
     break;
 case 'getNotifications':
     $query = "SELECT role FROM LU.users WHERE idusers='{$userid}';";
     $statement = $DB->prepare($query);
     $statement->execute();
     $result = $statement->fetch();
     $role = $result[0];
     if ($role == 'student') {
         $notifications = array(getGrade($userid, $DB), getDiscussion($userid, $DB), getAssignmentNQuiz($userid, $DB), getProfMessage($userid, $DB));
         echo json_encode($notifications);
     } else {
         if ($role == 'professor') {
             $notifications = array(getStuMessage($userid, $DB));
             // How many students took the class
             // $query = "SELECT cid FROM LU.teaching WHERE `idusers` = '$userid' ";
             // $statement = $DB->prepare($query);
             // $statement->execute();
             // $result = $statement->fetchAll(PDO::FETCH_ASSOC);
             // foreach ($result as $row => $cid) {
             // 	$query = "SELECT count(*) FROM LU.enrolled WHERE cid = ?;";
             // 	$statement = $DB->prepare($query);
             // 	$statement->bindValue(1, $cid['cid']);
             // 	$statement->execute();
             // 	$students = $statement->fetch();
Пример #10
0
                                    <p style="width: 95%;">
                                        <?php 
    echo $projects[$i]['abstract'];
    ?>
                                    </p>
                                    <!-- overflow effect --><div class="overflow-white"></div>
                                </div>
                            </div>
                            <div class="card-action score-in-card center">
                                <span>
                                    Score in Category:
                                </span>
                                <!-- Scores -->
                                <h1 class="sf-200 center green-text text-accent-3 no-margin">
                                    <?php 
    echo getGrade($projects[$i]['grade']);
    ?>
/4.0
                                </h1>
                                <?php 
    foreach ($projects[$i]['recogs'] as $recog) {
        ?>
                                <div class="cat mobile">
                                    <?php 
        echo $recog;
        ?>
                                </div>
                                <?php 
    }
    ?>
                            </div>
Пример #11
0
 /**
  * 收到文本消息时触发,回复收到的文本消息内容
  *
  * @return void
  */
 protected function onText()
 {
     $content = $this->getRequest('content');
     $openid = $this->getRequest('FromUserName');
     $time = $this->getRequest('CreateTime');
     if (mb_substr($content, 0, 3, 'utf-8') == '图书馆') {
         $string = library($content);
         $this->responseText($string);
         return;
     }
     if ($content == '成绩') {
         $checkbind = checkBind($openid);
         if ($checkbind['status'] == 0) {
             $url = 'http://guoerwx.sinaapp.com/login.php?openid=' . $openid;
             $this->responseText('请先绑定学号' . "\n" . '<a href=' . "\"" . $url . "\"" . '>点击绑定学号</a>');
             return;
         } else {
             if ($checkbind['status'] == 1) {
                 $string = getGrade($checkbind['data']['username'], $checkbind['data']['password']);
                 if (!empty($string)) {
                     $this->responseText($string);
                 } else {
                     $this->responseText('成绩还没出来,放心一定会过的!');
                 }
                 return;
             }
         }
     }
     if ($content == '考试安排') {
         $checkbind = checkBind($openid);
         if ($checkbind['status'] == 0) {
             $url = 'http://guoerwx.sinaapp.com/login.php?openid=' . $openid;
             $this->responseText('请先绑定学号' . "\n" . '<a href=' . "\"" . $url . "\"" . '>点击绑定学号</a>');
             return;
         } else {
             if ($checkbind['status'] == 1) {
                 $string = getExam($checkbind['data']['username'], $checkbind['data']['password']);
                 if (!empty($string)) {
                     $this->responseText($string);
                 } else {
                     $this->responseText('考试安排还没出来,先去复习吧!');
                 }
                 return;
             }
         }
     }
     if ($content == '解绑') {
         $data = unBind($openid);
         if ($data['status'] == 0) {
             $this->responseText('您还未绑定!');
         } else {
             if ($data['status'] == 1) {
                 $this->responseText('解绑成功!');
             }
         }
     }
     if ($content == '帮助') {
         $this->responseText("发送图书馆加关键词即可查书(如图书馆韩寒)\n发送成绩即可查询本学期成绩\n发送考试安排即可查询考试安排\n发送课表即可查询当日课表\n有问题直接发消息给我");
         return;
     }
     if (mb_substr($content, 0, 2, 'utf-8') == '课表') {
         $checkbind = checkBind($openid);
         if ($checkbind['status'] == 0) {
             $url = 'http://guoerwx.sinaapp.com/login.php?openid=' . $openid;
             $this->responseText('请先绑定学号' . "\n" . '<a href=' . "\"" . $url . "\"" . '>点击绑定学号</a>');
             return;
         } else {
             if ($checkbind['status'] == 1) {
                 $week = mb_substr($content, 2, 1, 'utf-8');
                 if ($week == '') {
                     $week = date('w', $time);
                 }
                 $string = getClass($checkbind['data']['username'], $checkbind['data']['password'], $week);
             }
         }
         $this->responseText($string);
         return;
     }
     if ($content == '测试') {
         $this->responseText($time);
         return;
     }
     return;
 }