コード例 #1
0
ファイル: lib.php プロジェクト: kai707/ITSA-backup
 function get_studentnameshtml()
 {
     global $CFG, $USER;
     $studentshtml = '';
     $showuserimage = $this->get_pref('showuserimage');
     $showuseridnumber = $this->get_pref('showuseridnumber');
     $fixedstudents = $this->is_fixed_students();
     $strsortasc = $this->get_lang_string('sortasc', 'grades');
     $strsortdesc = $this->get_lang_string('sortdesc', 'grades');
     $strfirstname = $this->get_lang_string('firstname');
     $strlastname = $this->get_lang_string('lastname');
     if ($this->sortitemid === 'lastname') {
         if ($this->sortorder == 'ASC') {
             $lastarrow = print_arrow('up', $strsortasc, true);
         } else {
             $lastarrow = print_arrow('down', $strsortdesc, true);
         }
     } else {
         $lastarrow = '';
     }
     if ($this->sortitemid === 'firstname') {
         if ($this->sortorder == 'ASC') {
             $firstarrow = print_arrow('up', $strsortasc, true);
         } else {
             $firstarrow = print_arrow('down', $strsortdesc, true);
         }
     } else {
         $firstarrow = '';
     }
     if ($fixedstudents) {
         $studentshtml .= '<div class="left_scroller">
             <table id="fixed_column" class="fixed_grades_column">
                 <tbody class="leftbody">';
         $colspan = '';
         if ($showuseridnumber) {
             $colspan = 'colspan="2"';
         }
         $levels = count($this->gtree->levels) - 1;
         for ($i = 0; $i < $levels; $i++) {
             $studentshtml .= '
                     <tr class="heading name_row">
                         <td ' . $colspan . ' class="fixedcolumn cell c0 topleft">&nbsp;</td>
                     </tr>
                     ';
         }
         $studentshtml .= '<tr class="heading"><th id="studentheader" class="header c0" scope="col"><a href="' . $this->baseurl . '&amp;sortitemid=firstname">' . $strfirstname . '</a> ' . $firstarrow . '/ <a href="' . $this->baseurl . '&amp;sortitemid=lastname">' . $strlastname . '</a>' . $lastarrow . '</th>';
         if ($showuseridnumber) {
             if ('idnumber' == $this->sortitemid) {
                 if ($this->sortorder == 'ASC') {
                     $idnumberarrow = print_arrow('up', $strsortasc, true);
                 } else {
                     $idnumberarrow = print_arrow('down', $strsortdesc, true);
                 }
             } else {
                 $idnumberarrow = '';
             }
             $studentshtml .= '<th class="header c0 useridnumber" scope="col"><a href="' . $this->baseurl . '&amp;sortitemid=idnumber">' . get_string('idnumber') . '</a> ' . $idnumberarrow . '</th>';
         }
         $studentshtml .= '</tr>';
         if ($USER->gradeediting[$this->courseid]) {
             $studentshtml .= '<tr class="controls"><th class="header c0 controls" scope="row" ' . $colspan . '>' . $this->get_lang_string('controls', 'grades') . '</th></tr>';
         }
         $row_classes = array(' even ', ' odd ');
         foreach ($this->users as $userid => $user) {
             $user_pic = null;
             if ($showuserimage) {
                 $user_pic = '<div class="userpic">' . print_user_picture($user, $this->courseid, NULL, 0, true) . "</div>\n";
             }
             $studentshtml .= '<tr class="r' . $this->rowcount++ . $row_classes[$this->rowcount % 2] . '">' . '<th class="c0 user" scope="row" onclick="set_row(this.parentNode.rowIndex);">' . $user_pic . '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $this->course->id . '">' . fullname($user) . "</a></th>\n";
             if ($showuseridnumber) {
                 $studentshtml .= '<th class="header c0 useridnumber" onclick="set_row(this.parentNode.rowIndex);">' . $user->idnumber . "</th>\n";
             }
             $studentshtml .= "</tr>\n";
         }
         if ($this->get_pref('showranges')) {
             $studentshtml .= '<tr class="range r' . $this->rowcount++ . '">' . '<th class="header c0 range " ' . $colspan . ' scope="row">' . $this->get_lang_string('range', 'grades') . '</th></tr>';
         }
         // Averages heading
         $straverage_group = get_string('groupavg', 'grades');
         $straverage = get_string('overallaverage', 'grades');
         $showaverages = $this->get_pref('showaverages');
         $showaverages_group = $this->currentgroup && $showaverages;
         if ($showaverages_group) {
             $studentshtml .= '<tr class="groupavg r' . $this->rowcount++ . '"><th class="header c0" ' . $colspan . 'scope="row">' . $straverage_group . '</th></tr>';
         }
         if ($showaverages) {
             $studentshtml .= '<tr class="avg r' . $this->rowcount++ . '"><th class="header c0" ' . $colspan . 'scope="row">' . $straverage . '</th></tr>';
         }
         $studentshtml .= '</tbody>
             </table>
         </div>
         <div class="right_scroller">
             <table id="user-grades" class="">
                 <tbody class="righttest">';
     } else {
         $studentshtml .= '<table id="user-grades" class="gradestable flexible boxaligncenter generaltable">
                             <tbody>';
     }
     return $studentshtml;
 }
