• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP getstring函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: demo_process_thread

function demo_process_thread($act, $outformat, $lastid, $isuser, $canpost, $istyping, $postmessage)
{
    global $kind_for_agent, $kind_info, $kind_events, $kind_user, $kind_agent, $webimroot, $settings;
    loadsettings();
    if ($act == "refresh" || $act == "post") {
        $lastid++;
        if ($outformat == "xml") {
            start_xml_output();
            print "<thread lastid=\"{$lastid}\" typing=\"" . ($istyping ? 1 : 0) . "\" canpost=\"" . ($canpost ? 1 : 0) . "\">";
        } else {
            start_html_output();
            $url = "{$webimroot}/thread.php?act=refresh&amp;thread=0&amp;token=123&amp;html=on&amp;user=" . ($isuser ? "true" : "false");
            print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . "<html>\n<head>\n" . "<link href=\"{$webimroot}/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n" . "<meta http-equiv=\"Refresh\" content=\"" . $settings['updatefrequency_oldchat'] . "; URL={$url}&amp;sn=11\">\n" . "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n" . "<title>chat</title>\n" . "</head>\n" . "<body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400'>" . "<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message'>";
        }
        if ($lastid == 1) {
            demo_print_message(array('ikind' => $kind_for_agent, 'created' => time() - 15, 'tname' => '', 'tmessage' => getstring2('chat.came.from', array("http://google.com"))), $outformat);
            demo_print_message(array('ikind' => $kind_info, 'created' => time() - 15, 'tname' => '', 'tmessage' => getstring('chat.wait')), $outformat);
            demo_print_message(array('ikind' => $kind_events, 'created' => time() - 10, 'tname' => '', 'tmessage' => getstring2("chat.status.operator.joined", array("Administrator"))), $outformat);
            demo_print_message(array('ikind' => $kind_agent, 'created' => time() - 9, 'tname' => 'Administrator', 'tmessage' => getstring("demo.chat.welcome")), $outformat);
            demo_print_message(array('ikind' => $kind_user, 'created' => time() - 5, 'tname' => getstring("chat.default.username"), 'tmessage' => getstring("demo.chat.question")), $outformat);
            if ($canpost && $outformat == 'xml') {
                demo_print_message(array('ikind' => $kind_info, 'created' => time() - 5, 'tname' => '', 'tmessage' => 'Hint: type something in message field to see typing notification'), $outformat);
            }
        }
        if ($act == 'post') {
            demo_print_message(array('ikind' => $isuser ? $kind_user : $kind_agent, 'created' => time(), 'tmessage' => $postmessage, 'tname' => $isuser ? getstring("chat.default.username") : "Administrator"), $outformat);
        }
        if ($outformat == "xml") {
            print "</thread>";
        } else {
            print "</td></tr></table><a name='aend'></a>" . "</body></html>";
        }
    }
}
开发者ID:paulcn,项目名称:mibew,代码行数:34,代码来源:demothread.php


示例2: userLogin

