コード例 #1
0
ファイル: PcTask.php プロジェクト: ntemple/intelli-plancake
 /**
  * Returns the repetition expression for the task (if any), ready to be displayed to the user.
  *
  * @return     string
  */
 public function getRepetitionHumanExpression()
 {
     if (!($repetitionId = $this->getRepetitionId())) {
         return '';
     } else {
         $repetition = PcRepetitionPeer::retrieveByPk($repetitionId);
         if (!$repetition->needsParam()) {
             return $repetition->getLocalizedHumanExpression();
         } else {
             $repetitionParam = $this->getRepetitionParam();
             if ($repetition->getSpecial() != 'selected_wkdays') {
                 if (!$repetition->isParamCardinal()) {
                     $repetitionParam = PcUtils::getOrdinalFromCardinal($repetitionParam);
                 }
                 $repetitionString = str_replace(__('ACCOUNT_TASK_REPETITION_SELECT_LATER'), $repetitionParam, $repetition->getLocalizedHumanExpression(), $count);
                 if (!$count) {
                     sfErrorNotifier::alert('The [select later] string has changed');
                 } else {
                     return $repetitionString;
                 }
             } else {
                 $weekdaysSet = DateFormat::fromIntegerToWeekdaysSetForRepetition($repetitionParam);
                 $selectedWeekdays = array();
                 foreach ($weekdaysSet as $k => $v) {
                     if ($v) {
                         $selectedWeekdays[] = __('ACCOUNT_DOW_ON_PREPOSITION') . ' ' . PcUtils::fromAbbreviationToWeekday($k);
                     }
                 }
                 return implode(", ", $selectedWeekdays);
             }
         }
     }
 }