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


PHP Attachments::getLink方法代码示例

本文整理汇总了PHP中Attachments::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachments::getLink方法的具体用法?PHP Attachments::getLink怎么用?PHP Attachments::getLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Attachments的用法示例。


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

示例1: renderFormFieldByType

 public static function renderFormFieldByType($f, $values)
 {
     $value = isset($values[$f['id']]) ? $values[$f['id']] : '';
     $attributes = array();
     switch ($f['type']) {
         case 'file':
             $html = '';
             if ($value > 0) {
                 if ($a = Doctrine_Core::getTable('Attachments')->find($value)) {
                     $html = '<br>' . Attachments::getLink($a) . input_hidden_tag('extra_fields_files[' . $f['id'] . ']', $value) . '<br>' . input_checkbox_tag('extra_fields_files_delete[' . $f['id'] . ']', $value) . ' <label for="extra_fields_files_delete_' . $f['id'] . '">' . __('Delete') . '</label>';
                     $attributes['class'] = '';
                 }
             }
             return input_file_tag('extra_fields[' . $f['id'] . ']', '', $attributes) . $html;
             break;
         case 'number':
             return input_tag('extra_fields[' . $f['id'] . ']', $value, $attributes);
             break;
         case 'text':
         case 'url':
             $attributes['size'] = '40';
             return input_tag('extra_fields[' . $f['id'] . ']', $value, $attributes);
             break;
         case 'textarea':
             return textarea_tag('extra_fields[' . $f['id'] . ']', $value, $attributes);
             break;
         case 'textarea_wysiwyg':
             if (isset($attributes['class'])) {
                 $attributes['class'] .= ' editor';
             } else {
                 $attributes['class'] = 'editor';
             }
             return textarea_tag('extra_fields[' . $f['id'] . ']', $value, $attributes);
             break;
         case 'date':
             if (isset($attributes['class'])) {
                 $attributes['class'] .= ' datepicker';
             } else {
                 $attributes['class'] = 'datepicker';
             }
             $attributes['size'] = '11';
             return input_tag('extra_fields[' . $f['id'] . ']', $value, $attributes);
             break;
         case 'date_range':
             if (isset($attributes['class'])) {
                 $attributes['class'] .= ' datepicker';
             } else {
                 $attributes['class'] = 'datepicker';
             }
             $attributes['size'] = '11';
             if (strlen($value) > 0) {
                 $value = explode('|', $value);
             } else {
                 $value = array('', '');
             }
             return __('From') . ': ' . input_tag('extra_fields[' . $f['id'] . '][from]', $value[0], $attributes) . ' ' . __('To') . ': ' . input_tag('extra_fields[' . $f['id'] . '][to]', $value[1], $attributes);
             break;
         case 'date_time':
             if (isset($attributes['class'])) {
                 $attributes['class'] .= ' datetimepicker';
             } else {
                 $attributes['class'] = 'datetimepicker';
             }
             $attributes['size'] = '17';
             return input_tag('extra_fields[' . $f['id'] . ']', $value, $attributes);
             break;
         case 'date_dropdown':
             $years = range(date('Y') - 100, date('Y') + 20);
             $w = new sfWidgetFormDate(array('years' => array_combine($years, $years), 'format' => __('Year') . ':%year% ' . __('Month') . ':%month% ' . __('Day') . ':%day%'));
             return $w->render('extra_fields[' . $f['id'] . ']', $value, $attributes);
             break;
         case 'pull_down':
             $choices = array();
             foreach (explode("\n", $f['default_values']) as $v) {
                 $choices[trim($v)] = trim($v);
             }
             return select_tag('extra_fields[' . $f['id'] . ']', $value, array('choices' => $choices), $attributes);
             break;
         case 'checkbox':
             $choices = array();
             foreach (explode("\n", $f['default_values']) as $v) {
                 $choices[trim($v)] = trim($v);
             }
             return '<div id="checkboxesList' . $f['id'] . '" class="checkboxesList">' . select_tag('extra_fields[' . $f['id'] . ']', explode("\n", $value), array('choices' => $choices, 'expanded' => true, 'multiple' => true), $attributes) . '</div>';
             break;
         case 'radiobox':
             $choices = array();
             foreach (explode("\n", $f['default_values']) as $v) {
                 $choices[trim($v)] = trim($v);
             }
             return select_tag('extra_fields[' . $f['id'] . ']', $value, array('choices' => $choices, 'expanded' => true), $attributes);
             break;
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:94,代码来源:ExtraFieldsList.class.php

示例2: foreach

<?php

foreach ($attachments as $a) {
    $file_path = sfConfig::get('sf_upload_dir') . '/attachments/' . $a->getFile();
    ?>
  <div id="attachedFile<?php 
    echo $a->getId();
    ?>
">
    <table>
      <tr>
        <td colspan="2"><?php 
    echo Attachments::getFileIcon($a->getFile()) . ' ' . (is_file($file_path) ? getimagesize($file_path) ? link_to(substr($a->getFile(), 7), 'attachments/view?id=' . $a->getId(), array('target' => '_blank', 'absolute' => true)) : Attachments::getLink($a) : substr($a->getFile(), 7));
    ?>
</td>
      </tr>                                                                                     
      </tr>
        <?php 
    if ($a->getBindType() != 'wiki') {
        ?>
        <td><?php 
        echo __('Description') . ':</td><td> ' . textarea_tag('attachments_info[' . $a->getId() . ']', $a->getInfo(), array('style' => 'height: 50px;', 'class' => 'attachments_textarea'));
        ?>
</td>
        <?php 
    }
    ?>
        
        <td><a href="#" onClick="return deleteAttachments(<?php 
    echo $a->getId();
    ?>
开发者ID:noikiy,项目名称:qdpm,代码行数:31,代码来源:previewSuccess.php


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