function userLogin($username, $password, $log = true)
{
    global $USER, $MSG;
    if ($username == "") {
        array_push($MSG, getstring('warning.login.noemail'));
        return false;
    }
    if ($password == "") {
        array_push($MSG, getstring('warning.login.nopassword'));
        return false;
    }
    $USER = new User($username);
    $USER->setUsername($username);
    $USER->password = $password;
    if ($USER instanceof User) {
        if ($USER->validPassword($password)) {
            $_SESSION["session_username"] = $USER->getUsername();
            setcookie("user", $USER->getUsername(), time() + 60 * 60 * 24 * 30, "/");
            setLang($USER->getProp('lang'));
            if ($log) {
                writeToLog('info', 'login', 'user logged in');
            }
            return true;
        } else {
            array_push($MSG, getstring('warning.login.invalid'));
            writeToLog('info', 'loginfailure', 'username: ' . $username);
            unset($USER);
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:nfreear,项目名称:mQuiz,代码行数:33,代码来源:accesslib.php


示例3: thread_to_xml

function thread_to_xml($thread, $link)
{
    global $state_chatting, $threadstate_to_string, $threadstate_key, $mibew_encoding, $operator, $settings, $can_viewthreads, $can_takeover, $mysqlprefix;
    $state = $threadstate_to_string[$thread['istate']];
    $result = "<thread id=\"" . safe_htmlspecialchars(safe_htmlspecialchars($thread['threadid'])) . "\" stateid=\"{$state}\"";
    if ($state == "closed") {
        return $result . "/>";
    }
    $state = getstring($threadstate_key[$thread['istate']]);
    $nextagent = $thread['nextagent'] != 0 ? operator_by_id_($thread['nextagent'], $link) : null;
    $threadoperator = $nextagent ? get_operator_name($nextagent) : ($thread['agentName'] ? $thread['agentName'] : "-");
    if ($threadoperator == "-" && $thread['groupname']) {
        $threadoperator = "- " . $thread['groupname'] . " -";
    }
    if (!($thread['istate'] == $state_chatting && $thread['agentId'] != $operator['operatorid'] && !is_capable($can_takeover, $operator))) {
        $result .= " canopen=\"true\"";
    }
    if ($thread['agentId'] != $operator['operatorid'] && $thread['nextagent'] != $operator['operatorid'] && is_capable($can_viewthreads, $operator)) {
        $result .= " canview=\"true\"";
    }
    if ($settings['enableban'] == "1") {
        $result .= " canban=\"true\"";
    }
    $banForThread = $settings['enableban'] == "1" ? ban_for_addr_($thread['remote'], $link) : false;
    if ($banForThread) {
        $result .= " ban=\"blocked\" banid=\"" . safe_htmlspecialchars(safe_htmlspecialchars($banForThread['banid'])) . "\"";
    }
    $result .= " state=\"{$state}\" typing=\"" . safe_htmlspecialchars(safe_htmlspecialchars($thread['userTyping'])) . "\">";
    $result .= "<name>";
    if ($banForThread) {
        $result .= safe_htmlspecialchars(getstring('chat.client.spam.prefix'));
    }
    $result .= safe_htmlspecialchars(safe_htmlspecialchars(get_user_name($thread['userName'], $thread['remote'], $thread['userid']))) . "</name>";
    $result .= "<addr>" . safe_htmlspecialchars(get_user_addr($thread['remote'])) . "</addr>";
    $result .= "<agent>" . safe_htmlspecialchars(safe_htmlspecialchars($threadoperator)) . "</agent>";
    $result .= "<time>" . safe_htmlspecialchars(safe_htmlspecialchars($thread['unix_timestamp(dtmcreated)'])) . "000</time>";
    $result .= "<modified>" . safe_htmlspecialchars(safe_htmlspecialchars($thread['unix_timestamp(dtmmodified)'])) . "000</modified>";
    if ($banForThread) {
        $result .= "<reason>" . safe_htmlspecialchars(safe_htmlspecialchars($banForThread['comment'])) . "</reason>";
    }
    $userAgent = get_useragent_version($thread['userAgent']);
    $result .= "<useragent>" . safe_htmlspecialchars($userAgent) . "</useragent>";
    if ($thread["shownmessageid"] != 0) {
        $query = "select tmessage from {$mysqlprefix}chatmessage where messageid = " . intval($thread["shownmessageid"]);
        $line = select_one_row($query, $link);
        if ($line) {
            $message = preg_replace("/[\r\n\t]+/", " ", $line["tmessage"]);
            $result .= "<message>" . safe_htmlspecialchars(safe_htmlspecialchars($message)) . "</message>";
        }
    }
    $result .= "</thread>";
    return $result;
}
开发者ID:kuell,项目名称:chat,代码行数:53,代码来源:update.php


示例4: check_login

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once '../libs/common.php';
require_once '../libs/operator.php';
require_once '../libs/chat.php';
$operator = check_login();
$page = array();
setlocale(LC_TIME, getstring("time.locale"));
function notification_info($id)
{
    global $mysqlprefix;
    $link = connect();
    $notification = select_one_row(db_build_select("id, locale, vckind, vcto, unix_timestamp(dtmcreated) as created, vcsubject, tmessage, refoperator", "{$mysqlprefix}chatnotification", array("id = {$id}"), ""), $link);
    mysql_close($link);
    return $notification;
}
$notificationid = verifyparam("id", "/^(\\d{1,9})\$/");
$page['notification'] = notification_info($notificationid);
prepare_menu($operator, false);
start_html_output();
require '../view/notification.php';
开发者ID:paulcn,项目名称:mibew,代码行数:31,代码来源:notification.php


示例5: error

 /**
  * Handle parsing error
  */
 protected function error($message, $text = '', $questionname = '')
 {
     global $MSG;
     array_push($MSG, getstring("import.quiz.error.questionformat", array($questionname)));
     $this->importerrors++;
 }
开发者ID:nfreear,项目名称:mQuiz,代码行数:9,代码来源:format.php


示例6: getstring

        echo "<li>" . $err . "</li>";
    }
    echo "</ul></div>";
}
echo "<p>" . getstring("reset.text") . "</h1>";
?>

<form method="post" action="">
	<div class="formblock">
		<div class="formlabel"><?php 
echo getstring('register.email');
?>
</div>
		<div class="formfield"><input type="text" name="email" value="<?php 
echo $email;
?>
"></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield">
			<input type="submit" name="submit" value="<?php 
echo getstring("reset.submit.button");
?>
"></input>
		</div>
	</div>
</form>

<?php 
include_once "./includes/footer.php";
开发者ID:nfreear,项目名称:mQuiz,代码行数:31,代码来源:reset.php


示例7: optional_param

$new = optional_param("new", "", PARAM_TEXT);
$view = optional_param("view", "invite", PARAM_TEXT);
$q = $API->getQuizForUser($qref, $USER->userid);
if (!$q) {
    die;
}
printf("<h1>%s</h1>", $q->title);
if ($new == "true") {
    printf("<div class='info'>%s</div>", getstring("quiz.new.saved", array($CONFIG->homeAddress . "m/?preview=true#" . $q->ref, $CONFIG->homeAddress . "quiz/edit.php?ref=" . $q->ref)));
} else {
    if ($new == "false") {
        printf("<div class='info'>%s</div>", getstring("quiz.edit.saved", array($CONFIG->homeAddress . "m/?preview=true#" . $q->ref, $CONFIG->homeAddress . "quiz/edit.php?ref=" . $q->ref)));
    }
}
if ($q->draft) {
    printf("<div class='info'>%s</div>", getstring('quiz.draft'));
} else {
    ?>
<div id="share">
	<h2>Share:</h2>
	<div id="tweet">


	<?php 
    printf('<a href="https://twitter.com/share" class="twitter-share-button"
			data-url="%sm/#%s" data-text="Try my new quiz \'%s\'" 
			data-size="large" data-count="none"
			data-hashtags="mquiz">Tweet</a>', $CONFIG->homeAddress, $q->ref, $q->title);
    ?>
		<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
	</div>
开发者ID:nfreear,项目名称:mQuiz,代码行数:31,代码来源:options.php


示例8: time

<?php

/* 
 * 
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (c) 2005-2009 ООО "ТОП".
 * Данное программное обеспечение и все сопутствующие материалы
 * предоставляются на условиях лицензии, доступной по адресу
 * http://webim.ru/license.html
 * 
 */
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.thread.php';
$operator = Operator::getInstance()->GetLoggedOperator(false);
// папка online в мэмкэш --------------------
//touch_online_file(OPERATOR_VIEW_TRACKER_FILE);
$mem_buff->set('OPERATOR_VIEW_TRACKER_FILE', time(), 1800);
if (!$operator) {
    Browser::SendXmlHeaders();
    echo "<error><descr>" . escape_with_cdata(getstring("agent.not_logged_in")) . "</descr></error>";
    exit;
}
$xml = Thread::getInstance()->BuildVisitorsXml();
Browser::SendXmlHeaders();
echo $xml;
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:27,代码来源:onsite.php


示例9: foreach

</h1>

<?php 
if (!empty($MSG)) {
    echo "<div class='warning'><ul>";
    foreach ($MSG as $err) {
        echo "<li>" . $err . "</li>";
    }
    echo "</ul></div>";
}
?>

<form method="post" action="">
	<div class="formblock">
		<div class="formlabel"><?php 
echo getstring('import.quiz.title');
?>
</div>
		<div class="formfield"><input type="text" name="title" size="60" value="<?php 
echo htmlentities($q->title);
?>
"></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class='formfield'>
			<input type="checkbox" name="quizdraft" value="1"
			<?php 
if ($q->draft == 1) {
    echo "checked='checked'";
}
开发者ID:nfreear,项目名称:mQuiz,代码行数:31,代码来源:edit.php


示例10: getstring

					</div>
				</div>
			</div>
		<?php 
}
?>
		

	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield"><input type="button" name="addquestion" value="<?php 
echo getstring("quiz.edit.add");
?>
" onclick="addQuestion()"/></div>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield"><input type="submit" name="submit" value="<?php 
echo getstring("quiz.edit.submit.button");
?>
"></input></div>
	</div>
	<input type="hidden" id="noquestions" name="noquestions" value="<?php 
echo count($qq);
?>
">
</form>
</div>
<?php 
include_once "../includes/footer.php";
开发者ID:nfreear,项目名称:mQuiz,代码行数:31,代码来源:edit.php


示例11: Start

function Start($id){
	global	$serversockets, $clientsockets, $sockets_status, $settings, $reqmessage,
		$timeout;
	$message = '';
	if(($message = getstring($clientsockets[$id], 10)) === CLOSED_SOCKET){
		close($id);
		return CLOSED_SOCKET;
	}
	
	elseif($message === NO_DATA)
		return NOT_ALL_DATA;
        @$reqmessage[$id] .= $message;
        // Checking the packet
        if($reqmessage[$id][0] !== VER){
		close($id);
		return CLOSED_SOCKET;
	}

	if(!isset($reqmessage[$id][1]))
		return NOT_ALL_DATA;

	if(ord($reqmessage[$id][1]) > strlen($reqmessage[$id]) - 2)
		return NOT_ALL_DATA;
	elseif(ord($reqmessage[$id][1]) === strlen($reqmessage[$id]) - 2){
		if($settings['AUTH'] !== 1){
			sendstring($clientsockets[$id],	VER.AUTH_NOT_REQ);
			unset($reqmessage[$id]);
			$sockets_status[$id]	= STATUS_REQUESTRECV;
			$timeout[$id]           = time();
			return 0;
		}
	
		if(strstr(substr($reqmessage[$id], 2, ord($reqmessage[$id][1])), AUTH_METHOD))
		{
		        $timeout[$id]		= time();
			$sockets_status[$id]	= STATUS_RECVAUTHREQ;
			sendstring($clientsockets[$id],	VER.AUTH_METHOD);
			unset($reqmessage[$id]);
			return 0;
		}
		else{
			sendstring($clientsockets[$id],	VER.WRONG_AUTH_METHODS);
			return 0;
			close($id);
			return CLOSED_SOCKET;
		}
		$sockets_status[$id] = STATUS_REQUEST;
		return 0;
	}
	else{
		close($id);
		
		return CLOSED_SOCKET;
	}
}
开发者ID:xl7dev,项目名称:WebShell,代码行数:55,代码来源:Antichat+Socks5+Server+v+1.0.php


示例12: getstring

?>
</div>
	</div>
	<div class="formblock">
		<div class="formlabel"><?php 
echo getstring("profile.newpassword");
?>
</div>
		<div class="formfield"><input type="password" name="password" value=""></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel"><?php 
echo getstring("profile.repeatnewpassword");
?>
</div>
		<div class="formfield"><input type="password" name="repeatpassword" value=""></input></div>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield"><input type="submit" name="submit" value="<?php 
echo getstring("profile.submit.button");
?>
"></input></div>
	</div>
</form>




<?php 
include_once "./includes/footer.php";
开发者ID:nfreear,项目名称:mQuiz,代码行数:31,代码来源:profile.php


示例13: getstring

<?php

include_once "../config.php";
$PAGE = "myresults";
include_once "../includes/header.php";
$results = $API->getMyQuizScores();
?>
<h1><?php 
echo getstring("myresults.title");
?>
</h1>

<?php 
if (count($results) == 0) {
    echo "<div class='info'>";
    echo getstring("myresults.none");
    echo "</div>";
} else {
    echo "<div id='title' class='quizlist'>";
    echo "<div style='clear:both'></div>";
    echo "<div class='quiztitle'>&nbsp;</div>";
    echo "<div class='quizcell'>Attempts</div>";
    echo "<div class='quizcell'>Highest Score</div>";
    echo "<div class='quizcell'>Lowest score</div>";
    echo "<div class='quizcell'>Average Score</div>";
    echo "<div class='quizcell'>Best Ranking</div>";
    echo "<div style='clear:both'></div>";
    echo "</div>";
    foreach ($results as $r) {
        echo "<div id='" . $r->ref . "' class='quizlist'>";
        echo "<div class='quiztitle'><a href='" . $CONFIG->homeAddress . "quiz/view.php?ref=" . $r->ref . "'>" . $r->title . "</a></div>";
开发者ID:nfreear,项目名称:mQuiz,代码行数:31,代码来源:results.php


示例14: printf

    printf("<div class='warning'>%s</div>", getstring("warning.quiz.hasattempts"));
}
?>

<div id="quizform">
<form method="post" action="">
	<div class="info">
		You you sure you want to delete the quiz '<?php 
echo $q->title;
?>
'?
		<p>This will completely remove the quiz and all its questions and cannot be undone.</p>
	</div>
	<div class="formblock">
		<div class="formlabel">&nbsp;</div>
		<div class="formfield">
			<input type="submit" name="delete" value="<?php 
echo getstring("quiz.delete.button");
?>
"></input>
			<input type="submit" name="cancel" value="<?php 
echo getstring("quiz.delete.cancel.button");
?>
"></input>
		</div>
	</div>
</form>
</div>

<?php 
include_once "../includes/footer.php";
开发者ID:nfreear,项目名称:mQuiz,代码行数:31,代码来源:delete.php


示例15: getstring

    }
    ?>
						</div>
					</div>
				</div>
			<?php 
}
?>
			
	
		</div>
		<div class="formblock">
			<div class="formlabel">&nbsp;</div>
			<div class="formfield"><input type="button" name="addquestion" value="<?php 
echo getstring("quiz.new.add");
?>
" onclick="addQuestion()"/></div>
		</div>
		<div class="formblock">
			<div class="formlabel">&nbsp;</div>
			<div class="formfield"><input type="submit" name="submit" value="<?php 
echo getstring("quiz.new.submit.button");
?>
"></input></div>
		</div>
		<input type="hidden" id="noquestions" name="noquestions" value="2"/>

</form>
</div>
<?php 
include_once "../includes/footer.php";
开发者ID:nfreear,项目名称:mQuiz,代码行数:31,代码来源:new.php


示例16: checkLogin

if (!in_array($PAGE, $nologinpages)) {
    checkLogin();
}
$lang = optional_param("lang", "", PARAM_TEXT);
if ($lang != "") {
    setLang($lang, true);
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<META name="description" content="mQuiz: mobile quiz application"/> 
	<META name="keywords" content="mquiz,quiz,assessment,mobile,android"/> 
	<title><?php 
echo getstring("app.title");
?>
</title>
	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
	<script type="text/javascript" src="<?php 
echo $CONFIG->homeAddress;
?>
m/includes/lib/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="<?php 
echo $CONFIG->homeAddress;
?>
m/includes/lib/jquery-ui-1.8.19.custom.min.js"></script>
	<script type="text/javascript" src="<?php 
echo $CONFIG->homeAddress;
?>
includes/script.php"></script>
开发者ID:nfreear,项目名称:mQuiz,代码行数:31,代码来源:header.php


示例17: visitor_from_request

function visitor_from_request()
{
    global $namecookie, $webim_encoding, $usercookie;
    $defaultName = getstring("chat.default.username");
    $userName = $defaultName;
    if (isset($_COOKIE[$namecookie])) {
        $data = base64_decode(strtr($_COOKIE[$namecookie], '-_,', '+/='));
        if (strlen($data) > 0) {
            $userName = myiconv("utf-8", $webim_encoding, $data);
        }
    }
    if ($userName == $defaultName) {
        $userName = getgetparam('name', $userName);
    }
    if (isset($_COOKIE[$usercookie])) {
        $userId = $_COOKIE[$usercookie];
    } else {
        $userId = get_user_id();
        setcookie($usercookie, $userId, time() + 60 * 60 * 24 * 365);
    }
    return array('id' => $userId, 'name' => $userName);
}
开发者ID:laiello,项目名称:cartonbank,代码行数:22,代码来源:chat.php


示例18: createQuizfromGIFT

 function createQuizfromGIFT($content, $title, $quizdraft, $description, $tags)
 {
     global $IMPORT_INFO, $MSG, $CONFIG, $USER;
     //first check if this quiz already exists
     $sql = sprintf("SELECT q.qref FROM quizprop qp\n\t\t\t\t\t\tINNER JOIN quiz q ON q.quizid = qp.quizid\n\t\t\t\t\t\tWHERE qp.quizpropname='content' \n\t\t\t\t\t\tAND qp.quizpropvalue='%s'\n\t\t\t\t\t\tAND q.createdby=%d", $content, $USER->userid);
     $result = _mysql_query($sql, $this->DB);
     while ($o = mysql_fetch_object($result)) {
         // store JSON object for quiz (for caching)
         $obj = $this->getQuizObject($o->qref);
         return $obj;
     }
     $supported_qtypes = array('truefalse', 'multichoice', 'essay', 'shortanswer', 'numerical');
     $questions_to_import = array();
     include_once $CONFIG->homePath . 'quiz/import/gift/import.php';
     $import = new qformat_gift();
     $lines = explode("\n", $content);
     $questions = $import->readquestions($lines);
     foreach ($questions as $q) {
         if (in_array($q->qtype, $supported_qtypes)) {
             array_push($questions_to_import, $q);
         } else {
             if ($q->qtype != 'category') {
                 array_push($IMPORT_INFO, $q->qtype . " question type not yet supported ('" . $q->questiontext . "')");
             }
         }
     }
     if (count($questions_to_import) == 0) {
         array_push($MSG, getstring('import.quiz.error.nosuppportedquestions'));
         return;
     }
     if (count($MSG) == 0) {
         // now do the actual import
         // setup quiz with default props
         $quizid = $this->addQuiz($title, $quizdraft, $description);
         $this->setProp('quiz', $quizid, 'generatedby', 'import');
         $this->setProp('quiz', $quizid, 'content', $content);
         $this->updateQuizTags($quizid, $tags);
         $importer = new GIFTImporter();
         $importer->quizid = $quizid;
         $importer->import($questions_to_import);
         $this->setProp('quiz', $quizid, 'maxscore', $importer->quizmaxscore);
         $q = $this->getQuizById($quizid);
         // store JSON object for quiz (for caching)
         $obj = $this->getQuizObject($q->ref);
         $json = json_encode($obj);
         $this->setProp('quiz', $quizid, 'json', $json);
         return $obj;
     }
     return;
 }
开发者ID:nfreear,项目名称:mQuiz,代码行数:50,代码来源:api.php


示例19: pm_notify_track_assign_handler

/**
 * Triggered when a track assignment takes place.
 * This function should use the CM configured values to send messages to appropriate users when a track assignment
 * takes place. Users will be ones configured for the context, which can include the user that is assigned and users
 * assigned to configured roles for that context. The message template used should be the one configured as well.
 *
 * @param object $eventdata the track assignment record
 * @return boolean success
 *
 */
function pm_notify_track_assign_handler($eventdata)
{
    global $CFG, $DB, $USER;
    /// Does the user receive a notification?
    $sendtouser = isset(elis::$config->local_elisprogram->notify_trackenrol_user) ? elis::$config->local_elisprogram->notify_trackenrol_user : '';
    $sendtorole = isset(elis::$config->local_elisprogram->notify_trackenrol_role) ? elis::$config->local_elisprogram->notify_trackenrol_role : '';
    $sendtosupervisor = isset(elis::$config->local_elisprogram->notify_trackenrol_supervisor) ? elis::$config->local_elisprogram->notify_trackenrol_supervisor : '';
    /// If nobody receives a notification, we're done.
    if (!$sendtouser && !$sendtorole && !$sendtosupervisor) {
        return true;
    }
    /// We get all context assigns, so check that this is a class. If not, we're done.
    $context = context_system::instance();
    /// Make sure this is a valid user.
    $enroluser = new user($eventdata->userid);
    if (!$enroluser) {
        if (in_cron()) {
            mtrace(getstring('nouser', 'local_elisprogram'));
        } else {
            print_error('nouser', 'local_elisprogram');
        }
        return true;
    }
    // Due to lazy loading, we need to pre-load this object
    $enroluser->load();
    if (empty($enroluser->id)) {
        if (in_cron()) {
            mtrace(getstring('nouser', 'local_elisprogram'));
        } else {
            print_error('nouser', 'local_elisprogram');
        }
        return true;
    }
    /// Get the track record from the track id.
    if (!($track = $DB->get_record('local_elisprogram_trk', array('id' => $eventdata->trackid)))) {
        if (in_cron()) {
            mtrace(get_string('notrack', 'local_elisprogram'));
        } else {
            print_error('notrack', 'local_elisprogram');
        }
        return true;
    }
    $message = new notification();
    /// Set up the text of the message
    $text = empty(elis::$config->local_elisprogram->notify_trackenrol_message) ? get_string('notifytrackenrolmessagedef', 'local_elisprogram') : elis::$config->local_elisprogram->notify_trackenrol_message;
    $search = array('%%userenrolname%%', '%%trackname%%');
    $replace = array($enroluser->moodle_fullname(), $track->name);
    $text = str_replace($search, $replace, $text);
    if ($sendtouser) {
        $message->send_notification($text, $enroluser);
    }
    $users = array();
    if ($sendtorole) {
        /// Get all users with the notify_trackenrol capability.
        if ($roleusers = get_users_by_capability($context, 'local/elisprogram:notify_trackenrol')) {
            $users = $users + $roleusers;
        }
    }
    if ($sendtosupervisor) {
        /// Get parent-context users.
        if ($supervisors = pm_get_users_by_capability('user', $eventdata->userid, 'local/elisprogram:notify_trackenrol')) {
            $users = $users + $supervisors;
        }
    }
    foreach ($users as $user) {
        $message->send_notification($text, $user, $enroluser);
    }
    /// If you don't return true, the message queue will clog and no more will be sent.
    return true;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:80,代码来源:notifications.php


示例20: optional_param

include_once "../config.php";
$PAGE = "viewquiz";
$HEADER = "<script type='text/javascript' src='https://www.google.com/jsapi'></script>";
include_once "../includes/header.php";
$ref = optional_param("ref", "", PARAM_TEXT);
$days = optional_param("days", 14, PARAM_INT);
$view = optional_param("view", "bydate", PARAM_TEXT);
$groupid = optional_param("groupid", 0, PARAM_INT);
$views = array('bydate' => 'Attempts by date', 'scoredist' => 'Score distribution', 'question' => 'Average score by question');
if ($API->isOwner($ref)) {
    $views['list'] = 'Detailed list';
}
$quiz = $API->getQuiz($ref);
if ($quiz == null) {
    echo getstring("warning.quiz.notfound");
    include_once "../includes/footer.php";
    die;
}
printf("<h1>%s</h1>", $quiz->quiztitle);
if ($quiz->quizdescription != "") {
    printf("<p class='desc'>%s</p>", $quiz->quizdescription);
}
if (!$API->quizHasAttempts($ref)) {
    printf("No attempts have been made on this quiz yet.");
    include_once "../includes/footer.php";
    die;
}
// get user groups
$groups = $API->getUserGroupQuiz($quiz->quizid);
if (count($groups) > 0) {
开发者ID:nfreear,项目名称:mQuiz,代码行数:30,代码来源:view.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP gettablebyidtype函数代码示例发布时间:2022-05-15
下一篇:
PHP getstr函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap