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


PHP Truncate函数代码示例

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


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

示例1: display

 public function display()
 {
     $array_type = "";
     if (is_array($this->_optionsArray[0])) {
         $array_type = "multi";
     }
     if ($this->_dropdown_type == "multi") {
         $dd_text = '<select multiple name= "' . $this->_dd_name . '">';
         // added benton
     } else {
         $dd_text = "<select name=\"" . $this->_dd_name . "\">";
     }
     // Add a first empty line if desired
     if ($this->_introselect != "") {
         $dd_text .= "<option value=\"\">{$this->_introselect}</option>";
     }
     $sorter = "";
     $current_type = "";
     if (!empty($this->_optionsArray)) {
         foreach ($this->_optionsArray as $key => $value) {
             // deal with multi vs. primitive arrays
             if ($array_type == "multi") {
                 $our_selected = $value[0];
                 $label = $value[1];
             } elseif ($this->_show_keys == TRUE) {
                 // we want to show both key and value
                 $our_selected = $key;
                 $label = $value;
             } else {
                 // show the value in both places
                 $our_selected = $value;
                 $label = $value;
             }
             //print "<p>Our selected = $our_selected || sorter = $sorter || label = $label</p>";
             if ($this->_truncation != "") {
                 $label = Truncate($label, $this->_truncation, '');
             }
             if ($current_type != $sorter) {
                 $dd_text .= "<option value=\"\" class=\"dropdown_list\"> -- " . strtoupper($sorter) . " -- </option>";
             }
             // check if our values are coming in a multidimensional array
             if (is_array($this->_selected)) {
                 if (in_array($our_selected, $this->_selected)) {
                     $dd_text .= "<option value=\"{$our_selected}\" selected=\"selected\">{$label}</option>";
                 } else {
                     $dd_text .= "<option value=\"{$our_selected}\">{$label}</option>";
                 }
             } else {
                 if ($our_selected === $this->_selected) {
                     $dd_text .= "<option value=\"{$our_selected}\" selected=\"selected\">{$label}</option>";
                 } else {
                     $dd_text .= "<option value=\"{$our_selected}\">{$label}</option>";
                 }
             }
             $current_type = $sorter;
         }
     }
     $dd_text .= "</select>";
     return $dd_text;
 }
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:60,代码来源:Dropdown.php

示例2: output

 public function output($action = "", $view = "public")
 {
     global $PublicPath;
     global $CpanelPath;
     // public vs. admin
     parent::establishView($view);
     // Get librarians associated with this guide
     $querier = new Querier();
     $qs = "SELECT f.faq_id, question, answer from faq f, faq_subject fs WHERE f.faq_id = fs.faq_id and fs.subject_id = " . $this->_subject_id . " ORDER BY question";
     //print $qs;
     $faqArray = $querier->query($qs);
     if ($faqArray) {
         $this->_body = "<ul>";
         foreach ($faqArray as $value) {
             $short_q = Truncate($value["question"], 150, '');
             $this->_body .= "<li><a target=\"_blank\" href=\"{$PublicPath}" . "faq.php?faq_id={$value['0']}\">{$short_q}</a></li>\n";
         }
         $this->_body .= "</ul>";
     } else {
         $this->_body = "<p class=\"faq-alert\">" . _("There are no FAQs linked for this guide") . "</p>";
         if ($view == "admin") {
             $this->_body = "<p class=\"faq-alert\">" . _("There are no FAQs linked for this guide") . "</p>\n                            <p><i class=\"fa fa-plus-square\"></i> <a href=\"../faq/faq.php?faq_id=&amp;wintype=pop\" class=\"showmedium-reloader\">" . _("Add New FAQ") . "</a></p>";
         }
     }
     parent::assemblePluslet();
     return $this->_pluslet;
 }
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:27,代码来源:4.php

示例3: genTalkBacks

