當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Format::truncate方法代碼示例

本文整理匯總了PHP中Format::truncate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Format::truncate方法的具體用法?PHP Format::truncate怎麽用?PHP Format::truncate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Format的用法示例。


在下文中一共展示了Format::truncate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

        ?>
">
                <td width=7px>
                  <input type="checkbox" name="canned[]" value="<?php 
        echo $row['premade_id'];
        ?>
" <?php 
        echo $sel ? 'checked' : '';
        ?>
 
                        onClick="highLight(this.value,this.checked);">
                <td><a href="kb.php?id=<?php 
        echo $row['premade_id'];
        ?>
"><?php 
        echo Format::htmlchars(Format::truncate($row['title'], 60));
        ?>
</a></td>
                <td><b><?php 
        echo $row['isenabled'] ? 'Active' : 'Disabled';
        ?>
</b></td>
                <td><?php 
        echo $row['dept_name'] ? Format::htmlchars($row['dept_name']) : 'All Departments';
        ?>
</td>
                <td><?php 
        echo Format::db_datetime($row['updated']);
        ?>
</td>
            </tr>
開發者ID:amira147,項目名稱:omniphics,代碼行數:31,代碼來源:premade.inc.php

示例2:

">
                <td width=7px>
                  <input type="checkbox" name="ids[]" value="<?php 
        echo $row['category_id'];
        ?>
" class="ckb"
                            <?php 
        echo $sel ? 'checked="checked"' : '';
        ?>
>
                </td>
                <td><a href="categories.php?id=<?php 
        echo $row['category_id'];
        ?>
"><?php 
        echo Format::truncate($row['name'], 200);
        ?>
</a>&nbsp;</td>
                <td><?php 
        echo $row['ispublic'] ? '<b>Public</b>' : 'Internal';
        ?>
</td>
                <td style="text-align:right;padding-right:25px;"><?php 
        echo $faqs;
        ?>
</td>
                <td>&nbsp;<?php 
        echo Format::db_datetime($row['updated']);
        ?>
</td>
            </tr>
開發者ID:pkdevboxy,項目名稱:osTicket-1.7,代碼行數:31,代碼來源:categories.inc.php

示例3: strpos

        echo $row['priority_desc'];
        ?>
</td>
                <td nowrap><?php 
        echo Format::truncate($row['name'], 22, strpos($row['name'], '@'));
        ?>
&nbsp;</td>
		<?php 
        if ($row['assigned_name'] == "") {
            ?>
                <td nowrap>- Unassigned -</td>
		<?php 
        } else {
            ?>
                <td nowrap><?php 
            echo Format::truncate($row['assigned_name'], 22, strpos($row['assigned_name'], '@'));
            ?>
&nbsp;</td>
		<?php 
        }
        ?>
            </tr>
            <?php 
        $class = $class == 'row2' ? 'row1' : 'row2';
    }
    //end of while.
} else {
    //not tickets found!!
    ?>
 
            <tr class="<?php 
開發者ID:amira147,項目名稱:omniphics,代碼行數:31,代碼來源:tickets.inc.php

示例4: strpos

echo $row['attachments'] ? "<span class='Icon file'>&nbsp;</span>" : '';
?>
</td>
                <td nowrap><?php 
echo Format::truncate($row['dept_name'], 30);
?>
</td>
                <td class="nohover" align="center" style="background-color:<?php 
echo $row['priority_color'];
?>
;"><?php 
echo $row['priority_desc'];
?>
</td>
                <td nowrap><?php 
echo Format::truncate($row['name'], 22, strpos($row['name'], '@'));
?>
&nbsp;</td>
            </tr>
            <?
            $class = ($class =='row2') ?'row1':'row2';
            } //end of while.
        else: //not tickets found!! ?> 
            <tr class="<?php 
echo $class;
?>
"><td colspan=8><b>Query returned 0 results.</b></td></tr>
        <?
        endif; ?>
       </table>
    </td></tr>
開發者ID:jeremyweiss,項目名稱:osTicket-Beinahe-Zwei,代碼行數:31,代碼來源:tickets.inc.php

示例5:

echo $row['ticketID'];
?>
"><?php 
echo $subject;
?>
</a>
                    &nbsp;<?php 
echo $row['attachments'] ? "<span class='Icon file'>&nbsp;</span>" : '';
?>
</td>
                <td nowrap>&nbsp;<?php 