コード例 #2
0
ファイル: lib.php プロジェクト: nuckey/moodle
    /**
     * Refactored function for generating HTML of sorting links with matching arrows.
     * Returns an array with 'studentname' and 'idnumber' as keys, with HTML ready
     * to inject into a table header cell.
     * @return array An associative array of HTML sorting links+arrows
     */
    public function get_sort_arrows() {
        global $OUTPUT;
        $arrows = array();

        $strsortasc   = $this->get_lang_string('sortasc', 'grades');
        $strsortdesc  = $this->get_lang_string('sortdesc', 'grades');
        $strfirstname = $this->get_lang_string('firstname');
        $strlastname  = $this->get_lang_string('lastname');

        $firstlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'firstname')), $strfirstname);
        $lastlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'lastname')), $strlastname);
        $idnumberlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'idnumber')), get_string('idnumber'));

        $arrows['studentname'] = $lastlink;

        if ($this->sortitemid === 'lastname') {
            if ($this->sortorder == 'ASC') {
                $arrows['studentname'] .= print_arrow('up', $strsortasc, true);
            } else {
                $arrows['studentname'] .= print_arrow('down', $strsortdesc, true);
            }
        }

        $arrows['studentname'] .= ' ' . $firstlink;

        if ($this->sortitemid === 'firstname') {
            if ($this->sortorder == 'ASC') {
                $arrows['studentname'] .= print_arrow('up', $strsortasc, true);
            } else {
                $arrows['studentname'] .= print_arrow('down', $strsortdesc, true);
            }
        }

        $arrows['idnumber'] = $idnumberlink;

        if ('idnumber' == $this->sortitemid) {
            if ($this->sortorder == 'ASC') {
                $arrows['idnumber'] .= print_arrow('up', $strsortasc, true);
            } else {
                $arrows['idnumber'] .= print_arrow('down', $strsortdesc, true);
            }
        }

        return $arrows;
    }
コード例 #3
0
ファイル: lib.php プロジェクト: saurabh947/MoodleLearning
 /**
  * Returns an arrow icon inside an <a> tag, for the purpose of sorting a column.
  * @param string $direction
  * @param moodle_url $sort_link
  * @param string HTML
  */
 protected function get_sort_arrow($direction = 'move', $sortlink = null)
 {
     global $OUTPUT;
     $matrix = array('up' => 'desc', 'down' => 'asc', 'move' => 'desc');
     $strsort = $this->get_lang_string('sort' . $matrix[$direction]);
     $arrow = print_arrow($direction, $strsort, true);
     return html_writer::link($sortlink, $arrow, array('title' => $strsort));
 }