function genTalkBacks($tbArray, $show_response = 1)
{
    global $IconPath;
    $row_count1 = 0;
    $row_count2 = 0;
    $colour1 = "evenrow";
    $colour2 = "oddrow";
    $tb_answer = "";
    foreach ($tbArray as $value) {
        $row_colour = $row_count2 % 2 ? $colour1 : $colour2;
        if ($value[2]) {
            $q_from = $value[2];
        } else {
            $q_from = _("Anonymous");
        }
        if (isset($show_response) && $show_response == 0) {
            $first_div_width = "90%";
            $last_mod_tb = "";
        } else {
            $first_div_width = "45%";
            $short_answer = stripslashes(htmlspecialchars_decode(TruncByWord($value["answer"], 15)));
            $last_mod_tb = lastModded("talkback", $value["talkback_id"], 0, 1);
        }
        $short_question = Truncate($value["question"], 200);
        if ($last_mod_tb) {
            $mod_line = _("--") . $last_mod_tb;
        } else {
            $mod_line = "";
        }
        $tb_answer .= "\n            <div style=\"clear: both; float: left;  padding: 3px 5px; width: 98%;\" class=\"striper {$row_colour}\">\n                <div style=\"float: left; width: 32px; max-width: 5%;\"><a class=\"showcustom\" style=\"color: #333;\" href=\"talkback.php?talkback_id={$value['0']}&amp;wintype=pop\"><i class=\"fa fa-pencil fa-lg\" alt=\"" . _("Edit") . "\"></i></a></div>\n                <div style=\"float: left; width: {$first_div_width};\">\n                 <strong>Q:</strong> {$short_question} <span style=\"color: #666; font-size: 10px;\">({$q_from}, {$value['date_formatted']})</span>\n                </div>";
        if (isset($show_response) && $show_response == 1) {
            $tb_answer .= "<div style=\"float: left; width: 45%; margin-left: 4%;\">\n                 <strong>A:</strong> {$short_answer} <span style=\"color: #666; font-size: 10px;\">{$mod_line}</span>\n                </div>\n            ";
        }
        $tb_answer .= "</div>";
        $row_count2++;
    }
    return $tb_answer;
}
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:38,代码来源:tb_bits.php

示例4: output

 public function output($action = "", $view = "public")
 {
     global $PublicPath;
     // public vs. admin
     parent::establishView($view);
     // Get librarians associated with this guide
     $querier = new Querier();
     $qs = "SELECT f.faq_id, question, answer from faq f, faq_subject fs WHERE f.faq_id = fs.faq_id and fs.subject_id = " . $this->_subject_id . " ORDER BY question";
     //print $qs;
     $faqArray = $querier->query($qs);
     if ($faqArray) {
         $this->_body = "<ul>";
         foreach ($faqArray as $value) {
             $short_q = Truncate($value[question], 150, '');
             $this->_body .= "<li><a target=\"_blank\" href=\"{$PublicPath}" . "faq.php?faq_id={$value['0']}\">{$short_q}</a></li>\n";
         }
         $this->_body .= "</ul>";
     } else {
         $this->_body = _("There are no FAQs linked for this guide");
     }
     parent::assemblePluslet();
     return $this->_pluslet;
 }
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:23,代码来源:4.php

