67 lines
1.8 KiB
PHP
67 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* event actions.
|
|
*
|
|
* @package pae
|
|
* @subpackage event
|
|
* @author Your name here
|
|
* @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
|
|
*/
|
|
class eventActions extends autoeventActions
|
|
{
|
|
/**
|
|
* Custom event saving functionality
|
|
*
|
|
* @return void
|
|
* @author Benjamin Ramey <ben.ramey@gmail.com>
|
|
**/
|
|
public function updateEventFromRequest()
|
|
{
|
|
parent::updateEventFromRequest();
|
|
|
|
$request = $this->getRequest();
|
|
|
|
// save the titles
|
|
foreach($request->getParameter('title') as $culture => $value)
|
|
{
|
|
$this->event->setCulture($culture);
|
|
$this->event->setTitle($value);
|
|
}
|
|
|
|
// save the descriptions
|
|
foreach($request->getParameter('description') as $culture => $value)
|
|
{
|
|
$this->event->setCulture($culture);
|
|
$this->event->setDescription($value);
|
|
}
|
|
|
|
// save the event picture
|
|
if($request->hasFiles())
|
|
{
|
|
foreach($request->getFileNames() as $fileName)
|
|
{
|
|
if($request->getFileSize($fileName) <= 0)
|
|
continue;
|
|
|
|
$eventImagePath = sfConfig::get('sf_web_dir').'/images/events';
|
|
$pictureName = preg_replace("/\W/", "", $this->event->getTitle()) . $request->getFileExtension($fileName);
|
|
$request->moveFile($fileName, $eventImagePath.'/'.$pictureName);
|
|
|
|
// resize the image to the standard size
|
|
$image = new phMagick($eventImagePath.'/'.$pictureName);
|
|
$image->setDestination($eventImagePath.'/'.$pictureName);
|
|
$image->resize(400, 0);
|
|
|
|
// create the thumbnail image
|
|
$thumbnail = $image;
|
|
$thumbnail->setDestination($eventImagePath.'/thumb_'.$pictureName);
|
|
$thumbnail->resize(70,0);
|
|
|
|
// save the image name in the employee
|
|
$this->event->setPicture($pictureName);
|
|
}
|
|
}
|
|
}
|
|
}
|