コード例 #4
0
ファイル: lib.php プロジェクト: ajv/Offline-Caching
 /**
  * Returns an arrow icon inside an <a> tag, for the purpose of sorting a column.
  * @param string $direction
  * @param string $sort_link
  * @param string HTML
  */
 protected function get_sort_arrow($direction = 'move', $sort_link = null)
 {
     $matrix = array('up' => 'desc', 'down' => 'asc', 'move' => 'desc');
     $strsort = $this->get_lang_string('sort' . $matrix[$direction]);
     $arrow = print_arrow($direction, $strsort, true);
     $html = '<a href="' . $sort_link . '" title="' . $strsort . '">' . $arrow . '</a>';
     return $html;
 }
コード例 #5
0
ファイル: lib.php プロジェクト: ncsu-delta/moodle
    /**
     * Refactored function for generating HTML of sorting links with matching arrows.
     * Returns an array with 'studentname' and 'idnumber' as keys, with HTML ready
     * to inject into a table header cell.
     * @param array $extrafields Array of extra fields being displayed, such as
     *   user idnumber
     * @return array An associative array of HTML sorting links+arrows
     */
    public function get_sort_arrows(array $extrafields = array()) {
        global $OUTPUT;
        $arrows = array();

        $strsortasc   = $this->get_lang_string('sortasc', 'grades');
        $strsortdesc  = $this->get_lang_string('sortdesc', 'grades');
        $strfirstname = $this->get_lang_string('firstname');
        $strlastname  = $this->get_lang_string('lastname');

        $firstlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'firstname')), $strfirstname);
        $lastlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'lastname')), $strlastname);

        $arrows['studentname'] = $lastlink;

        if ($this->sortitemid === 'lastname') {
            if ($this->sortorder == 'ASC') {
                $arrows['studentname'] .= print_arrow('up', $strsortasc, true);
            } else {
                $arrows['studentname'] .= print_arrow('down', $strsortdesc, true);
            }
        }

        $arrows['studentname'] .= ' ' . $firstlink;

        if ($this->sortitemid === 'firstname') {
            if ($this->sortorder == 'ASC') {
                $arrows['studentname'] .= print_arrow('up', $strsortasc, true);
            } else {
                $arrows['studentname'] .= print_arrow('down', $strsortdesc, true);
            }
        }

        foreach ($extrafields as $field) {
            $fieldlink = html_writer::link(new moodle_url($this->baseurl,
                    array('sortitemid'=>$field)), get_user_field_name($field));
            $arrows[$field] = $fieldlink;

            if ($field == $this->sortitemid) {
                if ($this->sortorder == 'ASC') {
                    $arrows[$field] .= print_arrow('up', $strsortasc, true);
                } else {
                    $arrows[$field] .= print_arrow('down', $strsortdesc, true);
                }
            }
        }

        return $arrows;
    }