示例5: Querier

    }
} else {
    $limit = "";
}
$querierVid = new Querier();
$qVid = "SELECT video_id, title, description, source, foreign_id, duration, date, display, vtags\n\tFROM video\n\tORDER BY video_id DESC\n\t{$limit}";
$vidArray = $querierVid->query($qVid);
$row_count1 = 0;
$row_count2 = 0;
$colour1 = "evenrow";
$colour2 = "oddrow";
$vid_list = "";
if ($vidArray) {
    foreach ($vidArray as $value) {
        $row_colour1 = $row_count1 % 2 ? $colour1 : $colour2;
        $short_title = Truncate($value["title"], 200);
        $short_desc = stripslashes(htmlspecialchars_decode(TruncByWord($value["description"], 15)));
        $last_revised_line = lastModded("video", $value[0]);
        if ($value[7] != "1") {
            $activity = " <span style=\"color: #666;\">* " . _("unpublished") . "</span>";
        } else {
            $activity = "";
        }
        $vid_list .= "\n            <div style=\"clear: both; float: left;  padding: 3px 5px; width: 98%;\" class=\"striper {$row_colour1}\">\n                <div style=\"pluslet_body\">\n                <a  class=\"showmedium\" href=\"video.php?video_id={$value['0']}&amp;wintype=pop\"><i class=\"fa fa-pencil fa-lg\" alt=\"" . _("Edit") . "\"></i></a>\n                &nbsp; &nbsp;<a href=\"" . $VideoPath . "?video_id={$value['0']}\" target=\"_blank\"><i class=\"fa fa-eye fa-lg\" alt=\"" . _("View") . "\"></i></a>\n                </div>\n                <div style=\"float: left; width: 90%;\">\n                 {$short_title} <span style=\"color: #666; font-size: 10px;\">({$last_revised_line})</span> {$activity}\n                </div>\n            </div>";
        $row_count1++;
    }
} else {
    $vid_list = "<p>" . _("No Videos yet.  Grab your camera.") . "</p>";
}
$ingest_body_text = "<a href=\"ingest.php\">" . _("FIND VIDEOS") . "</a>";
$add_metadata_text = "<a href=\"video.php\">" . _("ENTER VIDEO") . "</a>";
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:31,代码来源:index.php

示例6: SubstituteValueWorker

function SubstituteValueWorker($a_matches, $s_repl, $b_html = true)
{
    /**
     * @global FieldManager $SubstituteFields
     */
    global $aSubstituteErrors, $SubstituteFields, $SPECIAL_VALUES;
    $b_insert_br = true;
    // option to put "<br />" tags before newlines in HTML templates
    $n_max_chars = 0;
    $n_max_lines = 0;
    $s_list_sep = $SPECIAL_VALUES['template_list_sep'];
    $b_text_subs = false;
    $s_name = $a_matches[0];
    assert(strlen($s_name) > 1 && $s_name[0] == '$');
    $s_name = substr($s_name, 1);
    if (($i_len = strlen($s_name)) > 0 && $s_name[0] == '{') {
        assert($s_name[$i_len - 1] == '}');
        $s_name = substr($s_name, 1, -1);
        //
        // grab any processing options
        //
        $a_args = explode(":", $s_name);
        $s_name = $a_args[0];
        if (($n_args = count($a_args)) > 1) {
            for ($ii = 1; $ii < $n_args; $ii++) {
                //
                // some options are followed by =X
                // where X is a value
                //
                $s_param = "";
                if (($i_pos = strpos($a_args[$ii], '=')) !== false) {
                    $s_param = substr($a_args[$ii], $i_pos + 1);
                    $s_opt = substr($a_args[$ii], 0, $i_pos);
                } else {
                    $s_opt = $a_args[$ii];
                }
                switch ($s_opt) {
                    case "nobr":
                        $b_insert_br = false;
                        break;
                    case "chars":
                        if ($s_param !== "") {
                            $n_max_chars = (int) $s_param;
                        }
                        break;
                    case "lines":
                        if ($s_param !== "") {
                            $n_max_lines = (int) $s_param;
                        }
                        break;
                    case "sep":
                        if ($s_param !== "") {
                            $s_list_sep = $s_param;
                        }
                        break;
                    case "subs":
                        $b_text_subs = true;
                        break;
                }
            }
        }
    }
    $s_value = "";
    $s_mesg = "";
    if ($SubstituteFields->IsFieldSet($s_name) && !$SubstituteFields->TestFieldEmpty($s_name, $s_mesg)) {
        if ($b_html) {
            $s_value = $SubstituteFields->GetSafeFieldValue($s_name, $b_text_subs, $s_list_sep);
        } else {
            $s_value = $SubstituteFields->GetFieldValue($s_name, $s_list_sep);
        }
        $s_value = Truncate($s_value, $n_max_chars, $n_max_lines);
        if ($b_html && $b_insert_br) {
            $s_value = nl2br($s_value);
        }
    } elseif (isset($SPECIAL_VALUES[$s_name])) {
        $s_value = $b_html ? htmlspecialchars((string) $SPECIAL_VALUES[$s_name]) : (string) $SPECIAL_VALUES[$s_name];
        $s_value = Truncate($s_value, $n_max_chars, $n_max_lines);
    } elseif (isset($s_repl)) {
        $s_value = $s_repl;
    } else {
        $s_value = "";
    }
    return $s_value;
}
开发者ID:aaron-cheng,项目名称:Pur,代码行数:84,代码来源:formmail.php

