public function hint(array $params = array()) { $this->document->addStyleSheet($this->plugin->getStaticCssUrl() . $this->theme . '.css'); $this->document->addStyleSheet($this->plugin->getStaticCssUrl() . 'tipTip.css'); $this->document->addScript($this->plugin->getStaticJsUrl() . 'jquery.tipTip.minified.js'); $features = array_filter(@get_object_vars(json_decode(OW::getConfig()->getValue('profileprogressbar', 'features')))); $_features = array(); foreach ($features as $feature => $count) { $_features[$feature] = OW::getLanguage()->text('profileprogressbar', $feature . '_desc'); $_features[$feature . 'Count'] = $count; } $form = new PROFILEPROGRESSBAR_CLASS_HintForm(); function unsetUnusedHint($val) { return strpos($val, '{$') === FALSE; } function getHint($_features) { $vars = array(); foreach ($_features as $key => $value) { $vars['{$' . $key . '}'] = $value; } $hintText = explode('#', OW::getLanguage()->text('profileprogressbar', 'hint_text')); foreach ($hintText as $key => $hint) { $hintText[$key] = str_replace(array_keys($vars), array_values($vars), $hint); } $hintText = array_filter($hintText, 'unsetUnusedHint'); return trim(implode('', $hintText)); } if (OW::getRequest()->isAjax() && $form->isValid($_POST)) { OW::getConfig()->saveConfig('profileprogressbar', 'show_hint', (int) $form->getElement('show-hint')->getValue()); $languageService = BOL_LanguageService::getInstance(); $langKey = $languageService->findKey('profileprogressbar', 'hint_text'); $langValue = BOL_LanguageValueDao::getInstance()->findValue($languageService->getCurrent()->getId(), $langKey->getId()); $langValue->setValue($_POST['hint-text']); BOL_LanguageService::getInstance()->saveValue($langValue); exit(json_encode(array('content' => getHint($_features)))); } $hintText = getHint($_features); OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(';$("#profile-progressbar").tipTip({ maxWidth: "auto", content: {$hint} });', array('hint' => $hintText))); $this->addForm($form); }
<link rel="stylesheet" type="text/css" href="./css/plugin.css"> <script type="text/javascript" src="./js/zjhlib-1.0.js"></script> </head> <body> <div class="header"> <div class="inner container rel"> <a href="" class="logo"> </a> <div class="header-tag"> <a href="?r=login">登录</a> <a href="?r=logout">注销</a> </div> </div> </div> <div id="hint"><?php echo getHint(); ?> </div> <div class="container"> <?php if (!empty($data)) { ?> <div id="menu"> <dl> <dt>查看信息</dt> <dd><a href="?r=jobUser">兼职用户</a></dd> <dd><a href="?r=comUser">企业用户</a></dd> <dd><a href="?r=rebate">佣金记录</a></dd> <dd><a href="?r=recommendShow">推荐记录</a></dd> <dd><a href="?r=usershow">预约记录</a></dd> </dl>
session_start(); if (!isset($_SESSION['stu_id'])) { header("location: studentLogin.php"); } define("DB_NAME", $_SESSION["modCode"]); $link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection."); $db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database"); $allCorrect = true; // If the question has been answered if (isset($_POST["submit"])) { $hints = array(); foreach ($_POST as $key => $value) { if ($key != "submit") { if (!check_answer($value, $key)) { $allCorrect = false; $hints[$key] = getHint($key); } } } } function scramble_answers($array) { if (!is_array($array)) { return $array; } $keys = array_keys($array); shuffle($keys); $random = array(); foreach ($keys as $key) { $random[$key] = $array[$key]; }