本文整理汇总了PHP中mysqlquery::getrows方法的典型用法代码示例。如果您正苦于以下问题:PHP mysqlquery::getrows方法的具体用法?PHP mysqlquery::getrows怎么用?PHP mysqlquery::getrows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysqlquery
的用法示例。
在下文中一共展示了mysqlquery::getrows方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ON
function get_success_happy_drop_down($arg_success_item_id, $arg_share_id)
{
if (strlen($arg_success_item_id)) {
// Gimme rafl happy results
$query = "SELECT DISTINCT {$_SESSION['RealS_prefix']}members.mb_firstname, {$_SESSION['RealS_prefix']}members.mb_surmame\r\n\t\t\t\t FROM {$_SESSION['RealS_prefix']}items\r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}webcells ON {$_SESSION['RealS_prefix']}webcells.webcell_id = {$_SESSION['RealS_prefix']}items.item_webcell\r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}rafl_res ON {$_SESSION['RealS_prefix']}items.item_id = {$_SESSION['RealS_prefix']}rafl_res.rafl_res_item \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}items AS successes ON successes.item_id = {$_SESSION['RealS_prefix']}items.item_parent_item \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}items AS tasks ON tasks.item_id = successes.item_parent_item \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}items AS units ON units.item_id = tasks.item_parent_item \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}share ON {$_SESSION['RealS_prefix']}share.share_item = units.item_id \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}share_cohort_members ON ({$_SESSION['RealS_prefix']}share_cohort_members.s_c_m_share = {$_SESSION['RealS_prefix']}share.share_id AND {$_SESSION['RealS_prefix']}webcells.webcell_member = {$_SESSION['RealS_prefix']}share_cohort_members.s_c_m_member)\r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}members ON {$_SESSION['RealS_prefix']}members.mb_id = {$_SESSION['RealS_prefix']}share_cohort_members.s_c_m_member\r\n\t\t\t\t WHERE {$_SESSION['RealS_prefix']}items.item_parent_item = " . GetSQLValueString($arg_success_item_id, "int") . "\r\n\t\t\t\t \tAND {$_SESSION['RealS_prefix']}share.share_id = " . GetSQLValueString($arg_share_id, 'int') . "\r\n\t\t\t\t \tAND {$_SESSION['RealS_prefix']}members.mb_type != 'cohort'\r\n\t\t\t\t \tAND {$_SESSION['RealS_prefix']}items.item_default_type = 6\r\n\t\t\t\t \tAND rafl_res_rate = 2\r\n\t\t\t\t ORDER BY {$_SESSION['RealS_prefix']}members.mb_firstname, {$_SESSION['RealS_prefix']}members.mb_surmame";
// Debugging
//echo $query;
$mysql = new mysqlquery();
$rows = $mysql->getrows($query);
if (count($rows)) {
$drop_down = '<select size="1" class="who_is">';
//$drop_down .= ' <option>who is happy?</option>';
foreach ($rows as $row) {
$drop_down .= ' <option>' . trim($row['mb_firstname'] . ' ' . $row['mb_surmame']) . '</option>';
}
$drop_down .= '</select>';
return $drop_down;
} else {
return ' ';
}
} else {
return ' ';
}
}
示例2: textEditor
/**
* Displays rafl main page, i.e. learner and mentor view with unit and task pies.
* This page contains an AJAX page that is called by the flash to display a task's success criteria.
* @author Daniel Dammann <dan@smartassess.com>
*/
function display_rafl_component($course_id, $country_item_id, $arg_cfg)
{
// Debugging
//error_reporting(E_ALL);
// Set up session variables for the rafl pages
// Only one school, so hard-coded
$_SESSION['RealS_schoolid'] = RAFL_SCHOOL;
// WORKAROUND: have to pass it, cos inside this function we loose scope with the configuration
$CFG = $arg_cfg;
// WORKAROUND: Define moodle module table namespace and web path
$_SESSION['RealS_prefix'] = $CFG->prefix . RAFL_DBASE_PREFIX;
//$_SESSION['RealS_raflroot'] = $CFG->wwwroot . '/mod/rafl/';
print_simple_box_start('center');
// Disable login check for now, cos this share may be public. In checkSharedRights() we will know and do another login check.
$RL_disablelogincheck = 1;
// Gimme libraries
require_once "../config.php";
require_once "includes/rlsmart/header.php";
require_once "includes/rlsmart/general.php";
require_once 'includes/common/KT_common.php';
require_once 'includes/tng/tNG.inc.php';
require_once 'userviews_class.php';
require_once 'classes/class_skin_data.php';
require_once "includes/top_menu/top_menu.php";
require_once "classes/item/Comments.class.php";
require_once 'classes/class_comment_evidence_count.php';
require_once 'classes/class_text_editor.php';
// Gimme the text editor
$editor = new textEditor();
$editor->setFormField('evidence_text');
$editor->setEditorType('full');
$editor->setContent('');
$editor->setWidth('571px');
$editor->setHeight('225px');
$editor->setCssPath($CFG->wwwroot . '/mod/rafl/layouts/rafl_css.php');
$userview = new userviews();
$parent_data = $userview->findParent($country_item_id, "rafl");
//print_r($parent_data);
// Check viewing rights
if (!isset($course_id) || $course_id == "") {
$userview->checkViewRights();
//$userview->viewRight =1;
} else {
$userview->checkSharedRights($course_id);
//$userview->sharedRight=1;
}
$mysql = new mysqlquery();
/*
// Learner or mentor view
//if (strlen($_GET['view'])) {
//$view = $_GET['view'];
//} elseif (strlen($_SESSION['USER']->id)) {
// If this user is the item creator or a share mentor, default to mentor view
if (($_SESSION['USER']->id == $parent_data['webcell_member']) || $userview->shareMentor==1) {
$view = 'mentor';
}
//}
*/
// Learner or mentor view
$view = 'learner';
if ($_SESSION['USER']->id == $parent_data['webcell_member'] || $userview->shareMentor == 1) {
$view = 'mentor';
}
// Gimme user id
$user_id = $_SESSION['USER']->id;
//$user_id = $userview->getMemberId($_SESSION['USER']->id, $_GET['mb_id'], $view);
// Get tasks
// INNER JOIN share ON {$_SESSION['RealS_prefix']}share.share_item = {$_SESSION['RealS_prefix']}items.item_parent_item
// AND {$_SESSION['RealS_prefix']}share.share_id = " . GetSQLValueString($course_id, "int") . "
// CASE share_unread_evidence_count WHEN 0 THEN webcell_title ELSE CONCAT(webcell_title, ' (', share_unread_evidence_count, ')') END AS webcell_title
$query = "SELECT\n \t \t{$_SESSION['RealS_prefix']}webcells.webcell_title,\n \t \t{$_SESSION['RealS_prefix']}webcells.webcell_text,\n \t \t{$_SESSION['RealS_prefix']}items.item_id\n \t FROM {$_SESSION['RealS_prefix']}items\n \t \tINNER JOIN {$_SESSION['RealS_prefix']}webcells ON {$_SESSION['RealS_prefix']}webcells.webcell_id={$_SESSION['RealS_prefix']}items.item_webcell\n \t \tINNER JOIN {$_SESSION['RealS_prefix']}rafl ON {$_SESSION['RealS_prefix']}rafl.rafl_item={$_SESSION['RealS_prefix']}items.item_id\n \t \tINNER JOIN {$_SESSION['RealS_prefix']}members ON {$_SESSION['RealS_prefix']}webcells.webcell_member = {$_SESSION['RealS_prefix']}members.mb_id\n \t WHERE {$_SESSION['RealS_prefix']}items.item_parent_item = " . $parent_data['item_id'] . "\n \t \tAND {$_SESSION['RealS_prefix']}items.item_default_type = 1\n \t ORDER BY {$_SESSION['RealS_prefix']}rafl.rafl_order ASC";
$top_menu = $mysql->getrows($query);
if (count($top_menu) == 0) {
echo '<script type="text/javascript">alert(\'This page does not exist.\')</script>';
exit;
}
//$query = "SELECT tags.*, item_2_tag.item_tag_item FROM (item_2_tag LEFT JOIN tags ON tags.tag_id=item_2_tag.item_tag_tag) WHERE item_2_tag.item_tag_item=" . $parent_data [ 'item_id' ] ;
//$tags = $mysql->getrows ( $query ) ;
// User's skin
require_once "classes/class_skin_data.php";
$member_logged_in = $userview->getMemberData($_SESSION['USER']->id);
$skin_data = new SkinData("main/xml/skins/", $member_logged_in["mb_school"], $member_logged_in["mb_theme"]);
//$skin_path = $skin_data->getSkinPath();
// TAOC: Configure this when used in a location outside of the rafl mod directory
$skin_path = $CFG->wwwroot . '/mod/rafl/main/skins/AfL%20Default/';
//echo "<pre>";
//echo 'Background colour: ' . $skin_data->getSkinColour("pieChartBackgroundColour") ."\n";
//echo 'Complete colour: ' . $skin_data->getSkinColour("pieChartCompleteColour") ."\n";
//echo "skin path is '$skin_path'\n";
//echo "</pre>";
function strip_bad_tags($html)
{
$s = preg_replace("@</?[^>]*>*@", "", $html);
return $s;
}
//.........这里部分代码省略.........
示例3: increaseEvidenceCounter
public function increaseEvidenceCounter($argUnitItemId, $argEvidenceItemId, $argShareId)
{
// Notify request mentors UNION with share mentors (but not other share members)
// Don't set a status for the current user, cos that's not very informative
$sql = "SELECT DISTINCT {$_SESSION['RealS_prefix']}members.mb_id\r\n\t\t\t FROM {$_SESSION['RealS_prefix']}share\r\n\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}members ON ({$_SESSION['RealS_prefix']}members.mb_id = {$_SESSION['RealS_prefix']}share.share_member OR {$_SESSION['RealS_prefix']}members.mb_id = {$_SESSION['RealS_prefix']}share.share_permission)\r\n\t\t\t WHERE {$_SESSION['RealS_prefix']}members.mb_type = 'mentor'\r\n\t\t\t \tAND {$_SESSION['RealS_prefix']}share.share_id = " . GetSQLValueString($argShareId, "int") . "\r\n\t\t\t \tAND {$_SESSION['RealS_prefix']}members.mb_id != " . $_SESSION['USER']->id . "\r\n\t\t\t UNION\r\n\t\t\t\tSELECT DISTINCT {$_SESSION['RealS_prefix']}members.mb_id\r\n\t\t\t FROM {$_SESSION['RealS_prefix']}share\r\n\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}share_mentor ON share_mentor_share = share_id\r\n\t\t\t\t\tINNER JOIN {$_SESSION['RealS_prefix']}members ON {$_SESSION['RealS_prefix']}members.mb_id = share_mentor_mentor\r\n\t\t\t WHERE {$_SESSION['RealS_prefix']}members.mb_type = 'mentor'\r\n\t\t\t \tAND {$_SESSION['RealS_prefix']}share.share_id = " . GetSQLValueString($argShareId, "int") . "\r\n\t\t\t \tAND {$_SESSION['RealS_prefix']}members.mb_id != " . $_SESSION['USER']->id;
$mysql = new mysqlquery();
$members = $mysql->getrows($sql);
// Debugging
//echo($sql);
foreach ($members as $member) {
// Avoid duplicates, cos evidences can get updated
$sql = "SELECT NULL\r\n\t\t\t\t FROM {$_SESSION['RealS_prefix']}item_view_status\r\n\t\t\t\t WHERE mb_id_writer = " . $_SESSION['USER']->id . "\r\n\t\t\t\t \tAND mb_id_viewer = " . $member['mb_id'] . "\r\n\t\t\t\t \tAND item_id_comment_evidence = " . GetSQLValueString($argEvidenceItemId, "int");
$mysql = new mysqlquery();
$duplicates = $mysql->getrows($sql);
if (!$duplicates) {
// Insert mentor status
$sql = "INSERT INTO {$_SESSION['RealS_prefix']}item_view_status (\r\n\t\t\t\t\t \titem_view_status_id,\r\n\t\t\t\t\t \titem_type_id,\r\n\t\t\t\t\t \tmb_id_writer,\r\n\t\t\t\t\t \tmb_id_viewer,\r\n\t\t\t\t\t \titem_id_comment_evidence,\r\n\t\t\t\t\t \titem_id,\r\n\t\t\t\t\t \tshare_id,\r\n\t\t\t\t\t \tdate_created\r\n\t\t\t\t\t ) VALUES (\r\n\t\t\t\t\t \tNULL,\r\n\t\t\t\t\t \t'6',\r\n\t\t\t\t\t \t'" . $_SESSION['USER']->id . "',\r\n\t\t\t\t\t \t'" . $member['mb_id'] . "',\r\n\t\t\t\t\t \t'" . $argEvidenceItemId . "',\r\n\t\t\t\t\t \t'" . $argUnitItemId . "',\r\n\t\t\t\t\t \t" . $argShareId . ",\r\n\t\t\t\t\t \tNOW()\r\n\t\t\t\t\t )";
$mysql->query($sql);
}
}
}