function logTip($tipId, $tipAction, $newtip = null, $qcId = null) { $userId = $this->getUser()->getID(); $row = TipsPatrol::getTipRow($tipId); if (is_array($row)) { $row['tw_action'] = $tipAction; if ($qcId) { $row['tw_qc_id'] = $qcId; } $dbw = wfGetDB(DB_MASTER); // if it's a skip don't bother recording the the tipsandwarnings_log if ($tipAction != TipsPatrol::TIP_ACTION_SKIP) { $row['tw_tip'] = $newtip; $row['tw_user'] = $userId; $row['tw_timestamp'] = wfTimestampNow(); $dbw->insert('tipsandwarnings_log', $row, __METHOD__, array('IGNORE')); } // only count views while tipspatrol is active if (TipsPatrol::isTPCoachEnabled()) { $dbw->query("INSERT INTO `tipspatrol_views` (`tpv_user_id`, `tpv_count`) VALUES ({$userId}, 1) ON DUPLICATE KEY UPDATE tpv_count = tpv_count + 1"); } } }
function printData() { global $wgOut, $wgRequest; $coachEnabled = TipsPatrol::isTPCoachEnabled(); $vars['disableDisplay'] = $coachEnabled ? "block" : "none"; $vars['enableDisplay'] = $coachEnabled ? "none" : "block"; $vars['scores'] = $this->getScores(); $vars['tests'] = $this->getTests(); $vars['days'] = $wgRequest->getVal("days", 7); $vars['css'] = HtmlSnips::makeUrlTags('css', array('tpcoachadmin.css'), 'extensions/wikihow/tipsandwarnings', true); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('tpcoachadmin.js'), 'extensions/wikihow/tipsandwarnings', true)); $html = EasyTemplate::html('TPCoachAdmin', $vars); $wgOut->addHTML($html); }
function logTip($tipId, $tipAction, $revision = null, $newtip = null) { global $wgUser; $userId = $wgUser->getID(); $row = TipsPatrol::getTipRow($tipId); if (is_array($row)) { $row['tw_action'] = $tipAction; if ($revision) { $row['tw_rev_this'] = $revision->getId(); } // if it's a skip don't bother recording the tip itself if ($tipAction == TipsPatrol::TIP_ACTION_SKIP) { unset($row['tw_tip']); } if ($tipAction == TipsPatrol::TIP_ACTION_QG) { if ($newtip != null) { $row['tw_tip'] = $newtip; } } else { $row['tw_user'] = $userId; } $row['tw_timestamp'] = wfTimestampNow(); $dbw = wfGetDB(DB_MASTER); $dbw->insert('tipsandwarnings_log', $row, __METHOD__, array('IGNORE')); // only count views while tipspatrol is active if (TipsPatrol::isTPCoachEnabled()) { $dbw->query("INSERT INTO `tipspatrol_views` (`tpv_user_id`, `tpv_count`) VALUES ({$userId}, 1) ON DUPLICATE KEY UPDATE tpv_count = tpv_count + 1"); } } }