public static function callEvent(BaseEvent $event) { $status = BaseEvent::NORMAL; foreach ($event::$handlerPriority as $priority => $handlerList) { if (count($handlerList) > 0) { $event->setPrioritySlot($priority); foreach ($handlerList as $handler) { call_user_func($handler, $event); } if ($event->isForced()) { if ($event instanceof CancellableEvent and $event->isCancelled()) { return BaseEvent::DENY; } else { return BaseEvent::ALLOW; } } } } if ($event instanceof CancellableEvent and $event->isCancelled()) { return BaseEvent::DENY; } elseif ($event->isAllowed()) { return BaseEvent::ALLOW; } else { return BaseEvent::NORMAL; } }
public function delete($connection = null) { parent::delete($connection); if (isset($this->informationObject)) { QubitSearch::updateInformationObject($this->getInformationObject()); } }
public function save(Doctrine_Connection $conn = null) { $slug = Magic::slugify($this->getTitle()); if ($this->isNew()) { $i = 0; do { $i++; $q = Doctrine::getTable('Event')->findOneBySlug($slug); if (!$q) { break; } else { $slug = Magic::slugify($this->getTitle()); $slug .= $i; } } while ($i); $this->setSlug($slug); } elseif ($slug != $this->getSlug()) { $i = 0; do { $i++; $q = Doctrine::getTable('Event')->findOneBySlug($slug); if (!$q) { $this->setSlug($slug); break; } else { if ($slug == $this->getSlug()) { break; } else { $slug = Magic::slugify($this->getTitle()); $slug .= $i; } } } while ($i); } if ($this->get('sticky') == 'no') { $this->set('sticky', 1000); } parent::save($conn); $config = sfConfig::get('app_sfDoctrineJCroppablePlugin_models'); $dir = sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . $config['Events']['directory']; $image = $this->getImageSrc('mugshot', 'original'); if ($this->getMugshot() != '') { $arr_filename = explode('.', $this->getMugshot()); $filename = $arr_filename[0] . '_original.' . $arr_filename[1]; $file = $dir . DIRECTORY_SEPARATOR . $filename; if (is_file($file)) { $dims = array(array('w' => 950, 'h' => 534), array('w' => 720, 'h' => 405), array('w' => 250, 'h' => 141)); $size = getimagesize($file); $img = new sfImage($file, $size['mime']); foreach ($dims as $dim) { $img->resize($dim['w'], $dim['h']); $img->setQuality(90); $img->saveAs($dir . '/' . $arr_filename[0] . '_' . $dim['w'] . 'x' . $dim['h'] . '.jpg'); } } } }
public function __construct($raw) { parent::__construct($raw); $this->inflate(); }
public function delete(Doctrine_Connection $conn = null) { $parent = $this->getParent(); if ($this->getChildClass()) { foreach ($this->getChildren() as $child) { $child->delete($conn); } } $result = parent::delete($conn); if ($parent) { $parent->calc(); } return $result; }
public function getPeer() { if (self::$peer === null) { self::$peer = new EventPeer(); } return self::$peer; }
public function setTitle($v) { parent::setTitle($v); $this->setSlug(myTools::stripText($v)); }
public function init() { return parent::init(); }