echo Format::truncate($dept, 30);
?>
</td>
                <td>&nbsp;<?php 
echo Format::truncate($row['email'], 40);
?>
</td>
            </tr>
            <?
            $class = ($class =='row2') ?'row1':'row2';
            } //end of while.
        else: //not tickets found!! ?> 
            <tr class="<?php 
echo $class;
?>
"><td colspan=7><b>NO tickets found.</b></td></tr>
        <?
        endif; ?>
     </table>
    </td></tr>
開發者ID:supaket,項目名稱:helpdesk,代碼行數:31,代碼來源:tickets.inc.php

示例6: mysqli

</td>
                <td>&nbsp;<?php 
        echo $row['status'];
        ?>
</td>
                <td>
                    <a href="tickets.php?id=<?php 
        echo $row['ticket_id'];
        ?>
"><?php 
        echo $subject;
        ?>
</a>
                </td>
                <td>&nbsp;<?php 
        echo Format::truncate($dept, 30);
        ?>
</td>
<?php 
        $mysqli = new mysqli("localhost", "osticket", "0571ck37", "osticket1911");
        /* check connection */
        if (mysqli_connect_errno()) {
            printf("Connect failed: %s\n", mysqli_connect_error());
            exit;
        }
        $query2 = " SELECT \n                CAST(localizador AS char(100) CHARACTER SET utf8),\n                CAST(status_loc AS char(100) CHARACTER SET utf8) \n            FROM `ost_ticket__cdata` \n            WHERE ticket_id = " . $row['ticket_id'];
        $result2 = $mysqli->query($query2);
        $row2 = $result2->fetch_array();
        ?>
                <td>&nbsp;<?php 
        echo $row2[0];
開發者ID:jmangarret,項目名稱:ostickets,代碼行數:31,代碼來源:tickets_20150916.inc.php

示例7: truncate

function truncate($str, $len = 40)
{
    return Format::truncate($str, $len);
}
開發者ID:brysonian,項目名稱:Saint,代碼行數:4,代碼來源:Format.php

示例8:

        ?>
">
              <td width=7px>
               <input type="checkbox" name="tids[]" value="<?php 
        echo $row['topic_id'];
        ?>
" <?php 
        echo $sel ? 'checked' : '';
        ?>
  onClick="highLight(this.value,this.checked);">
              </td>
              <td><a href="admin.php?t=topics&id=<?php 
        echo $row['topic_id'];
        ?>
"><?php 
        echo Format::htmlchars(Format::truncate($row['topic'], 30));
        ?>
</a></td>
              <td><?php 
        echo $row['isactive'] ? _('Active') : _('<b>Disabled</b>');
        ?>
</td>
              <td>&nbsp;&nbsp;<?php 
        echo $row['noautoresp'] ? _('No') : _('<b>Yes</b>');
        ?>
</td>
              <td><a href="admin.php?t=dept&id=<?php 
        echo $row['dept_id'];
        ?>
"><?php 
        echo $row['dept_name'];
開發者ID:jahanzaibbahadur,項目名稱:Katak-support,代碼行數:31,代碼來源:helptopics.inc.php