示例7: Querier

    }
} else {
    $limit = "LIMIT 0,10";
}
$querierFAQ = new Querier();
$qFAQ = "SELECT faq_id, question, answer, keywords\n\tFROM faq\n\tORDER BY faq_id DESC\n\t{$limit}";
$faqArray = $querierFAQ->query($qFAQ);
$row_count1 = 0;
$row_count2 = 0;
$colour1 = "evenrow";
$colour2 = "oddrow";
$faq_list = "";
if ($faqArray) {
    foreach ($faqArray as $value) {
        $row_colour1 = $row_count1 % 2 ? $colour1 : $colour2;
        $short_question = Truncate($value["question"], 200);
        $short_answer = stripslashes(htmlspecialchars_decode(TruncByWord($value["answer"], 15)));
        $last_revised_line = lastModded("faq", $value[0]);
        // Answered FAQs
        $faq_list .= "\n            <div class=\"striper faq_wrapper {$row_colour1}\">\n                <div class=\"faq_tools\">\n                <a href=\"faq.php?faq_id={$value['0']}&amp;wintype=pop\" class=\"showmedium-reloader\"><img src=\"{$IconPath}/pencil.png\" alt=\"edit\" width=\"16\" height=\"16\" /></a>\n                &nbsp; &nbsp;<a href=\"" . $FAQPath . "?faq_id={$value['0']}\" target=\"_blank\"><img src=\"{$IconPath}/eye.png\" alt=\"edit\" width=\"16\" height=\"16\" /></a>\n                </div>\n                <div class=\"faq_question\">\n                 {$short_question} <span class=\"faq-short-question\">({$last_revised_line})</span>\n                </div>\n            </div>";
        $row_count1++;
    }
} else {
    $faq_list = "<p>" . _("No FAQs yet.  Why not dream one up?") . "</p>";
}
$faq_body = "<p><strong>{$row_count1} " . _("FAQs visible");
if (!isset($limit) || $limit != "all") {
    $faq_body .= " (<a href=\"index.php?limit=all\">" . _("See All") . "</a>)";
}
$faq_body .= "</strong></p>" . $faq_list;
?>
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:index.php

示例8: SubstituteValueWorker

