/** * @return Pap_Features_RebrandPdfBanner_Session */ public static function load(Pap_Features_RebrandPdfBanner_Banner $banner) { $session = Gpf_Session::getInstance(); $data = $session->getVar(self::SESSION_VAR); if($data && $data->bannerId == $banner->getId()){ return $data; } return null; }
/** * @param $form * @return Pap_Features_RebrandPdfBanner_Banner */ public static function create(Gpf_Rpc_Params $params){ $form = new Gpf_Rpc_Form($params); if($form->existsField(self::BANNERID)){ $banner = new Pap_Features_RebrandPdfBanner_Banner(); $banner->setId($form->getFieldValue(self::BANNERID)); return $banner; } throw new Gpf_Exception('No banner Id Found'); }
private function removeCouponConstants(Gpf_Data_Record $rebrandData) { $rebrand = new Pap_Features_RebrandPdfBanner_Banner(); $rebrand->fillFromRecord($rebrandData); $variables = $rebrand->getVariables(); foreach ($variables as $variable) { if (substr_count($variable, 'couponcode_') > 0) { $rebrand->removeVariable($variable); } } if (count($variables) > count($rebrand->getVariables())) { $rebrand->update(); } }
/** * @service banner write */ public function authenticate(Gpf_Rpc_Params $params){ $banner = Pap_Features_RebrandPdfBanner_Banner::create($params); $session = Pap_Features_RebrandPdfBanner_Session::load($banner); $form = new Gpf_Rpc_Form($params); $document = $this->createDocument($session->getFile()); if($document->authenticate($password = $form->getFieldValue('password'))){ $this->processVariables($document,$form,$banner,$session); }else{ $form->setInfoMessage($this->_('Bad Password')); $form->setField('status', 'encrypted'); } return $form; }