示例9: is_array

     $total=0;
     $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null;
     if($res && db_num_rows($res)):
         while ($row = db_fetch_array($res)) {
             $sel=false;
             if($ids && in_array($row['canned_id'],$ids))
                 $sel=true;
             $files=$row['files']?'<span class="Icon file">&nbsp;</span>':'';
             ?>
         <tr id="<?php echo $row['canned_id']; ?>">
             <td width=7px>
               <input type="checkbox" name="ids[]" value="<?php echo $row['canned_id']; ?>" class="ckb"
                         <?php echo $sel?'checked="checked"':''; ?> />
             </td>
             <td>
                 <a href="canned.php?id=<?php echo $row['canned_id']; ?>"><?php echo Format::truncate($row['title'],200); echo "&nbsp;$files"; ?></a>&nbsp;
             </td>
             <td><?php echo $row['isenabled']?__('Active'):'<b>'.__('Disabled').'</b>'; ?></td>
             <td><?php echo $row['department']?$row['department']:'&mdash; '.__('All Departments').' &mdash;'; ?></td>
             <td>&nbsp;<?php echo Format::db_datetime($row['updated']); ?></td>
         </tr>
         <?php
         } //end of while.
     endif; ?>
 <tfoot>
  <tr>
     <td colspan="5">
         <?php if($res && $num){ ?>
         <?php echo __('Select');?>:&nbsp;
         <a id="selectAll" href="#ckb"><?php echo __('All');?></a>&nbsp;&nbsp;
         <a id="selectNone" href="#ckb"><?php echo __('None');?></a>&nbsp;&nbsp;
開發者ID:CarlosAvilesMx,項目名稱:CarlosAviles.Mx,代碼行數:31,代碼來源:cannedresponses.inc.php

示例10: array

$types = array('M', 'R');
if ($thread = $ticket->getThreadEntries($types)) {
    $threadTypes = array('M' => 'message', 'R' => 'response', 'N' => 'note');
    foreach ($thread as $entry) {
        ?>
        <div class="thread-entry <?php 
        echo $threadTypes[$entry->type];
        ?>
">
            <table class="header"><tr><td>
                    <span><?php 
        echo Format::datetime($entry->created);
        ?>
</span>
                    <span style="padding:0 1em" class="faded title"><?php 
        echo Format::truncate($entry->title, 100);
        ?>
</span>
                </td>
                <td class="flush-right faded title" style="white-space:no-wrap">
                    <?php 
        echo Format::htmlchars($entry->getName());
        ?>
</span>
                </td>
            </tr></table>
            <div class="thread-body">
                <div><?php 
        echo $entry->getBody()->display('pdf');
        ?>
</div>
開發者ID:majklovec,項目名稱:osticket-bootstrap-theme,代碼行數:31,代碼來源:ticket-print.tmpl.php

示例11: _print


//.........這裏部分代碼省略.........
             $closedby = (string) $staff->getName();
         }
         $this->WriteCell($l, 7, __('Closed By'), 1, 0, 'L', true);
         $this->SetFont('');
         $this->WriteCell($c, 7, $closedby, 1, 0, 'L', true);
     }
     $this->SetFont('Arial', 'B', 11);
     $this->WriteCell($l, 7, __('Help Topic'), 1, 0, 'L', true);
     $this->SetFont('');
     $this->WriteCell($c, 7, $ticket->getHelpTopic(), 1, 1, 'L', true);
     $this->SetFont('Arial', 'B', 11);
     $this->WriteCell($l, 7, __('SLA Plan'), 1, 0, 'L', true);
     $this->SetFont('');
     $sla = $ticket->getSLA();
     $this->WriteCell($c, 7, $sla ? $sla->getName() : ' -- ', 1, 0, 'L', true);
     $this->SetFont('Arial', 'B', 11);
     $this->WriteCell($l, 7, __('Last Response'), 1, 0, 'L', true);
     $this->SetFont('');
     $this->WriteCell($c, 7, Format::db_datetime($ticket->getLastRespDate()), 1, 1, 'L', true);
     $this->SetFont('Arial', 'B', 11);
     if ($ticket->isOpen()) {
         $this->WriteCell($l, 7, __('Due Date'), 1, 0, 'L', true);
         $this->SetFont('');
         $this->WriteCell($c, 7, Format::db_datetime($ticket->getEstDueDate()), 1, 0, 'L', true);
     } else {
         $this->WriteCell($l, 7, __('Close Date'), 1, 0, 'L', true);
         $this->SetFont('');
         $this->WriteCell($c, 7, Format::db_datetime($ticket->getCloseDate()), 1, 0, 'L', true);
     }
     $this->SetFont('Arial', 'B', 11);
     $this->WriteCell($l, 7, __('Last Message'), 1, 0, 'L', true);
     $this->SetFont('');
     $this->WriteCell($c, 7, Format::db_datetime($ticket->getLastMsgDate()), 1, 1, 'L', true);
     $this->SetFillColor(255, 255, 255);
     foreach (DynamicFormEntry::forTicket($ticket->getId()) as $form) {
         $idx = 0;
         foreach ($form->getAnswers() as $a) {
             if (in_array($a->getField()->get('name'), array('email', 'name', 'subject', 'phone', 'priority'))) {
                 continue;
             }
             $this->SetFont('Arial', 'B', 11);
             if ($idx++ === 0) {
                 $this->Ln(5);
                 $this->SetFillColor(244, 250, 255);
                 $this->WriteCell(($l + $c) * 2, 7, $a->getForm()->get('title'), 1, 0, 'L', true);
                 $this->SetFillColor(255, 255, 255);
             }
             if ($val = $a->toString()) {
                 $this->Ln(7);
                 $this->WriteCell($l * 2, 7, $a->getField()->get('label'), 1, 0, 'L', true);
                 $this->SetFont('');
                 $this->WriteCell($c * 2, 7, $val, 1, 0, 'L', true);
             }
         }
     }
     $this->SetFillColor(244, 250, 255);
     $this->Ln(10);
     $this->SetFont('Arial', 'B', 11);
     $this->cMargin = 0;
     $this->SetTextColor(10, 86, 142);
     $this->WriteCell($w, 7, trim($ticket->getSubject()), 0, 0, 'L');
     $this->Ln(7);
     $this->SetTextColor(0);
     $this->cMargin = 3;
     //Table header colors (RGB)
     $colors = array('M' => array(195, 217, 255), 'R' => array(255, 224, 179), 'N' => array(250, 250, 210));
     //Get ticket thread
     $types = array('M', 'R');
     if ($this->includenotes) {
         $types[] = 'N';
     }
     if ($entries = $ticket->getThreadEntries($types)) {
         foreach ($entries as $entry) {
             $color = $colors[$entry['thread_type']];
             $this->SetFillColor($color[0], $color[1], $color[2]);
             $this->SetFont('Arial', 'B', 11);
             $this->WriteCell($w / 2, 7, Format::db_datetime($entry['created']), 'LTB', 0, 'L', true);
             $this->SetFont('Arial', '', 10);
             $this->WriteCell($w, 7, Format::truncate($entry['title'], 50), 'TB', 0, 'L', true);
             $this->WriteCell($w / 2, 7, $entry['name'] ?: $entry['poster'], 'TBR', 1, 'L', true);
             $this->SetFont('');
             $text = $entry['body']->display('pdf');
             if ($entry['attachments'] && ($tentry = $ticket->getThreadEntry($entry['id'])) && ($attachments = $tentry->getAttachments())) {
                 $files = array();
                 foreach ($attachments as $attachment) {
                     if (!$attachment['inline']) {
                         $files[] = $attachment['name'];
                     }
                 }
                 if ($files) {
                     $text .= "<div>Files Attached: [" . implode(', ', $files) . "]</div>";
                 }
                 $text .= "<div>" . sprintf(__('Files Attached: [%s]'), implode(', ', $files)) . "</div>";
             }
             $this->WriteHtml('<div class="thread-body">' . $text . '</div>', 2, false, false);
             $this->Ln(5);
         }
     }
     $this->WriteHtml('', 2, false, true);
 }