function SubstituteValueWorker($a_matches, $s_repl, $b_html = true)
{
    global $aSubstituteErrors, $SubstituteFields, $SPECIAL_VALUES;
    $b_insert_br = true;
    // option to put "<br />" tags before newlines in HTML templates
    $n_max_chars = 0;
    $n_max_lines = 0;
    $s_list_sep = $SPECIAL_VALUES['template_list_sep'];
    $b_text_subs = false;
    $s_name = $a_matches[0];
    assert(strlen($s_name) > 1 && $s_name[0] == '$');
    $s_name = substr($s_name, 1);
    if (($i_len = strlen($s_name)) > 0 && $s_name[0] == '{') {
        assert($s_name[$i_len - 1] == '}');
        $s_name = substr($s_name, 1, -1);
        //
        // grab any processing options
        //
        $a_args = explode(":", $s_name);
        $s_name = $a_args[0];
        if (($n_args = count($a_args)) > 1) {
            for ($ii = 1; $ii < $n_args; $ii++) {
                //
                // some options are followed by =X
                // where X is a value
                //
                $s_param = "";
                if (($i_pos = strpos($a_args[$ii], '=')) !== false) {
                    $s_param = substr($a_args[$ii], $i_pos + 1);
                    $s_opt = substr($a_args[$ii], 0, $i_pos);
                } else {
                    $s_opt = $a_args[$ii];
                }
                switch ($s_opt) {
                    case "nobr":
                        $b_insert_br = false;
                        break;
                    case "chars":
                        if ($s_param !== "") {
                            $n_max_chars = (int) $s_param;
                        }
                        break;
                    case "lines":
                        if ($s_param !== "") {
                            $n_max_lines = (int) $s_param;
                        }
                        break;
                    case "sep":
                        if ($s_param !== "") {
                            $s_list_sep = $s_param;
                        }
                        break;
                    case "subs":
                        $b_text_subs = true;
                        break;
                }
            }
        }
    }
    $s_value = "";
    if ($SubstituteFields->IsFieldSet($s_name) && !$SubstituteFields->TestFieldEmpty($s_name, $s_mesg)) {
        if ($b_html) {
            //
            // Up to and including version 8.24, the code used
            // htmlspecialchars.  Version 8.28 caused UTF-8 template
            // processing to break, because it started using htmlentities
            // without specifying the charset.
            //
            $s_value = $SubstituteFields->GetSafeFieldValue($s_name, $b_text_subs, $s_list_sep);
        } else {
            $s_value = $SubstituteFields->GetFieldValue($s_name, $s_list_sep);
        }
        $s_value = Truncate($s_value, $n_max_chars, $n_max_lines);
        if ($b_html && $b_insert_br) {
            //
            // Insert HTML line breaks before newlines.
            //
            $s_value = nl2br($s_value);
        }
    } elseif (isset($SPECIAL_VALUES[$s_name])) {
        $s_value = $b_html ? htmlspecialchars((string) $SPECIAL_VALUES[$s_name]) : (string) $SPECIAL_VALUES[$s_name];
        $s_value = Truncate($s_value, $n_max_chars, $n_max_lines);
    } elseif (isset($s_repl)) {
        //
        // If a replacement value has been specified use it, and
        // don't call htmlspecialchars.  This allows the use
        // of HTML tags in a replacement string.
        //
        $s_value = $s_repl;
    } else {
        $s_value = "";
    }
    return $s_value;
}
开发者ID:chrismathers,项目名称:premierplacement,代码行数:94,代码来源:resumemailer_061612.php

示例9: outputSubject

 public function outputSubject($value)
 {
     global $IconPath;
     $subject_name = Truncate($value[6], 25, '');
     $source_name = Truncate($value[7], 15, '');
     // check if the note override icon should be active or in
     if ($value[5] != "") {
         $note_fa = "";
     } else {
         $note_fa = "fa-inactive";
     }
     // check if the source override icon should be active or in
     if ($value[3] != $this->_def_source[0][0]) {
         //on
         $source_fa = "";
     } else {
         //off
         $source_fa = "fa-inactive";
     }
     $oursubjects = "\n \t<div class=\"pure-g selected_item_wrapper\">\n \t<div class=\"pure-u-1-2\">\n \t<input name=\"subject[]\" value=\"{$value['1']}\" type=\"hidden\" />\n \t<input name=\"rank[]\" value=\"{$value['0']}\" type=\"hidden\" />\n \t<input name=\"source[]\" value=\"{$value['3']}\" id=\"hidden_source-{$value['1']}-{$value['3']}\" type=\"hidden\" />\n \t{$subject_name} <span class=\"small_extra\">{$source_name}</span><br />\n \t<textarea style=\"display: none; clear: both;\" class=\"desc_override\" name=\"description_override[]\" rows=\"4\" cols=\"35\">{$value['5']}</textarea>\n \t</div>\n \t<div class=\"pure-u-1-2\">\n \t<i class=\"fa fa-lg fa-trash delete_sub clickable\" alt=\"" . _("remove subject") . "\" title=\"" . _("remove subject") . "\"></i>\n \t<i class=\"fa fa-lg fa-book {$source_fa} source_override clickable\" id=\"source_override-{$value['1']}-{$value['3']}\" alt=\"" . _("change source type") . "\" title=\"" . _("change source type") . "\" border=\"0\" /></i>\n \t<i class=\"fa fa-lg fa-file-text-o {$note_fa} note_override clickable\" id=\"note_override-{$value['1']}-{$value['3']}\" alt=\"" . _("add description override") . "\" title=\"" . _("add description override") . "\" border=\"0\" /></i>\n \t</div>\n \t</div>";
     return $oursubjects;
 }
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:22,代码来源:Record.php

