示例#1
0
 /**
  * Adapt mailinglist to current version
  * @param sfWebRequest $request
  * @return <type>
  */
 public function executeAdaptMailinglist(sfWebRequest $request) {
     $mailinglist = new Mailinglist();
     $docuObj = new Documenttemplate();
     $mailinglistdata = MailinglistTemplateTable::instance()->getMailinglistByVersionTemplateId($request->getParameter('id'))->toArray();
     $currentdocumenttemplateversion = DocumenttemplateVersionTable::instance()->getActiveVersionById($mailinglistdata[0]['documenttemplatetemplate_id'])->toArray();
     $slots = $docuObj->buildSlots($currentdocumenttemplateversion[0]['id'], 'SLOTSONLY');
     $mailinglistversiondata = MailinglistVersionTable::instance()->getActiveVersionById($request->getParameter('id'))->toArray();
     MailinglistVersionTable::instance()->setMailinglistInactiveById($mailinglistversiondata[0]['mailinglisttemplate_id']);
     $mailinglistversion_id = $mailinglist->storeVersion($mailinglistversiondata[0]['mailinglisttemplate_id'],$mailinglistversiondata[0]['version']+1, $currentdocumenttemplateversion[0]['id']);
     $userdata = MailinglistAllowedSenderTable::instance()->getAllowedSenderById($mailinglistversiondata[0]['id']);
     $users = $mailinglist->buildAllowedUser($userdata);
     $mailinglist->saveUser($mailinglistversion_id, isset($users) ? $users: array());
     $authdata = MailinglistAuthorizationSettingTable::instance()->getAuthorizationById($mailinglistversiondata[0]['id'])->toArray();
     $mailinglist->adaptAuthorizationEntry($authdata, $mailinglistversion_id);
     $mailinglist->storeMailinglist($slots, $mailinglistversion_id);
     return sfView::NONE;
 }
 /**
  * Check if the user can use the mailinglist to create a workflow
  *
  * @param int $mailinglistVersionId
  * @return boolean
  */
 public function checkAllowedSender($mailinglistVersionId) {
     $allowedsender = MailinglistAllowedSenderTable::instance()->getAllowedSenderByMailinglistIdAndUserId($this->userId, $mailinglistVersionId)->toArray();
     if(empty($allowedsender) == true) {
         $result['allowedtosend'] = 0;
         return $result;
     }
     else {
         $sender = MailinglistAuthorizationSettingTable::instance()->getSettingsByType('allowedsender', $mailinglistVersionId)->toArray();
         $sender[0]['allowedtosend'] = 1;
         return $sender[0];
     }
 }