コード例 #1
0
ファイル: results.php プロジェクト: artsmia/metamia
 public function fullViewMain($result, $result_config, $id, $highlight)
 {
     global $largetext, $layout, $array_fields;
     $sectionmain = array();
     $sections = array("top" => array(), "media" => array(), "object" => array(), "meta" => array(), "rights" => array());
     foreach ($result as $k => $v) {
         if (!empty($v) && $v != " ") {
             if (is_array($v)) {
                 $v = json_encode($v);
             }
             if (in_array($k, $array_fields)) {
                 $nv = explode(",", $v);
                 $v = "";
                 $v .= "<ul>";
                 for ($x = 0; $x < count($nv); $x++) {
                     $v .= "<li>" . $nv[$x] . "</li>";
                 }
                 $v .= "</ul>";
             }
             if (isset($layout["main"][$result_config['index']]) && in_array($k, $layout["main"][$result_config['index']])) {
                 $key = array_search($k, $layout["main"][$result_config['index']]);
                 if (in_array($k, $largetext)) {
                     if (strlen($v) > 2000) {
                         $sections['top'][$key] = "<li><h5 class='rslt-key' title='" . $this->title_msg . " " . $k . ".' alt='" . $k . "'>" . formatkey($k) . "</h5>" . stripslashes(pagedText($v, $id, $k, $highlight, 2000)) . "</li>";
                     } else {
                         if ($highlight != false) {
                             $sections['top'][$key] = "<li><h5 class='rslt-key' title='" . $this->title_msg . " " . $k . ".' alt='" . $k . "'>" . formatkey($k) . "</h5>" . stripslashes(replaceHighlight($v, $highlight, $k, 2000, false)) . "</li>";
                         } else {
                             $sections['top'][$key] = "<li><h5 class='rslt-key' title='" . $this->title_msg . " " . $k . ".' alt='" . $k . "'>" . formatkey($k) . "</h5><span>" . htmlentities($v) . "</span></li>";
                         }
                     }
                 } else {
                     $sections['top'][$key] = "<li><h5 class='rslt-key' title='" . $this->title_msg . " " . $k . ".' alt='" . $k . "'>" . formatkey($k) . "</h5><span>" . htmlentities($v) . "</span></li>";
                 }
             }
             if (isset($layout["media"][$result_config['index']]) && in_array($k, $layout["media"][$result_config['index']])) {
                 $key = array_search($k, $layout["media"][$result_config['index']]);
                 $sections['media'][$key] = "<li><h5 class='rslt-key' title='" . $this->title_msg . " " . $k . ".' alt='" . $k . "'>" . formatkey($k) . "</h5><span>" . htmlentities($v) . "</span></li>";
             }
             if (isset($layout["object"][$result_config['index']]) && in_array($k, $layout["object"][$result_config['index']])) {
                 $key = array_search($k, $layout["object"][$result_config['index']]);
                 $sections['object'][$key] = "<li><h5 class='rslt-key' title='" . $this->title_msg . " " . $k . ".' alt='" . $k . "'>" . formatkey($k) . "</h5><span>" . htmlentities($v) . "</span></li>";
             }
             if (isset($layout["meta"][$result_config['index']]) && in_array($k, $layout["meta"][$result_config['index']])) {
                 $key = array_search($k, $layout["meta"][$result_config['index']]);
                 $nv = "";
                 if ($k == "Keywords" || $k == "tags") {
                     $v = explode(",", $v);
                     foreach ($v as $kv => $vv) {
                         $nv .= "<em class='kw'>" . $vv . "</em>";
                     }
                     $v = $nv;
                 }
                 if ($k == "url") {
                     $v = "<a href='http://localhost" . $v . "' target='_BLANK'>" . $v . "</a>";
                 }
                 $sections['meta'][$key] = "<li><h5 class='rslt-key' title='" . $this->title_msg . " " . $k . ".' alt='" . $k . "'>" . formatkey($k) . "</h5><span>" . htmlentities($v) . "</span></li>";
             }
             if (isset($layout["rights"][$result_config['index']]) && in_array($k, $layout["rights"][$result_config['index']])) {
                 $key = array_search($k, $layout["rights"][$result_config['index']]);
                 $sections['rights'][$key] = "<li><h5 class='rslt-key' title='" . $this->title_msg . " " . $k . ".' alt='" . $k . "'>" . formatkey($k) . "</h5><span>" . htmlentities($v) . "</span></li>";
             }
         }
         //end if empty result
     }
     if (!empty($sections['top'])) {
         ksort($sections['top']);
         $sectionmain[] = "<ul style='border: 2px solid " . $result_config['color'] . "' class='fv-main'>" . html_entity_decode(implode('', $sections['top'])) . "<div class='clear'></div></ul>";
     }
     if (!empty($sections['rights'])) {
         ksort($sections['rights']);
         $sectionmain[] = "<ul class='fv-rights'><h4>Rights</h4>" . implode('', $sections['rights']) . "<div class='clear'></div></ul>";
     }
     if (!empty($sections['media'])) {
         ksort($sections['media']);
         $sectionmain[] = "<ul class='fv-media'><h4>Media</h4>" . implode('', $sections['media']) . "<div class='clear'></div></ul>";
     }
     if (!empty($sections['object'])) {
         ksort($sections['object']);
         $sectionmain[] = "<ul class='fv-object'><h4>Art Object Data</h4>" . html_entity_decode(implode('', $sections['object'])) . "<div class='clear'></div></ul>";
     }
     if (!empty($sections['meta'])) {
         ksort($sections['meta']);
         $sectionmain[] = "<ul class='fv-meta'><h4>Metadata</h4>" . implode('', $sections['meta']) . "<div class='clear'></div></ul>";
     }
     return "<section class='full-head'><ul>" . html_entity_decode(implode('', $sectionmain)) . "</ul></section>";
 }
コード例 #2
0
ファイル: AlbumCtrl.class.php プロジェクト: Jnnock/myyyk
 private function getAllUserInfo()
 {
     //实例化Model
     $userModel = new UserModel();
     //用户
     //查询所有用户信息
     $allUserInfo = $userModel->getAllUserInfo();
     $allUserInfo = formatkey($allUserInfo, 'userId');
     return $allUserInfo;
 }
コード例 #3
0
ファイル: search-ctrl.php プロジェクト: artsmia/metamia
 public function compileInput($k, $v, $t)
 {
     $operators = array("=", ">", "<");
     $frstopname = array("&" => "", "!" => "no", "or" => "or");
     $rmvbtn = "<a class='rm-val' href='#'>[x]</a>";
     $rngbtn = "";
     $inptitle = $k;
     if (strpos($k, ":op=")) {
         $op = $operators[substr($k, strpos($k, ":op=") + 4)];
         $kt = explode(":op=", $k);
         $inptitle = $kt[0];
         $rngbtn = "<a class='rng'>" . $op . "</a>";
     }
     if ($t != false) {
         $fname = "filter" . $frstopname[$t] . "[" . $k . "][]";
         $opbtn = "<a class='ornot' alt='" . $inptitle . "'>" . $t . "</a>" . $rngbtn;
     } else {
         $opbtn = "";
         $fname = "qaf[" . $k . "]";
     }
     $formattedtitle = formatkey($inptitle);
     return "<label for='" . $k . "'>{$formattedtitle}:<br/>" . $opbtn . "<input type='text' name='" . $fname . "' value='{$v}' class='filter'/>" . $rmvbtn . "</label>";
 }