示例10: scrubData

 */
$subcat = "guides";
$page_title = "Find Stuff";
$no_header = "yes";
include "../../includes/header.php";
$all_subs = "";
$our_subject_id = "";
if (isset($_GET["subject_id"])) {
    $our_subject_id = scrubData($_GET["subject_id"], "int");
}
// get list of all subjects with pluslets, to use later
$q3 = "SELECT s.shortform, s.subject FROM subject s\nINNER JOIN tab t\nON s.subject_id = t.subject_id\nINNER JOIN section sec\nON t.tab_id = sec.tab_id\nINNER JOIN pluslet_section ps\nON sec.section_id = ps.section_id\nGROUP BY s.subject";
//print $q2;
$r3 = $db->query($q3);
foreach ($r3 as $myrow) {
    $sub_title = Truncate($myrow[1], 50, '');
    $all_subs .= "<option value=\"{$myrow['0']}\">{$sub_title}</option>";
}
print "\n<div id=\"maincontent\">\n<form action=\"discover.php\" method=\"post\" id=\"target\">\n\n<div style=\"float: left; width: 60%;\">\n    <div class=\"box\">\n    <h2>Browse</h2>\n\n\t<select name=\"all_subs\" id=\"all_subs\">\n\t<option value=\"\" style=\"font-size: 9pt;\">" . _("- Browse Boxes -") . "</option>\n\n\t{$all_subs}\n</select>\n</div>\n\n</div>\n<div style=\"float: left;  width: 35%; margin-left: 3%;\">\n\t<div class=\"box\">\n    <h2>Search</h2>\n\n\t <input type=\"text\" id=\"search_terms\" name=\"search\" />\n\t <input type=\"submit\" value=\"" . _("Go!") . "\" name=\"searcher\" id=\"searcho\" />\n\t </div>\n</div>\n</form>\n<div class=\"box no_overflow\" class=\"clear-both\">\n<div id=\"results\"></div>\n</div>\n";
?>

