Esempio n. 1
0
 /**
  * Executes save action
  *
  * @param sfWebRequest $request A request object
  */
 public function executeSave(sfWebRequest $request)
 {
     $member = $this->getUser()->getMember();
     $isValid = $member->getConfig('paint_is_valid');
     $this->forward404Unless($isValid);
     $member->setConfig('paint_is_valid', false);
     $id = $request->getParameter('id', 0);
     $ccccImage = Doctrine::getTable('CcccImage')->find($id);
     if (!$ccccImage) {
         $ccccImage = new CcccImage();
     }
     $ccccComaId = $ccccImage->getCcccComaId();
     if ($ccccComaId && $ccccImage->getCcccComa()->getCcccImageId() == $ccccImage->getId()) {
         $ccccImage->getPchFile()->delete();
         $newCcccImage = new CcccImage();
         $newCcccImage->setBaseCcccImage($ccccImage);
         $ccccImage =& $newCcccImage;
     }
     $raw = new RawSpainter(base64_decode($member->getConfig('paint_rawdata')));
     $member->setConfig('paint_rawdata', '');
     $ccccImage->saveImageFileFromRawData($raw->getImage());
     $ccccImage->savePchFileFromRawData($raw->getPch());
     $ccccImage->setMember($member);
     $ccccImage->setCcccComaId($ccccComaId);
     $ccccImage->save();
     if ($ccccComaId) {
         $ccccComa = $ccccImage->getCcccComa();
         $ccccComa->setCcccImage($ccccImage);
         $ccccComa->save();
         $request->setParameter('id', $ccccComa->getCcccMangaId());
         $this->forward('ccccManga', 'index');
     }
     $this->forward('ccccImage', 'index');
 }
 public function createComa()
 {
     for ($i = 0; $i < $this->getComaRow(); $i++) {
         $ccccImage = new CcccImage();
         $ccccImage->setMemberId($this->getMemberId());
         $ccccImage->setPublicFlag('public');
         $ccccImage->save();
         $ccccComa = new CcccComa();
         $ccccComa->setCcccMangaId($this->getId());
         $ccccComa->setCcccImage($ccccImage);
         $ccccComa->setMangaComaId($i + 1);
         $ccccComa->save();
         $ccccImage->setCcccComa($ccccComa);
         $ccccImage->save();
     }
 }