開發者ID:KingsleyGU,項目名稱:osticket,代碼行數:101,代碼來源:class.pdf.php

示例12: if

            <td><?php echo $status; ?></td>
            <td><a <?php if ($flag) { ?> class="Icon <?php echo $flag; ?>Ticket" title="<?php echo ucfirst($flag); ?> Ticket" <?php } ?>
                href="tickets.php?id=<?php echo $row['ticket_id']; ?>"><?php echo $subject; ?></a>
                 <?php
                    if ($threadcount>1)
                        echo "<small>($threadcount)</small>&nbsp;".'<i
                            class="icon-fixed-width icon-comments-alt"></i>&nbsp;';
                    if ($row['collaborators'])
                        echo '<i class="icon-fixed-width icon-group faded"></i>&nbsp;';
                    if ($row['attachments'])
                        echo '<i class="icon-fixed-width icon-paperclip"></i>&nbsp;';
                ?>
            </td>
            <?php
            if ($user) { ?>
            <td><?php echo Format::truncate($row['dept_name'], 40); ?></td>
            <td>&nbsp;<?php echo $assigned; ?></td>
            <?php
            } else { ?>
            <td>&nbsp;<?php echo sprintf('<a href="users.php?id=%d">%s <em> &lt;%s&gt;</em></a>',
                    $row['user_id'], $row['name'], $row['email']); ?></td>
            <?php
            } ?>
        </tr>
   <?php
    }
    ?>
    </tbody>
</table>
</form>
<?php
開發者ID:KingsleyGU,項目名稱:osticket,代碼行數:31,代碼來源:tickets.tmpl.php

