当前位置: 首页>>代码示例>>PHP>>正文


PHP standard_text_escape函数代码示例

本文整理汇总了PHP中standard_text_escape函数的典型用法代码示例。如果您正苦于以下问题:PHP standard_text_escape函数的具体用法?PHP standard_text_escape怎么用?PHP standard_text_escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了standard_text_escape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showlinksofcategory

/**
 * @brief display links of category
 * @global type $is_editor
 * @global type $course_id
 * @global type $urlview
 * @global type $tool_content
 * @global type $urlServer
 * @global type $course_code
 * @global type $langLinkDelconfirm
 * @global type $langDelete
 * @global type $langUp
 * @global type $langDown
 * @global type $langModify
 * @global type $is_in_tinymce
 * @param type $catid
 */
function showlinksofcategory($catid)
{
    global $is_editor, $course_id, $urlview, $tool_content, $urlServer, $course_code, $langLinkDelconfirm, $langDelete, $langUp, $langDown, $langModify, $is_in_tinymce;
    $tool_content .= "<tr>";
    $result = Database::get()->queryArray("SELECT * FROM `link`\n                                   WHERE course_id = ?d AND category = ?d\n                                   ORDER BY `order`", $course_id, $catid);
    $numberoflinks = count($result);
    $i = 1;
    foreach ($result as $myrow) {
        $title = empty($myrow->title) ? $myrow->url : $myrow->title;
        $num_merge_cols = 1;
        $aclass = $is_in_tinymce ? " class='fileURL' " : '';
        $tool_content .= "<td colspan='{$num_merge_cols}'><a href='" . $urlServer . "modules/link/go.php?course={$course_code}&amp;id={$myrow->id}&amp;url=" . urlencode($myrow->url) . "' {$aclass} target='_blank'>" . q($title) . "</a>";
        if (!empty($myrow->description)) {
            $tool_content .= "<br />" . standard_text_escape($myrow->description);
        }
        $tool_content .= "</td>";
        $tool_content .= "<td class='option-btn-cell'>";
        if ($is_editor && !$is_in_tinymce) {
            $editlink = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;action=editlink&amp;id={$myrow->id}&amp;urlview={$urlview}";
            if (isset($category)) {
                $editlink .= "&amp;category={$category}";
            }
            $tool_content .= action_button(array(array('title' => $langDelete, 'icon' => 'fa-times', 'class' => 'delete', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;action=deletelink&amp;id={$myrow->id}&amp;urlview={$urlview}", 'confirm' => $langLinkDelconfirm), array('title' => $langModify, 'icon' => 'fa-edit', 'url' => $editlink), array('title' => $langUp, 'icon' => 'fa-arrow-up', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;urlview={$urlview}&amp;up={$myrow->id}", 'show' => $i != 1), array('title' => $langDown, 'icon' => 'fa-arrow-down', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;urlview={$urlview}&amp;down={$myrow->id}", 'show' => $i < $numberoflinks)));
        } else {
            $tool_content .= "&nbsp;";
        }
        $tool_content .= "</td>";
        $tool_content .= "</tr>";
        $i++;
    }
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:47,代码来源:linkfunctions.php

示例2: add_question

function add_question($node) {

	$objQuestion = new Question();
	$objQuestion->updateTitle(standard_text_escape($node->content));

	/**
	*Exercice type 1 refers to single response multiple choice question. 
	*Exercice type 2 refers to multiple response multiple choice question. 
	*QTILite allows only single response multiple choice questions.
	**/

	if($node->num_of_correct_answers > 1 ) {
		$objQuestion->updateType(2);
	} else {
		$objQuestion->updateType(1);
	}

	$objQuestion->save();

	$questionId = $objQuestion->selectId();

	$objAnswer = new Answer($questionId);
	$tmp_answer = array();

	if($node->answers) {
		foreach ($node->answers as $answer) {
			$objAnswer->createAnswer($answer['answer'], $answer['correct'], $answer['feedback'], $answer['weight'], 1);
		}
		$objAnswer->save();
	}
}
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:imsqtilib.php

示例3: list_videos

function list_videos()
{
    global $id, $tool_content, $themeimg, $course_id, $langTitle, $langDescr, $langDate, $langChoice, $langCatVideoDirectory, $langAddModulesButton, $langNoVideo, $course_code;
    $count = 0;
    $video_found = FALSE;
    $cnt1 = Database::get()->querySingle("SELECT COUNT(*) AS cnt FROM video WHERE course_id = ?d", $course_id)->cnt;
    $cnt2 = Database::get()->querySingle("SELECT COUNT(*) AS cnt FROM videolink WHERE course_id = ?d", $course_id)->cnt;
    $count = $cnt1 + $cnt2;
    if ($count > 0) {
        $video_found = TRUE;
        $tool_content .= "<form action='insert.php?course={$course_code}' method='post'><input type='hidden' name='id' value='{$id}' />";
        $tool_content .= "<table class='table-default'>";
        $tool_content .= "<tr>" . "<th width='200' class='text-left'>&nbsp;{$langTitle}</th>" . "<th class='text-left'>{$langDescr}</th>" . "<th width='100'>{$langDate}</th>" . "<th width='80'>{$langChoice}</th>" . "</tr>";
        foreach (array('video', 'videolink') as $table) {
            $result = Database::get()->queryArray("SELECT * FROM {$table} WHERE (category IS NULL OR category = 0) AND course_id = ?d", $course_id);
            foreach ($result as $row) {
                $row->course_id = $course_id;
                if ($table == 'video') {
                    $vObj = MediaResourceFactory::initFromVideo($row);
                    $videolink = MultimediaHelper::chooseMediaAhref($vObj);
                } else {
                    $vObj = MediaResourceFactory::initFromVideoLink($row);
                    $videolink = MultimediaHelper::chooseMedialinkAhref($vObj);
                }
                $tool_content .= "<td>&nbsp;" . icon('fa-film') . "&nbsp;&nbsp;" . $videolink . "</td>" . "<td>" . q($row->description) . "</td>" . "<td class='text-center'>" . nice_format($row->date, true, true) . "</td>" . "<td class='text-center'><input type='checkbox' name='video[]' value='{$table}:{$row->id}' /></td>" . "</tr>";
            }
        }
        $sql = Database::get()->queryArray("SELECT * FROM video_category WHERE course_id = ?d ORDER BY name", $course_id);
        if ($sql) {
            $tool_content .= "<tr><td colspan='3' class='bold'>&nbsp;{$langCatVideoDirectory}</td></tr>";
            foreach ($sql as $videocat) {
                $tool_content .= "<tr>";
                $tool_content .= "<td>" . icon('fa-folder-o') . "&nbsp;&nbsp;" . q($videocat->name) . "</td>";
                $tool_content .= "<td colspan='2'>" . standard_text_escape($videocat->description) . "</td>";
                $tool_content .= "<td align='center'><input type='checkbox' name='videocatlink[]' value='{$videocat->id}' /></td>";
                $tool_content .= "</tr>";
                foreach (array('video', 'videolink') as $table) {
                    $sql2 = Database::get()->queryArray("SELECT * FROM {$table} WHERE category = ?d", $videocat->id);
                    foreach ($sql2 as $linkvideocat) {
                        $tool_content .= "<tr>";
                        $tool_content .= "<td>&nbsp;&nbsp;&nbsp;&nbsp;<img src='{$themeimg}/links_on.png' />&nbsp;&nbsp;<a href='" . q($linkvideocat->url) . "' target='_blank'>" . q($linkvideocat->title == '' ? $linkvideocat->url : $linkvideocat->title) . "</a></td>";
                        $tool_content .= "<td>" . standard_text_escape($linkvideocat->description) . "</td>";
                        $tool_content .= "<td class='text-center'>" . nice_format($linkvideocat->date, true, true) . "</td>";
                        $tool_content .= "<td class='text-center'><input type='checkbox' name='video[]' value='{$table}:{$linkvideocat->id}' /></td>";
                        $tool_content .= "</tr>";
                    }
                }
            }
        }
        $tool_content .= "<tr><th colspan='4'><div align='right'><input class='btn btn-primary' type='submit' name='submit_video' value='" . q($langAddModulesButton) . "' />&nbsp;&nbsp;</div></th></tr></table></form>";
    }
    if (!$video_found) {
        $tool_content .= "<div class='alert alert-warning'>{$langNoVideo}</div>";
    }
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:55,代码来源:insert_video.php

示例4: table_row

function table_row($title, $content, $html = false)
{
    global $tool_content;
    if ($html) {
        $content = standard_text_escape($content);
    } else {
        $content = htmlspecialchars($content);
    }
    if (strlen(trim($content))) {
        $tool_content .= "<tr><th class='left'>{$title}:</th><td>{$content}</td></tr>";
    }
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:12,代码来源:work_functions.php

示例5: table_row

function table_row($title, $content, $html = false) {
    global $tool_content;

    if ($html) {
        $content = standard_text_escape($content);
    } else {
        $content = htmlspecialchars($content);
    }
    if (strlen(trim($content))) {
        $tool_content .= "
                        <div class='row margin-bottom-fat'>
                            <div class='col-sm-3'>
                                <strong>$title:</strong>
                            </div>
                            <div class='col-sm-9'>$content
                            </div>
                        </div>";
    }
}
开发者ID:nikosv,项目名称:openeclass,代码行数:19,代码来源:work_functions.php

示例6: list_links

/**
 * display available links (if any)
 * @global type $id
 * @global type $course_id
 * @global type $course_code
 * @global type $tool_content
 * @global type $langNoCategory
 * @global type $langCategorisedLinks
 * @global type $langComments
 * @global type $langAddModulesButton
 * @global type $langChoice
 * @global type $langNoLinksExist
 * @global type $langLinks
 * @global type $course_code
 */
function list_links()
{
    global $id, $course_id, $course_code, $tool_content, $langNoCategory, $langCategorisedLinks, $langComments, $langAddModulesButton, $langChoice, $langNoLinksExist, $langLinks, $course_code;
    $result = Database::get()->queryArray("SELECT * FROM link WHERE course_id = ?d", $course_id);
    if (count($result) == 0) {
        $tool_content .= "<div class='alert alert-warning'>{$langNoLinksExist}</div>";
    } else {
        $tool_content .= "<form action='insert.php?course={$course_code}' method='post'>\n\t\t\t\t<input type='hidden' name='id' value='{$id}' />" . "<table class='table-default'>" . "<tr>" . "<th class='text-left'>&nbsp;{$langLinks}</th>" . "<th class='text-left'>{$langComments}</th>" . "<th width='80'>{$langChoice}</th>" . "</tr>";
        $sql = Database::get()->queryArray("SELECT * FROM link_category WHERE course_id = ?d", $course_id);
        if (count($sql) > 0) {
            $tool_content .= "<tr>" . "<td colspan='3' class='bold'>&nbsp;{$langCategorisedLinks}</td>" . "</tr>";
            foreach ($sql as $catrow) {
                $tool_content .= "<tr>";
                $tool_content .= "<td>" . icon('fa-folder-o') . "&nbsp;" . q($catrow->name) . "</td>";
                $tool_content .= "<td>" . standard_text_escape($catrow->description) . "</td>";
                $tool_content .= "<td class='text-center'><input type='checkbox' name='catlink[]' value='{$catrow->id}' /></td>";
                $tool_content .= "</tr>";
                $sql2 = Database::get()->queryArray("SELECT * FROM link WHERE course_id = ?d AND category = ?d", $course_id, $catrow->id);
                foreach ($sql2 as $linkcatrow) {
                    $tool_content .= "<tr>";
                    $tool_content .= "<td>&nbsp;&nbsp;&nbsp;&nbsp;" . icon('fa-link') . "&nbsp;&nbsp;<a href='" . q($linkcatrow->url) . "' target='_blank'>" . q($linkcatrow->title == '' ? $linkcatrow->url : $linkcatrow->title) . "</a></td>";
                    $tool_content .= "<td>" . standard_text_escape($linkcatrow->description) . "</td>";
                    $tool_content .= "<td class='text-center'><input type='checkbox' name='link[]' value='{$linkcatrow->id}' /></td>";
                    $tool_content .= "</tr>";
                }
            }
        }
        $result = Database::get()->queryArray("SELECT * FROM link WHERE course_id = ?d AND category = 0", $course_id);
        $linkinfo = array();
        foreach ($result as $row) {
            $linkinfo[] = array('id' => $row->id, 'url' => $row->url, 'title' => $row->title == '' ? $row->url : $row->title, 'comment' => $row->description, 'category' => $row->category);
        }
        if (count($linkinfo) > 0) {
            $tool_content .= "<tr>" . "<td colspan='3' class='bold'>{$langNoCategory}</td>" . "</tr>";
            foreach ($linkinfo as $entry) {
                $tool_content .= "<tr>" . "<td>&nbsp;&nbsp;&nbsp;&nbsp;" . icon('fa-link') . "&nbsp;&nbsp;<a href='" . q($entry['url']) . "' target=_blank>" . q($entry['title']) . "</a></td>" . "<td>" . standard_text_escape($entry['comment']) . "</td>" . "<td class='text-center'><input type='checkbox' name='link[]' value='{$entry['id']}' /></td>";
                "</tr>";
            }
        }
        $tool_content .= "<tr>" . "<th colspan='3'><div align='right'>" . "<input class='btn btn-primary' type='submit' name='submit_link' value='{$langAddModulesButton}' /></div></th>" . "</tr></table></form>";
    }
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:57,代码来源:insert_link.php

示例7: event_list

    /**
     * @brief display event list
     * @global type $course_code
     * @global type $is_editor
     * @global type $langEvents
     * @global type $langCalendar
     * @global type $langDateNow
     * @global type $dateFormatLong
     * @global type $langHour
     * @global type $langHours
     * @global type $langDuration
     * @global type $langAgendaNoTitle
     * @global type $langDelete
     * @global type $langConfirmDeleteEvent
     * @global type $langConfirmDeleteRecursive
     * @global type $langConfirmDeleteRecursiveEvents
     * @global type $langModify
     * @global type $langVisible
     * @param type $events
     * @param type $sens
     * @return string
     */
    function event_list($events, $sens, $type = '') {
        global $course_code, $is_editor, $langDateNow, $dateFormatLong,
                $langHour, $langHours, $langDuration, $langAgendaNoTitle, $langDelete,
                $langConfirmDeleteEvent, $langConfirmDeleteRecursive, $langConfirmDeleteRecursiveEvents,
                $langEditChange, $langViewHide, $langViewShow, $id, $is_admin;

        $dateNow = date("j-n-Y / H:i", time());
        $barMonth = '';
        $nowBarShowed = false;
        $eventlist = "<div class='table-responsive'><table class='table-default'>";
        foreach ($events as $myrow) {
            $content = standard_text_escape($myrow->content);
            $d = strtotime($myrow->start);
            if (!$nowBarShowed) {
                // Following order
                if ((($d > time()) and ($sens == " ASC")) or ( ($d < time()) and ( $sens == " DESC "))) {
                    if ($barMonth != date("m", time())) {
                        $barMonth = date("m", time());
                        $eventlist .= "<tr>";
                        // current month
                        $eventlist .= "<td colspan='2' class='monthLabel list-header'><b>" . ucfirst(claro_format_locale_date("%B %Y", time())) . "</b></td>";
                        $eventlist .= "</tr>";
                    }
                    $nowBarShowed = TRUE;
                    $eventlist .= "<tr>";
                    $eventlist .= "<td colspan='2' class='today'>$langDateNow $dateNow</td>";
                    $eventlist .= "</tr>";
                }
            }
            if ($barMonth != date("m", $d)) {
                $barMonth = date("m", $d);
                // month LABEL
                $eventlist .= "<tr>";
                $eventlist .= "<td colspan='2' class='monthLabel list-header'>";
                $eventlist .= "<div align='center'><b>" . ucfirst(claro_format_locale_date("%B %Y", $d)) . "</b></div></td>";
                $eventlist .= "</tr>";
            }

            $classvis = '';
            if ($is_editor) {
                if ($myrow->visible == 0) {
                    $classvis = 'class = "not_visible"';
                }
            }
            $eventlist .= "<tr $classvis>";
            if ($is_editor or $type == 'personal' or ($is_admin and $type == 'admin')) {
                $eventlist .= "<td style='padding:15px;'>";
            } else {
                $eventlist .= "<td style='padding:15px;' colspan='2'>";
            }
            if (($myrow->duration != '0:00') and ($myrow->duration != '')) {
                if ($myrow->duration == 1) {
                    $message = $langHour;
                } else {
                    $message = $langHours;
                }
                $msg = "($langDuration: " . q($myrow->duration) . " $message)";
            } else {
                $msg = '';
            }
            if ($myrow->title == '') {
                $eventlist .= "<a href='$_SERVER[PHP_SELF]?course=$course_code&amp;id=$myrow->id'>$langAgendaNoTitle</a>";
            } else {
                $eventlist .= "<strong><a href='$_SERVER[PHP_SELF]?course=$course_code&amp;id=$myrow->id'>".q($myrow->title)."</a></strong> &nbsp;&nbsp;$msg";
            }

            $eventlist .= "<div><span class='day'>" . ucfirst(claro_format_locale_date($dateFormatLong, $d)) . "</span> ($langHour: " . ucfirst(date('H:i', $d)) . ")</div>";
            if (isset($id)) {
                $eventlist .= "<br>";
                $eventlist .= "<div class='text-muted'>$content</div>";
            }
            $eventlist .= "</td>";
            if ($type == 'admin' and $is_admin == true) {
               $eventlist .= "<td class='option-btn-cell'>";
               $eventlist .= action_button(array(
                        array('title' => $langEditChange,
                             'url' => "?admin=1&amp;modify=$myrow->id",
                             'icon' => 'fa-edit'),
//.........这里部分代码省略.........
开发者ID:nikosv,项目名称:openeclass,代码行数:101,代码来源:course_calendar.inc.php

示例8: AND

                                                        AND lang=?s
                                                        AND (`begin` <= NOW() or `begin` IS null)
                                                        AND (NOW() <= `end` or `end` IS null)
                                                ORDER BY `order` DESC", $language);

    $ann_content = '';
    if ($announceArr && sizeof($announceArr) > 0) {
        $ann_content .= "<ul class='front-announcements'>";
        $numOfAnnouncements = sizeof($announceArr);
        for ($i = 0; $i < $numOfAnnouncements; $i++) {
            $aid = $announceArr[$i]->id;
            $ann_content .= "
                    <li>
                    <div><a class='announcement-title' href='modules/announcements/main_ann.php?aid=$aid'>" . q($announceArr[$i]->title) . "</a></div>
                    <span class='announcement-date'>- " . claro_format_locale_date($dateFormatLong, strtotime($announceArr[$i]->date)) . " -</span>
            " . standard_text_escape(ellipsize_html("<div class='announcement-main'>".$announceArr[$i]->body."</div>", 500, "<div class='announcements-more'><a href='modules/announcements/main_ann.php?aid=$aid'>$langMore &hellip;</a></div>"))."</li>";
        }
    }

    $tool_content .= "<div class='row'>
        <div class='col-md-8'>";
        $tool_content .= "<div class='panel'>
            <div class='panel-body'>
                $langInfoAbout
            </div>
        </div>";

        // display admin announcements
        if(!empty($ann_content)) {
            $tool_content .= "<h3 class='content-title'>$langAnnouncements <a href='${urlServer}rss.php' style='padding-left:5px;'>
                    <i class='fa fa-rss-square'></i>
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:index.php

示例9: foreach

        <link href="../../../template/<?php echo $theme ?>/theme.css" rel="stylesheet" type="text/css" />
        <title><?php echo $langCourseProgram ?></title>
    </head>
    <body style="margin: 0px; padding-left: 0px; height: 100%!important; height: auto; background-color: #ffffff;">
        <div id="content" style="width:800px; margin: 0 auto;">

            <?php
            $q = Database::get()->queryArray("SELECT id, title, comments FROM course_description WHERE course_id = ?d ORDER BY `order`", $course_id);

            if ($q && count($q) > 0) {
                foreach ($q as $row) {
                    echo "
			<table class='table-default'>
			<tr>
			<td><strong>" . q($row->title) . "</strong></td>\n
			</tr>
			<tr>";

                    if ($is_editor) {
                        echo "\n<td colspan='6'>" . standard_text_escape($row->comments) . "</td>";
                    } else {
                        echo "\n<td>" . standard_text_escape($row->comments) . "</td>";
                    }
                    echo "</tr></table><br />\n";
                }
            } else {
                echo "   <div class='alert alert-warning'>$langThisCourseDescriptionIsEmpty</div>";
            }
            ?></div></body></html>

开发者ID:nikosv,项目名称:openeclass,代码行数:29,代码来源:showCourseDescription.php

示例10: icon

 $tool_content .= "<div class='table-responsive'><table class='table-default'>
                 <tr><th>$langTitle</th>
                     <th>$langAnnouncement</th>
                     <th colspan='2'><div align='center'>" . icon('fa-gears') . "</th>";
 foreach ($result as $myrow) {
     if ($myrow->visible == 1) {
         $visibility = 0;
         $classvis = '';
     } else {
         $visibility = 1;
         $classvis = 'not_visible';
     }
     $myrow->date = claro_format_locale_date($dateFormatLong, strtotime($myrow->date));
     $tool_content .= "<tr class='$classvis'>
         <td width='200'><b>" . q($myrow->title) . "</b><br><span class='smaller'>$myrow->date</span></td>
         <td>" . standard_text_escape($myrow->body) . "</td>
         <td width='6'>" .
             action_button(array(
                 array('title' => $langEditChange,
                     'url' => "$_SERVER[SCRIPT_NAME]?modify=$myrow->id",
                     'icon' => 'fa-edit'),
                 array('title' => $visibility == 0 ? $langViewHide : $langViewShow,
                     'url' => "$_SERVER[SCRIPT_NAME]?id=$myrow->id&amp;vis=$visibility",
                     'icon' => $visibility == 0 ? 'fa-eye-slash' : 'fa-eye'),
                 array('title' => $langUp,
                     'url' => "$_SERVER[SCRIPT_NAME]?up=$myrow->id",
                     'icon' => 'fa-arrow-up'),
                 array('title' => $langDown,
                     'url' => "$_SERVER[SCRIPT_NAME]?down=$myrow->id",
                     'icon' => 'fa-arrow-down'),
                 array('title' => $langDelete,
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:adminannouncements.php

示例11: foreach

                } else {
                    $tool_content .= " <span class='tag-value not_visible'> - $langProfileNotAvailable - </span>";

                }
                $tool_content .= $providers;
                $tool_content .= "</div>
                        </div> <!-- end of col-xs-6 -->
                    </div> <!-- end of row -->
                </div> <!-- end of col-xs-12 profile-pers-info -->
            </div> <!-- end of pers_info row -->";
    if (!empty($userdata->description)) {
        $tool_content .= "<div id='profile-about-me' class='row'>
                            <div class='col-xs-12 col-md-10 col-md-offset-2 profile-pers-info'>
                            <h4>$langProfileAboutMe</h4><div>
                                ".standard_text_escape($userdata->description)."</div></div></div>";
    }
        $tool_content .= "
    <div id='profile-departments' class='row'>
        <div class='col-xs-12 col-md-10 col-md-offset-2 profile-pers-info'>            
            <div><span class='tag'>$langHierarchyNode : </span>";
            $departments = $user->getDepartmentIds($id);
                $i = 1;
                foreach ($departments as $dep) {
                    $br = ($i < count($departments)) ? '<br/>' : '';
                    $tool_content .= $tree->getFullPath($dep) . $br;
                    $i++;
                }
        $tool_content .= "</div>
            <div>
                <span class='tag'>$langProfileMemberSince : </span><span class='tag-value'>$userdata->registered_at</span>
开发者ID:nikosv,项目名称:openeclass,代码行数:30,代码来源:display_profile.php

示例12: showQuestion

function showQuestion(&$objQuestionTmp, $exerciseResult = array())
{
    global $tool_content, $picturePath, $langNoAnswer, $langQuestion, $langColumnA, $langColumnB, $langMakeCorrespond, $langInfoGrades, $i, $exerciseType, $nbrQuestions, $langInfoGrade;
    $questionId = $objQuestionTmp->id;
    $questionWeight = $objQuestionTmp->selectWeighting();
    $answerType = $objQuestionTmp->selectType();
    $message = $langInfoGrades;
    if (intval($questionWeight) == $questionWeight) {
        $questionWeight = intval($questionWeight);
    }
    if ($questionWeight == 1) {
        $message = $langInfoGrade;
    }
    $questionName = $objQuestionTmp->selectTitle();
    $questionDescription = $objQuestionTmp->selectDescription();
    $questionDescription_temp = $questionDescription;
    $questionTypeWord = $objQuestionTmp->selectTypeWord($answerType);
    $tool_content .= "\n            <div class='panel panel-success'>\n              <div class='panel-heading'>\n                <h3 class='panel-title'>{$langQuestion} : {$i} ({$questionWeight} {$message})" . ($exerciseType == 2 ? " / " . $nbrQuestions : "") . "</h3>\n              </div>\n              <div class='panel-body'>\n                    <h4>{$questionName} <br> \n                        <small>{$questionTypeWord}</small>\n                    </h4>\n                    {$questionDescription_temp}\n                    <div class='text-center'>\n                        " . (file_exists($picturePath . '/quiz-' . $questionId) ? "<img src='../../{$picturePath}/quiz-{$questionId}'>" : "") . "\n                    </div>";
    // construction of the Answer object
    $objAnswerTmp = new Answer($questionId);
    $nbrAnswers = $objAnswerTmp->selectNbrAnswers();
    if ($answerType == FREE_TEXT) {
        $text = isset($exerciseResult[$questionId]) ? $exerciseResult[$questionId] : '';
        $tool_content .= rich_text_editor('choice[' . $questionId . ']', 14, 90, $text);
    }
    if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER || $answerType == TRUE_FALSE) {
        $tool_content .= "<input type='hidden' name='choice[{$questionId}]' value='0' />";
    }
    // only used for the answer type "Matching"
    if ($answerType == MATCHING && $nbrAnswers > 0) {
        $cpt1 = 'A';
        $cpt2 = 1;
        $Select = array();
        $tool_content .= "\n                      <table class='table-default'>\n                      <tr>\n                        <th>{$langColumnA}</th>\n                        <th>{$langMakeCorrespond}</th>\n                        <th>{$langColumnB}</th>\n                      </tr>";
    }
    if ($answerType == FILL_IN_BLANKS) {
        $tool_content .= "<div class='form-inline'>";
    }
    for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
        $answer = $objAnswerTmp->selectAnswer($answerId);
        $answer = mathfilter($answer, 12, '../../courses/mathimg/');
        $answerCorrect = $objAnswerTmp->isCorrect($answerId);
        if ($answerType == FILL_IN_BLANKS) {
            // splits text and weightings that are joined with the character '::'
            list($answer) = explode('::', $answer);
            // replaces [blank] by an input field
            $replace_callback = function () use($questionId, $exerciseResult) {
                static $id = 0;
                $id++;
                $value = isset($exerciseResult[$questionId][$id]) ? 'value = ' . $exerciseResult[$questionId][$id] : '';
                return "<input type='text' name='choice[{$questionId}][{$id}]' {$value}>";
            };
            $answer = preg_replace_callback('/\\[[^]]+\\]/', $replace_callback, standard_text_escape($answer));
        }
        // unique answer
        if ($answerType == UNIQUE_ANSWER) {
            $checked = isset($exerciseResult[$questionId]) && $exerciseResult[$questionId] == $answerId ? 'checked="checked"' : '';
            $tool_content .= "\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' name='choice[{$questionId}]' value='{$answerId}' {$checked}>\n                            " . standard_text_escape($answer) . "\n                          </label>\n                        </div>";
        } elseif ($answerType == MULTIPLE_ANSWER) {
            $checked = isset($exerciseResult[$questionId][$answerId]) && $exerciseResult[$questionId][$answerId] == 1 ? 'checked="checked"' : '';
            $tool_content .= "\n                        <div class='checkbox'>\n                          <label>\n                            <input type='checkbox' name='choice[{$questionId}][{$answerId}]' value='1' {$checked}>\n                            " . standard_text_escape($answer) . "\n                          </label>\n                        </div>";
        } elseif ($answerType == FILL_IN_BLANKS) {
            $tool_content .= $answer;
        } elseif ($answerType == MATCHING) {
            if (!$answerCorrect) {
                // options (A, B, C, ...) that will be put into the list-box
                $Select[$answerId]['Lettre'] = $cpt1++;
                // answers that will be shown at the right side
                $Select[$answerId]['Reponse'] = standard_text_escape($answer);
            } else {
                $tool_content .= "\n\t\t\t\t    <tr>\n\t\t\t\t      <td><b>{$cpt2}.</b> " . standard_text_escape($answer) . "</td>\n\t\t\t\t      <td><div align='left'>\n\t\t\t\t       <select name='choice[{$questionId}][{$answerId}]'>\n\t\t\t\t\t <option value='0'>--</option>";
                // fills the list-box
                foreach ($Select as $key => $val) {
                    $selected = isset($exerciseResult[$questionId][$answerId]) && $exerciseResult[$questionId][$answerId] == $key ? 'selected="selected"' : '';
                    $tool_content .= "\n\t\t\t\t\t<option value=\"" . q($key) . "\" {$selected}>{$val['Lettre']}</option>";
                }
                $tool_content .= "</select></div></td><td width='200'>";
                if (isset($Select[$cpt2])) {
                    $tool_content .= '<b>' . q($Select[$cpt2]['Lettre']) . '.</b> ' . $Select[$cpt2]['Reponse'];
                } else {
                    $tool_content .= '&nbsp;';
                }
                $tool_content .= "</td></tr>";
                $cpt2++;
                // if the left side of the "matching" has been completely shown
                if ($answerId == $nbrAnswers) {
                    // if it remains answers to shown at the right side
                    while (isset($Select[$cpt2])) {
                        $tool_content .= "\n                                              <tr class='even'>\n                                                <td colspan='2'>\n                                                  <table width='100%'>\n                                                  <tr>\n                                                  <td width='200'>&nbsp;</td>\n                                                  <td width='100'>&nbsp;</td>\n                                                  <td width='200' valign='top'>" . "<b>" . q($Select[$cpt2]['Lettre']) . ".</b> " . q($Select[$cpt2]['Reponse']) . "\n                                                  </td>\n                                                  </tr>\n                                                  </table>\n                                                </td>\n                                              </tr>";
                        $cpt2++;
                    }
                    // end while()
                }
                // end if()
            }
        } elseif ($answerType == TRUE_FALSE) {
            $checked = isset($exerciseResult[$questionId]) && $exerciseResult[$questionId] == $answerId ? 'checked="checked"' : '';
            $tool_content .= "\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' name='choice[{$questionId}]' value='{$answerId}' {$checked}>\n                            " . standard_text_escape($answer) . "\n                          </label>\n                        </div>";
        }
    }
//.........这里部分代码省略.........
开发者ID:kostastzo,项目名称:openeclass,代码行数:101,代码来源:exercise.lib.php

示例13: claro_format_locale_date

if ($is_course_admin) {
    $link = "<a href='{$urlAppend}modules/user/?course=$course_code'>$numUsers $langRegistered</a>";
} else {
    $link = "<a href='{$urlAppend}modules/user/userslist.php?course=$course_code'>$numUsers $langRegistered</a>";
}
$bar_content_2 .= "<br><b>$langUsers:</b> $link";
$citation_text = "$professor.&nbsp;<i>$currentCourseName.</i>&nbsp;$langAccessed" . claro_format_locale_date($dateFormatLong, strtotime('now')) . "&nbsp;$langFrom2 {$urlServer}courses/$course_code/";
$tool_content .= "<div class='modal fade' id='citation' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
                    <div class='modal-dialog'>
                        <div class='modal-content'>
                            <div class='modal-header'>
                                <button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button>
                                <h4 class='modal-title' id='myModalLabel'>$langCitation</h4>
                            </div>
                            <div class='modal-body'>".
                              standard_text_escape($citation_text)
                            ."</div>                                
                        </div>
                    </div>
                </div>";
$bar_content_2 .= "<br><a data-modal='citation' data-toggle='modal' data-target='#citation' href='javascript:void(0);'>$langCitation</a>";

// display course license
if ($course_license) {
    $license_info_box = "<small>" . copyright_info($course_id) . "</small>";
} else {
    $license_info_box = '';
}

// display opencourses level in bar
$level = ($levres = Database::get()->querySingle("SELECT level FROM course_review WHERE course_id =  ?d", $course_id)) ? CourseXMLElement::getLevel($levres->level) : false;
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:course_home.php

示例14: foreach

           </tr>";
 } else { // student view
     $tool_content .= "
             <th>$langExerciseName</th>
             <th class='text-center'>$langStart / $langEnd</th>
             <th class='text-center'>$langExerciseConstrain</th>
             <th class='text-center'>$langExerciseAttemptsAllowed</th>
             <th class='text-center'>$langResults</th>
           </tr>";
 }
 // display exercise list
 $k = 0;
 foreach ($result as $row) {
     
     $tool_content .= "<tr ".($is_editor && !$row->active ? "class='not_visible'" : "").">";
     $row->description = standard_text_escape($row->description);
     $exclamation_icon = '';
     $lock_icon = '';
     $link_class = '';
     if (isset($row->password_lock) || isset($row->ip_lock)) {
         $lock_description = "<ul>";
         if ($row->password_lock) {
             $lock_description .= "<li>$langPasswordUnlock</li>";
             $link_class = " class='password_protected'";
         }
         if ($row->ip_lock) {
             $lock_description .= "<li>$langIPUnlock</li>";
         }
         $lock_description .= "</ul>";
         $exclamation_icon = "&nbsp;&nbsp;<span class='fa fa-exclamation-triangle space-after-icon' data-toggle='tooltip' data-placement='right' data-html='true' data-title='$lock_description'><span>";
     }
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:index.php

示例15: show_assignment

function show_assignment($id, $display_graph_results = false)
{
    global $tool_content, $m, $langBack, $langNoSubmissions, $langSubmissions, $langEndDeadline, $langWEndDeadline, $langNEndDeadline, $langDays, $langDaysLeft, $langGradeOk, $course_code, $webDir, $urlServer, $langGraphResults, $m, $course_code, $themeimg, $works_url, $course_id, $langDelWarnUserAssignment, $langAutoJudgeShowWorkResultRpt;
    $row = Database::get()->querySingle("SELECT *, CAST(UNIX_TIMESTAMP(deadline)-UNIX_TIMESTAMP(NOW()) AS SIGNED) AS time\n                                FROM assignment\n                                WHERE course_id = ?d AND id = ?d", $course_id, $id);
    $nav[] = $works_url;
    assignment_details($id, $row);
    $rev = @($_REQUEST['rev'] == 1) ? ' DESC' : '';
    if (isset($_REQUEST['sort'])) {
        if ($_REQUEST['sort'] == 'am') {
            $order = 'am';
        } elseif ($_REQUEST['sort'] == 'date') {
            $order = 'submission_date';
        } elseif ($_REQUEST['sort'] == 'grade') {
            $order = 'grade';
        } elseif ($_REQUEST['sort'] == 'filename') {
            $order = 'file_name';
        } else {
            $order = 'surname';
        }
    } else {
        $order = 'surname';
    }
    $result = Database::get()->queryArray("SELECT * FROM assignment_submit AS assign, user\n                                 WHERE assign.assignment_id = ?d AND user.id = assign.uid\n                                 ORDER BY ?s ?s", $id, $order, $rev);
    $num_results = count($result);
    if ($num_results > 0) {
        if ($num_results == 1) {
            $num_of_submissions = $m['one_submission'];
        } else {
            $num_of_submissions = sprintf("{$m['more_submissions']}", $num_results);
        }
        $gradeOccurances = array();
        // Named array to hold grade occurances/stats
        $gradesExists = 0;
        foreach ($result as $row) {
            $theGrade = $row->grade;
            if ($theGrade) {
                $gradesExists = 1;
                if (!isset($gradeOccurances[$theGrade])) {
                    $gradeOccurances[$theGrade] = 1;
                } else {
                    if ($gradesExists) {
                        ++$gradeOccurances[$theGrade];
                    }
                }
            }
        }
        if (!$display_graph_results) {
            $result = Database::get()->queryArray("SELECT assign.id id, assign.file_name file_name,\n                                                   assign.uid uid, assign.group_id group_id,\n                                                   assign.submission_date submission_date,\n                                                   assign.grade_submission_date grade_submission_date,\n                                                   assign.grade grade, assign.comments comments,\n                                                   assign.grade_comments grade_comments,\n                                                   assignment.deadline deadline\n                                                   FROM assignment_submit AS assign, user, assignment\n                                                   WHERE assign.assignment_id = ?d AND assign.assignment_id = assignment.id AND user.id = assign.uid\n                                                   ORDER BY ?s ?s", $id, $order, $rev);
            $tool_content .= "\n                        <form action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}' method='post'>\n                        <input type='hidden' name='grades_id' value='{$id}' />\n                        <p><div class='sub_title1'>{$langSubmissions}:</div><p>\n                        <p>{$num_of_submissions}</p>\n                        <table width='100%' class='sortable'>\n                        <tr>\n                      <th width='3'>&nbsp;</th>";
            sort_link($m['username'], 'username');
            sort_link($m['am'], 'am');
            sort_link($m['filename'], 'filename');
            sort_link($m['sub_date'], 'date');
            sort_link($m['grade'], 'grade');
            $tool_content .= "</tr>";
            $i = 1;
            foreach ($result as $row) {
                //is it a group assignment?
                if (!empty($row->group_id)) {
                    $subContentGroup = "{$m['groupsubmit']} " . "<a href='../group/group_space.php?course={$course_code}&amp;group_id={$row->group_id}'>" . "{$m['ofgroup']} " . gid_to_name($row->group_id) . "</a>";
                } else {
                    $subContentGroup = '';
                }
                $uid_2_name = display_user($row->uid);
                $stud_am = Database::get()->querySingle("SELECT am FROM user WHERE id = ?d", $row->uid)->am;
                if ($i % 2 == 1) {
                    $row_color = "class='even'";
                } else {
                    $row_color = "class='odd'";
                }
                $filelink = empty($row->file_name) ? '&nbsp;' : "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;get={$row->id}'>" . q($row->file_name) . "</a>";
                $late_sub_text = (int) $row->deadline && $row->submission_date > $row->deadline ? '<div style="color:red;">$m[late_submission]</div>' : '';
                $tool_content .= "\n                                <tr {$row_color}>\n                                <td align='right' width='4' rowspan='2' valign='top'>{$i}.</td>\n                                <td>{$uid_2_name}</td>\n                                <td width='85'>" . q($stud_am) . "</td>\n                                <td width='180'>{$filelink}\n                                <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;id={$id}&amp;as_id={$row->id}' onClick='return confirmation(\"{$langDelWarnUserAssignment}\");'>\n                                 <img src='{$themeimg}/delete.png' title='{$m['WorkDelete']}' />\n                                </a>\n                                </td>\n                                <td width='100'>" . nice_format($row->submission_date, TRUE) . $late_sub_text . "</td>\n                                <td width='5'>\n                                <div align='center'><input type='text' value='{$row->grade}' maxlength='3' size='3' name='grades[{$row->id}]'></div>\n                                </td>\n                                </tr>\n                                <tr {$row_color}>\n                                <td colspan='5'>\n                                <div>{$subContentGroup}</div>";
                if (trim($row->comments != '')) {
                    $tool_content .= "<div style='margin-top: .5em;'><b>{$m['comments']}:</b> " . q($row->comments) . '</div>';
                }
                //professor comments
                $gradelink = "grade_edit.php?course={$course_code}&amp;assignment={$id}&amp;submission={$row->id}";
                $reportlink = "work_result_rpt.php?course={$course_code}&amp;assignment={$id}&amp;submission={$row->id}";
                if (trim($row->grade_comments)) {
                    $label = $m['gradecomments'] . ':';
                    $icon = 'edit.png';
                    $comments = "<div class='smaller'>" . standard_text_escape($row->grade_comments) . "</div>";
                } else {
                    $label = $m['addgradecomments'];
                    $icon = 'add.png';
                    $comments = '';
                }
                if ($row->grade_comments || $row->grade != '') {
                    $comments .= "<div class='smaller'><i>({$m['grade_comment_date']}: " . nice_format($row->grade_submission_date) . ")</i></div>";
                }
                $tool_content .= "<div style='padding-top: .5em;'><a href='{$gradelink}'><b>{$label}</b></a>\n\t\t\t\t  <a href='{$gradelink}'><img src='{$themeimg}/{$icon}'></a>\n\t\t\t\t  {$comments}\n\t\t\t\t  <a href='{$reportlink}'><b>{$langAutoJudgeShowWorkResultRpt}</b></a>\n                                </td>\n                                </tr>";
                $i++;
            }
            //END of Foreach
            $tool_content .= "</table>\n                        <p class='smaller right'><img src='{$themeimg}/email.png' alt='' >\n                                {$m['email_users']}: <input type='checkbox' value='1' name='email'></p>\n                        <p><input class='btn btn-primary' type='submit' name='submit_grades' value='{$langGradeOk}'></p>\n                        </form>";
        } else {
            // display pie chart with grades results
            if ($gradesExists) {
                // Used to display grades distribution chart
//.........这里部分代码省略.........
开发者ID:kostastzo,项目名称:openeclass,代码行数:101,代码来源:index.php


注:本文中的standard_text_escape函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。