/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = MOfficeCampaignScore::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'office_campaign_id' => $this->office_campaign_id, 'staff_id' => $this->staff_id, 'score' => $this->score, 'created_time' => $this->created_time]); return $dataProvider; }
public function getScoredOfficeCountByScorer($scorer_id) { $count = 0; foreach ($this->offices as $office) { if (MOfficeCampaignScore::getScoreByScorer($office->office_id, $scorer_id) !== false) { $count++; } } return $count; }
<header class="bar bar-nav"> <a class="icon icon-close pull-right" id='quick-scoring-close' href='#quick-scoring'></a> <h1 class='title'>快速评分</h1> </header> <div class="content"> <div class="slider" id="office-campaign-details"> <div class="slide-group"> <?php foreach ($models_categories as $category) { if (!$office->is_selfOperated && $category->sort_order == 6) { continue; } if (empty($staff)) { $staff = $wx_user->staff; } $myscore = \app\models\MOfficeCampaignScore::getScoreByScorerAndPicCategory($office->office_id, $staff->staff_id, $category->id); if ($myscore !== false) { continue; } $min_score = 0; if (!$office->is_selfOperated) { $max_score = 20; } else { if ($category->sort_order == 6) { $max_score = 10; } else { $max_score = 18; } } $detail = MOfficeCampaignDetail::getDetailByOfficeAndPicCategory($office->office_id, $category->id); if (!empty($detail)) {
<script src="http://libs.useso.com/js/jquery/2.1.1/jquery.min.js"></script> <!-- Include the compiled Ratchet JS --> <script src="/wx/web/ratchet/dist/js/ratchet.js"></script> </head> <body> <!-- Make sure all your bars are the first things in your <body> --> <header class="bar bar-nav"> <a class="icon icon-left-nav pull-left" id="btn_back" onclick="javascript:history.back();"></a> <h1 class="title"> 渠道宣传竞赛资料提交 </h1> </header> <?php $scores = \app\models\MOfficeCampaignScore::getScoreByPicCategory($model_office->office_id, $model_ocpc->id); $supervisor = $model_office->supervisor; ?> <!-- Wrap all non-bar HTML in the .content div (this is actually what scrolls) --> <div class="content"> <p> <?php echo $model_ocpc->name; ?> </p> <?php $model_office_campaign_detail = MOfficeCampaignDetail::findOne(['pic_category' => $model_ocpc->id, 'office_id' => $model_office->office_id]); if (!empty($model_office_campaign_detail)) {
public function actionHandleqdxcjspb() { $this->layout = false; $gh_id = U::getSessionParam('gh_id'); $openid = U::getSessionParam('openid'); Yii::$app->wx->setGhId($gh_id); $office_campaign_id = empty($_GET['office_campaign_id']) ? 0 : $_GET['office_campaign_id']; $staff_id = empty($_GET['staff_id']) ? 0 : $_GET['staff_id']; $score = empty($_GET['score']) ? 0 : $_GET['score']; $comment = empty($_GET['comment']) ? '' : $_GET['comment']; $model = new MOfficeCampaignScore(); //$model->gh_id = $gh_id; //$model->openid = $openid; $model->office_campaign_id = $office_campaign_id; $model->staff_id = $staff_id; $model->score = $score; $model->comment = $comment; $model->save(false); return json_encode(['code' => 0]); }
public function actionOfficeCampaignRanking($date = null, $is_selfOpearted = 1, $filename = 'office-campaign-results.csv') { $file = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'exported_data' . DIRECTORY_SEPARATOR . $filename; if ($date == null) { $date = date('Y-m-d'); } $results = \app\models\MOfficeCampaignScore::getScoreRanking($is_selfOpearted, $date); $fh = fopen($file, "w"); foreach ($results as $result) { $office = \app\models\MOffice::findOne(['office_id' => $result['office_id']]); fprintf($fh, "%s, %.2f" . PHP_EOL, $office->title, $result['score']); } fclose($fh); }
} ?> <h1 class="title"> 渠道宣传竞赛评选 </h1> </header> <?php $scores = \app\models\MOfficeCampaignScore::getScoreByPicCategory($office->office_id, $model_ocpc->id); $is_scorer = false; if ($staff->isOfficeCampaignScorer()) { $is_scorer = true; $scorer_score = \app\models\MOfficeCampaignScore::getScoreByScorerAndPicCategory($office->office_id, $staff->staff_id, $model_ocpc->id); $scorer = $staff->officeCampaignScorer; $scorer_comment = \app\models\MOfficeCampaignScore::getCommentByScorerAndPicCategory($office->office_id, $staff->staff_id, $model_ocpc->id); if ($scorer_score === false) { $can_score = true; } else { $can_score = false; } } else { $can_score = false; } ?> <!-- Wrap all non-bar HTML in the .content div (this is actually what scrolls) --> <div class="content"> <?php if ($can_score) { ?>
/** * Finds the MOfficeCampaignScore model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return MOfficeCampaignScore the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MOfficeCampaignScore::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
?> "> <!-- <img class="media-object pull-left" src="http://placehold.it/80x80"> --> <div class="pull-right"> <?php $score = \app\models\MOfficeCampaignScore::getScore($model_office->office_id); if ($score) { $wx_user = \app\models\MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]); $staff = $wx_user->mobileStaff; if (empty($staff)) { $staff = $wx_user->staff; } if ($staff->isOfficeCampaignScorer()) { $myscore = \app\models\MOfficeCampaignScore::getScoreByScorer($model_office->office_id, $staff->staff_id); if ($myscore === false) { ?> <span class="icon icon-info" style="color:red"></span> <?php } } ?> <span class="badge badge-positive"><?php echo number_format($score, 2); ?> 分</span> <?php } else { if (\app\models\MOfficeCampaignDetail::getDetailReadyStatus($model_office->office_id) != \app\models\MOfficeCampaignDetail::DETAIL_COMPLETE) { ?>
?> "> <span class="icon icon-left-nav"></span> </a> <?php } ?> <h1 class="title"> <i class="fa fa-trophy" style="color:#fff"></i> 渠道宣传竞赛评选排行榜 </h1> </header> <?php $ranking = \app\models\MOfficeCampaignScore::getScoreRanking(); $ranking_2 = \app\models\MOfficeCampaignScore::getScoreRanking(1); ?> <!-- Wrap all non-bar HTML in the .content div (this is actually what scrolls) --> <div class="content"> <div class="segmented-control"> <a class="control-item active" href="#item1mobile"> 自营厅 </a> <a class="control-item" href="#item2mobile"> 合作厅 </a> </div> <div class="card"> <span id="item1mobile" class="control-content active">