示例13:

         <tr class="<?=$class?> " id="<?=$row['ticket_id']?>">
             <?if($canDelete || $canClose) {?>
             <td align="center" class="nohover">
                 <input type="checkbox" name="tids[]" value="<?=$row['ticket_id']?>" onClick="highLight(this.value,this.checked);">
             </td>
             <?}?>
             <td align="center" title="<?=$row['email']?>" nowrap>
               <a class="Icon <?=strtolower($row['source'])?>Ticket" title="<?=$row['source']?> Ticket: <?=$row['email']?>" 
                 href="tickets.php?id=<?=$row['ticket_id']?>"><?=$tid?></a></td>
             <td align="center" nowrap><?=Format::db_date($row['created'])?></td>
             <td><a <?if($flag) { ?> class="Icon <?=$flag?>Ticket" title="<?=ucfirst($flag)?> Ticket" <?}?> 
                 href="tickets.php?id=<?=$row['ticket_id']?>"><?=$subject?></a>
                 &nbsp;<?=$row['attachments']?"<span class='Icon file'>&nbsp;</span>":''?></td>
             <td nowrap><?=Format::truncate($row['dept_name'],30)?></td>
             <td class="nohover" align="center" style="background-color:<?=$row['priority_color']?>;"><?=$row['priority_desc']?></td>
             <td nowrap><?=Format::truncate($row['name'],22,strpos($row['name'],'@'))?>&nbsp;</td>
         </tr>
         <?
         $class = ($class =='row2') ?'row1':'row2';
         } //end of while.
     else: //not tickets found!! ?> 
         <tr class="<?=$class?>"><td colspan=8><b>Query returned 0 results.</b></td></tr>
     <?
     endif; ?>
    </table>
 </td></tr>
 <?
 if($num>0){ //if we actually had any tickets returned.
 ?>
     <tr><td style="padding-left:20px">
         <?if($canDelete || $canClose) { ?>
開發者ID:hungnv0789,項目名稱:vhtm,代碼行數:31,代碼來源:tickets.inc.php

示例14: while

        if($res && db_num_rows($res)):
            while ($row = db_fetch_array($res)) {
                $sel=false;
                if($ids && in_array($row['category_id'],$ids))
                    $sel=true;

                $faqs=0;
                if($row['faqs'])
                    $faqs=sprintf('<a href="faq.php?cid=%d">%d</a>',$row['category_id'],$row['faqs']);
                ?>
            <tr id="<?php echo $row['category_id']; ?>">
                <td width=7px>
                  <input type="checkbox" name="ids[]" value="<?php echo $row['category_id']; ?>" class="ckb"
                            <?php echo $sel?'checked="checked"':''; ?>>
                </td>
                <td><a href="categories.php?id=<?php echo $row['category_id']; ?>"><?php echo Format::truncate($row['name'],200); ?></a>&nbsp;</td>
                <td><?php echo $row['ispublic']?'<b>'.__('Public').'</b>':__('Internal'); ?></td>
                <td style="text-align:right;padding-right:25px;"><?php echo $faqs; ?></td>
                <td>&nbsp;<?php echo Format::db_datetime($row['updated']); ?></td>
            </tr>
            <?php
            } //end of while.
        endif; ?>
    <tfoot>
     <tr>
        <td colspan="5">
            <?php if($res && $num){ ?>
            <?php echo __('Select');?>:&nbsp;
            <a id="selectAll" href="#ckb"><?php echo __('All');?></a>&nbsp;&nbsp;
            <a id="selectNone" href="#ckb"><?php echo __('None');?></a>&nbsp;&nbsp;
            <a id="selectToggle" href="#ckb"><?php echo __('Toggle');?></a>&nbsp;&nbsp;
開發者ID:KingsleyGU,項目名稱:osticket,代碼行數:31,代碼來源:categories.inc.php

示例15: strpos

        echo $row['ticket_id'];
        ?>
"><?php 
        echo $subject;
        ?>
</a>
                &nbsp;<?php 
        echo $row['attachments'] ? "<span class='Icon file'>&nbsp;</span>" : '';
        ?>
</td>
            <td nowrap><?php 
        echo Format::truncate($row['name'], 22, strpos($row['name'], '@'));
        ?>
&nbsp;</td>
            <td nowrap><?php 
        echo Format::truncate($row['dept_name'], 30);
        ?>
</td>
            <td class="nohover" align="center" style="color:<?php 
        echo $row['priority_color'];
        ?>
;"><?php 
        echo $row['priority_desc'];
        ?>
</td>
        </tr>
        <?php 
        $class = $class == 'row2' ? 'row1' : 'row2';
    }
    //end of while.
} else {
開發者ID:jahanzaibbahadur,項目名稱:Katak-support,代碼行數:31,代碼來源:tickets.inc.php


注:本文中的Format::truncate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。