public function getLinkString($model)
 {
     $insertLabel = Zurmo::t('ZurmoModule', 'Insert Image');
     if ($this->sourceIdFieldId == null) {
         $url = ImageFileModelUtil::getUrlForGetImageFromImageFileName($model->getImageCacheFileName());
         return ZurmoHtml::link($insertLabel, '#', array('class' => Redactor::LINK_FOR_INSERT_CLASS . ' mini-button', 'data-url' => $url));
     }
     return ZurmoHtml::link($insertLabel, $this->getScriptForClick($model), array('class' => 'mini-button'));
 }
예제 #2
0
 protected function renderForm()
 {
     $this->renderScripts();
     list($form, $formStart) = $this->controller->renderBeginWidget('ZurmoActiveForm', array('id' => 'image-edit-form', 'enableAjaxValidation' => true, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false, 'beforeValidate' => 'js:$(this).beforeValidateAction', 'afterValidate' => 'js:$(this).afterValidateAjaxAction', 'afterValidateAjax' => $this->renderConfigSaveAjax())));
     $src = ImageFileModelUtil::getUrlForGetImageFromImageFileName($this->model->getImageCacheFileName());
     $content = $formStart;
     $content .= ZurmoHtml::openTag('div', array('class' => 'form-inputs right-column'));
     $content .= ZurmoHtml::openTag('div', array('class' => 'image-resize-field clearfix'));
     $content .= $form->labelEx($this->formModel, 'cropX');
     $content .= $form->numberField($this->formModel, 'cropX');
     $content .= $form->error($this->formModel, 'cropX');
     $content .= ZurmoHtml::closeTag('div');
     $content .= ZurmoHtml::openTag('div', array('class' => 'image-resize-field clearfix'));
     $content .= $form->labelEx($this->formModel, 'cropY');
     $content .= $form->numberField($this->formModel, 'cropY');
     $content .= $form->error($this->formModel, 'cropY');
     $content .= ZurmoHtml::closeTag('div');
     $content .= ZurmoHtml::openTag('div', array('class' => 'image-resize-field clearfix'));
     $content .= $form->labelEx($this->formModel, 'cropWidth');
     $content .= $form->numberField($this->formModel, 'cropWidth');
     $content .= $form->error($this->formModel, 'cropWidth');
     $content .= ZurmoHtml::closeTag('div');
     $content .= ZurmoHtml::openTag('div', array('class' => 'image-resize-field clearfix'));
     $content .= $form->labelEx($this->formModel, 'cropHeight');
     $content .= $form->numberField($this->formModel, 'cropHeight');
     $content .= $form->error($this->formModel, 'cropHeight');
     $content .= ZurmoHtml::closeTag('div');
     $content .= ZurmoHtml::openTag('div', array('class' => 'image-resize-field clearfix'));
     $content .= $form->labelEx($this->formModel, 'imageWidth');
     $content .= $form->numberField($this->formModel, 'imageWidth');
     $content .= $form->error($this->formModel, 'imageWidth');
     $content .= ZurmoHtml::closeTag('div');
     $content .= ZurmoHtml::openTag('div', array('class' => 'image-resize-field clearfix'));
     $content .= $form->labelEx($this->formModel, 'imageHeight');
     $content .= $form->numberField($this->formModel, 'imageHeight');
     $content .= $form->error($this->formModel, 'imageHeight');
     $content .= ZurmoHtml::closeTag('div');
     $content .= ZurmoHtml::openTag('div', array('class' => 'image-resize-field clearfix'));
     $content .= $form->labelEx($this->formModel, 'lockImageProportion');
     $content .= $form->checkBox($this->formModel, 'lockImageProportion');
     $content .= $form->error($this->formModel, 'lockImageProportion');
     $content .= ZurmoHtml::closeTag('div');
     $content .= ZurmoHtml::closeTag('div');
     $content .= ZurmoHtml::tag('div', array('class' => 'left-column'), ZurmoHtml::image($src, '', array('class' => 'crop-and-resize')));
     $linkOptions = array('onclick' => "\$(this).addClass('attachLoadingTarget').closest('form').submit()", 'class' => 'z-button');
     $content .= ZurmoHtml::openTag('div', array('class' => 'view-toolbar-container clearfix'));
     $content .= ZurmoHtml::openTag('div', array('class' => 'form-toolbar'));
     $content .= ZurmoHtml::link(ZurmoHtml::tag('span', array('class' => 'z-label'), Zurmo::t('Core', 'Save')), "#", $linkOptions);
     $content .= ZurmoHtml::closeTag('div');
     $content .= ZurmoHtml::closeTag('div');
     $content .= $this->controller->renderEndWidget();
     return $content;
 }
예제 #3
0
 /**
  * @inheritdoc
  */
 protected function renderContent()
 {
     return ZurmoHtml::image(ImageFileModelUtil::getUrlForGetImageFromImageFileName($this->imageFileName));
 }
 public function testGetUrlForGetImageFromImageFileName()
 {
     $filename = '1_test.jpg';
     $this->assertContains('zurmo/imageModel/getImage?fileName=' . $filename, ImageFileModelUtil::getUrlForGetImageFromImageFileName($filename));
     $this->assertContains('zurmo/imageModel/getThumb?fileName=' . $filename, ImageFileModelUtil::getUrlForGetImageFromImageFileName($filename, true));
 }
예제 #5
0
 protected function renderImage($isThumb = false)
 {
     $altText = '';
     $htmlOptions = array();
     if (!$isThumb) {
         $altText = $this->getAltText();
         $htmlOptions = $this->getHtmlOptions();
     }
     if ($this->image != null) {
         $url = ImageFileModelUtil::getUrlForGetImageFromImageFileName($this->image->getImageCacheFileName(), $isThumb);
     } else {
         $url = PlaceholderImageUtil::resolvePlaceholderImageUrl();
     }
     return ZurmoHtml::image($url, $altText, $htmlOptions);
 }