# default values
all:
- max_offices_on_pager: 3
- max_ads_on_pager: 2
- max_categories_on_pager: 3
- default_language: eng # Everything must exist at least with this language
+ max_offices_on_pager: 3
+ max_ads_on_pager: 2
+ max_categories_on_pager: 3
+ default_picture_directory: /home/gustavo/symfonyreloaded/mobiads/web/uploads/images/
+ default_language: eng # Everything must exist at least with this language
sf_guard_plugin:
remember_key_expiration_age: 2592000 # 30 days in seconds
$this->forward404Unless($companyId == $companyUserId, sprintf('Ad does not exist (%s).', $request->getParameter('id')));
+ //Remove picture from file system.
+ $fs = new sfFilesystem();
+ $fs->remove(sfConfig::get('app_default_picture_directory').$ad->getAdMobileImageLink());
+ //Remove ad from database.
$ad->delete();
$this->redirect('ad/index');
<tbody>
<?php foreach ($ads as $ad): ?>
<tr>
- <td><img src="<?php echo $ad->getAd()->getAdMobileImageLink() ?>" width="80" height="80" alt="<?php echo $ad->getAdName() ?>"/></td>
+ <td><img src="<?php echo "/uploads/images/".$ad->getAd()->getAdMobileImageLink() ?>" width="80" height="80" alt="<?php echo $ad->getAdName() ?>"/></td>
<td>
<?php if ($ad->getAd()->getCompanyCategId() != null): ?>
<?php echo $ad->getAd()->getCompanyCategory() ?>
<?php endif; ?>
</td>
<td><?php echo $ad->getAdName() ?></td>
- <td><a href="<?php echo url_for('ad/edit?id='.$ad->getAd()->getId()) ?>"><img src="/images/pencil_add.png" alt="" title="" border="0" /></a></td>
+ <td><a href="<?php echo url_for('ad/edit?id='.$ad->getAd()->getId().'&page='.$page) ?>"><img src="/images/pencil_add.png" alt="" title="" border="0" /></a></td>
<td><?php echo link_to('<img src="/images/inadminpanel/images/trash.png" alt="" title="" border="0" />', 'ad/delete?id='.$ad->getAd()->getId(), array('method' => 'delete', 'confirm' => 'Are you sure?')) ?></td>
</tr>
'required' => false,
'query' => $companyCategs));
+
+ $this->widgetSchema['ad_mobile_image_link'] =
+ new sfWidgetFormInputFileEditable(array('file_src' => '/uploads/images/'.$this->getObject()->ad_mobile_image_link,
+ 'edit_mode' => !$this->isNew(),
+ 'is_image' => true,
+ 'with_delete' => false));
+
+
+ $this->validatorSchema['ad_mobile_image_link'] = new sfValidatorFile(array('mime_types' => 'web_images',
+ 'path' => sfConfig::get('app_default_picture_directory'),
+ 'required' => true));
+
+
$this->widgetSchema->setLabels(array('company_categ_id' => 'Company Category'));
$this->widgetSchema->setLabels(array('ad_mobile_image_link' => "Picture on the user's mobile"));