/** * Process incoming parameters and display search results or a record. * * @return void * @access public */ public function launch() { $params = $this->parseOpenURL(); $searchObject = $this->processOpenURL($params); // If we were asked to return just information whether something was found, // do it here if (isset($_REQUEST['vufind_response_type']) && $_REQUEST['vufind_response_type'] == 'resultcount') { echo $searchObject->getResultTotal(); return; } // Otherwise just display results $results = new Results(); $results->showResults($searchObject); }
public function postIndex() { $postData = Input::all(); $Qlenght = $postData['questionsLenght']; $anArr = array(); $total = 0; $questionArr = []; for ($i = 0; $i < $Qlenght; $i++) { $j = $i + 1; $currentQuestionArr = $postData["currentQuestion{$j}"]; $question = Question::find($currentQuestionArr); $correctAn = $question->correct_answer; $questionId = $question->id; if (isset($postData['optionsRadios' . $j . $questionId])) { $answer = $postData['optionsRadios' . $j . $questionId]; if ($answer == $correctAn) { $total = $total + 1; } $formOrigin = "quizz"; $questionArr[$questionId] = $answer; Results::where('user_id', Auth::user()->id)->delete(); } else { return Redirect::to('backends/dashboard')->withInput()->with('flash_message', 'Please select all option to check answer.'); } } $results = Results::create(['user_id' => Auth::user()->id, 'question_quizzler_answer' => json_encode($questionArr), 'active' => 1]); $total = $total / $Qlenght * 100; return Redirect::to('backends/dashboard?keyword=' . $formOrigin . "&total=" . $total . "&resultId=" . $results->id)->withInput(); }
public function postLoginform() { $postData = Input::all(); $rules = array('username' => 'required'); $validator = Validator::make($postData, $rules); if ($validator->fails()) { return Redirect::to('/login')->withInput()->withErrors($validator); } else { $credentials = array('username' => $postData['username'], 'password' => $postData['password']); if (Auth::attempt($credentials)) { if (Auth::user()->active == 1) { if (Auth::user()->user_role_id == 2) { return Redirect::to('backends/dashboard')->with('flash_message', 'Welcome To : The Quizzler.'); exit; } else { $results = Results::where('user_id', Auth::user()->id)->first(); if (isset($results)) { return Redirect::to('backends/dashboard/viewresult'); exit; } else { return Redirect::to('backends/dashboard')->with('flash_message', 'Welcome To : The Quizzler.'); exit; } } } else { return Redirect::to('/login')->withInput()->with('flash_message', 'Your Username and Password are Invalide.'); exit; } } else { return Redirect::to('/login')->withInput()->with('flash_message', 'Your Username and Password are Invalide.'); exit; } } }
public function destroy($id) { if (\Input::get('bulk_opa_items')) { $result = Results::find(Input::get('bulk_opa_items')[0]); $result->delete(); } return Redirect::to("/admin/surveys/" . $id . "/results"); }
public static function getResults($id) { //比赛成绩 $winners = Results::model()->with(array('person', 'person.country', 'round', 'event', 'format'))->findAllByAttributes(array('competitionId' => $id, 'pos' => 1, 'roundId' => array('c', 'f')), array('order' => 'event.rank, round.rank, t.pos')); $top3 = Results::model()->with(array('person', 'person.country', 'round', 'event', 'format'))->findAllByAttributes(array('competitionId' => $id, 'pos' => array(1, 2, 3), 'roundId' => array('c', 'f')), array('order' => 'event.rank, round.rank, t.pos')); $all = Results::model()->with(array('person', 'person.country', 'round', 'event', 'format'))->findAllByAttributes(array('competitionId' => $id), array('order' => 'event.rank, round.rank, t.pos')); $scrambles = Scrambles::model()->with(array('round', 'event'))->findAllByAttributes(array('competitionId' => $id), array('order' => 'event.rank, round.rank, t.groupId, t.isExtra, t.scrambleNum')); return array('winners' => $winners, 'top3' => $top3, 'all' => $all, 'scrambles' => $scrambles); }
public function getEventsString($event) { $str = ''; if (in_array($event, $this->events)) { $str = '<span class="fa fa-check"></span>'; if ($this->best > 0 && self::$sortAttribute === $event && self::$sortDesc !== true) { $str = self::$sortDesc === true ? '' : '[' . $this->pos . ']' . $str; $str .= Results::formatTime($this->best, $event); } } return $str; }
public function getTestagain($userId = 0) { $result = Results::where('user_id', $userId)->first(); $result = Results::find($result['id']); //return $result->active; if ($result->active == 0) { $result->active = 1; } elseif ($result->active == 1) { $result->active = 0; } $result->save(); return Redirect::to('backends/users'); }
public function main() { if (!isset($_GET['pod_id'])) { return R('/'); } $podId = $_GET['pod_id']; $pod = new Pod($podId); $args = (array) $pod; if (A()->isAdmin() && $pod->awaitingPairings()) { $args['pairUrl'] = U('/pair/', false, ['pod_id' => $podId]); } $results = new Results(); foreach ($args['rounds'] as &$round) { foreach ($round['matches'] as &$match) { $needsReport = $match['wins'] === null; $canReport = A()->isAdmin() || $match['playerId'] === S()->id() || $match['opponentId'] === S()->id(); if ($needsReport && $canReport) { $match['potentialResults'] = $results->potentialResults($match['matchId']); } } } $args['standings'] = (new Standings($podId))->getStandings(); return T()->pod($args); }
private static function formatSum($row) { switch ($row['eventId']) { case '333mbf': return array_sum(array_map(function ($row) { $result = $row[0]['average']; $difference = 99 - substr($result, 0, 2); return $difference; }, array($row['first'], $row['second'], $row['third']))); case '333fm': return $row['sum'] / 100; default: return Results::formatTime($row['sum'], $row['eventId']); } }
/** * Constructor * * If provided, executes SQL query via parent Results object * * @param string Name of table in database * @param string Prefix of fields in the table * @param string Name of the ID field (including prefix) * @param string Name of Class for objects within this list * @param string SQL query * @param integer number of lines displayed on one screen * @param string prefix to differentiate page/order params when multiple Results appear one same page * @param string default ordering of columns (special syntax) */ function DataObjectList($tablename, $prefix = '', $dbIDname = 'ID', $objType = 'Item', $sql = NULL, $limit = 20, $param_prefix = '', $default_order = NULL) { $this->dbtablename = $tablename; $this->dbprefix = $prefix; $this->dbIDname = $dbIDname; $this->objType = $objType; if (!is_null($sql)) { // We have an SQL query to execute: parent::Results($sql, $param_prefix, $default_order, $limit); } else { // TODO: do we want to autogenerate a query here??? // Temporary... parent::Results($sql, $param_prefix, $default_order, $limit); } }
public function getResultsYear() { session_start(); $headers = apache_request_headers(); $token = $headers['X-Auth-Token']; if (!$headers['X-Auth-Token']) { header('Invalid CSRF Token', true, 401); return print json_encode(array('success' => false, 'status' => 400, '1msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT); die; } else { if ($token != $_SESSION['form_token']) { header('Invalid CSRF Token', true, 401); return print json_encode(array('success' => false, 'status' => 400, 'msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT); die; } else { Results::getResultsYear(); } } }
public static function build($statistic) { $command = Yii::app()->wcaDb->createCommand()->select(array('r.*', 'rs.personName', 'rs.competitionId', 'c.cellName', 'c.cityName', 'c.year', 'c.month', 'c.day'))->leftJoin('Persons p', 'r.personId=p.id AND p.subid=1')->where('r.countryRank=1 AND rs.personCountryId="China"'); $rows = array(); foreach (Results::getRankingTypes() as $type) { $cmd = clone $command; $cmd->from(sprintf('Ranks%s r', ucfirst($type)))->leftJoin('Results rs', sprintf('r.best=rs.%s AND r.personId=rs.personId AND r.eventId=rs.eventId', $type == 'single' ? 'best' : $type))->leftJoin('Competitions c', 'rs.competitionId=c.id'); foreach ($cmd->queryAll() as $row) { $row['type'] = $type; if (isset($rows[$type][$row['eventId']])) { $temp = $rows[$type][$row['eventId']]; if ($temp['year'] > $row['year'] || $temp['month'] > $row['month'] || $temp['day'] > $row['day']) { continue; } } $row = self::getCompetition($row); $rows[$type][$row['eventId']] = $row; } } $rows = array_merge(array_values($rows['single']), array_values($rows['average'])); usort($rows, function ($rowA, $rowB) { $temp = $rowA['year'] - $rowB['year']; if ($temp == 0) { $temp = $rowA['month'] - $rowB['month']; } if ($temp == 0) { $temp = $rowA['day'] - $rowB['day']; } if ($temp == 0) { $temp = strcmp($rowA['personName'], $rowB['personName']); } return $temp; }); $rows = array_slice($rows, 0, self::$limit); //person days event type result record competition $columns = array(array('header' => 'Yii::t("statistics", "Person")', 'value' => 'Persons::getLinkByNameNId($data["personName"], $data["personId"])', 'type' => 'raw'), array('header' => 'Yii::t("statistics", "Days")', 'value' => 'CHtml::tag("b", array(), floor((time() - strtotime(sprintf("%s-%s-%s", $data["year"], $data["month"], $data["day"]))) / 86400))', 'type' => 'raw'), array('header' => 'Yii::t("common", "Event")', 'value' => 'Yii::t("event", Events::getFullEventName($data["eventId"]))'), array('header' => 'Yii::t("common", "Type")', 'value' => 'Yii::t("common", ucfirst($data["type"]))'), array('header' => 'Yii::t("common", "Result")', 'value' => 'Results::formatTime($data["best"], $data["eventId"])'), array('header' => 'Yii::t("common", "Records")', 'value' => '$data["worldRank"] == 1 ? "WR" : ($data["continentRank"] == 1 ? "AsR" : "NR")'), array('header' => 'Yii::t("common", "Competition")', 'value' => 'CHtml::link(ActiveRecord::getModelAttributeValue($data, "name"), $data["url"])', 'type' => 'raw')); return self::makeStatisticsData($statistic, $columns, $rows); }
* @copyright (c)2009-2015 by Francois Planque - {@link http://fplanque.com/} * Parts of this file are copyright (c)2009 by The Evo Factory - {@link http://www.evofactory.com/}. * * @package evocore */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } global $Blog; // Create query $SQL = new SQL(); $SQL->SELECT('t.*, IF( tb.itc_ityp_ID > 0, 1, 0 ) AS type_enabled'); $SQL->FROM('T_items__type AS t'); $SQL->FROM_add('LEFT JOIN T_items__type_coll AS tb ON itc_ityp_ID = ityp_ID AND itc_coll_ID = ' . $Blog->ID); // Create result set: $Results = new Results($SQL->get(), 'ityp_'); $Results->title = T_('Item/Post/Page types') . get_manual_link('managing-item-types'); // get reserved and default ids global $default_ids; $default_ids = ItemType::get_default_ids(); /** * Callback to build possible actions depending on post type id * */ function get_actions_for_itemtype($id) { global $default_ids; $action = action_icon(T_('Duplicate this Post Type...'), 'copy', regenerate_url('action', 'ityp_ID=' . $id . '&action=new')); if (!ItemType::is_reserved($id)) { // Edit all post types except of not reserved post type $action = action_icon(T_('Edit this Post Type...'), 'edit', regenerate_url('action', 'ityp_ID=' . $id . '&action=edit')) . $action;
$group_filtered_SQL = new SQL(); $group_filtered_SQL->SELECT('cgr_ID AS ID, cgr_name AS name, COUNT(cgu_user_ID) AS count_users'); $group_filtered_SQL->FROM('T_messaging__contact_groups'); $group_filtered_SQL->FROM_add('LEFT JOIN T_messaging__contact_groupusers ON cgu_cgr_ID = cgr_ID'); $group_filtered_SQL->WHERE('cgr_ID = ' . $DB->quote($g)); $group_filtered_SQL->WHERE_and('cgr_user_ID = ' . $current_User->ID); $group_filtered_SQL->GROUP_BY('cgr_ID'); $group_filtered = $DB->get_row($group_filtered_SQL->get()); } // Create result set: if ($Settings->get('allow_avatars')) { $default_order = '--A'; } else { $default_order = '-A'; } $Results = new Results($select_SQL->get(), 'mct_', $default_order, NULL, $count_SQL->get()); $Results->title = T_('Contacts list'); if (is_admin_page()) { // Set an url for manual page: $Results->title .= get_manual_link('contacts-list'); } /** * Callback to add filters on top of the result set * * @param Form */ function filter_contacts(&$Form) { global $item_ID; $Form->text('s', get_param('s'), 30, T_('Search'), '', 255); $Form->select_input('g', get_param('g'), 'get_contacts_groups_options', T_('Group'));
* Created on Jul 4, 2007 * * Author: Andrew Nelson * Processes the input from home.html */ $action = $_POST["operation"]; if ($action != null && $action != "") { if ($action == "generate") { $fileName = $_POST["saveFile"]; $runs = $_POST["runs"]; if ($fileName != null && $fileName != "") { echo "Generating Your Results. Please be Patient<br />"; ob_flush(); flush(); include "results.php"; $result = new Results(); $result->runTests($runs); $result->writeXML($fileName); echo "Your file has been saved to {$fileName}<br />"; echo "<a href = 'home.php'>Run the Tool Again</a><br />"; return; } else { echo "You must input a file name!<br />"; } } if ($action == "compare") { $fileOne = $_POST["firstFile"]; $fileTwo = $_POST["secondFile"]; if ($fileOne != null && $fileOne != "" && $fileTwo != null && $fileTwo != "") { if (!file_exists($fileOne)) { echo "The first specified file doesn't exist<br/>";
// Filter by start date $SQL->WHERE_and('emlog_timestamp >= ' . $DB->quote($datestart . ' 00:00:00')); $count_SQL->WHERE_and('emlog_timestamp >= ' . $DB->quote($datestart . ' 00:00:00')); } if (!empty($datestop)) { // Filter by end date $SQL->WHERE_and('emlog_timestamp <= ' . $DB->quote($datestop . ' 23:59:59')); $count_SQL->WHERE_and('emlog_timestamp <= ' . $DB->quote($datestop . ' 23:59:59')); } if (!empty($email)) { // Filter by email $email = utf8_strtolower($email); $SQL->WHERE_and('emlog_to LIKE ' . $DB->quote($email)); $count_SQL->WHERE_and('emlog_to LIKE ' . $DB->quote($email)); } $Results = new Results($SQL->get(), 'emlog_', 'D', $UserSettings->get('results_per_page'), $count_SQL->get()); $Results->title = T_('Sent emails') . get_manual_link('sent-emails'); /** * Callback to add filters on top of the result set * * @param Form */ function filter_email_sent(&$Form) { global $datestart, $datestop, $email; $Form->date_input('datestartinput', $datestart, T_('From date')); $Form->date_input('datestopinput', $datestop, T_('To date')); $Form->text_input('email', $email, 40, T_('Email')); } $Results->filter_area = array('callback' => 'filter_email_sent', 'presets' => array('all' => array(T_('All'), $admin_url . '?ctrl=email&tab=sent'))); $Results->cols[] = array('th' => T_('ID'), 'order' => 'emlog_ID', 'th_class' => 'shrinkwrap', 'td_class' => 'right', 'td' => '$emlog_ID$');
load_funcs('regional/model/_regional.funcs.php'); // Get params from request $s = param('s', 'string', '', true); // Create query $SQL = new SQL(); $SQL->SELECT('ctry_ID, ctry_code, ctry_name, curr_shortcut, curr_code, ctry_enabled, ctry_preferred, ctry_status, ctry_block_count'); $SQL->FROM('T_regional__country'); $SQL->FROM_add('LEFT JOIN T_regional__currency ON ctry_curr_ID=curr_ID'); $SQL->ORDER_BY('*, ctry_code ASC'); if (!empty($s)) { // We want to filter on search keyword: // Note: we use CONCAT_WS (Concat With Separator) because CONCAT returns NULL if any arg is NULL $SQL->WHERE('CONCAT_WS( " ", ctry_code, ctry_name, curr_code ) LIKE "%' . $DB->escape($s) . '%"'); } // Create result set: $Results = new Results($SQL->get(), 'ctry_', '-D'); $Results->title = T_('Countries') . get_manual_link('regional-countries-tab'); /* * STATUS TD: */ function ctry_td_enabled($ctry_enabled, $ctry_ID) { $r = ''; $redirect_ctrl = param('ctrl', 'string', 'countries'); if ($ctry_enabled == true) { $r .= action_icon(T_('Disable the country!'), 'bullet_full', regenerate_url('ctrl,action', 'ctrl=countries&action=disable_country&ctry_ID=' . $ctry_ID . '&redirect_ctrl=' . $redirect_ctrl . '&' . url_crumb('country'))); } else { $r .= action_icon(T_('Enable the country!'), 'bullet_empty', regenerate_url('ctrl,action', 'ctrl=countries&action=enable_country&ctry_ID=' . $ctry_ID . '&redirect_ctrl=' . $redirect_ctrl . '&' . url_crumb('country'))); } return $r; }
* * @package admin */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } global $blog, $admin_url, $UserSettings; // Create result set: $SQL = new SQL(); $SQL->SELECT('SQL_NO_CACHE ivc_ID, ivc_code, ivc_expire_ts, ivc_source, ivc_grp_ID, grp_name, grp_level'); $SQL->FROM('T_users__invitation_code'); $SQL->FROM_add('INNER JOIN T_groups ON grp_ID = ivc_grp_ID'); $count_SQL = new SQL(); $count_SQL->SELECT('SQL_NO_CACHE COUNT( ivc_ID )'); $count_SQL->FROM('T_users__invitation_code'); $Results = new Results($SQL->get(), 'ivc_', '-D', $UserSettings->get('results_per_page'), $count_SQL->get()); $Results->title = T_('Invitation codes') . get_manual_link('invitation-codes-list'); /* * Table icons: */ if ($current_User->check_perm('users', 'edit', false)) { // create new group link $Results->global_icon(T_('Create a new invitation code...'), 'new', '?ctrl=invitations&action=new', T_('Add invitation code') . ' »', 3, 4, array('class' => 'action_icon btn-primary')); } $Results->cols[] = array('th' => T_('ID'), 'order' => 'ivc_ID', 'th_class' => 'shrinkwrap', 'td_class' => 'right', 'td' => '$ivc_ID$'); $Results->cols[] = array('th' => T_('Expires'), 'order' => 'ivc_expire_ts', 'td_class' => 'shrinkwrap', 'td' => '$ivc_expire_ts$'); $Results->cols[] = array('th' => T_('Group'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'order' => 'grp_name', 'td' => '$grp_name$ ($grp_level$)'); $Results->cols[] = array('th' => T_('Code'), 'order' => 'ivc_code', 'td' => $current_User->check_perm('users', 'edit', false) ? '<a href="' . $admin_url . '?ctrl=invitations&action=edit&ivc_ID=$ivc_ID$"><b>$ivc_code$</b></a>' : '$ivc_code$'); $Results->cols[] = array('th' => T_('Code'), 'order' => 'ivc_code', 'td' => '<a href="' . get_secure_htsrv_url() . 'register.php?invitation=$ivc_code$">' . T_('Link') . '</a>'); $Results->cols[] = array('th' => T_('Source'), 'order' => 'ivc_source', 'td' => '$ivc_source$'); if ($current_User->check_perm('users', 'edit', false)) {
/** * Display functions */ function display_functions() { $this->functions_area = array('callback' => array('this', 'selection_menu')); parent::display_functions(); }
/** * Needed by functions * @var LinkOwner */ global $LinkOwner; global $AdminUI, $current_User; // Override $debug in order to keep the display of the iframe neat global $debug; $debug = 0; if (empty($Blog)) { $Blog =& $LinkOwner->get_Blog(); } // Name of the iframe we want some actions to come back to: param('iframe_name', 'string', '', true); $SQL = $LinkOwner->get_SQL(); $Results = new Results($SQL->get(), 'link_'); $Results->title = T_('Attachments'); /* * Sub Type column */ function display_subtype(&$row) { if (empty($row->file_ID)) { return ''; } global $current_File; // Instantiate a File object for this line: $current_File = new File($row->file_root_type, $row->file_root_ID, $row->file_path); // COPY! // Flow meta data into File object: $current_File->load_meta(false, $row);
* Parts of this file are copyright (c)2005 by Daniel HAHLER - {@link http://thequod.de/contact}. * * @license http://b2evolution.net/about/license.html GNU General Public License (GPL) * * @package admin * * {@internal Below is a list of authors who have contributed to design/coding of this file: }} * @author efy-asimo: Attila Simo. * * @version $Id: _broken_posts.view.php 3328 2013-03-26 11:44:11Z yura $ */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } $SQL = new SQL(); $SQL->SELECT('post_ID, post_title, post_main_cat_ID, post_canonical_slug_ID'); $SQL->FROM('T_items__item'); $SQL->WHERE('post_main_cat_ID NOT IN (SELECT cat_ID FROM T_categories )'); $Results = new Results($SQL->get(), 'broken_posts_'); $Results->title = T_('Broken items with no matching category'); $Results->global_icon(T_('Cancel!'), 'close', regenerate_url('action')); $Results->cols[] = array('th' => T_('Item ID'), 'th_class' => 'shrinkwrap', 'td_class' => 'small center', 'order' => 'post_ID', 'td' => '$post_ID$'); $Results->cols[] = array('th' => T_('Title'), 'th_class' => 'nowrap', 'order' => 'post_title', 'td' => '$post_title$', 'td_class' => 'small'); $Results->cols[] = array('th' => T_('Main Cat ID'), 'th_class' => 'shrinkwrap', 'order' => 'post_main_cat_ID', 'td' => '$post_main_cat_ID$', 'td_class' => 'small center'); $Results->cols[] = array('th' => T_('Canoncical Slug ID'), 'th_class' => 'shrinkwrap', 'order' => 'post_canonical_slug_ID', 'td' => '$post_canonical_slug_ID$', 'td_class' => 'small center'); $Results->display(array('page_url' => regenerate_url('blog,ctrl,action,results_' . $Results->param_prefix . 'page', 'action=' . param_action() . '&' . url_crumb('tools')))); if ($current_User->check_perm('options', 'edit', true) && $Results->get_num_rows()) { // display Delete link $redirect_to = regenerate_url('action', 'action=del_broken_posts&' . url_crumb('tools')); echo '<p>[<a href="' . $redirect_to . '">' . T_('Delete these posts') . '</a>]</p>'; }
public function getCompetitionNum() { return Results::model()->countByAttributes(array('personId' => $this->id), array('select' => 'COUNT(DISTINCT competitionId)')); }
// Not active users $SQL->WHERE('user_status NOT IN( \'activated\', \'autoactivated\' )'); $total_cnt_notactive = $DB->get_var($SQL->get()); // Users with pictures $SQL->WHERE('user_avatar_file_ID IS NOT NULL'); $total_cnt_pictured = $DB->get_var($SQL->get()); // Get all records $SQL = new SQL(); $SQL->SELECT('IF( user_gender IN ( "M", "F" ), user_gender, "A" ) AS gender_sign, COUNT( IF( user_status IN( \'activated\', \'autoactivated\' ), 1, NULL ) ) AS cnt_active, COUNT( IF( user_status IN( \'activated\', \'autoactivated\' ), NULL, 1 ) ) AS cnt_notactive, COUNT( IF( user_avatar_file_ID IS NOT NULL, 1, NULL ) ) AS cnt_pictured'); $SQL->FROM('T_users'); $SQL->GROUP_BY('gender_sign'); // Create result set: $Results = new Results($SQL->get(), 'gender_', 'D', NULL, 3); $Results->title = T_('Gender statistics'); /** * Get formatted data with current value and percentage * * @param integer Cell value * @param integer Total of the column * @return string Value (Percent) */ function stats_gender_value($value, $total) { $percent = $total == 0 ? 0 : floor($value / $total * 100); return $value . ' (' . $percent . '%)'; } /** * Convert gender value from DB short name to full readable name
}); /* * Change idiom */ $app->get('/idiom/:idiom', function ($idiom) use($app) { BootWiki::setIdiom($idiom); $app->redirect(BASEURL); }); /* * Display search results */ $app->get('/search', function () use($app) { // load query $q = $app->request()->get('q'); // Process results $main = new Results(); $main->find($q); // Load layout $layout = new Layout($main); $layout->loadRecent(); $layout->loadPopular(); $layout->query = $q; // Print layout $app->response()->body((string) $layout); }); /* * Display content */ $app->get('/:alias', function ($alias) use($app) { $content = new Content(); $content = $content->load($alias);
* * @package admin */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } global $current_User; $current_User->check_perm('blogs', 'editall', true); param_action('emptytrash', true); $SQL = new SQL(); $SQL->SELECT('DISTINCT(blog_ID), blog_name, count(comment_ID) as comments_number'); // select target_title for sorting $SQL->FROM('T_blogs LEFT OUTER JOIN T_categories ON blog_ID = cat_blog_ID'); $SQL->FROM_add('LEFT OUTER JOIN T_items__item ON cat_ID = post_main_cat_ID'); $SQL->FROM_add('LEFT OUTER JOIN T_comments ON post_ID = comment_item_ID'); $SQL->WHERE('comment_status = "trash"'); $SQL->GROUP_BY('blog_ID'); $count_SQL = new SQL(); $count_SQL->SELECT('COUNT( comment_ID )'); $count_SQL->FROM('T_comments'); $count_SQL->WHERE('comment_status = "trash"'); // Create result set: $Results = new Results($SQL->get(), 'emptytrash_', '', NULL, $count_SQL->get()); $Results->title = T_('Comment recycle bins') . ' (' . $Results->get_total_rows() . ')'; $Results->cols[] = array('th' => T_('Blog ID'), 'th_class' => 'shrinkwrap', 'order' => 'blog_ID', 'td' => '$blog_ID$', 'td_class' => 'shrinkwrap'); $Results->cols[] = array('th' => T_('Blog name'), 'order' => 'blog_name', 'td' => '$blog_name$'); $Results->cols[] = array('th' => T_('Comments in recycle bin'), 'th_class' => 'shrinkwrap', 'order' => 'comments_number', 'td' => '$comments_number$', 'td_class' => 'shrinkwrap'); $Results->cols[] = array('th' => T_('Actions'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'td' => action_icon(TS_('Empty blog\'s recycle bin'), 'recycle_empty', regenerate_url('action', 'blog_ID=$blog_ID$&action=trash_delete') . '&' . url_crumb('comment'))); $Results->global_icon(T_('Cancel empty recycle bin'), 'close', regenerate_url('action', 'action=list&filter=reset'), 3, 4); echo '<p>[<a href="' . regenerate_url('action,blog_ID', 'action=trash_delete') . '&' . url_crumb('comment') . '">' . T_('Empty all blogs\' recycle bin') . '</a>]</p>'; $Results->display();
/** * * 支付结果通用通知 * @param function $callback * 直接回调函数使用方法: notify(you_function); * 回调类成员函数方法:notify(array($this, you_function)); * $callback 原型为:function function_name($data){} */ public static function notify($callback, &$msg) { //获取通知的数据 $xml = $GLOBALS['HTTP_RAW_POST_DATA']; //如果返回成功则验证签名 try { $result = Results::Init($xml); } catch (Exception $e) { $msg = $e->errorMessage(); return false; } return call_user_func($callback, $result); }
} if ($r > 0) { // Filter by region: $sql_where[] = 'rgn_ID = "' . $DB->escape($r) . '"'; } if ($sr > 0) { // Filter by sub-region: $sql_where[] = 'subrg_ID = "' . $DB->escape($sr) . '"'; } if (count($sql_where) > 0) { // Some filters are applied $SQL->WHERE(implode(' AND ', $sql_where)); } // Create result set: //echo $SQL->get(); $Results = new Results($SQL->get(), 'city_', '-----A'); $Results->title = T_('Cities') . get_manual_link('countries_list'); /* * STATUS TD: */ function city_td_enabled($city_enabled, $city_ID) { global $dispatcher; $r = ''; if ($city_enabled == true) { $r .= action_icon(T_('Disable the city!'), 'bullet_full', regenerate_url('action', 'action=disable_city&city_ID=' . $city_ID . '&' . url_crumb('city'))); } else { $r .= action_icon(T_('Enable the city!'), 'bullet_empty', regenerate_url('action', 'action=enable_city&city_ID=' . $city_ID . '&' . url_crumb('city'))); } return $r; }
$sql_where = array(); if (!empty($s)) { // We want to filter on search keyword: // Note: we use CONCAT_WS (Concat With Separator) because CONCAT returns NULL if any arg is NULL $sql_where[] = 'CONCAT_WS( " ", rgn_code, rgn_name ) LIKE "%' . $DB->escape($s) . '%"'; } if ($c > 0) { // We want to filter on search country: $sql_where[] = 'rgn_ctry_ID = "' . $DB->escape($c) . '"'; } if (count($sql_where) > 0) { // Some filters are applied $SQL->WHERE(implode(' AND ', $sql_where)); } // Create result set: $Results = new Results($SQL->get(), 'rgn_', '----A'); $Results->title = T_('Regions/States') . get_manual_link('countries_list'); /* * STATUS TD: */ function rgn_td_enabled($rgn_enabled, $rgn_ID) { global $dispatcher; $r = ''; if ($rgn_enabled == true) { $r .= action_icon(T_('Disable the region!'), 'bullet_full', regenerate_url('action', 'action=disable_region&rgn_ID=' . $rgn_ID . '&' . url_crumb('region'))); } else { $r .= action_icon(T_('Enable the region!'), 'bullet_empty', regenerate_url('action', 'action=enable_region&rgn_ID=' . $rgn_ID . '&' . url_crumb('region'))); } return $r; }
* * @version $Id: _skin_list.view.php 3328 2013-03-26 11:44:11Z yura $ */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } // Create result set: $SQL = new SQL(); $SQL->SELECT('T_skins__skin.*, COUNT( DISTINCT( cset_coll_ID ) ) AS nb_blogs'); $SQL->FROM('T_skins__skin LEFT JOIN T_coll_settings ON skin_ID = cset_value AND ( cset_name = "normal_skin_ID" OR cset_name = "mobile_skin_ID" OR cset_name = "tablet_skin_ID" )'); $SQL->GROUP_BY('skin_ID'); $CountSQL = new SQL(); $CountSQL->SELECT('COUNT( * )'); $CountSQL->FROM('T_skins__skin'); $Results = new Results($SQL->get(), 'skin_', '', NULL, $CountSQL->get()); $Results->Cache =& get_SkinCache(); $Results->title = T_('Installed skins') . get_manual_link('installed_skins'); if ($current_User->check_perm('options', 'edit', false)) { // We have permission to modify: $Results->cols[] = array('th' => T_('Name'), 'order' => 'skin_name', 'td' => '<strong><a href="' . regenerate_url('', 'skin_ID=$skin_ID$&action=edit') . '" title="' . TS_('Edit skin properties...') . '">$skin_name$</a></strong>'); } else { // We have NO permission to modify: $Results->cols[] = array('th' => T_('Name'), 'order' => 'skin_name', 'td' => '<strong>$skin_name$</strong>'); } $Results->cols[] = array('th' => T_('Skin type'), 'order' => 'skin_type', 'td_class' => 'center', 'td' => '$skin_type$'); $Results->cols[] = array('th' => T_('Blogs'), 'order' => 'nb_blogs', 'th_class' => 'shrinkwrap', 'td_class' => 'center', 'td' => '~conditional( (#nb_blogs# > 0), #nb_blogs#, \' \' )~'); $Results->cols[] = array('th' => T_('Skin Folder'), 'order' => 'skin_folder', 'td' => '$skin_folder$'); if ($current_User->check_perm('options', 'edit', false)) { // We have permission to modify: $Results->cols[] = array('th' => T_('Actions'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'td' => action_icon(TS_('Edit skin properties...'), 'properties', '%regenerate_url( \'\', \'skin_ID=$skin_ID$&action=edit\')%') . action_icon(TS_('Reload containers!'), 'reload', '%regenerate_url( \'\', \'skin_ID=$skin_ID$&action=reload&' . url_crumb('skin') . '\')%') . '~conditional( #nb_blogs# < 1, \'' . action_icon(TS_('Uninstall this skin!'), 'delete', '%regenerate_url( \'\', \'skin_ID=$skin_ID$&action=delete&' . url_crumb('skin') . '\')%') . '\', \'' . get_icon('delete', 'noimg') . '\' )~');
public function actionCompetition() { $provinces = CHtml::listData(Region::getRegionsByPid(1), 'id', 'name_zh'); $cities = Yii::app()->db->cache(86400)->createCommand()->select('*')->from('region')->where('pid>1')->order('id')->queryAll(); $allCities = array(); foreach ($cities as $city) { if (!isset($allCities[$city['pid']])) { $allCities[$city['pid']] = array(); } $allCities[$city['pid']][$city['id']] = $city['name_zh']; } $cities = $allCities; $db = Yii::app()->db; $db->createCommand()->truncateTable('old_competition'); $oldEvents = $db->createCommand()->select('*')->from('cubingchina_mf8.比赛项目')->order('项目顺序')->queryAll(); $oldEvents = array_combine(array_map(function ($event) { return $event['项目顺序']; }, $oldEvents), $oldEvents); $oldCompetitions = $db->createCommand()->select('*')->from('cubingchina_mf8.比赛事件')->order('比赛id')->queryAll(); foreach ($oldCompetitions as $oldCompetition) { $competition = new Competition(); //基本信息 $competition->name_zh = str_replace(' ', '', $oldCompetition['比赛名称']); $competition->date = strtotime($oldCompetition['比赛日期']); if ($oldCompetition['天数'] > 1) { $competition->end_date = $competition->date + 86400 * ($oldCompetition['天数'] - 1); } $competition->reg_end = $competition->date - 86400; $competition->old_competition_id = $oldCompetition['比赛id']; //地点 $location = new CompetitionLocation(); $detected = false; $address = $oldCompetition['地址'] . $oldCompetition['比赛名称']; foreach ($provinces as $provinceId => $province) { if (strpos($address, $province) !== false) { $location->province_id = $provinceId; $location->city_id = $this->_cityId; foreach ($cities[$provinceId] as $cityId => $city) { if (mb_strlen($city, 'utf-8') > 2) { $city = mb_substr($city, 0, -1, 'utf-8'); } if (strpos($address, $city) !== false) { $location->city_id = $cityId; break; } } $detected = true; break; } } if (!$detected) { $location->province_id = $this->_provinceId; $location->city_id = $this->_cityId; } $location->venue_zh = $oldCompetition['地址']; $competition->location = array($location); if ($oldCompetition['是否wca']) { $competition->type = Competition::TYPE_WCA; $wcaCompetitions = Competitions::model()->findAllByAttributes(array('countryId' => 'China', 'year' => date('Y', $competition->date), 'month' => date('m', $competition->date), 'day' => date('d', $competition->date))); $wcaCompetition = null; if (count($wcaCompetitions) == 1) { $wcaCompetition = $wcaCompetitions[0]; } else { foreach ($wcaCompetitions as $value) { if (strpos($value->website, '=' . $competition->old_competition_id) !== false) { $wcaCompetition = $value; break; } } } if ($wcaCompetition !== null) { $competition->name = $wcaCompetition->name; $competition->wca_competition_id = $wcaCompetition->id; $location->venue = $wcaCompetition->venueDetails . ', ' . $wcaCompetition->venueAddress; } } else { $competition->type = Competition::TYPE_OTHER; } //代表和主办 $oldComp = new OldCompetition(); $oldComp->id = $oldCompetition['比赛id']; $oldComp->delegate_zh = OldCompetition::generateInfo($this->makeInfo($oldCompetition['监督代表'])); $organizer = $this->makeInfo($oldCompetition['主办方']); if ($oldCompetition['主办电邮']) { $organizer[0]['email'] = $oldCompetition['主办电邮']; } $oldComp->organizer_zh = OldCompetition::generateInfo($organizer); $oldComp->save(false); //项目 $events = array(); $resultEvents = $db->createCommand()->select('*')->from('cubingchina_mf8.比赛成绩')->leftJoin('cubingchina_mf8.比赛项目', '比赛项目.项目id=比赛成绩.项目id')->where('比赛成绩.事件id=' . $oldCompetition['比赛id'])->group('比赛成绩.项目id, 比赛成绩.第N轮')->queryAll(); if ($resultEvents !== array()) { foreach ($resultEvents as $value) { $eventName = $value['项目名']; $event = isset($this->_eventsMap[$eventName]) ? $this->_eventsMap[$eventName] : 'funny'; if (!isset($events[$event])) { $events[$event] = array('round' => 0, 'fee' => 0); } $events[$event]['round']++; } } if ($events === array() && $competition->wca_competition_id !== '') { $resultEvents = Results::model()->findAllByAttributes(array('competitionId' => $competition->wca_competition_id), array('group' => 'eventId,roundId')); if ($resultEvents !== array()) { foreach ($resultEvents as $value) { $event = $value->eventId; if (!isset($events[$event])) { $events[$event] = array('round' => 0, 'fee' => 0); } $events[$event]['round']++; } } } if ($events === array()) { for ($i = 0; $i < strlen($oldCompetition['比赛项目']); $i++) { if ($oldCompetition['比赛项目'][$i]) { $eventName = $oldEvents[$i + 1]['项目名']; $event = isset($this->_eventsMap[$eventName]) ? $this->_eventsMap[$eventName] : 'funny'; $events[$event] = array('round' => 1, 'fee' => 0); } } } $competition->events = $events; $competition->handleEvents(); $ret = $competition->save(false); $location->competition_id = $competition->id; $location->save(false); } }