コード例 #6
0
ファイル: index.php プロジェクト: shourya07/zperfmon
function print_gauges()
{
    global $overviewData;
    $web_eu = $overviewData['web_eu'];
    $dataArr = array("web_mem" => $web_eu['memory'], "web_cpu" => $web_eu['cpu'], "web_rps" => $overviewData['web_rps']);
    $threshold = array("web_mem" => 80, "web_cpu" => 90);
    foreach ($dataArr as $key => $data) {
        $curr = $data['current'];
        $prev = $data['previous'];
        $diff = $curr - $prev;
        $label = $data['label'];
        $highest = $data['max'];
        echo '<div class="gauge-wrapper left">';
        if ($key == "web_rps") {
            //no percentage, no color coding
            print_gauge2($key, $label, $curr, 0, 500, $highest);
        } else {
            print_gauge($key, $label, $curr, 0, 100, 40, $threshold[$key], $highest);
            print_arrow($curr - $prev);
        }
        echo '</div>';
        if ($key != "web_rps" && $curr > $threshold[$key]) {
            global $warnMsgArr;
            $warnMsgArr[] = "Web " . $label . " has exceeded its warning threshold of " . $threshold[$key] . "%.";
        }
    }
}
コード例 #7
0
 /**
  * Builds and returns the HTML code for the headers.
  * @return string $headerhtml
  */
 function get_headerhtml()
 {
     global $CFG, $USER;
     //        $this->rowcount = 0;
     $fixedstudents = $this->is_fixed_students();
     $strsortasc = $this->get_lang_string('sortasc', 'grades');
     $strsortdesc = $this->get_lang_string('sortdesc', 'grades');
     $strfirstname = $this->get_lang_string('firstname');
     $strlastname = $this->get_lang_string('lastname');
     $showuseridnumber = $this->get_pref('showuseridnumber');
     $showuserimage = $this->get_pref('showuserimage');
     $showquickfeedback = $this->get_pref('showquickfeedback');
     if ($showquickfeedback && $USER->gradeediting[$this->courseid]) {
         $minwidth = '; min-width: 180px';
     } else {
         $minwidth = '';
     }
     // figure out how wide we should make the names column
     $namewidth = 1;
     foreach ($this->users as $user) {
         $namewidth = max($namewidth, strlen($user->firstname), strlen($user->lastname) * 1.4);
     }
     $namewidth = 'style="min-width:' . s(round($namewidth) * 7) . 'px"';
     if ($this->sortitemid === 'lastname') {
         if ($this->sortorder == 'ASC') {
             $lastarrow = print_arrow('up', $strsortasc, true);
         } else {
             $lastarrow = print_arrow('down', $strsortdesc, true);
         }
     } else {
         $lastarrow = '';
     }
     if ($this->sortitemid === 'firstname') {
         if ($this->sortorder == 'ASC') {
             $firstarrow = print_arrow('up', $strsortasc, true);
         } else {
             $firstarrow = print_arrow('down', $strsortdesc, true);
         }
     } else {
         $firstarrow = '';
     }
     // Prepare Table Headers
     $headerhtml = '';
     //        $numrows = count($this->gtree->levels);
     //        $columns_to_unset = array();
     $columncount = 0;
     $headerhtml .= '<tr class="heading r' . $this->rowcount++ . '">';
     //        $colspan = 'colspan="2" ';
     $colspan = '';
     $user_pic = '';
     $name_header = $columncount == 0 ? ' class="name-header"' : '';
     $output = '<div class="inlinebutton" title="Download contents of gradebook as-is to Excel. SAVE CHANGES FIRST!">';
     $output .= '<a href="' . $CFG->wwwroot . '/grade/report/laegrader/index.php?id=' . $this->courseid . '&action=quick-dump" class="inlinebutton"><img src="' . $CFG->wwwroot . '/grade/report/laegrader/copytoexcel.png" /></a></div>';
     $options = array('id' => $this->courseid, 'action' => 'quick-dump');
     $headerhtml .= '<th class=" header c' . $columncount++ . '  nameheader" scope="col" ' . $colspan . $namewidth . '>' . $user_pic . $output . '<a href="' . $this->baseurl . '&amp;sortitemid=firstname">' . $strfirstname . '</a> ' . $firstarrow . '/ <a href="' . $this->baseurl . '&amp;sortitemid=lastname" width="100px"' . $name_header . '>' . $strlastname . '</a>' . $lastarrow . '</th><th class="header gradeheader"></th>';
     //                . '</th><th style="background-color:#ffffff"></th>'; // '#F3DFD0' : '#D0DBF3'
     if ($showuseridnumber) {
         if ('idnumber' == $this->sortitemid) {
             if ($this->sortorder == 'ASC') {
                 $idnumberarrow = print_arrow('up', $strsortasc, true);
             } else {
                 $idnumberarrow = print_arrow('down', $strsortdesc, true);
             }
         } else {
             $idnumberarrow = '';
         }
         $headerhtml .= '<th class="header  c' . $columncount++ . ' useridnumber" scope="col"><a href="' . $this->baseurl . '&amp;sortitemid=idnumber">' . get_string('idnumber') . '</a> ' . $idnumberarrow . '</th>';
     }
     $catcount = 0;
     $catparent = 0;
     foreach ($this->gtree->items as $columnkey => $element) {
         $sort_link = '';
         if (isset($element->id)) {
             $sort_link = $this->baseurl . '&amp;sortitemid=' . $element->id;
         }
         $eid = 'i' . $element->id;
         $object = $element;
         $type = stristr('courseitem,categoryitem', $element->itemtype) ? $element->itemtype . 'item' : 'item';
         $element->type = $type;
         $itemmodule = null;
         $iteminstance = null;
         $columnclass = 'c' . $columncount++;
         $colspan = '';
         $catlevel = '';
         $itemmodule = $object->itemmodule;
         $iteminstance = $object->iteminstance;
         if ($element->id == $this->sortitemid) {
             if ($this->sortorder == 'ASC') {
                 $arrow = $this->get_sort_arrow('up', $sort_link);
             } else {
                 $arrow = $this->get_sort_arrow('down', $sort_link);
             }
         } else {
             $arrow = $this->get_sort_arrow('move', $sort_link);
         }
         $url = $this->baseurl . '&amp;action=display&target=' . $element->id . '&sesskey=' . sesskey();
         $hidden = '';
         if ($element->is_hidden()) {
             $hidden = ' hidden ';
             $catcolor = '#dfdfdf';
         } else {
             if (isset($element->categoryid)) {
                 //            } else if (isset($element->categoryid) AND $this->gtree->items[$element->parent]->itemtype <> 'course') {
                 // same category as last
                 if ($element->categoryid != $catparent) {
                     $catparent = $element->categoryid;
                     $catcount++;
                     $catcolor = $catcount % 2 ? '#F3DFD0' : '#D0DBF3';
                 }
                 // category header for last category
             } else {
                 if ($element->itemtype == 'category') {
                     // course item
                 } else {
                     $catcolor = '#ffffff';
                 }
             }
         }
         $headerlink = get_element_headerlaegrader($element, true, $this->get_pref('showactivityicons'), false);
         $headerhtml .= '<th class=" ' . $columnclass . ' ' . $type . $catlevel . $hidden . '" style="background-color:' . $catcolor . $minwidth . '" scope="col" onclick="set_col(this.cellIndex)">' . $headerlink;
         if (isset($this->gtree->parents[$element->id]->agg) and $this->gtree->parents[$element->id]->agg == GRADE_AGGREGATE_WEIGHTED_MEAN) {
             $headerhtml .= '<br /><div class="gradeweight">W=' . number_format($element->aggregationcoef, 2) . '	</div>' . $arrow;
         } else {
             $headerhtml .= '<br />' . $arrow;
         }
         /*
                     $new_parent = $this->gtree->items[substr($eid,1,5)]->parent;
                     if (isset($this->gtree->items[$new_parent]) AND $this->gtree->items[$new_parent]->agg_method == GRADE_AGGREGATE_WEIGHTED_MEAN) {
                             $headerhtml .= '<br /><div class="gradeweight">W=' . number_format($element->aggregationcoef,2) . '	</div>';
                     }
         */
         $headerhtml .= '</th>';
     }
     $headerhtml .= '</tr>';
     return $headerhtml;
 }
