public function show($slug) { //DB::table('yourtablename')->where('yourcolumn','value')->groupBy('column','column')->get(); $result = result::select(DB::raw('vote,slug, count(*) as count'))->where('slug', '=', $slug)->groupBy('vote', 'slug')->get(); $question = question::whereSlug($slug)->firstOrFail(); //result::whereSlug($slug)->whereVote('option1')->first()->count('*'); //result::all(); //where('slug','=',$slug)->groupBy('vote')->first()->count(); //result::whereSlug($slug)->whereVote('option1')->count()->first(); //DB::table('results')->select(DB::raw('count(*) as count')) // ->where('slug', '=', $slug) // ->groupBy('vote') // ->get(); //DB::table('results')->where('slug',$slug)->groupBy('vote','slug')->first(); //result::select(result::raw('select (vote, slug) count(*) as count where slug = ',$slug,' Group by vote, slug'))->first(); //select('vote','slug')->count('*')->where('slug','=',$slug)->groupBy('vote')->get(); //result::select('vote','slug')->count('*')->where('slug','=',$slug)->groupBy('vote')->get(); //result::whereSlug($slug)->whereVote('option1')->firstOrFail(); // select(result::raw('count("vote") as votes')) ->where('slug', $slug)->get(); //count('vote')->where('Slug',$slug)->whereVote('option1')->firstOrFail(); //SELECT vote, slug, COUNT(*) FROM results where slug = '56583a4852f37' Group by vote, slug return view('results.show', compact('result', 'question')); }
/** * Gets information about this tree (including all or selected children) as * HTML for display to staff or student. * * @param bool $not True if there is a NOT in effect * @param info $info Information about location of condition tree * @param result $result Result object if this is a student display, else null * @param bool $root True if this is the root item * @param bool $hidden Staff display; true if this tree has show=false (from parent) */ protected function get_full_information_recursive($not, info $info, result $result = null, $root, $hidden = false) { global $PAGE; // Get list of children - either full list, or those which are shown. $children = $this->children; $staff = true; if ($result) { $children = $result->filter_nodes($children); $staff = false; } // If no children, return empty string. if (!$children) { return ''; } list($innernot, $andoperator) = $this->get_logic_flags($not); // If there is only one child, don't bother displaying this tree // (AND and OR makes no difference). Recurse to the child if a tree, // otherwise display directly. if (count($children) === 1) { $child = reset($children); if ($this->root && is_null($result)) { if (is_null($this->showchildren)) { $childhidden = !$this->show; } else { $childhidden = !$this->showchildren[0]; } } else { $childhidden = $hidden; } if ($child instanceof tree) { return $child->get_full_information_recursive($innernot, $info, $result, $root, $childhidden); } else { if ($root) { $result = $child->get_standalone_description($staff, $innernot, $info); } else { $result = $child->get_description($staff, $innernot, $info); } if ($childhidden) { $result .= ' ' . get_string('hidden_marker', 'availability'); } return $result; } } // Multiple children, so prepare child messages (recursive). $items = array(); $index = 0; foreach ($children as $child) { // Work out if this node is hidden (staff view only). $childhidden = $this->root && is_null($result) && !is_null($this->showchildren) && !$this->showchildren[$index]; if ($child instanceof tree) { $items[] = $child->get_full_information_recursive($innernot, $info, $result, false, $childhidden); } else { $childdescription = $child->get_description($staff, $innernot, $info); if ($childhidden) { $childdescription .= ' ' . get_string('hidden_marker', 'availability'); } $items[] = $childdescription; } $index++; } // If showing output to staff, and root is set to hide completely, // then include this information in the message. if ($this->root) { $treehidden = !$this->show && is_null($result); } else { $treehidden = $hidden; } // Format output for display. $renderer = $PAGE->get_renderer('core', 'availability'); return $renderer->multiple_messages($root, $andoperator, $treehidden, $items); }
/** * Fetches the current data. * @return array */ protected function getCurrentData() { return $this->key() > $this->count() ? null : $this->result->fetchArray($this->key() - 1); }
if ($_SESSION['wx_state'] != $state) { $rs = new result(WX_ACCESS_FAILED); echo $rs->json(); exit; } $token_url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . WX_APP_ID . '&secret=' . WX_APP_SECRET . '&code=' . $code . '&grant_type=authorization_code'; $token = json_decode(file_get_contents($token_url)); if (isset($token->errcode)) { $rs = new result(WX_TOKEN_FAILED, '[' . $token->errcode . ']: ' . $token->errmsg); echo $rs->json(); exit; } /* $user_info_url = 'https://api.weixin.qq.com/sns/userinfo?access_token=' . $token->access_token . '&openid=' . $token->openid . '&lang=zh_CN'; $user_info = json_decode(file_get_contents($user_info_url)); if (isset($user_info->errcode)) { $rs = new result(WX_USERINFO_FAILED, '[' . $token->errcode . ']: ' . $token->errmsg); echo $rs->json(); exit(); } */ $openid = $token->openid; if ($openid != null) { session_start(); $_SESSION['open_id'] = $openid; echo "<script>location.href='index.php?un=1';</script>"; } else { $rs = new result(CREATE_USER_FAILED); echo $rs->json(); exit; }
/** * @param result $result Result or exception. * @param array $acceptor Acceptor configuration being checked. * * @return bool */ private function matchesError($result, array $acceptor) { if ($result instanceof AwsException) { return $result->isConnectionError() || $result->getAwsErrorCode() == $acceptor['expected']; } return false; }
<?php require_once "inc/initialize.php"; $assessment_id = @$_GET['id']; $assessment = assessment::find_by_id($assessment_id); $team = team::find_by_id($assessment->team_id); $user = user::find_by_id($assessment->user_id); $goal = goal::find_by_id($assessment->goals_id); $assessment->results; $result = result::find_by_id($assessment->results); if ($assessment->intended_outcome_id) { $intended_outcome = intended_outcome::find_by_id($assessment->intended_outcome_id); } if ($team->team_type == 0) { $slo = slo::find_by_id($assessment->slo_id); } ?> <script language="Javascript1.2"> <!-- function printpage() { window.print(); } //--> </script> <body onload="printpage()"> <table width="1020" cellpadding="5" cellspacing="0" border="0"><td align="left" style="font-size: 20px; font-weight: bold;">Office of Strategic Planning, Assessment, & Accreditation</td></tr></table> <div style="padding: 20px; width: 990px; text-align: left;">
$xSerie = $_POST['xSerie']; // +++ set session and cookie if (!defined('CFG_CURRENT_EVENT')) { define('CFG_CURRENT_EVENT', $xSerie); } $_SESSION[CFG_SESSION]['xSerie'] = $xSerie; set_cookie('xSerie', $xSerie); // --- set session and cookie location('index.php'); } elseif (isset($_POST['frm_action']) && $_POST['frm_action'] == 'quit_event') { $cls_result = new result(CFG_CURRENT_EVENT); $cls_result->closeEvent(3); location('index.php'); } include ROOT_PATH . 'header.php'; $cls_result = new result(CFG_CURRENT_EVENT); ?> <script type="text/javascript"> $(document).ready(function(){ $('.button').button(); $('#refreshEvent, #refreshEventList').button({ icons: {primary:'ui-icon-refresh'} }); $('#quitEvent').button({ icons: {primary:'ui-icon-home'} }); $('#accordion_settings').accordion({ autoHeight: false , collapsible: true , navigation: true , active: false }); $('#accordion_results').accordion({ autoHeight: false
/** * @param result $result Result or exception. * @param array $acceptor Acceptor configuration being checked. * * @return bool */ private function matchesError($result, array $acceptor) { return !$result instanceof AwsException ? false : $result->getAwsErrorCode() == $acceptor['expected']; }