本文整理汇总了PHP中Utility::teaser方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::teaser方法的具体用法?PHP Utility::teaser怎么用?PHP Utility::teaser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility::teaser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareData
public function prepareData()
{
/** @var Response[]|Doctrine_Collection $responses */
$responses = $this->getBaseQuery()->execute();
$this->alternative_names = array();
$measurement = array();
$alternatives_list = array();
$this->criteria_names[0] = 'Total benefit';
// TODO: Response can have different "Rating method"
foreach ($responses as $response) {
foreach ($response->AlternativeMeasurement as $alternativeMeasurement) {
/** @var AlternativeMeasurement $alternativeMeasurement */
$alternative = $alternativeMeasurement->Alternative;
$criterion = $alternativeMeasurement->Criterion;
if (!isset($this->criteria_names[$criterion->id])) {
$this->criteria_names[$criterion->id] = Utility::teaser($criterion->name, 55);
}
if (!in_array($alternative->id, $this->filtered_alternatives_ids)) {
if (!isset($this->alternative_names[$alternative->id])) {
$this->alternative_names[$alternative->id] = Utility::teaser($alternative->name, 55);
}
if (!isset($measurement[$criterion->id][$alternative->id])) {
$measurement[$criterion->id][$alternative->id] = new AnalyzeAverageScore();
}
$measurement[$criterion->id][$alternative->id]->addScore($alternativeMeasurement->score);
$alternatives_list[$alternative->id] = 0;
}
}
}
if (count($measurement)) {
$graph = $this->saveGraph();
$alternatives_numb = count($alternatives_list);
foreach ($measurement as $criterion_id => $alternatives) {
$this->data[$criterion_id] = array();
/** @var PlannedAlternativeMeasurement $measurement */
foreach ($alternatives as $alternative_id => $measurement) {
$value = $measurement->getAverage();
$this->data[$criterion_id][$alternative_id] = $value;
if ($criterion_id) {
$this->graph_definitions[] = array($graph->id, $criterion_id, $alternative_id, $value);
}
}
// Sets 0 for alternatives without responses
if (count($this->data[$criterion_id]) && count($this->data[$criterion_id]) != $alternatives_numb) {
$this->data[$criterion_id] = $this->data[$criterion_id] + $alternatives_list;
}
if (!count($this->data[$criterion_id])) {
unset($this->data[$criterion_id]);
}
}
$this->saveGraphDefinitions();
}
}
示例2: prepareData
public function prepareData()
{
/** @var Response[]|Doctrine_Collection $responses */
$responses = $this->getBaseQuery()->execute();
foreach ($responses as $response) {
foreach ($response->AlternativeMeasurement as $alternativeMeasurement) {
/** @var AlternativeMeasurement $alternativeMeasurement */
$alternative = $alternativeMeasurement->Alternative;
$criterion = $alternativeMeasurement->Criterion;
if (!isset($this->criteria_names[$criterion->id])) {
$this->criteria_names[$criterion->id] = Utility::teaser($criterion->name, 55);
}
if (isset($this->measurement[$criterion->id][$alternative->id])) {
$this->measurement[$criterion->id][$alternative->id]->addScore($alternativeMeasurement->score);
} else {
$this->measurement[$criterion->id][$alternative->id] = new AnalyzeAverageScore();
$this->measurement[$criterion->id][$alternative->id]->addScore($alternativeMeasurement->score);
}
}
}
}
示例3: image_path
echo $item->id;
?>
" class="draggable ui-widget-content">
<div class="text-left">
<a href="javascript:void(0)" data-toggle="modal" data-target="#comments-<?php
echo $item->id;
?>
"><img style="margin-top: -5px" src="<?php
echo image_path('comment.png');
?>
" /></a>
<span class="bootstrap-tooltip" data-toggle="tooltip" data-placement="top" title="<?php
echo $item->name;
?>
"><?php
echo Utility::teaser($item->name, 42);
?>
</span>
</div>
<div class="desc-cell"><?php
echo $item->getRawValue()->getTooltip();
?>
</div>
</div>
</div>
<div class="col-xs-2"></div>
<div class="col-xs-5 text-center" style="position: relative">
<div id="rating-<?php
echo $max_rating - $i;
?>
" class="droppable ui-widget-header" style="float: right;"><?php
示例4: prepareData
public function prepareData()
{
/** @var Response[]|Doctrine_Collection $responses */
$responses = $this->getBaseQuery()->andWhere("c.variable_type = 'Benefit'")->execute();
$this->alternative_names = array();
foreach ($responses as $response) {
foreach ($response->AlternativeMeasurement as $alternativeMeasurement) {
/** @var AlternativeMeasurement $alternativeMeasurement */
$alternative = $alternativeMeasurement->Alternative;
$criterion = $alternativeMeasurement->Criterion;
if (!isset($this->criteria_names[$criterion->id])) {
$this->criteria_names[$criterion->id] = Utility::teaser($criterion->name, 55);
}
if (!in_array($alternative->id, $this->filtered_alternatives_ids)) {
if (!isset($this->alternative_names[$alternative->id])) {
$this->alternative_names[$alternative->id] = Utility::teaser($alternative->name, 55);
}
if (isset($this->measurement[$criterion->id][$alternative->id])) {
$this->measurement[$criterion->id][$alternative->id]->addScore($alternativeMeasurement->score);
} else {
$this->measurement[$criterion->id][$alternative->id] = new AnalyzeAverageScore();
$this->measurement[$criterion->id][$alternative->id]->addScore($alternativeMeasurement->score);
}
}
}
}
if (count($this->measurement)) {
if ($this->save_graph) {
$graph = $this->saveGraph();
}
foreach ($this->measurement as $criterion_id => $alternatives) {
$sum = $this->getSum($criterion_id);
if ($sum) {
$criterion_value = $this->getCriterionValue($criterion_id);
/** @var PlannedAlternativeMeasurement $measurement */
foreach ($alternatives as $alternative_id => $measurement) {
if (!isset($this->data[$criterion_id])) {
$this->data[$criterion_id] = array();
}
$value = $measurement->getAverage() / $sum;
$this->data[$criterion_id][$alternative_id] = $value * $criterion_value;
$this->cumulative_gain[$alternative_id][$criterion_id] = $value * $criterion_value;
if (!isset($this->sorted_alternative_ids[$alternative_id])) {
$this->sorted_alternative_ids[$alternative_id] = 0;
}
if (!isset($this->total_benefit[$alternative_id])) {
$this->total_benefit[$alternative_id] = 0;
}
$this->total_benefit[$alternative_id] += $value * $criterion_value;
$this->sorted_alternative_ids[$alternative_id] += $value * $criterion_value;
$this->graph_definitions[] = array($graph->id, $criterion_id, $alternative_id, $value * 100);
}
} else {
unset($this->criteria_names[$criterion_id]);
}
}
if ($this->save_graph) {
$this->saveGraphDefinitions();
}
}
}
示例5: foreach
</thead>
<tbody>
<?php
foreach ($alternatives as $alternative) {
?>
<tr>
<td class="active">
<label title="<?php
echo $alternative->name;
?>
">
<input id="all-alternative-<?php
echo $alternative->id;
?>
" type="checkbox" /> <?php
echo Utility::teaser($alternative->name, 30);
?>
</label>
</td>
<?php
foreach ($criteria as $criterion) {
?>
<td style="text-align: center;">
<input data-criterion="<?php
echo $criterion->id;
?>
" data-alternative="<?php
echo $alternative->id;
?>
" class="measure criterion-<?php