コード例 #8
0
ファイル: lib.php プロジェクト: r007/PMoodle
 /**
  * Builds and returns the HTML code for the headers.
  * @return string $headerhtml
  */
 function get_headerhtml()
 {
     global $CFG, $USER;
     $strsortasc = $this->get_lang_string('sortasc', 'grades');
     $strsortdesc = $this->get_lang_string('sortdesc', 'grades');
     $strfirstname = $this->get_lang_string('firstname');
     $strlastname = $this->get_lang_string('lastname');
     $showuseridnumber = $this->get_pref('showuseridnumber');
     if ($this->sortitemid === 'lastname') {
         if ($this->sortorder == 'ASC') {
             $lastarrow = print_arrow('up', $strsortasc, true);
         } else {
             $lastarrow = print_arrow('down', $strsortdesc, true);
         }
     } else {
         $lastarrow = '';
     }
     if ($this->sortitemid === 'firstname') {
         if ($this->sortorder == 'ASC') {
             $firstarrow = print_arrow('up', $strsortasc, true);
         } else {
             $firstarrow = print_arrow('down', $strsortdesc, true);
         }
     } else {
         $firstarrow = '';
     }
     // Prepare Table Headers
     $headerhtml = '';
     $numrows = count($this->gtree->levels);
     $columns_to_unset = array();
     foreach ($this->gtree->levels as $key => $row) {
         $columncount = 0;
         if ($key == 0) {
             // do not display course grade category
             // continue;
         }
         $headerhtml .= '<tr class="heading r' . $this->rowcount++ . '">';
         if ($key == $numrows - 1) {
             $headerhtml .= '<th class="header c' . $columncount++ . '" scope="col"><a href="' . $this->baseurl . '&amp;sortitemid=firstname">' . $strfirstname . '</a> ' . $firstarrow . '/ <a href="' . $this->baseurl . '&amp;sortitemid=lastname">' . $strlastname . '</a>' . $lastarrow . '</th>';
             if ($showuseridnumber) {
                 if ('idnumber' == $this->sortitemid) {
                     if ($this->sortorder == 'ASC') {
                         $idnumberarrow = print_arrow('up', $strsortasc, true);
                     } else {
                         $idnumberarrow = print_arrow('down', $strsortdesc, true);
                     }
                 } else {
                     $idnumberarrow = '';
                 }
                 $headerhtml .= '<th class="header c' . $columncount++ . ' useridnumber" scope="col"><a href="' . $this->baseurl . '&amp;sortitemid=idnumber">' . get_string('idnumber') . '</a> ' . $idnumberarrow . '</th>';
             }
         } else {
             $colspan = '';
             if ($showuseridnumber) {
                 $colspan = 'colspan="2" ';
             }
             $headerhtml .= '<td ' . $colspan . 'class="cell c' . $columncount++ . ' topleft">&nbsp;</td>';
             if ($showuseridnumber) {
                 $columncount++;
             }
         }
         foreach ($row as $columnkey => $element) {
             $sort_link = '';
             if (isset($element['object']->id)) {
                 $sort_link = $this->baseurl . '&amp;sortitemid=' . $element['object']->id;
             }
             $eid = $element['eid'];
             $object = $element['object'];
             $type = $element['type'];
             $categorystate = @$element['categorystate'];
             $itemmodule = null;
             $iteminstance = null;
             $columnclass = 'c' . $columncount++;
             if (!empty($element['colspan'])) {
                 $colspan = 'colspan="' . $element['colspan'] . '"';
                 $columnclass = '';
             } else {
                 $colspan = '';
             }
             if (!empty($element['depth'])) {
                 $catlevel = ' catlevel' . $element['depth'];
             } else {
                 $catlevel = '';
             }
             // Element is a filler
             if ($type == 'filler' or $type == 'fillerfirst' or $type == 'fillerlast') {
                 $headerhtml .= '<th class="' . $columnclass . ' ' . $type . $catlevel . '" ' . $colspan . ' scope="col">&nbsp;</th>';
             } else {
                 if ($type == 'category') {
                     $headerhtml .= '<th class="header ' . $columnclass . ' category' . $catlevel . '" ' . $colspan . ' scope="col">' . shorten_text($element['object']->get_name());
                     $headerhtml .= $this->get_collapsing_icon($element);
                     // Print icons
                     if ($USER->gradeediting[$this->courseid]) {
                         $headerhtml .= $this->get_icons($element);
                     }
                     $headerhtml .= '</th>';
                 } else {
                     $itemmodule = $element['object']->itemmodule;
                     $iteminstance = $element['object']->iteminstance;
                     if ($element['object']->id == $this->sortitemid) {
                         if ($this->sortorder == 'ASC') {
                             $arrow = $this->get_sort_arrow('up', $sort_link);
                         } else {
                             $arrow = $this->get_sort_arrow('down', $sort_link);
                         }
                     } else {
                         $arrow = $this->get_sort_arrow('move', $sort_link);
                     }
                     $hidden = '';
                     if ($element['object']->is_hidden()) {
                         $hidden = ' hidden ';
                     }
                     $headerlink = $this->gtree->get_element_header($element, true, $this->get_pref('showactivityicons'), false);
                     $headerhtml .= '<th class="header ' . $columnclass . ' ' . $type . $catlevel . $hidden . '" scope="col" onclick="set_col(this.cellIndex)">' . shorten_text($headerlink) . $arrow;
                     $headerhtml .= '</th>';
                 }
             }
         }
         $headerhtml .= '</tr>';
     }
     return $headerhtml;
 }
