protected function renderControlNonEditable()
 {
     assert('$this->model instanceof EmailMessage');
     if ($this->model->folder->type == EmailFolder::TYPE_SENT) {
         return parent::renderControlNonEditable();
     }
     return Zurmo::t('EmailMessagesModule', 'Currently in the {folderType} folder', array('{folderType}' => EmailFolder::getTranslatedFolderNameByType($this->model->folder->type)));
 }
 /**
  * Renders the attribute from the model.
  * @return The element's content.
  */
 protected function renderControlNonEditable()
 {
     if ($this->model->{$this->attribute} != null) {
         return parent::renderControlNonEditable();
     } else {
         return Zurmo::t('Core', 'Never');
     }
 }
Ejemplo n.º 3
0
 protected function renderMissionContent()
 {
     $userUrl = Yii::app()->createUrl('/users/default/details', array('id' => $this->model->createdByUser->id));
     $content = '<div class="comment model-details-summary">';
     $content .= ZurmoHtml::link($this->model->createdByUser->getAvatarImage(100), $userUrl);
     $content .= '<span class="user-details">';
     $content .= ZurmoHtml::link(strval($this->model->createdByUser), $userUrl, array('class' => 'user-link'));
     $content .= '</span>';
     $element = new TextAreaElement($this->model, 'description');
     $element->nonEditableTemplate = '<div class="comment-content">{content}</div>';
     $content .= $element->render();
     if ($this->model->reward != null) {
         $element = new TextElement($this->model, 'reward');
         $element->nonEditableTemplate = '<div class="comment-content">' . Zurmo::t('MissionsModule', 'Reward') . ': {content}</div>';
         $content .= $element->render();
     }
     if ($this->model->takenByUser->id > 0) {
         $element = new UserElement($this->model, 'takenByUser');
         $element->nonEditableTemplate = '<div class="comment-content">' . Zurmo::t('MissionsModule', 'Taken By') . ': {content}</div>';
         $content .= $element->render();
     }
     if (!DateTimeUtil::isDateTimeValueNull($this->model, 'dueDateTime')) {
         $element = new DateTimeElement($this->model, 'dueDateTime');
         $element->nonEditableTemplate = '<div class="comment-content">' . Zurmo::t('MissionsModule', 'Due') . ': {content}</div>';
         $content .= $element->render();
     }
     $date = '<span class="comment-details"><strong>' . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->createdDateTime, 'long', null) . '</strong></span>';
     $content .= $date;
     if ($this->model->files->count() > 0) {
         $element = new FilesElement($this->model, 'null');
         $element->nonEditableTemplate = '<div>{content}</div>';
         $content .= '<div><strong>' . Zurmo::t('MissionsModule', 'Attachments') . '</strong></div>';
         $content .= $element->render();
     }
     $element = new MissionStatusElement($this->model, 'status');
     $element->nonEditableTemplate = '<div class="comment-content">' . Zurmo::t('MissionsModule', 'Status') . ': {content}</div>';
     $content .= $element->render();
     $content .= '</div>';
     return ZurmoHtml::tag('div', array('id' => 'ModelDetailsSummaryView'), $content);
 }
Ejemplo n.º 4
0
 public function testRender()
 {
     $model = new TestDateTimeModel();
     $model->myDateTime = '2012-02-24 13:05:32';
     $dateTimeElement = new DateTimeElement($model, 'myDateTime');
     date_default_timezone_set('EST');
     $content = $dateTimeElement->render();
     $this->assertTrue(stripos($content, '2/24/12 8:05 AM') !== false);
     date_default_timezone_set('UTC');
     $content = $dateTimeElement->render();
     $this->assertTrue(stripos($content, '2/24/12 1:05 PM') !== false);
     date_default_timezone_set('US/Eastern');
     $content = $dateTimeElement->render();
     $this->assertTrue(stripos($content, '2/24/12 8:05 AM') !== false);
     date_default_timezone_set('America/New_York');
     $content = $dateTimeElement->render();
     $this->assertTrue(stripos($content, '2/24/12 8:05 AM') !== false);
     date_default_timezone_set('Europe/Madrid');
     $content = $dateTimeElement->render();
     $this->assertTrue(stripos($content, '2/24/12 2:05 PM') !== false);
     date_default_timezone_set('Asia/Ho_Chi_Minh');
     $content = $dateTimeElement->render();
     $this->assertTrue(stripos($content, '2/24/12 8:05 PM') !== false);
 }
 /**
  * Renders due date time
  * @param string $form
  * @return string
  */
 protected function renderDueDateTimeContent($form)
 {
     $element = new DateTimeElement($this->getModel(), 'dueDateTime', $form);
     $element->editableTemplate = '{label}{content}{error}';
     return $element->render();
 }