本文整理汇总了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>
示例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> </td>
<td><?php
echo $row['ispublic'] ? '<b>Public</b>' : 'Internal';
?>
</td>
<td style="text-align:right;padding-right:25px;"><?php
echo $faqs;
?>
</td>
<td> <?php
echo Format::db_datetime($row['updated']);
?>
</td>
</tr>
示例3: strpos
echo $row['priority_desc'];
?>
</td>
<td nowrap><?php
echo Format::truncate($row['name'], 22, strpos($row['name'], '@'));
?>
</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'], '@'));
?>
</td>
<?php
}
?>
</tr>
<?php
$class = $class == 'row2' ? 'row1' : 'row2';
}
//end of while.
} else {
//not tickets found!!
?>
<tr class="<?php
示例4: strpos
echo $row['attachments'] ? "<span class='Icon file'> </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'], '@'));
?>
</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>
示例5:
echo $row['ticketID'];
?>
"><?php
echo $subject;
?>
</a>
<?php
echo $row['attachments'] ? "<span class='Icon file'> </span>" : '';
?>
</td>
<td nowrap> <?php
echo Format::truncate($dept, 30);
?>
</td>
<td> <?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>
示例6: mysqli
</td>
<td> <?php
echo $row['status'];
?>
</td>
<td>
<a href="tickets.php?id=<?php
echo $row['ticket_id'];
?>
"><?php
echo $subject;
?>
</a>
</td>
<td> <?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> <?php
echo $row2[0];
示例7: truncate
function truncate($str, $len = 40)
{
return Format::truncate($str, $len);
}
示例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> <?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'];
示例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"> </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 " $files"; ?></a>
</td>
<td><?php echo $row['isenabled']?__('Active'):'<b>'.__('Disabled').'</b>'; ?></td>
<td><?php echo $row['department']?$row['department']:'— '.__('All Departments').' —'; ?></td>
<td> <?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');?>:
<a id="selectAll" href="#ckb"><?php echo __('All');?></a>
<a id="selectNone" href="#ckb"><?php echo __('None');?></a>
示例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>
示例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);
}
示例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> ".'<i
class="icon-fixed-width icon-comments-alt"></i> ';
if ($row['collaborators'])
echo '<i class="icon-fixed-width icon-group faded"></i> ';
if ($row['attachments'])
echo '<i class="icon-fixed-width icon-paperclip"></i> ';
?>
</td>
<?php
if ($user) { ?>
<td><?php echo Format::truncate($row['dept_name'], 40); ?></td>
<td> <?php echo $assigned; ?></td>
<?php
} else { ?>
<td> <?php echo sprintf('<a href="users.php?id=%d">%s <em> <%s></em></a>',
$row['user_id'], $row['name'], $row['email']); ?></td>
<?php
} ?>
</tr>
<?php
}
?>
</tbody>
</table>
</form>
<?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>
<?=$row['attachments']?"<span class='Icon file'> </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'],'@'))?> </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) { ?>
示例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> </td>
<td><?php echo $row['ispublic']?'<b>'.__('Public').'</b>':__('Internal'); ?></td>
<td style="text-align:right;padding-right:25px;"><?php echo $faqs; ?></td>
<td> <?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');?>:
<a id="selectAll" href="#ckb"><?php echo __('All');?></a>
<a id="selectNone" href="#ckb"><?php echo __('None');?></a>
<a id="selectToggle" href="#ckb"><?php echo __('Toggle');?></a>
示例15: strpos
echo $row['ticket_id'];
?>
"><?php
echo $subject;
?>
</a>
<?php
echo $row['attachments'] ? "<span class='Icon file'> </span>" : '';
?>
</td>
<td nowrap><?php
echo Format::truncate($row['name'], 22, strpos($row['name'], '@'));
?>
</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 {