コード例 #9
0
ファイル: link.php プロジェクト: hrs113355/OfSmall
<body onload="refresh_list()">
<div id="main">
<?php 
$page_name = ' - 關鍵字/回應對應表';
include 'header.php';
?>
<script type="text/javascript" src="js/jquery-autocomplete/jquery.autocomplete.js"></script>
<p>請建立<b>『小的機器人』</b>對於『關鍵字』和『回應』的連結 (分別輸入『關鍵字』和相對應的『回應』,會自動帶出系統現有的辭彙,輸入完畢按 Enter): <br>
<span style="font-weight: bold; color: red">注意: 請不要加入具有針對性的關鍵字,否則會考慮封 IP 或直接永久關閉編輯功能</span><br>
關鍵字:<input type="text" size="120" id="origin_input-box" maxlength="140"><span id="origin_rest_length"></span><br />
回應:<input type="text" size="120" id="reply_input-box" maxlength="140"><span id="reply_rest_length"></span>

<hr>
目前資料庫中的關鍵字<?php 
print_arrow();
?>
回應:
<div id="list"></div>
</p>
</div>

<script type="text/javascript">
setTimeout("refresh_list();", 15000);
reply_update_limit();
origin_update_limit();
function origin_update_limit()
{
    $("#origin_rest_length").html((140 - $("#origin_input-box").val().length));
}
function reply_update_limit()
コード例 #10
0
ファイル: lib.php プロジェクト: BackupTheBerlios/samouk-svn
 /**
  * Builds and returns the HTML code for the headers.
  * @return string $headerhtml
  */
 function get_headerhtml()
 {
     global $CFG, $USER;
     $strsortasc = $this->get_lang_string('sortasc', 'grades');
     $strsortdesc = $this->get_lang_string('sortdesc', 'grades');
     $strfirstname = $this->get_lang_string('firstname');
     $strlastname = $this->get_lang_string('lastname');
     if ($this->sortitemid === 'lastname') {
         if ($this->sortorder == 'ASC') {
             $lastarrow = print_arrow('up', $strsortasc, true);
         } else {
             $lastarrow = print_arrow('down', $strsortdesc, true);
         }
     } else {
         $lastarrow = '';
     }
     if ($this->sortitemid === 'firstname') {
         if ($this->sortorder == 'ASC') {
             $firstarrow = print_arrow('up', $strsortasc, true);
         } else {
             $firstarrow = print_arrow('down', $strsortdesc, true);
         }
     } else {
         $firstarrow = '';
     }
     // Prepare Table Headers
     $headerhtml = '';
     $numrows = count($this->gtree->levels);
     $columns_to_unset = array();
     foreach ($this->gtree->levels as $key => $row) {
         $columncount = 0;
         if ($key == 0) {
             // do not display course grade category
             // continue;
         }
         $headerhtml .= '<tr class="heading r' . $this->rowcount++ . '">';
         if ($key == $numrows - 1) {
             $headerhtml .= '<th class="header c' . $columncount++ . ' user" scope="col"><a href="' . $this->baseurl . '&amp;sortitemid=firstname">' . $strfirstname . '</a> ' . $firstarrow . '/ <a href="' . $this->baseurl . '&amp;sortitemid=lastname">' . $strlastname . '</a>' . $lastarrow . '</th>';
         } else {
             $headerhtml .= '<td class="cell c' . $columncount++ . ' topleft">&nbsp;</td>';
         }
         foreach ($row as $columnkey => $element) {
             $sort_link = '';
             if (isset($element['object']->id)) {
                 $sort_link = $this->baseurl . '&amp;sortitemid=' . $element['object']->id;
             }
             $eid = $element['eid'];
             $object = $element['object'];
             $type = $element['type'];
             $categorystate = @$element['categorystate'];
             $itemmodule = null;
             $iteminstance = null;
             $columnclass = 'c' . $columncount++;
             if (!empty($element['colspan'])) {
                 $colspan = 'colspan="' . $element['colspan'] . '"';
                 $columnclass = '';
             } else {
                 $colspan = '';
             }
             if (!empty($element['depth'])) {
                 $catlevel = ' catlevel' . $element['depth'];
             } else {
                 $catlevel = '';
             }
             // Element is a filler
             if ($type == 'filler' or $type == 'fillerfirst' or $type == 'fillerlast') {
                 $headerhtml .= '<th class="' . $columnclass . ' ' . $type . $catlevel . '" ' . $colspan . ' scope="col">&nbsp;</th>';
             } else {
                 if ($type == 'category') {
                     $headerhtml .= '<th class="header ' . $columnclass . ' category' . $catlevel . '" ' . $colspan . ' scope="col">' . $element['object']->get_name();
                     $headerhtml .= $this->get_collapsing_icon($element);
                     // Print icons
                     if ($USER->gradeediting[$this->courseid]) {
                         $headerhtml .= $this->get_icons($element);
                     }
                     $headerhtml .= '</th>';
                 } else {
                     $itemmodule = $element['object']->itemmodule;
                     $iteminstance = $element['object']->iteminstance;
                     if ($element['object']->id == $this->sortitemid) {
                         if ($this->sortorder == 'ASC') {
                             $arrow = $this->get_sort_arrow('up', $sort_link);
                         } else {
                             $arrow = $this->get_sort_arrow('down', $sort_link);
                         }
                     } else {
                         $arrow = $this->get_sort_arrow('move', $sort_link);
                     }
                     $dimmed = '';
                     if ($element['object']->is_hidden()) {
                         $dimmed = ' dimmed_text ';
                     }
                     if ($object->itemtype == 'mod') {
                         $icon = '<img src="' . $CFG->modpixpath . '/' . $object->itemmodule . '/icon.gif" class="icon" alt="' . $this->get_lang_string('modulename', $object->itemmodule) . '"/>';
                     } else {
                         if ($object->itemtype == 'manual') {
                             //TODO: add manual grading icon
                             $icon = '<img src="' . $CFG->pixpath . '/t/edit.gif" class="icon" alt="' . $this->get_lang_string('manualgrade', 'grades') . '"/>';
                         }
                     }
                     $headerlink = $this->get_module_link($element['object']->get_name(), $itemmodule, $iteminstance);
                     $headerhtml .= '<th class="header ' . $columnclass . ' ' . $type . $catlevel . $dimmed . '" scope="col">' . $headerlink . $arrow;
                     $headerhtml .= $this->get_icons($element) . '</th>';
                     $this->items[$element['object']->sortorder] =& $element['object'];
                 }
             }
         }
         $headerhtml .= '</tr>';
     }
     return $headerhtml;
 }