<script type="text/javascript" language="javascript">
$(document).ready(function(){

	var thisguide = '<?php 
print $our_subject_id;
?>
';
	$("#all_subs").change(function() {
		var desired_guide = $("select option:selected").val();
		$("#results").fadeIn(3000).load("find_results.php", {shortform: desired_guide, guide_id: thisguide});
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:31,代码来源:discover.php

示例11: getTopic

 function getTopic($where, $page, $num)
 {
     global $DB, $table_topic;
     $TopicArr = array();
     $Tsql = "SELECT COUNT(`tid`) FROM `" . $table_topic . "` " . $where;
     $TotalTopic = $DB->fetch_one($Tsql);
     if ($TotalTopic > 0) {
         $RSql = "SELECT * FROM `" . $table_topic . "` " . $where . " ORDER BY `tid` DESC LIMIT " . ($page - 1) * $num . "," . $num;
         $Result = $DB->query($RSql);
         while ($Re = $DB->fetch_array($Result)) {
             $TopicArr[] = array("tid" => $Re['tid'], "fid" => $Re['fid'], "author" => stripslashes($Re['author']), "authorid" => $Re['authorid'], "authorico" => $Re['authorico'], "title" => filterHTML($Re['subject']), "subject" => Truncate(filterHTML($Re['subject']), 84), "dateline" => $Re['dateline'], "lasttime" => getCountDown($Re['lasttime']), "lastauthor" => stripslashes($Re['lastauthor']), "lastauthorid" => $Re['lastauthorid'], "lastauthorico" => $Re['lastauthorico'], "views" => $Re['views'], "replies" => $Re['replies'], "stick" => $Re['stick'], "digest" => $Re['digest'], "lockout" => $Re['lockout']);
         }
     }
     $return['Total'] = $TotalTopic;
     $return['Topic'] = $TopicArr;
     $return['Page'] = $this->Pagination($TotalTopic, $num, $page);
     return $return;
 }
开发者ID:tanny2015,项目名称:DataStructure,代码行数:18,代码来源:class_Query.php

示例12: getDBbySubBoxes

function getDBbySubBoxes($selected_sub)
{
    $db = new Querier();
    $subs_option_boxes = "";
    $alphabet = "";
    $subs_query = "SELECT distinct subject_id, subject, type FROM `subject` WHERE type = 'Subject' AND active = '1' ORDER BY subject";
    $subs_result = $db->query($subs_query);
    $num_subs = count($subs_result);
    if ($num_subs > 0) {
        foreach ($subs_result as $myrow) {
            $subs_id = $myrow[0];
            $subs_name = $myrow[1];
            $subs_name = Truncate($subs_name, 50, '');
            $subs_option_boxes .= "<option value=\"databases.php?letter=bysub&amp;subject_id={$subs_id}\"";
            if ($selected_sub == $subs_id) {
                $subs_option_boxes .= " selected=\"selected\"";
            }
            $subs_option_boxes .= ">" . _($subs_name) . "</option>";
        }
    }
    $alphabet .= " <select name=\"browser\" onChange=\"window.location=this.options[selectedIndex].value\">\n  <option value=\"\" style=\"color: #ccc;\">- by subject -</option>\n        {$subs_option_boxes}\n        </select>";
    return $alphabet;
}
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:23,代码来源:functions.php

示例13: getDBbySubBoxes

function getDBbySubBoxes($selected_sub, $additionaltype = "Placeholder")
{
    $db = new Querier();
    $subs_option_boxes = "";
    $alphabet = "";
    $morequery = "";
    if ($additionaltype != "") {
        $morequery = "OR type = '" . $additionaltype . "'";
    }
    $subs_query = "SELECT distinct subject_id, subject, type FROM `subject` WHERE (type = 'Subject' " . $morequery . ") AND active = '1' ORDER BY subject";
    $subs_query = "\n    SELECT DISTINCT s.subject_id, s.subject, s.type \nFROM SUBJECT s\nINNER JOIN rank r\nON s.subject_id = r.subject_id\nINNER JOIN title t\nON r.title_id = t.title_id\nINNER JOIN location_title lt\nON t.title_id = lt.title_id\nINNER JOIN location l\nON lt.location_id = l.location_id\nWHERE s.type = 'Subject' \nAND s.active = '1' \nAND l.eres_display = 'Y'\nORDER BY s.subject";
    $subs_result = $db->query($subs_query);
    $num_subs = count($subs_result);
    if ($num_subs > 0) {
        foreach ($subs_result as $myrow) {
            $subs_id = $myrow[0];
            $subs_name = $myrow[1];
            $subs_name = Truncate($subs_name, 50, '');
            $subs_option_boxes .= "<option value=\"databases.php?letter=bysub&amp;subject_id={$subs_id}\"";
            if ($selected_sub == $subs_id) {
                $subs_option_boxes .= " selected=\"selected\"";
            }
            $subs_option_boxes .= ">" . _($subs_name) . "</option>";
        }
    }
    $alphabet .= " <select name=\"browser\" onChange=\"window.location=this.options[selectedIndex].value\">\n  <option value=\"\" style=\"color: #ccc;\">- by subject -</option>\n        {$subs_option_boxes}\n        </select>";
    return $alphabet;
}
开发者ID:johnwinsor,项目名称:SubjectsPlus,代码行数:28,代码来源:functions.php

示例14: genTalkBacks

function genTalkBacks($tbArray, $show_response = 1)
{
    global $IconPath;
    $row_count1 = 0;
    $row_count2 = 0;
    $colour1 = "evenrow";
    $colour2 = "oddrow";
    $tb_answer = "";
    if (!is_array($tbArray)) {
        return "<strong>" . _("Alas, there are no items with this tag.") . "</strong>";
    }
    foreach ($tbArray as $key => $value) {
        $tb_tagger = "";
        $row_colour = $row_count2 % 2 ? $colour1 : $colour2;
        if ($value[2]) {
            $q_from = $value[2];
        } else {
            $q_from = _("Anonymous");
        }
        if ($value["answer"] == '') {
            $row_colour = "tb_highlight";
        }
        //show tag even if answer is not empty
        $tb_tagger = "<span class=\"ctag-on\">" . $value["tbtags"] . "</span>";
        if (isset($show_response) && $show_response == 0) {
            $first_div_width = "90%";
            $last_mod_tb = "";
        } else {
            $first_div_width = "45%";
            $short_answer = stripslashes(htmlspecialchars_decode(TruncByWord($value["answer"], 15)));
            $last_mod_tb = lastModded("talkback", $value["talkback_id"], 0, 1);
        }
        $short_question = Truncate($value["question"], 200);
        if ($last_mod_tb) {
            $mod_line = _("--") . $last_mod_tb;
        } else {
            $mod_line = "";
        }
        $tb_answer .= "\n            <div style=\"clear: both; float: left;  padding: 3px 5px; width: 98%;\" class=\"striper {$row_colour}\">\n                <div style=\"float: left; width: 32px; max-width: 5%;\"><a class=\"showmedium-reloader\" style=\"color: #333;\" href=\"talkback.php?talkback_id={$value['0']}&amp;wintype=pop\"><img src=\"{$IconPath}/pencil.png\" alt=\"edit\" width=\"16\" height=\"16\" /></a></div>\n                <div style=\"float: left; width: {$first_div_width};\">\n                 {$tb_tagger}<strong>Q:</strong> {$short_question} <span style=\"color: #666; font-size: 10px;\">({$q_from}, {$value['date_formatted']})</span>\n                </div>";
        if (isset($show_response) && $show_response == 1) {
            $tb_answer .= "<div style=\"float: left; width: 45%; margin-left: 4%;\">\n                 <strong>A:</strong> {$short_answer} <span style=\"color: #666; font-size: 10px;\">{$mod_line}</span>\n                </div>\n            ";
        }
        $tb_answer .= "</div>";
        $row_count2++;
    }
    return $tb_answer;
}
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:47,代码来源:index.php

示例15: outputCollection

 public function outputCollection($value)
 {
     global $IconPath;
     $collection_name = Truncate($value["name"], 25, '');
     $ourcolls = "\n        <div class=\"selected_item_wrapper\">\n            <div class=\"selected_item\">\n                <input name=\"collection[]\" value=\"{$value['faqpage_id']}\" type=\"hidden\" />\n                {$collection_name}\n            </div>\n            <div class=\"selected_item_options\">\n                <img src=\"{$IconPath}/delete.png\" class=\"delete_sub\" alt=\"" . "delete" . "\" title=\"" . "remove subject" . "\" border=\"0\">\n            </div>\n        </div>";
     return $ourcolls;
 }
开发者ID:kenirwin,项目名称:SubjectsPlus,代码行数:7,代码来源:FAQ.php


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