| 1 |
<?php |
|---|
| 2 |
sfLoader::loadHelpers('I18N'); |
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
function flag_image_tag($country_code, $options = null) |
|---|
| 12 |
{ |
|---|
| 13 |
if (!$country_code) |
|---|
| 14 |
{ |
|---|
| 15 |
return ''; |
|---|
| 16 |
} |
|---|
| 17 |
|
|---|
| 18 |
$options = _parse_attributes($options); |
|---|
| 19 |
|
|---|
| 20 |
if (isset($options['class'])) |
|---|
| 21 |
{ |
|---|
| 22 |
$options['class'] = trim($options['class']) . ' flag'; |
|---|
| 23 |
} |
|---|
| 24 |
else |
|---|
| 25 |
{ |
|---|
| 26 |
$options['class'] = 'flag'; |
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
$options['alt'] = format_country($country_code); |
|---|
| 30 |
$flag_image = sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'flags'.DIRECTORY_SEPARATOR.strtolower($country_code).'.png'; |
|---|
| 31 |
if (!file_exists($flag_image)) |
|---|
| 32 |
{ |
|---|
| 33 |
return ''; |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
return image_tag('flags/'.strtolower($country_code).'.png', $options); |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
function application_image_tag($application, $options = null) |
|---|
| 47 |
{ |
|---|
| 48 |
return image_tag(sprintf('/%s/applications/%s', |
|---|
| 49 |
sfContext::getInstance()->getConfiguration()->getUploadDirName(), |
|---|
| 50 |
$application->getScreenshotPath()), $options); |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
function company_image_tag($company, $options = null) |
|---|
| 61 |
{ |
|---|
| 62 |
return image_tag(sprintf('/%s/companies/%s', |
|---|
| 63 |
sfContext::getInstance()->getConfiguration()->getUploadDirName(), |
|---|
| 64 |
$company->getLogoPath()), $options); |
|---|
| 65 |
} |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
function person_image_tag($person, $format = 'standard', $options = null) |
|---|
| 76 |
{ |
|---|
| 77 |
if (!$person->getAvatarPath()) |
|---|
| 78 |
{ |
|---|
| 79 |
$config = sfConfig::get('app_people_formats', array()); |
|---|
| 80 |
|
|---|
| 81 |
if (isset($config[$format]['default'])) |
|---|
| 82 |
{ |
|---|
| 83 |
return image_tag(sprintf('/images/%s', $config[$format]['default']), $options); |
|---|
| 84 |
} |
|---|
| 85 |
} |
|---|
| 86 |
|
|---|
| 87 |
return image_tag(sprintf('/%s/people/%s', |
|---|
| 88 |
sfContext::getInstance()->getConfiguration()->getUploadDirName(), |
|---|
| 89 |
$person->getAvatarPath()), $options); |
|---|
| 90 |
} |
|---|