예제 #1
0
 /**
  * Calculates a unique permanent name for this Mailing
  *
  * @param string $iteration (optional) Iteration
  * @return string Permanent name
  */
 function calcPName($iteration = "")
 {
     $mailingID = $this->_id;
     $pinfo = $this->get();
     $mailingname = $pinfo["NAME"];
     if ((int) sConfig()->getVar("CONFIG/CASE_SENSITIVE_URLS") == 0) {
         $mailingname = strtolower($mailingname);
     }
     $pname = $this->filterPName($mailingname);
     if (is_numeric($pname)) {
         $pname = 'mailing_' . $pname;
     }
     $mailingMgr = new MailingMgr();
     if ($iteration != '') {
         $checkpinfo = $mailingMgr->getMailingIdByPName($pname . '_' . $iteration);
     } else {
         $checkpinfo = $mailingMgr->getMailingIdByPName($pname);
     }
     if ($checkpinfo["ID"] == $mailingID) {
         if ($iteration != '') {
             return $pname . '_' . $iteration;
         } else {
             return $pname;
         }
     } else {
         if ($checkpinfo["ID"] == NULL) {
             if ($iteration != '') {
                 return $pname . '_' . $iteration;
             } else {
                 return $pname;
             }
         } else {
             if ($iteration == "") {
                 $iteration = 1;
             }
             return $this->calcPName(++$iteration);
         }
     }
 }